You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ni...@apache.org on 2006/06/12 18:07:30 UTC
svn commit: r413694 - in
/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf:
model/TextRun.java usermodel/RichTextRun.java
Author: nick
Date: Mon Jun 12 09:07:29 2006
New Revision: 413694
URL: http://svn.apache.org/viewvc?rev=413694&view=rev
Log:
Some initial changes that are needed to fix bug #38544
Modified:
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java?rev=413694&r1=413693&r2=413694&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java Mon Jun 12 09:07:29 2006
@@ -100,7 +100,9 @@
_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();
@@ -118,7 +120,8 @@
}
// 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
@@ -291,7 +294,7 @@
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());
@@ -323,9 +326,12 @@
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
);
}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java?rev=413694&r1=413693&r2=413694&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java Mon Jun 12 09:07:29 2006
@@ -47,11 +47,12 @@
/**
* 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)
@@ -61,7 +62,7 @@
* @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
@@ -70,9 +71,12 @@
* @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;
@@ -81,14 +85,17 @@
}
/**
- * 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
@@ -309,4 +316,12 @@
* 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; }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/