diff --git a/src/main/java/writer2latex/bibtex/BibTeXDocument.java b/src/main/java/writer2latex/bibtex/BibTeXDocument.java index e411765..ed98820 100644 --- a/src/main/java/writer2latex/bibtex/BibTeXDocument.java +++ b/src/main/java/writer2latex/bibtex/BibTeXDocument.java @@ -96,7 +96,7 @@ public class BibTeXDocument implements OutputFile { * @return the export name */ public String getExportName(String sIdentifier) { - return exportNames.getExportName(sIdentifier); + return exportNames.addToExport(sIdentifier); } /** Returns the document name without file extension @@ -137,7 +137,7 @@ public class BibTeXDocument implements OutputFile { osw.write("@"); osw.write(entry.getEntryType().toUpperCase()); osw.write("{"); - osw.write(exportNames.getExportName(entry.getIdentifier())); + osw.write(exportNames.addToExport(entry.getIdentifier())); osw.write(",\n"); for (EntryType entryType : EntryType.values()) { String sValue = entry.getField(entryType); diff --git a/src/main/java/writer2latex/latex/CharStyleConverter.java b/src/main/java/writer2latex/latex/CharStyleConverter.java index d9ee916..261c627 100644 --- a/src/main/java/writer2latex/latex/CharStyleConverter.java +++ b/src/main/java/writer2latex/latex/CharStyleConverter.java @@ -146,7 +146,7 @@ public class CharStyleConverter extends StyleConverter { applyFont(style,false,true,baText,new Context()); applyFontEffects(style,true,baText); // declare the text style (\newcommand) - String sTeXName = styleNames.getExportName(ofr.getTextStyles().getDisplayName(sName)); + String sTeXName = styleNames.addToExport(ofr.getTextStyles().getDisplayName(sName)); styleMap.put(sName,"\\textstyle"+sTeXName+"{","}"); declarations.append("\\newcommand\\textstyle") .append(sTeXName).append("[1]{") diff --git a/src/main/java/writer2latex/latex/ConverterPalette.java b/src/main/java/writer2latex/latex/ConverterPalette.java index af4956a..a26a65f 100644 --- a/src/main/java/writer2latex/latex/ConverterPalette.java +++ b/src/main/java/writer2latex/latex/ConverterPalette.java @@ -121,7 +121,7 @@ public final class ConverterPalette extends ConverterBase { // fill out inner converter method public void convertInner() throws IOException { sTargetFileName = Misc.trimDocumentName(sTargetFileName,".tex"); - String sSafeTargetFileName = new ExportNameCollection(true).getExportName(sTargetFileName); + String sSafeTargetFileName = new ExportNameCollection(true).addToExport(sTargetFileName); imageConverter.setBaseFileName(sSafeTargetFileName+"-img"); if (config.saveImagesInSubdir()) { imageConverter.setUseSubdir(sSafeTargetFileName+"-img"); diff --git a/src/main/java/writer2latex/latex/FieldConverter.java b/src/main/java/writer2latex/latex/FieldConverter.java index c3034ad..e562a0c 100644 --- a/src/main/java/writer2latex/latex/FieldConverter.java +++ b/src/main/java/writer2latex/latex/FieldConverter.java @@ -163,7 +163,7 @@ public class FieldConverter extends ConverterHelper { } // Create counter decl.append("\\newcounter{") - .append(seqnames.getExportName(sName)) + .append(seqnames.addToExport(sName)) .append("}"); String sPrefix = ""; if (nLevel>0) { @@ -176,10 +176,10 @@ public class FieldConverter extends ConverterHelper { } decl.nl() .append("\\renewcommand\\the") - .append(seqnames.getExportName(sName)) + .append(seqnames.addToExport(sName)) .append("{").append(sPrefix) .append(ListConverter.numFormat(sNumFormat)) - .append("{").append(seqnames.getExportName(sName)) + .append("{").append(seqnames.addToExport(sName)) .append("}}").nl(); } } @@ -218,7 +218,7 @@ public class FieldConverter extends ConverterHelper { // Export \label only, assuming the number is generated by \caption if (sRefName!=null && ofr.hasSequenceRefTo(sRefName)) { ldp.append("\\label{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); } } @@ -231,16 +231,16 @@ public class FieldConverter extends ConverterHelper { if (sRefName!=null && ofr.hasSequenceRefTo(sRefName)) { // Export as {\refstepcounter{name}\thename\label{refname}} ldp.append("{").append(changeCounter(sName,sFormula,true)) - .append("\\the").append(seqnames.getExportName(sName)) + .append("\\the").append(seqnames.addToExport(sName)) .append("\\label{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}}"); } else { // Export as \stepcounter{name}{\thename} ldp.append(changeCounter(sName,sFormula,false)) .append("{\\the") - .append(seqnames.getExportName(sName)) + .append(seqnames.addToExport(sName)) .append("}"); } } @@ -256,7 +256,7 @@ public class FieldConverter extends ConverterHelper { String sRefName = Misc.getAttribute(node,XMLString.TEXT_REF_NAME); if (sRefName!=null && ofr.hasSequenceRefTo(sRefName)) { ldp.append("\\label{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); } } @@ -327,10 +327,10 @@ public class FieldConverter extends ConverterHelper { private String stepCounter(String sName, boolean bRef) { if (bRef) { - return "\\refstepcounter{" + seqnames.getExportName(sName) + "}"; + return "\\refstepcounter{" + seqnames.addToExport(sName) + "}"; } else { - return "\\stepcounter{" + seqnames.getExportName(sName) + "}"; + return "\\stepcounter{" + seqnames.addToExport(sName) + "}"; } } @@ -339,12 +339,12 @@ public class FieldConverter extends ConverterHelper { return stepCounter(sName, bRef); } else if (bRef) { - return "\\addtocounter{" + seqnames.getExportName(sName) + "}" + return "\\addtocounter{" + seqnames.addToExport(sName) + "}" + "{" + Integer.toString(nValue-1) + "}" - + "\\refstepcounter{" + seqnames.getExportName(sName) + "}"; + + "\\refstepcounter{" + seqnames.addToExport(sName) + "}"; } else if (nValue!=0) { - return "\\addtocounter{" + seqnames.getExportName(sName) + "}" + return "\\addtocounter{" + seqnames.addToExport(sName) + "}" + "{" + Integer.toString(nValue) + "}"; } else { @@ -354,12 +354,12 @@ public class FieldConverter extends ConverterHelper { private String setCounter(String sName, int nValue, boolean bRef) { if (bRef) { - return "\\setcounter{" + seqnames.getExportName(sName) + "}" + return "\\setcounter{" + seqnames.addToExport(sName) + "}" + "{" + Integer.toString(nValue-1) + "}" - + "\\refstepcounter{" + seqnames.getExportName(sName) + "}"; + + "\\refstepcounter{" + seqnames.addToExport(sName) + "}"; } else { - return "\\setcounter{" + seqnames.getExportName(sName) + "}" + return "\\setcounter{" + seqnames.addToExport(sName) + "}" + "{" + Integer.toString(nValue) + "}"; } } @@ -377,12 +377,12 @@ public class FieldConverter extends ConverterHelper { if (sRefName!=null) { if (sFormat==null || "page".equals(sFormat)) { ldp.append("\\pageref{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); } else if ("value".equals(sFormat)) { ldp.append("\\ref{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); } else if ("category-and-value".equals(sFormat)) { @@ -399,13 +399,13 @@ public class FieldConverter extends ConverterHelper { } } ldp.append("\\ref{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); } else if ("caption".equals(sFormat) && config.useTitleref() && (ofr.isFigureSequenceName(sName) || ofr.isTableSequenceName(sName))) { ldp.append("\\titleref{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); bUsesTitleref = true; } @@ -420,9 +420,9 @@ public class FieldConverter extends ConverterHelper { ldp.append("\\tablename"); } ldp.append("~\\ref{seq:") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}:~\\titleref{") - .append(seqrefnames.getExportName(sRefName)) + .append(seqrefnames.addToExport(sRefName)) .append("}"); bUsesTitleref = true; } @@ -707,7 +707,7 @@ public class FieldConverter extends ConverterHelper { && (!bConvertJabRef || !handleJabRefReferenceName(sName, ldp, oc))) { // Plain reference mark // Note: Always include \label here, even when it's not used - ldp.append("\\label{ref:"+refnames.getExportName(shortenRefname(sName))+"}"); + ldp.append("\\label{ref:"+refnames.addToExport(shortenRefname(sName))+"}"); } } else { @@ -726,11 +726,11 @@ public class FieldConverter extends ConverterHelper { String sFormat = node.getAttribute(XMLString.TEXT_REFERENCE_FORMAT); String sName = node.getAttribute(XMLString.TEXT_REF_NAME); if (("page".equals(sFormat) || "".equals(sFormat)) && sName!=null) { - ldp.append("\\pageref{ref:"+refnames.getExportName(shortenRefname(sName))+"}"); + ldp.append("\\pageref{ref:"+refnames.addToExport(shortenRefname(sName))+"}"); } else if ("chapter".equals(sFormat) && ofr.referenceMarkInHeading(sName)) { // This is safe if the reference mark is contained in a heading - ldp.append("\\ref{ref:"+refnames.getExportName(shortenRefname(sName))+"}"); + ldp.append("\\ref{ref:"+refnames.addToExport(shortenRefname(sName))+"}"); } else { // use current value palette.getInlineCv().traversePCDATA(node,ldp,oc); @@ -753,7 +753,7 @@ public class FieldConverter extends ConverterHelper { // for a reference. We export whatever is actually used: addTarget(node,"",ldp); if (ofr.hasBookmarkRefTo(sName)) { - ldp.append("\\label{bkm:"+bookmarknames.getExportName(sName)+"}"); + ldp.append("\\label{bkm:"+bookmarknames.addToExport(sName)+"}"); } } } @@ -773,11 +773,11 @@ public class FieldConverter extends ConverterHelper { String sFormat = node.getAttribute(XMLString.TEXT_REFERENCE_FORMAT); String sName = node.getAttribute(XMLString.TEXT_REF_NAME); if (("page".equals(sFormat) || "".equals(sFormat)) && sName!=null) { - ldp.append("\\pageref{bkm:"+bookmarknames.getExportName(sName)+"}"); + ldp.append("\\pageref{bkm:"+bookmarknames.addToExport(sName)+"}"); } else if ("chapter".equals(sFormat) && ofr.bookmarkInHeading(sName)) { // This is safe if the bookmark is contained in a heading - ldp.append("\\ref{bkm:"+bookmarknames.getExportName(sName)+"}"); + ldp.append("\\ref{bkm:"+bookmarknames.addToExport(sName)+"}"); } else if (("number".equals(sFormat) || "number-no-superior".equals(sFormat) || "number-all-superior".equals(sFormat)) && (ofr.bookmarkInHeading(sName) || ofr.bookmarkInList(sName))) { @@ -803,7 +803,7 @@ public class FieldConverter extends ConverterHelper { sSuffix = style.getLevelProperty(nLevel, XMLString.STYLE_NUM_SUFFIX); } if (sPrefix!=null) ldp.append(palette.getI18n().convert(sPrefix,false,oc.getLang())); - ldp.append("\\ref{bkm:").append(bookmarknames.getExportName(sName)).append("}"); + ldp.append("\\ref{bkm:").append(bookmarknames.addToExport(sName)).append("}"); if (sSuffix!=null) ldp.append(palette.getI18n().convert(sSuffix,false,oc.getLang())); } else { // use current value @@ -858,7 +858,7 @@ public class FieldConverter extends ConverterHelper { // TODO: hyperlinks to headings (?) and objects if (bUseHyperref) { ldp.append("\\hyperlink{") - .append(targets.getExportName(Misc.urlDecode(sHref.substring(1)))) + .append(targets.addToExport(Misc.urlDecode(sHref.substring(1)))) .append("}{"); // ignore text style (let hyperref.sty handle the decoration): palette.getInlineCv().traverseInlineText(node,ldp,oc); @@ -909,7 +909,7 @@ public class FieldConverter extends ConverterHelper { if (sName == null || !bUseHyperref) { return; } if (!ofr.hasLinkTo(sName+sSuffix)) { return; } ldp.append("\\hypertarget{") - .append(targets.getExportName(sName+sSuffix)) + .append(targets.addToExport(sName+sSuffix)) .append("}{}"); } @@ -923,7 +923,7 @@ public class FieldConverter extends ConverterHelper { public void addTarget(String sName, String sSuffix, LaTeXDocumentPortion ldp) { if (sName!=null && bUseHyperref && ofr.hasLinkTo(sName+sSuffix)) { ldp.append("\\hypertarget{") - .append(targets.getExportName(sName+sSuffix)) + .append(targets.addToExport(sName+sSuffix)) .append("}{}"); } } diff --git a/src/main/java/writer2latex/latex/ListConverter.java b/src/main/java/writer2latex/latex/ListConverter.java index b3d2295..b45f923 100644 --- a/src/main/java/writer2latex/latex/ListConverter.java +++ b/src/main/java/writer2latex/latex/ListConverter.java @@ -241,7 +241,7 @@ public class ListConverter extends StyleConverter { if (!listStyleLevelNames.containsKey(oc.getListStyleName())) { createListStyleLabels(oc.getListStyleName()); } - ba.add("\\liststyle"+styleNames.getExportName(getDisplayName(oc.getListStyleName()))+"\n",""); + ba.add("\\liststyle"+styleNames.addToExport(getDisplayName(oc.getListStyleName()))+"\n",""); } if (oc.getListLevel()<=4) { String sCounterName = listStyleLevelNames.get(oc.getListStyleName())[oc.getListLevel()]; @@ -266,7 +266,7 @@ public class ListConverter extends StyleConverter { if (!styleNames.containsName(getDisplayName(oc.getListStyleName()))) { createListStyle(oc.getListStyleName()); } - String sTeXName="list"+styleNames.getExportName(getDisplayName(oc.getListStyleName())) + String sTeXName="list"+styleNames.addToExport(getDisplayName(oc.getListStyleName())) +"level"+Misc.int2roman(oc.getListLevel()); if (!oc.isInContinuedList() && style.isNumber(oc.getListLevel())) { int nStartValue = Misc.getPosInteger(style.getLevelProperty(oc.getListLevel(),XMLString.TEXT_START_VALUE),1)-1; @@ -317,7 +317,7 @@ public class ListConverter extends StyleConverter { } // Step 4: Export with formatting, as "Writer style" custom lists if (nLevel<=4 && !bHeader) { // TODO: Max level should not be fixed - String sTeXName="list"+styleNames.getExportName(getDisplayName(sStyleName)) + String sTeXName="list"+styleNames.addToExport(getDisplayName(sStyleName)) +"level"+Misc.int2roman(nLevel); if (bRestart && style.isNumber(nLevel)) { ba.add("\\setcounter{"+sTeXName+"}{"+(nStartValue-1)+"}\n",""); @@ -331,7 +331,7 @@ public class ListConverter extends StyleConverter { * a List Style */ private void createListStyleLabels(String sStyleName) { - String sTeXName = styleNames.getExportName(getDisplayName(sStyleName)); + String sTeXName = styleNames.addToExport(getDisplayName(sStyleName)); declarations.append("\\newcommand\\liststyle") .append(sTeXName).append("{%").nl(); ListStyle style = ofr.getListStyle(sStyleName); @@ -358,7 +358,7 @@ public class ListConverter extends StyleConverter { ListStyle style = ofr.getListStyle(sStyleName); // Create labels - String sTeXName = styleNames.getExportName(getDisplayName(sStyleName)); + String sTeXName = styleNames.addToExport(getDisplayName(sStyleName)); String[] sLevelName = new String[5]; for (int i=1; i<=4; i++) { sLevelName[i]="list"+sTeXName+"level"+Misc.int2roman(i); diff --git a/src/main/java/writer2latex/latex/NoteConverter.java b/src/main/java/writer2latex/latex/NoteConverter.java index d9abb4b..0e1ebe1 100644 --- a/src/main/java/writer2latex/latex/NoteConverter.java +++ b/src/main/java/writer2latex/latex/NoteConverter.java @@ -98,7 +98,7 @@ public class NoteConverter extends ConverterHelper { ldp.append("\\footnote"); ldp.append("{"); if (sId != null && ofr.hasFootnoteRefTo(sId)) { - ldp.append("\\label{fnt:"+footnotenames.getExportName(sId)+"}"); + ldp.append("\\label{fnt:"+footnotenames.addToExport(sId)+"}"); } traverseNoteBody(fntbody,ldp,ic); ldp.append("}"); @@ -172,7 +172,7 @@ public class NoteConverter extends ConverterHelper { } ldp.append("{"); if (sId != null && ofr.hasEndnoteRefTo(sId)) { - ldp.append("\\label{ent:"+endnotenames.getExportName(sId)+"}"); + ldp.append("\\label{ent:"+endnotenames.addToExport(sId)+"}"); } traverseNoteBody(entbody,ldp,ic); ldp.append("}"); @@ -215,10 +215,10 @@ public class NoteConverter extends ConverterHelper { String sFormat = node.getAttribute(XMLString.TEXT_REFERENCE_FORMAT); String sName = node.getAttribute(XMLString.TEXT_REF_NAME); if (("page".equals(sFormat) || "".equals(sFormat)) && sName!=null) { - ldp.append("\\pageref{fnt:"+footnotenames.getExportName(sName)+"}"); + ldp.append("\\pageref{fnt:"+footnotenames.addToExport(sName)+"}"); } else if ("text".equals(sFormat) && sName!=null) { - ldp.append("\\ref{fnt:"+footnotenames.getExportName(sName)+"}"); + ldp.append("\\ref{fnt:"+footnotenames.addToExport(sName)+"}"); } else { // use current value palette.getInlineCv().traversePCDATA(node,ldp,oc); @@ -235,10 +235,10 @@ public class NoteConverter extends ConverterHelper { String sFormat = node.getAttribute(XMLString.TEXT_REFERENCE_FORMAT); String sName = node.getAttribute(XMLString.TEXT_REF_NAME); if (("page".equals(sFormat) || "".equals(sFormat)) && sName!=null) { - ldp.append("\\pageref{ent:"+endnotenames.getExportName(sName)+"}"); + ldp.append("\\pageref{ent:"+endnotenames.addToExport(sName)+"}"); } else if ("text".equals(sFormat) && sName!=null) { - ldp.append("\\ref{ent:"+endnotenames.getExportName(sName)+"}"); + ldp.append("\\ref{ent:"+endnotenames.addToExport(sName)+"}"); } else { // use current value palette.getInlineCv().traversePCDATA(node,ldp,oc); diff --git a/src/main/java/writer2latex/latex/PageStyleConverter.java b/src/main/java/writer2latex/latex/PageStyleConverter.java index 11a3e04..acf37b1 100644 --- a/src/main/java/writer2latex/latex/PageStyleConverter.java +++ b/src/main/java/writer2latex/latex/PageStyleConverter.java @@ -136,11 +136,11 @@ public class PageStyleConverter extends StyleConverter { String sNextName = style.getProperty(XMLString.STYLE_NEXT_STYLE_NAME); MasterPage nextStyle = ofr.getMasterPage(sNextName); if (style==nextStyle || nextStyle==null) { - ba.add("\\pagestyle{"+styleNames.getExportName(getDisplayName(sName))+"}\n", ""); + ba.add("\\pagestyle{"+styleNames.addToExport(getDisplayName(sName))+"}\n", ""); } else { - ba.add("\\pagestyle{"+styleNames.getExportName(getDisplayName(sNextName))+"}\n"+ - "\\thispagestyle{"+styleNames.getExportName(getDisplayName(sName))+"}\n",""); + ba.add("\\pagestyle{"+styleNames.addToExport(getDisplayName(sNextName))+"}\n"+ + "\\thispagestyle{"+styleNames.addToExport(getDisplayName(sName))+"}\n",""); } // todo: should warn the user if next master also contains a next-style-name; // LaTeX's page style mechanism cannot handle that @@ -174,7 +174,7 @@ public class PageStyleConverter extends StyleConverter { if (config.useFancyhdr()) { ldp.append("\\fancypagestyle{") - .append(styleNames.getExportName(getDisplayName(sName))) + .append(styleNames.addToExport(getDisplayName(sName))) .append("}{\\fancyhf{}").nl(); // Header - odd or both ldp.append(" \\fancyhead[") @@ -216,7 +216,7 @@ public class PageStyleConverter extends StyleConverter { } else { // use low-level page styles ldp.append("\\newcommand\\ps@") - .append(styleNames.getExportName(getDisplayName(sName))) + .append(styleNames.addToExport(getDisplayName(sName))) .append("{").nl(); // Header ldp.append(" \\renewcommand\\@oddhead{"); diff --git a/src/main/java/writer2latex/latex/ParConverter.java b/src/main/java/writer2latex/latex/ParConverter.java index 6585a15..c6b46a8 100644 --- a/src/main/java/writer2latex/latex/ParConverter.java +++ b/src/main/java/writer2latex/latex/ParConverter.java @@ -475,7 +475,7 @@ public class ParConverter extends StyleConverter { ba.add("\\writerlistlabel",""); ba.add("\\ignorespaces",""); // Declare the paragraph style (\newenvironment) - String sTeXName = "style" + styleNames.getExportName(style.getDisplayName()); + String sTeXName = "style" + styleNames.addToExport(style.getDisplayName()); styleMap.put(style.getName(),"\\begin{"+sTeXName+"}","\\end{"+sTeXName+"}"); declarations.append("\\newenvironment{").append(sTeXName) .append("}{").append(ba.getBefore()).append("}{") diff --git a/src/main/java/writer2latex/latex/SectionConverter.java b/src/main/java/writer2latex/latex/SectionConverter.java index f47563a..d256514 100644 --- a/src/main/java/writer2latex/latex/SectionConverter.java +++ b/src/main/java/writer2latex/latex/SectionConverter.java @@ -157,11 +157,11 @@ public class SectionConverter extends ConverterHelper { String sFileName = null; Element source = Misc.getChildByTagName(node,XMLString.TEXT_SECTION_SOURCE); if (config.splitLinkedSections() && source!=null) { - sFileName = fileNames.getExportName(Misc.removeExtension(Misc.urlDecode(source.getAttribute(XMLString.XLINK_HREF)))); + sFileName = fileNames.addToExport(Misc.removeExtension(Misc.urlDecode(source.getAttribute(XMLString.XLINK_HREF)))); } else if (config.splitToplevelSections() && isToplevel(node)) { //sFileName = fileNames.getExportName(palette.getOutFileName()+node.getAttribute(XMLString.TEXT_NAME)); - sFileName = fileNames.getExportName(node.getAttribute(XMLString.TEXT_NAME)); + sFileName = fileNames.addToExport(node.getAttribute(XMLString.TEXT_NAME)); } LaTeXDocumentPortion sectionLdp = ldp; diff --git a/src/main/java/writer2latex/util/ExportNameCollection.java b/src/main/java/writer2latex/util/ExportNameCollection.java index b449870..8f985c9 100644 --- a/src/main/java/writer2latex/util/ExportNameCollection.java +++ b/src/main/java/writer2latex/util/ExportNameCollection.java @@ -109,7 +109,7 @@ public class ExportNameCollection{ } } - public String getExportName(String sName) { + public String addToExport(String sName) { // add the name, if it does not exist if (!containsName(sName)) { addName(sName); } return sPrefix + exportNames.get(sName); diff --git a/src/main/java/writer2latex/xhtml/Converter.java b/src/main/java/writer2latex/xhtml/Converter.java index bbb2a03..d78bc1f 100644 --- a/src/main/java/writer2latex/xhtml/Converter.java +++ b/src/main/java/writer2latex/xhtml/Converter.java @@ -320,11 +320,11 @@ public class Converter extends ConverterBase { if (targetIndex!=null) { int nTargetIndex = targetIndex.intValue(); if (nTargetIndex == ld.nIndex) { // same file - ld.element.setAttribute("href","#"+targetNames.getExportName(ld.sId)); + ld.element.setAttribute("href","#"+targetNames.addToExport(ld.sId)); } else { ld.element.setAttribute("href",getOutFileName(nTargetIndex,true) - +"#"+targetNames.getExportName(ld.sId)); + +"#"+targetNames.addToExport(ld.sId)); } } } @@ -804,14 +804,14 @@ public class Converter extends ConverterBase { // create a target public Element createTarget(String sId) { Element a = htmlDOM.createElement("a"); - a.setAttribute("id",targetNames.getExportName(sId)); + a.setAttribute("id",targetNames.addToExport(sId)); targets.put(sId, new Integer(nOutFileIndex)); return a; } // put a target id on an existing element public void addTarget(Element node,String sId) { - node.setAttribute("id",targetNames.getExportName(sId)); + node.setAttribute("id",targetNames.addToExport(sId)); targets.put(sId, new Integer(nOutFileIndex)); } diff --git a/src/main/java/writer2latex/xhtml/FrameStyleConverter.java b/src/main/java/writer2latex/xhtml/FrameStyleConverter.java index 71dcb37..31ff685 100644 --- a/src/main/java/writer2latex/xhtml/FrameStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/FrameStyleConverter.java @@ -78,7 +78,7 @@ public class FrameStyleConverter extends StyleWithPropertiesConverterHelper { buf.append(sIndent) .append(getDefaultTagName(null)) .append(".").append(getClassNamePrefix()) - .append(styleNames.getExportName(sDisplayName)) + .append(styleNames.addToExport(sDisplayName)) .append(" p {").append(props.toString()).append("}").append(config.prettyPrint() ? "\n" : " "); } } diff --git a/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java b/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java index 56a6375..b44de5b 100644 --- a/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/HeadingStyleConverter.java @@ -71,7 +71,7 @@ public class HeadingStyleConverter extends StyleConverterHelper { CSVList props = new CSVList(";"); getParSc().applyProperties(style,props,true); props.addValue("clear","left"); - buf.append(sIndent).append("h").append(i).append(".").append(styleNames.getExportName(sDisplayName)) + buf.append(sIndent).append("h").append(i).append(".").append(styleNames.addToExport(sDisplayName)) .append(" {").append(props.toString()).append("}").append(config.prettyPrint() ? "\n" : " "); } } @@ -113,7 +113,7 @@ public class HeadingStyleConverter extends StyleConverterHelper { } else if (style!=ofr.getHeadingStyle(nLevel)) { // This is not the main style for this level, add class and remember - info.sClass = styleNames.getExportName(sDisplayName); + info.sClass = styleNames.addToExport(sDisplayName); if (1<=nLevel && nLevel<=6) { otherLevelStyles.get(nLevel).add(sDisplayName); } diff --git a/src/main/java/writer2latex/xhtml/ListStyleConverter.java b/src/main/java/writer2latex/xhtml/ListStyleConverter.java index b95a76d..f75c431 100644 --- a/src/main/java/writer2latex/xhtml/ListStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/ListStyleConverter.java @@ -73,7 +73,7 @@ public class ListStyleConverter extends StyleConverterHelper { } else { info.sClass = "listlevel"+Integer.toString(nLevel) - +styleNames.getExportName(sDisplayName); + +styleNames.addToExport(sDisplayName); } } } @@ -99,7 +99,7 @@ public class ListStyleConverter extends StyleConverterHelper { buf.append(sIndent); buf.append(".listlevel"); buf.append(nLevel); - buf.append(styleNames.getExportName(sDisplayName)); + buf.append(styleNames.addToExport(sDisplayName)); buf.append(" {"); buf.append(props.toString()); buf.append("}"); @@ -112,7 +112,7 @@ public class ListStyleConverter extends StyleConverterHelper { buf.append(sIndent) .append(".listlevel") .append(nLevel) - .append(styleNames.getExportName(sDisplayName)) + .append(styleNames.addToExport(sDisplayName)) .append(" p {").append(parProps.toString()).append("}").append(config.prettyPrint() ? "\n" : " "); } } diff --git a/src/main/java/writer2latex/xhtml/PageStyleConverter.java b/src/main/java/writer2latex/xhtml/PageStyleConverter.java index 7f94004..9b79c7b 100644 --- a/src/main/java/writer2latex/xhtml/PageStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/PageStyleConverter.java @@ -120,7 +120,7 @@ public class PageStyleConverter extends StyleConverterHelper { String sDisplayName = masterPage.getDisplayName(); if (ofr.isPresentation()) { // Always generates class name - info.sClass="masterpage"+styleNames.getExportName(sDisplayName); + info.sClass="masterpage"+styleNames.addToExport(sDisplayName); } } } @@ -152,7 +152,7 @@ public class PageStyleConverter extends StyleConverterHelper { } // Then export the results buf.append(sIndent) - .append(".masterpage").append(styleNames.getExportName(sDisplayName)) + .append(".masterpage").append(styleNames.addToExport(sDisplayName)) .append(" {").append(info.props.toString()).append("}") .append(config.prettyPrint() ? "\n" : " "); } diff --git a/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java b/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java index f203081..2424aa8 100644 --- a/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/PresentationStyleConverter.java @@ -100,7 +100,7 @@ public class PresentationStyleConverter extends FrameStyleConverter { if (!props.isEmpty()) { buf.append(sIndent) .append("li.outline") - .append(styleNames.getExportName(sDisplayName)) + .append(styleNames.addToExport(sDisplayName)) .append(" p {").append(props.toString()).append("}") .append(config.prettyPrint() ? "\n" : " "); } @@ -147,7 +147,7 @@ public class PresentationStyleConverter extends FrameStyleConverter { public void applyOutlineStyle(int nLevel, StyleInfo info) { if (2<=nLevel && nLevel<=9 && sCurrentOutlineStyle!=null) { if (outlineStyles.containsKey(sCurrentOutlineStyle)) { - info.sClass = "outline"+outlineStyleNames.getExportName(outlineStyles.get(sCurrentOutlineStyle)[nLevel]); + info.sClass = "outline"+outlineStyleNames.addToExport(outlineStyles.get(sCurrentOutlineStyle)[nLevel]); } } } diff --git a/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java b/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java index caa566b..cdff33a 100644 --- a/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java +++ b/src/main/java/writer2latex/xhtml/StyleWithPropertiesConverterHelper.java @@ -83,7 +83,7 @@ public abstract class StyleWithPropertiesConverterHelper else { // Generate class name from display name info.sClass = getClassNamePrefix() - + styleNames.getExportName(sDisplayName); + + styleNames.addToExport(sDisplayName); } } } @@ -107,7 +107,7 @@ public abstract class StyleWithPropertiesConverterHelper buf.append(getDefaultTagName(null)); buf.append("."); buf.append(getClassNamePrefix()); - buf.append(styleNames.getExportName(sDisplayName)); + buf.append(styleNames.addToExport(sDisplayName)); buf.append(" {"); buf.append(props.toString()); buf.append("}"); diff --git a/src/main/java/writer2latex/xhtml/TextStyleConverter.java b/src/main/java/writer2latex/xhtml/TextStyleConverter.java index b5e5f41..cc39172 100644 --- a/src/main/java/writer2latex/xhtml/TextStyleConverter.java +++ b/src/main/java/writer2latex/xhtml/TextStyleConverter.java @@ -132,11 +132,11 @@ public class TextStyleConverter extends StyleWithPropertiesConverterHelper { // This combination is not seen before, but the base style may be known // In that case, use the visited style name as well if (anchorStyleNames.containsName(sStyleName)) { - sExportName = anchorStyleNames.getExportName(sStyleName) - +anchorVisitedStyleNames.getExportName(sVisitedStyleName); + sExportName = anchorStyleNames.addToExport(sStyleName) + +anchorVisitedStyleNames.addToExport(sVisitedStyleName); } else { - sExportName = anchorStyleNames.getExportName(sStyleName); + sExportName = anchorStyleNames.addToExport(sStyleName); } anchorCombinedStyleNames.put(sName,sExportName); orgAnchorStyleNames.put(sExportName,sStyleName);