public class WriteOdt extends TranslateOdtCommon
Modifier and Type | Class and Description |
---|---|
private static class |
WriteOdt.Cfg |
static class |
WriteOdt.CmdArgs |
TranslateOdtCommon.CommonArgs
Modifier and Type | Field and Description |
---|---|
(package private) WriteOdt.CmdArgs |
args |
(package private) boolean |
bColumnBreakBefore
True then a "'''" was seen before.
|
(package private) boolean |
bInsideCode |
(package private) boolean |
bInsideColumn2 |
(package private) boolean |
bInsideListItem
true then a <text:list-item... is opened in the moment.
|
(package private) boolean |
bPageBreakBefore
True then a "'''" was seen before.
|
(package private) boolean |
bParagrFirstline
true only immediately after set <text:p
|
(package private) WriteOdt.Cfg |
cfg |
(package private) java.util.Map<java.lang.String,ReadOdt.LabelRef> |
idxChnrExternRef |
(package private) java.util.Map<java.lang.String,ReadOdt.LabelRef> |
idxLabelExternRef
Index of all foreign book marks (adequate option -labels:*.Labels.text)
filled from this files.
|
private java.lang.String |
lastAnchorReplaced
The last anchor which is replaced for operation arguments.
|
(package private) int |
nList
>=1 then the deepness of nesting list nodes.
|
(package private) int |
nrFrameImgName |
(package private) int |
nrSectionName |
(package private) int |
nrTableName |
(package private) int |
nSection
>=1 then the deepness of nesting section nodes.
|
(package private) java.io.BufferedReader |
rAdoc |
(package private) java.lang.StringBuilder |
sbo |
(package private) static java.lang.String[][] |
sCheckReplace |
(package private) static java.lang.String[] |
sCheckTextReplVmu
Builds the search Strings for replacing from VMU to character in
sTextReplace [0]. |
(package private) java.lang.String |
sCodeStyle
If set (not null) then the next lines till "----" should be written as <text:p... with this style.
|
(package private) java.lang.String |
sLineNext
Last read line from aDoc.
|
private static java.lang.String[] |
specificLineStarts |
(package private) java.lang.String |
sRefBookmark
It is set if a ref to bookmark was created.
|
(package private) java.lang.String |
sStyleParagr
If not null then a
[.style] was read. |
(package private) java.util.Stack<java.io.BufferedReader> |
stack_rAdoc |
(package private) static java.lang.String[][] |
sTextCtrlCommon |
(package private) static java.lang.String[] |
sTextCtrlCommonSearchAsciidoc
Contains the Strings to search in Markup source to replace with function or style..
|
(package private) static java.lang.String[] |
sTextCtrlCommonSearchMu
Contains the Strings to search in Markup source to replace with function or style..
|
(package private) static java.lang.String[][] |
sTextReplace
https://op.europa.eu/de/web/eu-vocabularies/formex/physical-specifications/character-encoding/quotation-marks
|
(package private) static java.lang.String[][] |
sTextReplaceAsciidoc
This Strings are replaced from Asciidoc to LibreOffice.
|
(package private) static java.lang.String |
sTextReplaceChars
Single characters to replace with
sTextReplace proper for StringFunctions# |
(package private) static java.lang.String[] |
sWwwLink |
(package private) java.lang.String |
sXXXLabel
Stores a [#label] for the next header or paragraph.
|
private java.io.Writer |
wrRep |
(package private) XmlCfg |
xmlCfgOdt |
(package private) XmlSequWriter |
xmlWr |
(package private) int |
XXXnParagr
>=1 then the deepness of nesting paragraph nodes.
|
log
Modifier | Constructor and Description |
---|---|
protected |
WriteOdt(WriteOdt.CmdArgs args) |
Modifier and Type | Method and Description |
---|---|
static int |
amain(WriteOdt.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 java.io.File |
checkAndChangeFileImage(java.lang.String[] sLinkUse,
java.io.File dirOdt,
java.lang.String sLink,
java.lang.String sTitle) |
private java.lang.String |
checkParseCommentLine(java.lang.String line) |
private java.lang.String |
checkReplaceLinkOperationLabel(java.lang.String sRef) |
void |
execute() |
private void |
finitList(int nList) |
private void |
finitSection(int toLevel) |
private void |
includeSrcCode(java.lang.String sLineIncl)
Includes lines from a source file.
|
private boolean |
isEmptyLine(java.lang.String line,
int fromPos) |
static void |
main(java.lang.String[] sArgs)
main for WriteOdt, invoked from cmd line.
|
protected java.lang.String |
parseAdocLine(java.lang.String line)
Parse a new line for paragraph etc, not the continued lines from a paragraph.
|
private java.lang.String |
parseAdocM(java.lang.String line)
Parse a new line for paragraph etc, not the continued lines from a paragraph.
|
private java.lang.String |
parseImage(java.lang.String args,
boolean bOnlyImage)
Writes an image with given arguments from the span <:args
|
private java.lang.String |
parseList(java.lang.String line) |
private java.lang.String |
parseTableRow(java.lang.String line) |
void |
parseVmlWriteOdt() |
private java.lang.String |
parseWriteCodeBlock(java.lang.String sStartLine)
Writes a block as code, write each line as extra <text:p....
|
private java.lang.String |
parseWriteParagr(java.lang.String line,
java.lang.String sLabel) |
private java.lang.String |
parseWriteParagrStyleLabel(java.lang.String line) |
private java.lang.String |
parseWriteSection(java.lang.String line) |
private java.lang.String |
parseWriteTable(java.lang.String line) |
private java.lang.String |
parseWriteText(java.lang.CharSequence clineArg,
boolean bIndentSpaces)
Analyzes the given line where interpretation are necessrary, and writes it with <:text:span... > in the given line,
writes the text with
#writeText(String, boolean) outside interpreations stuff. |
private java.lang.StringBuilder |
readAllTextLinesOfParagraph(java.lang.String sLineStart)
Reads all text lines till empty line or till specific such as "* " for a list.
|
private void |
readLabelFile(java.io.File fLabel,
java.lang.String nameRefFile) |
private java.lang.CharSequence |
replaceBackslasSubscription(java.lang.CharSequence txtArg,
java.lang.StringBuilder sbTextArg) |
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 java.lang.String |
switchToInclude(java.lang.String sFileArg) |
private void |
writeExternReferences() |
private java.lang.String |
writeHeaderLine(java.lang.String lineArg) |
private void |
writeInternalRef(java.lang.String refArg) |
private void |
writeInternalRefPage(java.lang.String sRefArg)
Writes a page reference due to given <:@page:sRef
|
private void |
writeLink(java.lang.String sLink) |
private java.lang.String |
writeSectionEnd(java.lang.String line) |
private int |
writeSpaceSupplement(java.lang.CharSequence spaces) |
private void |
writeStyleSections() |
private java.lang.String |
writeTableOfContents(java.lang.String line) |
private java.lang.String |
writeText(java.lang.CharSequence txtArg,
boolean bNewline)
Writes the pure text to XML, whereby spaces are replaced by <text:s...>.
|
private void |
wrRep(java.lang.CharSequence line) |
private void |
XXXfinitParagr() |
private java.lang.String |
XXXwriteCodeLine(java.lang.String line) |
searchForReplaceLinkOperationLabel, writeBackupFile
final WriteOdt.CmdArgs args
final WriteOdt.Cfg cfg
final XmlCfg xmlCfgOdt
java.io.BufferedReader rAdoc
java.util.Stack<java.io.BufferedReader> stack_rAdoc
java.lang.String sLineNext
int XXXnParagr
java.lang.String sStyleParagr
[.style] was read.
Valid for the next paragraph.
boolean bParagrFirstline
int nSection
int nList
boolean bInsideListItem
boolean bPageBreakBefore
boolean bColumnBreakBefore
boolean bInsideColumn2
int nrSectionName
int nrTableName
int nrFrameImgName
java.util.Map<java.lang.String,ReadOdt.LabelRef> idxLabelExternRef
readLabelFile(File, String)
.
This index is used for writeInternalRef(String)
and writeInternalRefPage(String)
to write the external link.java.util.Map<java.lang.String,ReadOdt.LabelRef> idxChnrExternRef
java.lang.String sCodeStyle
boolean bInsideCode
java.lang.String sRefBookmark
java.lang.String sXXXLabel
final java.lang.StringBuilder sbo
private java.io.Writer wrRep
private java.lang.String lastAnchorReplaced
final XmlSequWriter xmlWr
private static java.lang.String[] specificLineStarts
static java.lang.String[][] sTextReplace
static java.lang.String sTextReplaceChars
sTextReplace
proper for StringFunctions#static java.lang.String[][] sTextReplaceAsciidoc
static java.lang.String[][] sCheckReplace
static java.lang.String[] sCheckTextReplVmu
sTextReplace
[0].static java.lang.String[][] sTextCtrlCommon
static java.lang.String[] sTextCtrlCommonSearchMu
sTextCtrlCommon
[...][0]static java.lang.String[] sTextCtrlCommonSearchAsciidoc
static java.lang.String[] sWwwLink
protected WriteOdt(WriteOdt.CmdArgs args)
public static int amain(WriteOdt.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 void wrRep(java.lang.CharSequence line) throws java.io.IOException
java.io.IOException
public void execute() throws java.io.IOException
java.io.IOException
private java.lang.String switchToInclude(java.lang.String sFileArg) throws java.io.IOException
java.io.IOException
private void readLabelFile(java.io.File fLabel, java.lang.String nameRefFile)
private void writeStyleSections() throws java.io.IOException
java.io.IOException
public void parseVmlWriteOdt() throws java.io.IOException
java.io.IOException
protected java.lang.String parseAdocLine(java.lang.String line) throws java.io.IOException
line
- found linejava.io.IOException
private java.lang.String parseAdocM(java.lang.String line) throws java.io.IOException
line
- found linejava.io.IOException
private boolean isEmptyLine(java.lang.String line, int fromPos)
private java.lang.String writeHeaderLine(java.lang.String lineArg) throws java.io.IOException
java.io.IOException
private java.lang.String checkParseCommentLine(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseWriteSection(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String writeSectionEnd(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseWriteParagrStyleLabel(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseWriteParagr(java.lang.String line, java.lang.String sLabel) throws java.io.IOException
line
- This is only the start (first) line. All other lines will be read here
calling readAllTextLinesOfParagraph(String)
sLabel
- null or a label (bookmark) for this paragraph TODO not implemented yet.java.io.IOException
private java.lang.String parseList(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.StringBuilder readAllTextLinesOfParagraph(java.lang.String sLineStart) throws java.io.IOException
sLineStart
- The first line.sLineNext
for using for the next paragraph, especially a list.java.io.IOException
private java.lang.String parseWriteText(java.lang.CharSequence clineArg, boolean bIndentSpaces) throws java.io.IOException
#writeText(String, boolean)
outside interpreations stuff.
Which is regarded: see sTextCtrlCommon
, #sTextCtrlItalicBold
, #sTextCtrlStyleForItalicBold
.
The WriteOdt.Cfg.useItalicBold
decides whether __textInItalic__
etc. is outputted as indirect style italic
or as direct style "Quotation". Both is possible.line
- java.io.IOException
private int writeSpaceSupplement(java.lang.CharSequence spaces) throws java.io.IOException
java.io.IOException
private void writeInternalRef(java.lang.String refArg) throws java.io.IOException
java.io.IOException
private void writeInternalRefPage(java.lang.String sRefArg) throws java.io.IOException
sRef
- can be empty or only consist of a max 3-digit number,
then it is ignored, instead the reference use on last called writeInternalRef(String)
is used here also.
This is sensible if the <:@page:.> follows after the <:@ref:sRef:Title.>.
If sRef is given, it can be used only for a page reference without reference text.java.io.IOException
private void writeLink(java.lang.String sLink) throws java.io.IOException
java.io.IOException
private java.lang.String checkReplaceLinkOperationLabel(java.lang.String sRef)
private java.lang.String writeText(java.lang.CharSequence txtArg, boolean bNewline) throws java.io.IOException
#parseWriteText(String)
txtArg
- bNewline
- java.io.IOException
private java.lang.CharSequence replaceBackslasSubscription(java.lang.CharSequence txtArg, java.lang.StringBuilder sbTextArg)
private java.lang.String XXXwriteCodeLine(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseWriteCodeBlock(java.lang.String sStartLine) throws java.io.IOException
#parseWriteText(String)
.
It means, also here character mark up (span) and character replacements
(replaceBackslasSubscription(CharSequence, StringBuilder)
are also done here.
includeSrcCode(String)
.sStartLine
- first line of code block, containing the <:Code....java.io.IOException
private void includeSrcCode(java.lang.String sLineIncl) throws java.io.IOException
<include:../path/to/src::TAG::44::2,4:txt,5.>
sLineIncl
- java.io.IOException
private java.lang.String writeTableOfContents(java.lang.String line) throws java.io.IOException
java.io.IOException
private void writeExternReferences() throws java.io.IOException
java.io.IOException
private void XXXfinitParagr() throws java.io.IOException
java.io.IOException
private void finitList(int nList) throws java.io.IOException
java.io.IOException
private void finitSection(int toLevel) throws java.io.IOException
java.io.IOException
private java.lang.String parseWriteTable(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseTableRow(java.lang.String line) throws java.io.IOException
java.io.IOException
private java.lang.String parseImage(java.lang.String args, boolean bOnlyImage) throws java.io.IOException
args
- starts with the path to the image, contains all after "<:image:"bOnlyImage
- true then the paragraph contains only the image.
Note in LibreOffice an image is always embedded in a paragraph.java.io.IOException
private java.io.File checkAndChangeFileImage(java.lang.String[] sLinkUse, java.io.File dirOdt, java.lang.String sLink, java.lang.String sTitle)