_rtRuns[0] = new RichTextRun(this, 0, runRawText.length());
} else {
// Build up Rich Text Runs, one for each character style block
+ // TODO: Handle case of shared character styles
int pos = 0;
+
int curP = 0;
int pLenRemain = ((TextPropCollection)pStyles.get(curP)).getCharactersCovered();
}
// Build the rich text run
- _rtRuns[i] = new RichTextRun(this, pos, len, pProps, cProps);
+ // TODO: Tell the RichTextRun if the styles are shared
+ _rtRuns[i] = new RichTextRun(this, pos, len, pProps, cProps, false, false);
pos += len;
// See if we need to move onto the next paragraph style
cCol.updateTextSize(s.length()+1);
// Recreate rich text run with first styling
- _rtRuns[0] = new RichTextRun(this,0,s.length(), pCol, cCol);
+ _rtRuns[0] = new RichTextRun(this,0,s.length(), pCol, cCol, false, false);
} else {
// Recreate rich text run with no styling
_rtRuns[0] = new RichTextRun(this,0,s.length());
if(_rtRuns.length != 1) {
throw new IllegalStateException("Needed to add StyleTextPropAtom when had many rich text runs");
}
+ // These are the only styles for now
_rtRuns[0].supplyTextProps(
(TextPropCollection)_styleAtom.getParagraphStyles().get(0),
- (TextPropCollection)_styleAtom.getCharacterStyles().get(0)
+ (TextPropCollection)_styleAtom.getCharacterStyles().get(0),
+ false,
+ false
);
}
/**
* Our paragraph and character style.
- * Note - we may share the Paragraph style with another RichTextRun
- * (the Character style should be ours alone)
+ * Note - we may share these styles with other RichTextRuns
*/
private TextPropCollection paragraphStyle;
private TextPropCollection characterStyle;
+ private boolean sharingParagraphStyle;
+ private boolean sharingCharacterStyle;
/**
* Create a new wrapper around a (currently not)
* @param len
*/
public RichTextRun(TextRun parent, int startAt, int len) {
- this(parent, startAt, len, null, null);
+ this(parent, startAt, len, null, null, false, false);
}
/**
* Create a new wrapper around a rich text string
* @param len The length of this run
* @param pStyle The paragraph style property collection
* @param cStyle The character style property collection
+ * @param pShared The paragraph styles are shared with other runs
+ * @param cShared The character styles are shared with other runs
*/
public RichTextRun(TextRun parent, int startAt, int len,
- TextPropCollection pStyle, TextPropCollection cStyle) {
+ TextPropCollection pStyle, TextPropCollection cStyle,
+ boolean pShared, boolean cShared) {
parentRun = parent;
startPos = startAt;
length = len;
}
/**
- * Supply (normally default) textprops, when a run gets them
+ * Supply (normally default) textprops, and if they're shared,
+ * when a run gets them
*/
- public void supplyTextProps(TextPropCollection pStyle, TextPropCollection cStyle) {
+ public void supplyTextProps(TextPropCollection pStyle, TextPropCollection cStyle, boolean pShared, boolean cShared) {
if(paragraphStyle != null || characterStyle != null) {
throw new IllegalStateException("Can't call supplyTextProps if run already has some");
}
paragraphStyle = pStyle;
characterStyle = cStyle;
+ sharingParagraphStyle = pShared;
+ sharingCharacterStyle = cShared;
}
/**
* Supply the SlideShow we belong to
* For normal use, use the friendly setters and getters
*/
public TextPropCollection _getRawCharacterStyle() { return characterStyle; }
+ /**
+ * Internal Use Only - are the Paragraph styles shared?
+ */
+ public boolean _isParagraphStyleShared() { return sharingParagraphStyle; }
+ /**
+ * Internal Use Only - are the Character styles shared?
+ */
+ public boolean _isCharacterStyleShared() { return sharingCharacterStyle; }
}