Kaydet (Commit) 9f023774 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Push everything to the cell context.

This is to prepare for the use of EditEngine to create rich text paragraphs.

Change-Id: Ic3577e38352429a61c3524114d071c80507e4a4b
üst a112251d
...@@ -28,24 +28,26 @@ void ScXMLCellTextParaContext::StartElement(const uno::Reference<xml::sax::XAttr ...@@ -28,24 +28,26 @@ void ScXMLCellTextParaContext::StartElement(const uno::Reference<xml::sax::XAttr
void ScXMLCellTextParaContext::EndElement() void ScXMLCellTextParaContext::EndElement()
{ {
OUString aPara = maContent.makeStringAndClear(); if (!maContent.isEmpty())
if (aPara.isEmpty()) mrParentCxt.PushParagraphSpan(maContent);
return;
mrParentCxt.PushParagraph(aPara); mrParentCxt.PushParagraphEnd();
} }
void ScXMLCellTextParaContext::Characters(const OUString& rChars) void ScXMLCellTextParaContext::Characters(const OUString& rChars)
{ {
if (rChars.isEmpty()) maContent = rChars;
return;
maContent.append(rChars);
} }
SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList) 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(); const SvXMLTokenMap& rTokenMap = GetScImport().GetCellTextParaElemTokenMap();
switch (rTokenMap.Get(nPrefix, rLocalName)) switch (rTokenMap.Get(nPrefix, rLocalName))
{ {
...@@ -61,10 +63,7 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext( ...@@ -61,10 +63,7 @@ SvXMLImportContext* ScXMLCellTextParaContext::CreateChildContext(
void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan) void ScXMLCellTextParaContext::PushSpan(const OUString& rSpan)
{ {
if (rSpan.isEmpty()) mrParentCxt.PushParagraphSpan(rSpan);
return;
maContent.append(rSpan);
} }
ScXMLCellTextSpanContext::ScXMLCellTextSpanContext( ScXMLCellTextSpanContext::ScXMLCellTextSpanContext(
......
...@@ -21,7 +21,7 @@ class ScXMLTableRowCellContext; ...@@ -21,7 +21,7 @@ class ScXMLTableRowCellContext;
class ScXMLCellTextParaContext : public ScXMLImportContext class ScXMLCellTextParaContext : public ScXMLImportContext
{ {
ScXMLTableRowCellContext& mrParentCxt; ScXMLTableRowCellContext& mrParentCxt;
OUStringBuffer maContent; OUString maContent;
public: public:
ScXMLCellTextParaContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent); ScXMLCellTextParaContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLTableRowCellContext& rParent);
......
...@@ -300,9 +300,14 @@ bool cellExists( const ScAddress& rCellPos ) ...@@ -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, SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( sal_uInt16 nPrefix,
......
...@@ -41,6 +41,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext ...@@ -41,6 +41,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
boost::optional<OUString> maContentValidationName; boost::optional<OUString> maContentValidationName;
std::vector<OUString> maParagraphs; std::vector<OUString> maParagraphs;
OUStringBuffer maParagraph;
boost::scoped_ptr< ScXMLAnnotationData > mxAnnotationData; boost::scoped_ptr< ScXMLAnnotationData > mxAnnotationData;
ScMyImpDetectiveObjVec* pDetectiveObjVec; ScMyImpDetectiveObjVec* pDetectiveObjVec;
...@@ -106,7 +107,8 @@ public: ...@@ -106,7 +107,8 @@ public:
const ::com::sun::star::uno::Reference< const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList ); ::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 SetAnnotation( const ScAddress& rPosition );
void SetDetectiveObj( const ScAddress& rPosition ); void SetDetectiveObj( const ScAddress& rPosition );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment