summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-04-29 21:47:18 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-29 21:59:28 +0200
commitb3fe4039767f60aa43a5e3e2d1a9259fd337d871 (patch)
treee94cfbec8e9fcb20a0843f08da9e03f6a128e394 /sw
parentf02c7cdbef595660703cce9359fe9eb71ceefacf (diff)
sw doc model dump: improve section format dump
Instead of looking up the relevant entry from mpSectionFmtTbl in each section using the layout, dump mpSectionFmtTbl directly. This makes the dump of the section format table consistent with the other format table dumps. Change-Id: I988c8f4fdfd52b64359eb4acf9c61383f33fb8ad
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docary.hxx1
-rw-r--r--sw/source/core/docnode/nodedump.cxx33
2 files changed, 20 insertions, 14 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 120606a550cd..f3615a679c9d 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -116,6 +116,7 @@ public:
virtual SwFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return (SwFmt*)operator[](idx); }
sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
bool Contains(const SwSectionFmt* pFmt) const;
+ void dumpAsXml(xmlTextWriterPtr w);
/// free's any remaining child objects
virtual ~SwSectionFmts();
};
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index d4d70afc1f4c..a2ffd3ce5924 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -182,6 +182,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
mpTxtFmtCollTbl->dumpAsXml( writer );
mpCharFmtTbl->dumpAsXml( writer );
mpSpzFrmFmtTbl->dumpAsXml( writer );
+ mpSectionFmtTbl->dumpAsXml( writer );
mpNumRuleTbl->dumpAsXml( writer );
mpRedlineTbl->dumpAsXml( writer );
mpExtraRedlineTbl->dumpAsXml( writer );
@@ -320,7 +321,7 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w )
name = "table";
break;
case ND_SECTIONNODE:
- name = "sectionNode";
+ name = "section";
break;
default:
switch( GetStartNodeType())
@@ -350,19 +351,6 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w )
writer.writeFormatAttribute( "ptr", "%p", this );
writer.writeFormatAttribute( "index", TMP_FORMAT, GetIndex() );
- if (GetNodeType() == ND_SECTIONNODE)
- {
- SwSection& rSection = GetSectionNode()->GetSection();
- writer.startElement("section");
-
- SwSectionFmt* pFmt = rSection.GetFmt();
- writer.startElement("swsectionfmt");
- lcl_dumpSfxItemSet(writer, &pFmt->GetAttrSet());
- writer.endElement();
-
- writer.endElement();
- }
-
// writer.endElement(); - it is a start node, so don't end, will make xml better nested
}
@@ -566,6 +554,23 @@ void SwCharFmts::dumpAsXml(xmlTextWriterPtr w)
}
}
+void SwSectionFmts::dumpAsXml(xmlTextWriterPtr w)
+{
+ WriterHelper writer(w);
+ if (size())
+ {
+ writer.startElement("swsectionfmts");
+ for (size_t i = 0; i < size(); ++i)
+ {
+ SwSectionFmt* pFmt = static_cast<SwSectionFmt*>(GetFmt(i));
+ writer.startElement("swsectionfmt");
+ lcl_dumpSfxItemSet(writer, &pFmt->GetAttrSet());
+ writer.endElement();
+ }
+ writer.endElement();
+ }
+}
+
void SwTxtFmtColls::dumpAsXml(xmlTextWriterPtr w)
{
WriterHelper writer(w);