sc/source/filter/xml/xmlcelli.cxx |   16 ++++++++--------
 sc/source/filter/xml/xmlcelli.hxx |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit df2c34045d753fc80484f7d7f128ec5e8b52ffc7
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Mon Aug 26 15:28:46 2013 -0400

    fdo#68581: The first paragraph text can be legitimately empty.
    
    Change-Id: I2309a0c6aebc8a111e67e2e3d591cbabfbbadfb4
    (cherry picked from commit 969d5a3b97903fe32b3a7da0c3de8bf86f323c17)
    Reviewed-on: https://gerrit.libreoffice.org/5637
    Reviewed-by: Thorsten Behrens <tbehr...@suse.com>
    Tested-by: Thorsten Behrens <tbehr...@suse.com>

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index f4eb73e..7438e4b 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -600,10 +600,10 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 
nBegin, sal_Int32 nEnd, cons
 
 OUString ScXMLTableRowCellContext::GetFirstParagraph() const
 {
-    if (maFirstParagraph.isEmpty())
+    if (!maFirstParagraph)
         return mpEditEngine->GetText(0);
 
-    return maFirstParagraph;
+    return *maFirstParagraph;
 }
 
 void ScXMLTableRowCellContext::PushParagraphFieldDate(const OUString& 
rStyleName)
@@ -635,12 +635,12 @@ void ScXMLTableRowCellContext::PushParagraphEnd()
 
     if (mbEditEngineHasText)
     {
-        if (!maFirstParagraph.isEmpty())
+        if (maFirstParagraph)
         {
             // Flush the cached first paragraph first.
             mpEditEngine->Clear();
-            mpEditEngine->SetText(maFirstParagraph);
-            maFirstParagraph = OUString();
+            mpEditEngine->SetText(*maFirstParagraph);
+            maFirstParagraph.reset();
         }
         mpEditEngine->InsertParagraph(mpEditEngine->GetParagraphCount(), 
maParagraph.makeStringAndClear());
     }
@@ -652,7 +652,7 @@ void ScXMLTableRowCellContext::PushParagraphEnd()
     }
     else if (mnCurParagraph == 0)
     {
-        maFirstParagraph = maParagraph.makeStringAndClear();
+        maFirstParagraph.reset(maParagraph.makeStringAndClear());
         mbEditEngineHasText = true;
     }
 
@@ -1089,10 +1089,10 @@ void ScXMLTableRowCellContext::PutTextCell( const 
ScAddress& rCurrentPos,
         }
         else if (mbEditEngineHasText)
         {
-            if (!maFirstParagraph.isEmpty())
+            if (maFirstParagraph)
             {
                 // This is a normal text without format runs.
-                rDoc.setStringCell(rCurrentPos, maFirstParagraph);
+                rDoc.setStringCell(rCurrentPos, *maFirstParagraph);
             }
             else
             {
diff --git a/sc/source/filter/xml/xmlcelli.hxx 
b/sc/source/filter/xml/xmlcelli.hxx
index e49e3a3..15c95fb 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -63,9 +63,9 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
     boost::optional<FormulaWithNamespace> maFormula; /// table:formula 
attribute
     boost::optional<OUString> maStringValue;         /// office:string-value 
attribute
     boost::optional<OUString> maContentValidationName;
+    boost::optional<OUString> maFirstParagraph; /// unformatted first 
paragraph, for better performance.
 
     ScEditEngineDefaulter* mpEditEngine;
-    OUString maFirstParagraph; /// unformatted first paragraph, for better 
performance.
     OUStringBuffer maParagraph;
     sal_Int32 mnCurParagraph;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to