summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-26 15:28:46 -0400
committerThorsten Behrens <tbehrens@suse.com>2013-08-27 13:27:20 +0000
commitdf2c34045d753fc80484f7d7f128ec5e8b52ffc7 (patch)
tree561e71e526a976b3cd973458a8cbe270eee053ce
parent59d8dde3fc9a4dc653e43efb8552efc4ab3efc92 (diff)
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 <tbehrens@suse.com> Tested-by: Thorsten Behrens <tbehrens@suse.com>
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx16
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx2
2 files changed, 9 insertions, 9 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index f4eb73e86e55..7438e4b041bd 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 e49e3a30e190..15c95fb1c238 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;