public class ReadOdt
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ReadOdt.CmdArgs |
Modifier and Type | Field and Description |
---|---|
private boolean |
bInCodeBlock |
private boolean |
bInColumns |
(package private) int[] |
chapterNr
If not null, then replace the first ' ' of the next output with this char.
|
private ReadOdt.CmdArgs |
cmdArgs |
private java.util.Map<java.lang.String,java.lang.String> |
idxBookmarkToShort |
private java.util.Map<java.lang.String,java.lang.String> |
idxDirectOnlyStyle |
private java.util.Map<java.lang.String,StyleOdt> |
idxDirectToStyle |
private java.util.Map<java.lang.String,StyleImg> |
idxImgDirectToStyle |
private java.util.Map<java.lang.String,StyleOdt> |
idxIndirectStyle
This index is filled initially with a few styles which are expected,
especially TextPg and TextCol, because of
StyleOdt.pgBreakBefore etc. known by knowledge. |
private java.util.Map<java.lang.String,java.lang.String> |
idxShortToStyle |
private java.util.Map<java.lang.String,java.lang.String> |
idxStyleToShort |
private java.util.Map<java.lang.String,java.lang.String> |
idxUsedStyles |
private java.lang.String |
lastHlinkPathToReplaced
The last anchor which is replaced for operation arguments.
|
private java.util.List<XmlDataNode> |
listNdTitle
Node text:h with the title of the document.
|
LogMessage |
log |
private XmlDataNode |
nodeDirectStyles |
private XmlDataNode |
nodeText |
private java.lang.StringBuilder |
sb
Buffer able to see in debug for buffered writer for markup and asciidoc.
|
private java.lang.StringBuilder |
sba
Buffer able to see in debug for buffered writer for markup and asciidoc.
|
(package private) static java.lang.String[][] |
sCheckReplace |
(package private) static java.lang.String |
sIndent |
(package private) static java.lang.String[] |
sNewlineCheck |
(package private) static java.lang.String[] |
sNewlineCheckBack
Used for search a separator position if
sNewlineCheck is not found. |
private java.lang.String |
sRefBookmark
Stores a found BOOKMARK in
to write it in <#label, text ....> to compare with the other refs. |
private java.lang.String |
sRefChapter
Stores a found text in
|
private StyleOdt |
styleP |
private java.io.Writer |
wr
The output channel for markup and asciidoc
|
private java.io.Writer |
wra
The output channel for markup and asciidoc
|
private java.io.Writer |
wrRep
The output channel for markup and asciidoc
|
private XmlCfg |
xmlCfgOdt |
Constructor and Description |
---|
ReadOdt(ReadOdt.CmdArgs cmdArgs) |
Modifier and Type | Method and Description |
---|---|
static int |
amain(ReadOdt.CmdArgs args)
main for this class, with given prepared arguments
Does not catch unexpected exceptions and does not System.exit(...), use it to execute in a Java environment.
|
private void |
defineIndirectStyles() |
private java.lang.String |
execute() |
private java.lang.String |
gatherAllHeading(XmlDataNode ndText) |
protected java.lang.String |
gatherContent(XmlDataNode nodeContent,
int deepnessSection) |
private java.lang.String |
gatherDirectStyles(XmlDataNode nodeDirectStyles) |
private java.lang.String |
gatherHeader(XmlDataNode node)
Writes a header as
'''
[#label]
==== Chapter title
|
private java.lang.String |
gathWrFrameOrImage(XmlDataNode ndParagr,
XmlDataNode ndFrame,
java.lang.String styleFrameRaw,
boolean bCaption) |
private java.lang.String |
gathWrList(XmlDataNode nodeList) |
private java.lang.String |
gathWrListItem(XmlDataNode ndItem) |
private java.lang.String |
gathWrListItemOrNumbHeader(XmlDataNode nodeItem)
Gather an item in a list, not known what is it.
|
private java.lang.String |
gathWrParagraph(XmlDataNode node,
int indent,
java.lang.String[] stylesExpected)
Writes an paragraph from XML to VMU
It does not write a newline after the paragraph text because TODO
|
private java.lang.String |
gathWrSpan(XmlDataNode node,
StyleOdt style)
span is for any text part with specific formatting.
|
private java.lang.String |
gathWrTable(XmlDataNode ndTable) |
private java.lang.String |
gathWrTableOfContent(XmlDataNode node) |
private java.lang.String |
gathWrText(XmlDataNode nodeP)
This is all inside a paragraph.
|
private java.lang.String |
gathWrXlink(XmlDataNode ndA) |
private char |
gathWrXRef(XmlDataNode nodeXref)
Gathers a <text:bookmark-ref ...>, writes in Adoc as <<#label>>.
|
private int |
getAttribNumber(XmlDataNode node,
java.lang.String key,
int defaultNr) |
private StyleOdt |
getBaseStyle(java.lang.String styleNameArg) |
(package private) java.lang.String |
getBookmarkShort(XmlDataNode node,
java.lang.String sAttribKey) |
private int |
getNumber(java.lang.String sNr,
int defaultNr) |
static void |
main(java.lang.String[] sArgs)
main for UFBglConv, invoked from cmd line.
|
private java.lang.String |
readOdgxmlWriteAsciidoc(XmlDataNode ndRootOdg)
This is the main routine after reading the whole XML file content.xml from odg.
|
private java.lang.String |
readXml(java.lang.Object data,
java.io.File fInOdg)
Reads completely the content.xml from the given odg file
and stores the data in the returned instance.
|
private int |
searchLineBreak(boolean[] bInsideRef,
java.lang.StringBuilder sb1,
int posStart,
int posEndFocus,
int posEndTextSentence,
int posEndTextline)
Searches a possible text line break for a beautification shortened text write style.
|
static int |
smain(java.lang.String[] sArgs,
java.lang.Appendable logHelp,
java.lang.Appendable logError)
main gets the arguments as String,
but does not catch unexpected exceptions and does not System.exit(...), use it to execute in a Java environment.
|
private void |
wrAdoc(java.lang.CharSequence text) |
private void |
wrBufferToFile(java.lang.StringBuilder sb1,
java.io.Writer wr1,
boolean bEnd)
Writes the buffer content to the file and supplements necessary line breaks for Asciidoc:
A line break is set always after a ". " whereby the space is replaced by the line break.
|
private java.lang.String |
wrClose() |
private void |
writeAsciidocHead() |
private java.lang.String |
writeTitle(XmlDataNode nodeContent) |
private void |
writeVmlHead() |
private void |
wrm(java.lang.CharSequence text) |
private void |
wrRep(java.lang.CharSequence line) |
private void |
wrReplaceLastSpace(char cNew) |
private java.lang.String |
wrText(java.lang.String textArg)
Writes a given text from XML to VML.
|
private java.lang.String |
wrTextAdoc(java.lang.String textArg)
Writes a given text from XML to Asciidoc, but with detection of pass:[...] parts.
|
private final ReadOdt.CmdArgs cmdArgs
public final LogMessage log
private XmlCfg xmlCfgOdt
private java.util.Map<java.lang.String,StyleOdt> idxDirectToStyle
private java.util.Map<java.lang.String,StyleImg> idxImgDirectToStyle
private java.util.Map<java.lang.String,StyleOdt> idxIndirectStyle
StyleOdt.pgBreakBefore
etc. known by knowledge.
The index is supplemented by found style names without direct style, which are just indirect styles.
The properties of the indirect styles are not known here, because the styles.xml is not evaluated.private java.util.Map<java.lang.String,java.lang.String> idxDirectOnlyStyle
private java.util.Map<java.lang.String,java.lang.String> idxUsedStyles
private java.util.Map<java.lang.String,java.lang.String> idxStyleToShort
private java.util.Map<java.lang.String,java.lang.String> idxShortToStyle
private java.util.Map<java.lang.String,java.lang.String> idxBookmarkToShort
private XmlDataNode nodeDirectStyles
private XmlDataNode nodeText
private java.util.List<XmlDataNode> listNdTitle
gatherAllHeading(XmlDataNode)
.private StyleOdt styleP
private java.lang.String sRefBookmark
to write it in <#label, text ....> to compare with the other refs.private java.lang.String sRefChapter
text
to write it in <#label, text ....>private boolean bInCodeBlock
private boolean bInColumns
private java.lang.String lastHlinkPathToReplaced
int[] chapterNr
private java.lang.StringBuilder sb
private java.lang.StringBuilder sba
private java.io.Writer wr
private java.io.Writer wra
private java.io.Writer wrRep
static java.lang.String sIndent
static final java.lang.String[] sNewlineCheck
static final java.lang.String[] sNewlineCheckBack
sNewlineCheck
is not found.
Also used to search forward the next possible separator position after "<:@xxx.> further text.static java.lang.String[][] sCheckReplace
public ReadOdt(ReadOdt.CmdArgs cmdArgs) throws java.nio.charset.IllegalCharsetNameException, java.nio.charset.UnsupportedCharsetException, java.io.FileNotFoundException, java.io.IOException
java.nio.charset.IllegalCharsetNameException
java.nio.charset.UnsupportedCharsetException
java.io.FileNotFoundException
java.io.IOException
public static int amain(ReadOdt.CmdArgs args) throws java.io.IOException
args
- prepared cmd line argumentsjava.io.IOException
java.lang.Exception
- if unexpected.public static int smain(java.lang.String[] sArgs, java.lang.Appendable logHelp, java.lang.Appendable logError) throws java.io.IOException
sArgs
- java.io.IOException
java.lang.Exception
- if unexpected.public static void main(java.lang.String[] sArgs)
sArgs
- private java.lang.String execute() throws java.io.IOException
java.io.IOException
private void defineIndirectStyles()
private java.lang.String readXml(java.lang.Object data, java.io.File fInOdg) throws java.io.IOException
fInOdg
- The file to readjava.io.IOException
- On file read problemsprivate java.lang.String readOdgxmlWriteAsciidoc(XmlDataNode ndRootOdg) throws java.io.IOException
ndRootOdg
- the root node of the content.xmljava.io.IOException
private java.lang.String gatherDirectStyles(XmlDataNode nodeDirectStyles)
private void writeAsciidocHead() throws java.io.IOException
java.io.IOException
private void writeVmlHead() throws java.io.IOException
java.io.IOException
private java.lang.String gatherAllHeading(XmlDataNode ndText)
private java.lang.String writeTitle(XmlDataNode nodeContent) throws java.io.IOException
java.io.IOException
protected java.lang.String gatherContent(XmlDataNode nodeContent, int deepnessSection) throws java.io.IOException
java.io.IOException
private java.lang.String gatherHeader(XmlDataNode node) throws java.io.IOException
''' [#label] ==== Chapter title
node
- text:h or maybe text:p nodejava.io.IOException
private java.lang.String gathWrParagraph(XmlDataNode node, int indent, java.lang.String[] stylesExpected) throws java.io.IOException
node
- indent
- stylesExpected
- java.io.IOException
private java.lang.String gathWrText(XmlDataNode nodeP) throws java.io.IOException
nodeP
- java.io.IOException
private java.lang.String gathWrSpan(XmlDataNode node, StyleOdt style) throws java.io.IOException
node
- style
- java.io.IOException
private java.lang.String gathWrList(XmlDataNode nodeList) throws java.io.IOException
java.io.IOException
private java.lang.String gathWrListItemOrNumbHeader(XmlDataNode nodeItem) throws java.io.IOException
nodeItem
- java.io.IOException
private java.lang.String gathWrListItem(XmlDataNode ndItem) throws java.io.IOException
java.io.IOException
private java.lang.String gathWrTable(XmlDataNode ndTable) throws java.io.IOException
java.io.IOException
private java.lang.String gathWrTableOfContent(XmlDataNode node) throws java.io.IOException
java.io.IOException
private java.lang.String gathWrFrameOrImage(XmlDataNode ndParagr, XmlDataNode ndFrame, java.lang.String styleFrameRaw, boolean bCaption) throws java.io.IOException
java.io.IOException
private java.lang.String gathWrXlink(XmlDataNode ndA) throws java.io.IOException
java.io.IOException
private char gathWrXRef(XmlDataNode nodeXref) throws java.io.IOException
nodeXref
- java.io.IOException
private StyleOdt getBaseStyle(java.lang.String styleNameArg)
private int getNumber(java.lang.String sNr, int defaultNr)
java.lang.String getBookmarkShort(XmlDataNode node, java.lang.String sAttribKey)
private int getAttribNumber(XmlDataNode node, java.lang.String key, int defaultNr)
private java.lang.String wrText(java.lang.String textArg) throws java.io.IOException
WriteOdt.sTextReplace
such as non-breaking spaces or the backslash
then the adequate transcription is used. This is in the same kind also in the WriteOdg direction.text
- The text from XMLjava.io.IOException
private java.lang.String wrTextAdoc(java.lang.String textArg) throws java.io.IOException
WriteOdt.sTextCtrlCommon
then either +text+
or pass:[text]
is translated to Asciidoc
with the adequate text parts. This can/should be given in the same kind in the WriteOdg direction.text
- The text from XMLjava.io.IOException
private void wrReplaceLastSpace(char cNew)
private void wrAdoc(java.lang.CharSequence text) throws java.io.IOException
java.io.IOException
private void wrm(java.lang.CharSequence text) throws java.io.IOException
java.io.IOException
private int searchLineBreak(boolean[] bInsideRef, java.lang.StringBuilder sb1, int posStart, int posEndFocus, int posEndTextSentence, int posEndTextline)
sb1
- The whole bufferposStart
- focus from here.posEndFocus
- spread span from start of the focus to detect also <:@....> as long span.posEndTextline
- spread or span from start ot length of a normal sentence till ". " or alternativel till ", " etc.private void wrBufferToFile(java.lang.StringBuilder sb1, java.io.Writer wr1, boolean bEnd) throws java.io.IOException
bEnd
- true then writes all, false then prevent the last content without dot on end.
if false, further output comes which is regarded later.java.io.IOException
private void wrRep(java.lang.CharSequence line) throws java.io.IOException
java.io.IOException
private java.lang.String wrClose() throws java.io.IOException
java.io.IOException