VoidT WriteIniCVars(BoolT book) { StringT temp1 = NULL; WriteIniCommonVars(True, True); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "ProjectName", temp1 = Fm2a(OHProjName)); F_Free(temp1); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "HelpFileTitle", temp1 = Fm2a(HelpTitle)); F_Free(temp1); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "DefaultTopic", DefaultTopicFile ? DefaultTopicFile : ""); if (UseOHTOC || UseOHIX || UseOHFTS || UseOHREL) { temp1 = F_StrNew(17); if (UseOHTOC) F_StrCat(temp1, " Toc"); if (UseOHIX) F_StrCat(temp1, " Idx"); if (UseOHFTS) F_StrCat(temp1, " Fts"); if (UseOHREL) F_StrCat(temp1, " Rel"); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "NavElems", temp1); F_Free(temp1); } M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "MainCssName",temp1 = Fm2a(CssFileName)); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "IECssName", temp1); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "N6CssName", temp1); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "N4CssName", temp1); M2GIniPutSetting(CurrIniName, "CSS", "CssFileName", temp1); F_Free(temp1); M2GIniPutBool(CurrIniName, "OmniHelpOptions", "UseFTS", UseOHFTS); M2GIniPutSetting(CurrIniName, "OmniHelpOptions", "RefFileType", book ? "Body" : "Full"); }
VoidT GetDocStyles(F_ObjHandleT docId, BoolT isPara) { F_ObjHandleT compId = 0; StringT sname = NULL; StringT vname = NULL; StringT fname = NULL; IntT fnum = 0; DesStyleT *curr = NULL; compId = F_ApiGetId(FV_SessionId, docId, isPara ? FP_FirstPgfFmtInDoc : FP_FirstCharFmtInDoc); while (compId) { sname = F_ApiGetString(docId, compId, FP_Name); if (InDesList(sname)) F_StrFree(sname); else { curr = CreateDesignerStyle(sname); curr->para = isPara; if (isPara || (F_ApiGetInt(docId, compId, FP_UseFontVariation) && F_ApiGetInt(docId, compId, FP_UseFontFamily))) { vname = F_ApiGetString(docId, compId, FP_FontVariation); if (vname && *vname) { if (F_StrICmp(vname, "Regular")) { fnum = F_ApiGetInt(docId, compId, FP_FontFamily); fname = F_StrNew(F_StrLen(vname) + F_StrLen(FontFamilies.val[fnum]) + 1); F_StrCpy(fname, FontFamilies.val[fnum]); F_StrCat(fname, vname); AddDesFont(fname); F_StrFree(fname); } F_StrFree(vname); } } LastDesStyle->next = curr; LastDesStyle = curr; DesStyleCount++; } compId = F_ApiGetId(docId, compId, isPara ? FP_NextPgfFmtInDoc : FP_NextCharFmtInDoc); } }
VoidT WriteStylesToIni(StringT ininame, BoolT confirm) { DesStyleT *curr = NULL; UCharT helpStyle[MAX_PROFILE]; StringT hsPtr = NULL; UCharT contType[3]; UCharT contTypes[4] = { 'V', 'H', 'T', 'B' }; StringT aname = NULL; StringT temp1; if (TextChanged) SetIniTF(ininame, SubOptions, "RemoveUnusedStyles", CurrDesText.rem_unused_sty); if (!StylesChanged) return; for (curr = DesStyles; curr; curr = (DesStyleT *) curr->next) { aname = Fm2a(curr->name); if (curr->remap) { temp1 = curr->rem_name; SetIniStr(ininame, StyleSections[0], aname, temp1); //F_Free(temp1); } else SetIniStr(ininame, StyleSections[0], aname, NULL); if (curr->remap) { temp1 = curr->rep_name; SetIniStr(ininame, StyleSections[1], aname, temp1); //F_Free(temp1); } else SetIniStr(ininame, StyleSections[1], aname, NULL); helpStyle[0] = '\0'; hsPtr = NULL; switch (curr->helptyp) { case 1: if (curr->topictyp == 0) hsPtr = "Topic "; else if (curr->topictyp == 1) hsPtr = "Topic Slide "; else if (curr->topictyp == 2) hsPtr = "Resume "; break; case 2: if (curr->hotsptyp == 0) hsPtr = "JumpHot "; else if (curr->hotsptyp == 1) hsPtr = "PopHot "; else if (curr->hotsptyp == 2) hsPtr = "Window "; else if (curr->hotsptyp == 3) hsPtr = "PopOver "; break; case 3: hsPtr = curr->pop_cont ? "PopContent " : "JumpTarget "; break; case 4: hsPtr = "MacroHot "; break; case 0: default: break; } if (hsPtr) F_StrCpy(helpStyle, hsPtr); if (curr->usekey) F_StrCat(helpStyle, "Key "); if (curr->akey) F_StrCat(helpStyle, "AKey "); if (curr->keys && *curr->keys) { F_StrCat(helpStyle, "SpKey "); SetIniStr(ininame, "HelpKeywordStyles", aname, curr->keys); } if (curr->helptyp == 1) { if (curr->browse) { F_StrCat(helpStyle, "Browse "); SetIniStr(ininame, "HelpBrowsePrefixStyles", aname, (curr->br_px && *curr->br_px) ? curr->br_px : NULL); } if (curr->cont) { F_StrCat(helpStyle, "Contents "); contType[0] = contTypes[curr->conttyp]; contType[1] = *curr->contlev; contType[2] = '\0'; SetIniStr(ininame, "HelpCntStyles", aname, contType); } if (curr->mac_name && *curr->mac_name) { F_StrCat(helpStyle, "Macro "); SetIniStr(ininame, "HelpMacroStyles", aname, curr->mac_name); } if (curr->build) { F_StrCat(helpStyle, "Build "); SetIniStr(ininame, "HelpTopicBuildStyles", aname, curr->build_tag); } if (curr->window) { F_StrCat(helpStyle, "Window "); SetIniStr(ininame, "HelpWindowStyles", aname, curr->win_name); } if (curr->notitle) F_StrCat(helpStyle, "NoTitle "); else if (curr->titsx) { F_StrCat(helpStyle, "TitleSuf "); SetIniStr(ininame, "HelpTitleSufStyles", aname, curr->title_sx); } if (curr->refer) { F_StrCat(helpStyle, "Refer "); if (curr->ref_sx && *curr->ref_sx) { F_StrCat(helpStyle, "Suffix "); SetIniStr(ininame, "HelpSuffixStyles", aname, curr->ref_sx); } } if (curr->noscr_used) F_StrCat(helpStyle, curr->noscroll ? "NoScroll " : "Scroll "); if (curr->xtscr_used) F_StrCat(helpStyle, curr->xtscroll ? "XScroll " : "NoXScroll "); } else if (curr->helptyp == 2) { if (curr->window) { if (curr->hotsptyp != 2) F_StrCat(helpStyle, "Window "); SetIniStr(ininame, "HelpWindowStyles", aname, curr->win_name); } if (curr->fileref) { F_StrCat(helpStyle, "File "); SetIniStr(ininame, "HelpJumpFileStyles", aname, curr->file_name); } if (curr->local) F_StrCat(helpStyle, "Local "); if (curr->fixed) SetIniStr(ininame, "HelpRefStyles", aname, curr->fixed_name); else if (curr->ref_sx && *curr->ref_sx) { F_StrCat(helpStyle, "Suffix "); SetIniStr(ininame, "HelpSuffixStyles", aname, curr->ref_sx); } if (!curr->ungreen) F_StrCat(helpStyle, "Green "); if (!curr->nouline) F_StrCat(helpStyle, "Uline "); } else if (curr->helptyp == 3) { if (curr->local) F_StrCat(helpStyle, "Local "); if (curr->refer) { F_StrCat(helpStyle, "Suffix "); SetIniStr(ininame, "HelpSuffixStyles", aname, curr->ref_sx); } if (curr->cont) { F_StrCat(helpStyle, "Contents "); contType[0] = contTypes[curr->conttyp]; contType[1] = *curr->contlev; contType[2] = '\0'; SetIniStr(ininame, "HelpCntStyles", aname, contType); } } else if (curr->helptyp == 4) { if (curr->mac_name && *curr->mac_name) SetIniStr(ininame, "HelpMacroStyles", aname, curr->mac_name); if (!curr->ungreen) F_StrCat(helpStyle, "Green "); if (!curr->nouline) F_StrCat(helpStyle, "Uline "); } hsPtr = helpStyle + F_StrLen(helpStyle); if (*hsPtr == ' ') *hsPtr = '\0'; SetIniStr(ininame, "HelpStyles", aname, *helpStyle ? helpStyle : NULL); F_Free(aname); } StylesChanged = False; }
VoidT editHeader() { F_ObjHandleT docId, bodyPageId, masterPageId, pageFrameId, textFrameId, paraHeaderId, headerVarId, varFmtId, nextParaId, highId, firstFlowId, edefId; F_TextLocT headerLoc; StringT headerText, idText, elemName; F_AttributesT attributes; UIntT j; /* get Id of the active document */ docId = F_ApiGetId(FV_SessionId, FV_SessionId, FP_ActiveDoc); /* get Id of the Right MasterPage*/ masterPageId = F_ApiGetId(FV_SessionId, docId, FP_FirstMasterPageInDoc); /* Get Id of the first Page masterPage */ masterPageId = F_ApiGetId(FV_SessionId, masterPageId, FP_PageNext); /* Get Id of the pageFrame of masterPage*/ pageFrameId = F_ApiGetId(FV_SessionId, masterPageId, FP_PageFrame); /* Get Id of TextFrame of PageFrame */ textFrameId = F_ApiGetId(FV_SessionId, pageFrameId, FP_FirstGraphicInFrame); /* Get Id of First Paragraph of TextFrame */ paraHeaderId = F_ApiGetId(FV_SessionId, textFrameId, FP_FirstPgf); /* Insert new first paragraph and delete old first */ nextParaId = F_ApiNewSeriesObject(docId, FO_Pgf, paraHeaderId); F_ApiDelete(docId, paraHeaderId); /* Create insertion point in new paragraph */ headerLoc.objId = nextParaId; headerLoc.offset = 0; //headerLoc = F_ApiAddText(docId, &headerLoc, "Test text\'s header"); /* Create new variable format for header string */ varFmtId = F_ApiGetNamedObject(docId, FO_VarFmt, "userVarFormat"); if (FA_errno == FE_NameNotFound) { varFmtId = F_ApiNewNamedObject(docId, FO_VarFmt, "userVarFormat"); FA_errno = FE_Success; } bodyPageId = F_ApiGetId(FV_SessionId, docId, FP_FirstBodyPageInDoc); pageFrameId = F_ApiGetId(docId, bodyPageId, FP_PageFrame); textFrameId = F_ApiGetId(docId, pageFrameId, FP_FirstGraphicInFrame); firstFlowId = F_ApiGetId(docId, textFrameId, FP_Flow); highId = F_ApiGetId(docId, firstFlowId, FP_HighestLevelElement); edefId = F_ApiGetId(docId, highId, FP_ElementDef); elemName = F_ApiGetString(docId, edefId, FP_Name); //F_Printf(NULL, "%s\n", elemName); attributes = F_ApiGetAttributes(docId, highId); for(j=0; j<attributes.len; j++) { if (F_StrEqual("Name", attributes.val[j].name)) { idText = F_StrCopyString(attributes.val[j].values.val[0]); F_StrStripTrailingSpaces(idText); F_StrStripLeadingSpaces(idText); break; } } headerText = F_StrCopyString(elemName); headerText = F_Realloc(headerText, F_StrLen(headerText)+F_StrLen(" <Emphasis>")+1, NO_DSE); F_StrCat(headerText," <Emphasis>"); //F_Printf(NULL, "A%sA\n", idText); //F_Printf(NULL, "%s\n", headerText); if (!F_StrIsEmpty(idText)) { headerText = F_Realloc(headerText, F_StrLen(headerText)+F_StrLen(idText)+1,NO_DSE); F_StrCat(headerText,idText); //F_Printf(NULL, "%s\n", headerText); //F_ApiPrintFAErrno(); } F_StrStripTrailingSpaces(headerText); //F_ApiAlert(headerText,FF_ALERT_CONTINUE_NOTE); F_ApiSetString(docId, varFmtId, FP_Fmt, headerText); //F_ApiPrintFAErrno(); /* Insert variable with created format into header */ headerVarId = F_ApiNewAnchoredFormattedObject(docId, FO_Var, "userVarFormat", &headerLoc); }