public class DocumentCache extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DocumentCache.TextParagraph |
Modifier and Type | Field and Description |
---|---|
static int |
CURSOR_TYPE_ENDNOTE |
static int |
CURSOR_TYPE_FOOTNOTE |
static int |
CURSOR_TYPE_HEADER_FOOTER |
static int |
CURSOR_TYPE_SHAPE |
static int |
CURSOR_TYPE_TABLE |
static int |
CURSOR_TYPE_TEXT |
static int |
CURSOR_TYPE_UNKNOWN |
static int |
NUMBER_CURSOR_TYPES |
protected List<DocumentCache.TextParagraph> |
toTextMapping |
Modifier and Type | Method and Description |
---|---|
int |
correctStartPoint(int nStart,
int nFPara)
correct a start point to change of flat paragraph by zero space characters
|
DocumentCache.TextParagraph |
createTextParagraph(int type,
int paragraph) |
static String |
fixLinebreak(String text)
Change manual linebreak to distinguish from end of paragraph
|
List<Integer> |
getChangedUnsupportedParagraphs(org.languagetool.openoffice.DocumentCursorTools docCursor,
org.languagetool.openoffice.ResultCache firstResultCache)
get all paragraphs within unsupported text types (shapes, tables in frames)
change the cache to new value
return all changed paragraphs
|
String |
getDocAsString()
Gives Back the full Text as String
|
String |
getDocAsString(DocumentCache.TextParagraph textParagraph,
int parasToCheck,
boolean checkOnlyParagraph,
boolean useQueue,
boolean hasFootnotes)
Gives Back the full Text as String sorted by cursor types
|
com.sun.star.lang.Locale |
getDocumentLocale() |
int |
getEndOfParaCheck(DocumentCache.TextParagraph textParagraph,
int parasToCheck,
boolean checkOnlyParagraph,
boolean useQueue,
boolean addParas)
Gives back the end paragraph for text level check
|
String |
getFlatParagraph(int n)
get Flat Paragraph by Index
|
List<Integer> |
getFlatParagraphDeletedCharacters(int n)
get deleted characters (report changes) of Flat Paragraph by Index
|
int[] |
getFlatParagraphFootnotes(int n)
get footnotes of Flat Paragraph by Index
|
int |
getFlatparagraphFromSortedTextId(int sortedTextId)
Return Number of flat Paragraph from node index
|
com.sun.star.lang.Locale |
getFlatParagraphLocale(int n)
get Locale of Flat Paragraph by Index
|
int |
getFlatParagraphNumber(DocumentCache.TextParagraph textParagraph)
get Number of Flat Paragraph from Number of Text Paragraph
|
Map<Integer,Integer> |
getHeadingMap()
Get Map of Headings (only cursor type text)
|
int |
getNearestSortedTextId(int sortedTextId)
Return nearest sorted text Id
|
DocumentCache.TextParagraph |
getNumberOfTextParagraph(int numberOfFlatParagraph)
get Number of Text Paragraph from Number of Flat Paragraph
|
int |
getParagraphType(int numberOfFlatParagraph)
get Type of Paragraph from flat paragraph number
|
int |
getStartOfParaCheck(DocumentCache.TextParagraph textParagraph,
int parasToCheck,
boolean checkOnlyParagraph,
boolean useQueue,
boolean addParas)
Gives back the start paragraph for text level check
|
int |
getStartOfParagraph(int nPara,
DocumentCache.TextParagraph textParagraph,
int parasToCheck,
boolean checkOnlyParagraph,
boolean useQueue,
boolean hasFootnotes)
Gives Back the StartPosition of Paragraph
|
String |
getTextParagraph(DocumentCache.TextParagraph textParagraph)
get the Content of a Text Paragraph
|
List<Integer> |
getTextParagraphDeletedCharacters(DocumentCache.TextParagraph textParagraph)
get deleted Characters of Text Paragraph
|
int[] |
getTextParagraphFootnotes(DocumentCache.TextParagraph textParagraph)
get footnotes of Text Paragraph by Index
|
com.sun.star.lang.Locale |
getTextParagraphLocale(DocumentCache.TextParagraph textParagraph)
get Locale of Text Paragraph by Index
|
boolean |
hasNoContent(boolean lock)
has no content
|
boolean |
hasUnsupportedText() |
boolean |
isActual(int documentElementsCount)
Return false if cache has to be actualized
|
boolean |
isAutomaticGenerated(int n)
get deleted characters (report changes) of Flat Paragraph by Index
|
boolean |
isEmpty()
is DocumentCache empty
|
boolean |
isEqual(int n,
String text,
com.sun.star.lang.Locale locale)
Text and local are equal to cache
|
boolean |
isEqual(int n,
String text,
com.sun.star.lang.Locale locale,
List<Integer> delChars)
Text, deleted chars and local are equal to cache
|
boolean |
isEqualCacheSize(org.languagetool.openoffice.DocumentCursorTools docCursor)
size of cache has changed?
|
static boolean |
isEqualText(String flatPara,
String textPara,
int[] footnotes) |
boolean |
isFinished()
wait till reset is finished
|
boolean |
isMultilingualFlatParagraph(int n)
is multilingual Flat Paragraph
|
boolean |
isResetRunning()
wait till reset is finished
|
boolean |
isSingleParagraph(int numberOfFlatParagraph)
is flat paragraph a single paragraph
|
void |
put(DocumentCache in)
Replace a document Cache
|
void |
refresh(SingleDocument document,
com.sun.star.lang.Locale fixedLocale,
com.sun.star.lang.Locale docLocale,
com.sun.star.lang.XComponent xComponent,
int fromWhere)
Refresh the cache
|
org.languagetool.openoffice.DocumentCache.ChangedRange |
refreshAndCompare(SingleDocument document,
com.sun.star.lang.Locale fixedLocale,
com.sun.star.lang.Locale docLocale,
com.sun.star.lang.XComponent xComponent,
int fromWhere)
Refresh the cache and compare with the old
Give back the range of difference and size
|
static String |
removeZeroWidthSpace(String text)
Change manual linebreak to distinguish from end of paragraph
|
void |
setFlatParagraph(int n,
String sPara)
set Flat Paragraph at Index
|
void |
setFlatParagraph(int n,
String sPara,
com.sun.star.lang.Locale locale)
set Flat Paragraph and Locale at Index
|
void |
setFlatParagraphDeletedCharacters(int n,
List<Integer> deletedChars)
set deleted characters (report changes) of Flat Paragraph by Index
|
void |
setFlatParagraphFootnotes(int n,
int[] footnotePos)
set footnotes of Flat Paragraph by Index
|
void |
setFlatParagraphLocale(int n,
com.sun.star.lang.Locale locale)
set Locale of Flat Paragraph by Index
|
void |
setForTest(List<String> paragraphs,
List<List<String>> textParagraphs,
List<int[]> footnotes,
List<List<Integer>> chapterBegins,
com.sun.star.lang.Locale locale)
set the cache only for test use
|
void |
setMultilingualFlatParagraph(int n)
set multilingual flag to Flat Paragraph
|
boolean |
setSingleParagraphsCacheToNull(int numberFlatParagraph,
List<org.languagetool.openoffice.ResultCache> paragraphsCache)
Set text level cache for one paragraph to no errors for single paragraph text
|
void |
setTextParagraphFootnotes(DocumentCache.TextParagraph textParagraph,
int[] footnotePos)
set footnotes of Text Paragraph
|
int |
size()
size of document cache (number of all flat paragraphs)
|
int |
textSize(DocumentCache.TextParagraph textParagraph)
size of text cache for a type of text
|
int |
textSize(int type)
size of text cache for a type of text
|
public static final int CURSOR_TYPE_UNKNOWN
public static final int CURSOR_TYPE_ENDNOTE
public static final int CURSOR_TYPE_FOOTNOTE
public static final int CURSOR_TYPE_HEADER_FOOTER
public static final int CURSOR_TYPE_SHAPE
public static final int CURSOR_TYPE_TEXT
public static final int CURSOR_TYPE_TABLE
public static final int NUMBER_CURSOR_TYPES
protected final List<DocumentCache.TextParagraph> toTextMapping
public void setForTest(List<String> paragraphs, List<List<String>> textParagraphs, List<int[]> footnotes, List<List<Integer>> chapterBegins, com.sun.star.lang.Locale locale)
public void refresh(SingleDocument document, com.sun.star.lang.Locale fixedLocale, com.sun.star.lang.Locale docLocale, com.sun.star.lang.XComponent xComponent, int fromWhere)
public boolean hasUnsupportedText()
public boolean setSingleParagraphsCacheToNull(int numberFlatParagraph, List<org.languagetool.openoffice.ResultCache> paragraphsCache)
public boolean isResetRunning()
public boolean isFinished()
public String getFlatParagraph(int n)
public void setFlatParagraph(int n, String sPara)
public void setFlatParagraph(int n, String sPara, com.sun.star.lang.Locale locale)
public boolean isMultilingualFlatParagraph(int n)
public void setMultilingualFlatParagraph(int n)
public com.sun.star.lang.Locale getFlatParagraphLocale(int n)
public void setFlatParagraphLocale(int n, com.sun.star.lang.Locale locale)
public int[] getFlatParagraphFootnotes(int n)
public void setFlatParagraphFootnotes(int n, int[] footnotePos)
public List<Integer> getFlatParagraphDeletedCharacters(int n)
public boolean isAutomaticGenerated(int n)
public void setFlatParagraphDeletedCharacters(int n, List<Integer> deletedChars)
public int correctStartPoint(int nStart, int nFPara)
public void put(DocumentCache in)
public boolean isEmpty()
public boolean hasNoContent(boolean lock)
public int size()
public String getTextParagraph(DocumentCache.TextParagraph textParagraph)
public int getFlatParagraphNumber(DocumentCache.TextParagraph textParagraph)
public com.sun.star.lang.Locale getTextParagraphLocale(DocumentCache.TextParagraph textParagraph)
public List<Integer> getTextParagraphDeletedCharacters(DocumentCache.TextParagraph textParagraph)
public int[] getTextParagraphFootnotes(DocumentCache.TextParagraph textParagraph)
public void setTextParagraphFootnotes(DocumentCache.TextParagraph textParagraph, int[] footnotePos)
public DocumentCache.TextParagraph getNumberOfTextParagraph(int numberOfFlatParagraph)
public int getParagraphType(int numberOfFlatParagraph)
public int textSize(int type)
public int textSize(DocumentCache.TextParagraph textParagraph)
public boolean isEqual(int n, String text, com.sun.star.lang.Locale locale)
public boolean isEqual(int n, String text, com.sun.star.lang.Locale locale, List<Integer> delChars)
public boolean isEqualCacheSize(org.languagetool.openoffice.DocumentCursorTools docCursor)
public List<Integer> getChangedUnsupportedParagraphs(org.languagetool.openoffice.DocumentCursorTools docCursor, org.languagetool.openoffice.ResultCache firstResultCache)
public boolean isSingleParagraph(int numberOfFlatParagraph)
public int getStartOfParaCheck(DocumentCache.TextParagraph textParagraph, int parasToCheck, boolean checkOnlyParagraph, boolean useQueue, boolean addParas)
public int getEndOfParaCheck(DocumentCache.TextParagraph textParagraph, int parasToCheck, boolean checkOnlyParagraph, boolean useQueue, boolean addParas)
public String getDocAsString(DocumentCache.TextParagraph textParagraph, int parasToCheck, boolean checkOnlyParagraph, boolean useQueue, boolean hasFootnotes)
public String getDocAsString()
public static String fixLinebreak(String text)
public static String removeZeroWidthSpace(String text)
public int getStartOfParagraph(int nPara, DocumentCache.TextParagraph textParagraph, int parasToCheck, boolean checkOnlyParagraph, boolean useQueue, boolean hasFootnotes)
public DocumentCache.TextParagraph createTextParagraph(int type, int paragraph)
public org.languagetool.openoffice.DocumentCache.ChangedRange refreshAndCompare(SingleDocument document, com.sun.star.lang.Locale fixedLocale, com.sun.star.lang.Locale docLocale, com.sun.star.lang.XComponent xComponent, int fromWhere)
public Map<Integer,Integer> getHeadingMap()
public int getNearestSortedTextId(int sortedTextId)
public int getFlatparagraphFromSortedTextId(int sortedTextId)
public boolean isActual(int documentElementsCount)
public com.sun.star.lang.Locale getDocumentLocale()