diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-08 00:02:28 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-11 22:33:32 -0500 |
commit | 9f023774b84986fd754e3be7a5bd2e1db0ca6800 (patch) | |
tree | 176efb9326034f8860f5240ae1250878b5b5626d | |
parent | a112251d748ab74c5254e7e0ad1c8f3fb3d67b70 (diff) |
Push everything to the cell context.
This is to prepare for the use of EditEngine to create rich text paragraphs.
Change-Id: Ic3577e38352429a61c3524114d071c80507e4a4b
-rw-r--r-- | sc/source/filter/xml/celltextparacontext.cxx | 23 | ||||
-rw-r--r-- | sc/source/filter/xml/celltextparacontext.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 9 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.hxx | 4 |
4 files changed, 22 insertions, 16 deletions
diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index a70143e07a53..66c48e7d2447 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -28,24 +28,26 @@ void ScXMLCellTextParaContext::StartElement(const uno::Reference<xml::sax::XAttr void ScXMLCellTextParaContext::EndElement() { - OUString aPara = maContent.makeStringAndClear(); - if (aPara.isEmpty()) - return; + if (!maContent.isEmpty()) + mrParentCxt.PushParagraphSpan(maContent); - mrParentCxt.PushParagraph(aPara); + mrParentCxt.PushParagraphEnd(); } void ScXMLCellTextParaContext::Characters(const OUString& rChars) { - if (rChars.isEmpty()) - return; - - maContent.append(rChars); + maContent = rChars; } SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList) { + if (!maContent.isEmpty()) + { + mrParentCxt.PushParagraphSpan(maContent); + maContent = OUString(); + } + const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextParaElemTokenMap(); switch (rTokenMap.Get(nPrefix, rLocalName)) { @@ -61,10 +63,7 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan) { - if (rSpan.isEmpty()) - return; - - maContent.append(rSpan); + mrParentCxt.PushParagraphSpan(rSpan); } ScXMLCellTextSpanContext::ScXMLCellTextSpanContext( diff --git a/sc/source/filter/xml/celltextparacontext.hxx b/sc/source/filter/xml/celltextparacontext.hxx index ecc68808f571..75ce3f8c76db 100644 --- a/sc/source/filter/xml/celltextparacontext.hxx +++ b/sc/source/filter/xml/celltextparacontext.hxx @@ -21,7 +21,7 @@ class ScXMLTableRowCellContext; class ScXMLCellTextParaContext : public ScXMLImportContext { ScXMLTableRowCellContext& mrParentCxt; - OUStringBuffer maContent; + OUString maContent; public: ScXMLCellTextParaContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index abe8353f8cfa..e13cb82dc7c5 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -300,9 +300,14 @@ bool cellExists( const ScAddress& rCellPos ) } -void ScXMLTableRowCellContext::PushParagraph(const OUString& rPara) +void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan) { - maParagraphs.push_back(rPara); + maParagraph.append(rSpan); +} + +void ScXMLTableRowCellContext::PushParagraphEnd() +{ + maParagraphs.push_back(maParagraph.makeStringAndClear()); } SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPrefix, diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx index 58d0e4526562..cb61ce4a4956 100644 --- a/sc/source/filter/xml/xmlcelli.hxx +++ b/sc/source/filter/xml/xmlcelli.hxx @@ -41,6 +41,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext boost::optional<OUString> maContentValidationName; std::vector<OUString> maParagraphs; + OUStringBuffer maParagraph; boost::scoped_ptr< ScXMLAnnotationData > mxAnnotationData; ScMyImpDetectiveObjVec* pDetectiveObjVec; @@ -106,7 +107,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); - void PushParagraph(const OUString& rPara); + void PushParagraphSpan(const OUString& rSpan); + void PushParagraphEnd(); void SetAnnotation( const ScAddress& rPosition ); void SetDetectiveObj( const ScAddress& rPosition ); |