summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-02-28 10:41:27 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-02-28 12:53:40 +0100
commit9a93b3c671835267433b7dc9eb71aa9f1c79dd67 (patch)
tree723f9650be8e9881dce7b8566f71093c6eeafdb4 /sw
parent8a231fb2fa630c7c0992d2144ca10f21d0771baa (diff)
Extract SwDoc::dumpAsXml() from docnode
Change-Id: I49a35270d6ff2ea5c840a1f4f73d1f6a0701b2d5
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx2
-rw-r--r--sw/source/core/doc/docfmt.cxx42
-rw-r--r--sw/source/core/docnode/nodedump.cxx27
3 files changed, 43 insertions, 28 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e030ff9ad36e..7178c0dca3a2 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1666,7 +1666,7 @@ public:
* Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
* @since 3.5
*/
- void dumpAsXml( xmlTextWriterPtr writer = NULL ) const;
+ void dumpAsXml(struct _xmlTextWriter* = 0) const;
std::set<Color> GetDocColors();
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 59d08aa32084..0d319011a49b 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <libxml/xmlwriter.h>
#include <hintids.hxx>
#include <svl/itemiter.hxx>
#include <sfx2/app.hxx>
@@ -38,6 +39,8 @@
#include <frmatr.hxx>
#include <doc.hxx>
#include <docfunc.hxx>
+#include <drawdoc.hxx>
+#include <MarkManager.hxx>
#include <IDocumentUndoRedo.hxx>
#include <DocumentContentOperationsManager.hxx>
#include <IDocumentFieldsAccess.hxx>
@@ -1914,6 +1917,45 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const OUString & sNewName,
BroadcastStyleOperation(sNewName, eFamily, SFX_STYLESHEET_MODIFIED);
}
+void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ bool bOwns = false;
+ if (!pWriter)
+ {
+ pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
+ xmlTextWriterStartDocument(pWriter, NULL, NULL, NULL);
+ bOwns = true;
+ }
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swDoc"));
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+ m_pNodes->dumpAsXml(pWriter);
+ mpMarkManager->dumpAsXml(pWriter);
+ m_pUndoManager->dumpAsXml(pWriter);
+ getIDocumentFieldsAccess().GetFldTypes()->dumpAsXml(pWriter);
+ mpTxtFmtCollTbl->dumpAsXml(pWriter);
+ mpCharFmtTbl->dumpAsXml(pWriter);
+ mpFrmFmtTbl->dumpAsXml(pWriter, "frmFmtTbl");
+ mpSpzFrmFmtTbl->dumpAsXml(pWriter, "spzFrmFmtTbl");
+ mpSectionFmtTbl->dumpAsXml(pWriter);
+ mpNumRuleTbl->dumpAsXml(pWriter);
+ getIDocumentRedlineAccess().GetRedlineTbl().dumpAsXml(pWriter);
+ getIDocumentRedlineAccess().GetExtraRedlineTbl().dumpAsXml(pWriter);
+ if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
+ pModel->dumpAsXml(pWriter);
+
+ xmlTextWriterStartElement(pWriter, BAD_CAST("mbModified"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(getIDocumentState().IsModified()).getStr()));
+ xmlTextWriterEndElement(pWriter);
+
+ xmlTextWriterEndElement(pWriter);
+ if (bOwns)
+ {
+ xmlTextWriterEndDocument(pWriter);
+ xmlFreeTextWriter(pWriter);
+ }
+}
+
std::set<Color> SwDoc::GetDocColors()
{
std::set<Color> aDocColors;
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index ad37ca1058ba..57b483515f03 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -98,33 +98,6 @@ static const char* TMP_FORMAT = "%" SAL_PRIuUINTPTR;
}
-void SwDoc::dumpAsXml( xmlTextWriterPtr w ) const
-{
- WriterHelper writer( w );
- writer.startElement( "doc" );
- writer.writeFormatAttribute( "ptr", "%p", this );
- m_pNodes->dumpAsXml( writer );
- mpMarkManager->dumpAsXml( writer );
- m_pUndoManager->dumpAsXml(writer);
- getIDocumentFieldsAccess().GetFldTypes()->dumpAsXml( writer );
- mpTxtFmtCollTbl->dumpAsXml( writer );
- mpCharFmtTbl->dumpAsXml( writer );
- mpFrmFmtTbl->dumpAsXml( writer, "frmFmtTbl" );
- mpSpzFrmFmtTbl->dumpAsXml( writer, "spzFrmFmtTbl" );
- mpSectionFmtTbl->dumpAsXml( writer );
- mpNumRuleTbl->dumpAsXml( writer );
- getIDocumentRedlineAccess().GetRedlineTbl().dumpAsXml( writer );
- getIDocumentRedlineAccess().GetExtraRedlineTbl().dumpAsXml( writer );
- if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
- pModel->dumpAsXml(writer);
-
- writer.startElement("mbModified");
- writer.writeFormatAttribute("value", TMP_FORMAT, static_cast<int>(getIDocumentState().IsModified()));
- writer.endElement();
-
- writer.endElement();
-}
-
void SwFldTypes::dumpAsXml( xmlTextWriterPtr w ) const
{
WriterHelper writer(w);