poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r656252 - in /poi/trunk/src: documentation/ documentation/content/xdocs/ scratchpad/src/org/apache/poi/hslf/model/ scratchpad/src/org/apache/poi/hslf/usermodel/
Date Wed, 14 May 2008 12:42:31 GMT
Author: yegor
Date: Wed May 14 05:42:30 2008
New Revision: 656252

URL: http://svn.apache.org/viewvc?rev=656252&view=rev
Log:
convert line breaks into internal ppt represenatation when changing text

Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/documentation/release-guide.txt
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=656252&r1=656251&r2=656252&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Wed May 14 05:42:30 2008
@@ -37,6 +37,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.1-beta2" date="2008-05-??">
+           <action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom
when the parent text is changed</action>
            <action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly
read xls files without ROW records</action>
            <action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell()
and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
            <action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use
empty string instead of null when the length is zero.</action>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=656252&r1=656251&r2=656252&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Wed May 14 05:42:30 2008
@@ -34,6 +34,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-beta2" date="2008-05-??">
+           <action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom
when the parent text is changed</action>
            <action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly
read xls files without ROW records</action>
            <action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell()
and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
            <action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use
empty string instead of null when the length is zero.</action>

Modified: poi/trunk/src/documentation/release-guide.txt
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/release-guide.txt?rev=656252&r1=656251&r2=656252&view=diff
==============================================================================
--- poi/trunk/src/documentation/release-guide.txt (original)
+++ poi/trunk/src/documentation/release-guide.txt Wed May 14 05:42:30 2008
@@ -37,14 +37,14 @@
   3. Checkout the tagged version
 {code}
 cd tags
-svn checkout https://svn.apache.org/repos/asf/poi/tags/TAG
+svn checkout https://svn.apache.org/repos/asf/poi/tags/$TAG
 {code}
 
   4. Merge (if required)
 
 {code}
 cd $TAG
-$ svn merge https://svn.apache.org/repos/asf/poi/tags/TAG \
+$ svn merge https://svn.apache.org/repos/asf/poi/tags/$TAG \
 https://svn.apache.org/repos/asf/poi/trunk
 {code}
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java?rev=656252&r1=656251&r2=656252&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java Wed May 14 05:42:30
2008
@@ -318,9 +318,9 @@
 	 *  touch the stylings. 
 	 */
 	private void storeText(String s) {
-		// Remove a single trailing \n, as there is an implicit one at the
+		// Remove a single trailing \r, as there is an implicit one at the
 		//  end of every record
-		if(s.endsWith("\n")) {
+		if(s.endsWith("\r")) {
 			s = s.substring(0, s.length()-1);
 		}
 		
@@ -457,7 +457,7 @@
 	 *  as the the first character has. 
 	 * If you care about styling, do setText on a RichTextRun instead 
 	 */
-	public synchronized void setText(String s) {
+	public synchronized void setRawText(String s) {
 		// Save the new text to the atoms
 		storeText(s);
 		RichTextRun fst = _rtRuns[0];
@@ -487,7 +487,16 @@
 
 	}
 
-	/**
+    /**
+     * Changes the text.
+     * Converts '\r' into '\n'
+     */
+    public synchronized void setText(String s) {
+        String text = normalize(s);
+        setRawText(text);
+    }
+
+    /**
 	 * Ensure a StyleTextPropAtom is present for this run, 
 	 *  by adding if required. Normally for internal TextRun use.
 	 */
@@ -666,4 +675,12 @@
         return null;
 
     }
+
+    /**
+     * Returns a new string with line breaks converted into internal ppt representation
+     */
+    public String normalize(String s){
+        String ns = s.replaceAll("\\r?\\n", "\r");
+        return ns;
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java?rev=656252&r1=656251&r2=656252&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java Wed May 14
05:42:30 2008
@@ -162,10 +162,18 @@
 	 * Change the text
 	 */
 	public void setText(String text) {
-		length = text.length();
-		parentRun.changeTextInRichTextRun(this,text);
+        String s = parentRun.normalize(text);
+        setRawText(s);
 	}
 	
+    /**
+     * Change the text
+     */
+    public void setRawText(String text) {
+        length = text.length();
+        parentRun.changeTextInRichTextRun(this,text);
+    }
+
 	/**
 	 * Tells the RichTextRun its new position in the parent TextRun
 	 * @param startAt



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message