From 9f023774b84986fd754e3be7a5bd2e1db0ca6800 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 8 Feb 2013 00:02:28 -0500 Subject: Push everything to the cell context. This is to prepare for the use of EditEngine to create rich text paragraphs. Change-Id: Ic3577e38352429a61c3524114d071c80507e4a4b --- sc/source/filter/xml/celltextparacontext.cxx | 23 +++++++++++------------ sc/source/filter/xml/celltextparacontext.hxx | 2 +- sc/source/filter/xml/xmlcelli.cxx | 9 +++++++-- 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& 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 maContentValidationName; std::vector 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 ); -- cgit