[Libreoffice-commits] core.git: Branch 'aoo/trunk' - oox/inc oox/source

Clarence Guo clarence_guo at apache.org
Mon May 26 03:09:04 PDT 2014


 oox/inc/oox/xls/richstring.hxx |    1 +
 oox/source/xls/richstring.cxx  |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit d39da40700ceab57e9f80bd9851598e1d455f121
Author: Clarence Guo <clarence_guo at apache.org>
Date:   Mon May 26 03:03:05 2014 +0000

    for #i124928, rich text portion could be converted several times, each time when it is converted, the string will be set once, but in the setString logic, the text is inserted instead of set.
    
    Repeated conversion is unnecessary, add a flag to avoid repeated conversion

diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index 18f177b..afd88f1 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -78,6 +78,7 @@ private:
     ::rtl::OUString     maText;         /// Portion text.
     FontRef             mxFont;         /// Embedded portion font, may be empty.
     sal_Int32           mnFontId;       /// Link to global font list.
+    bool                mbConverted;    /// Without repeatly convert
 };
 
 typedef ::boost::shared_ptr< RichStringPortion > RichStringPortionRef;
diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx
index b2349ab..1fb24f4 100644
--- a/oox/source/xls/richstring.cxx
+++ b/oox/source/xls/richstring.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 #include "oox/xls/richstring.hxx"
 
 #include <com/sun/star/text/XText.hpp>
@@ -59,7 +57,8 @@ inline bool lclNeedsRichTextFormat( const Font* pFont )
 
 RichStringPortion::RichStringPortion( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
-    mnFontId( -1 )
+    mnFontId( -1 ),
+    mbConverted( false )
 {
 }
 
@@ -89,6 +88,9 @@ void RichStringPortion::finalizeImport()
 
 void RichStringPortion::convert( const Reference< XText >& rxText, const Font* pFont, bool bReplace )
 {
+    if ( mbConverted )
+        return;
+
     Reference< XTextRange > xRange;
     if( bReplace )
         xRange.set( rxText, UNO_QUERY );
@@ -113,6 +115,8 @@ void RichStringPortion::convert( const Reference< XText >& rxText, const Font* p
             pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
         }
     }
+
+    mbConverted = true;
 }
 
 // ----------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list