|
Docmosis API 4.9.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.docmosis.template.analysis.TextWritableSafeAreas
public class TextWritableSafeAreas
This class is used to provide information as to locations in a document where information can be injected safely. Most basically, this is inside a paragraph or a span, but of course these can contain other structures where it is not safe to inject content. Consider
<text:p>
here is good
<text:span>
here is good too
<some other XML>
no good here
</some other XML>
good here again (inside the span)
</text:span>
good here too (inside the paragraph>
</text:p>
So we simply create an array of areas where we know it's safe and this can be
tested against a working index later.
This allows us to be able to determine if our current stream index is inside or outside of
a paragraph. This means we can decide how we need to proceed when injecting content like
error messages.
| Nested Class Summary | |
|---|---|
static class |
TextWritableSafeAreas.ParagraphMapItem
|
| Constructor Summary | |
|---|---|
TextWritableSafeAreas()
|
|
| Method Summary | |
|---|---|
void |
add(long startIdx,
long endIdx,
boolean inSpan,
boolean hasFrameAncestor,
boolean hasShapeAncestor,
boolean requiresArtificialParagraph)
Start recording a writable area immediately after the given end index. |
boolean |
equals(Object obj)
|
void |
finish()
Finish and optimise for runtime rendering. |
TextWritableSafeAreas.ParagraphMapItem |
getNextWritableLocation(long startIdx,
long endIdx)
Get the next safe-to-write location starting from the given start and up to the given end. |
TextWritableSafeAreas.ParagraphMapItem |
getNextWritableLocation(long startIdx,
long endIdx,
boolean excludeFrames)
Get the next safe-to-write location starting from the given start and up to the given end, optionally only returning areas that are not within frames. |
TextWritableSafeAreas.ParagraphMapItem |
getWritableLocation(long idx)
Determine if the given idx points to a safe-to-write location and if so return information about it. |
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TextWritableSafeAreas()
| Method Detail |
|---|
public void add(long startIdx,
long endIdx,
boolean inSpan,
boolean hasFrameAncestor,
boolean hasShapeAncestor,
boolean requiresArtificialParagraph)
startIdx - the start index of the tagendIdx - the end index of the taginSpan - indicator whether we are inside a span or nothasFrameAncestor - specify whether the safe area is within a framehasFrameAncestor - specify whether the safe area is within a shaperequiresArtificialParagraph - specify whether the safe area is artificial and
requires a paragraph to be constructed to contain it.public void finish()
public TextWritableSafeAreas.ParagraphMapItem getWritableLocation(long idx)
throws IllegalStateException
idx - the index to test for safe-writability
IllegalStateException - if finish() has not been called.
public TextWritableSafeAreas.ParagraphMapItem getNextWritableLocation(long startIdx,
long endIdx)
throws IllegalStateException
startIdx - the index to test for safe-writabilityendIdx - do not go past this index. -1 means ignore the end index.
IllegalStateException - if finish() has not been called.
public TextWritableSafeAreas.ParagraphMapItem getNextWritableLocation(long startIdx,
long endIdx,
boolean excludeFrames)
throws IllegalStateException
startIdx - the index to test for safe-writabilityedIdx - do not go past this index. -1 means ignore the end indexexcludeFrames - if true, "safe" locations will not be returned if they are
within frames.
IllegalStateException - if finish() has not been called.public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Object
|
Docmosis API 4.9.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||