[Libreoffice-commits] core.git: sw/inc sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Feb 28 03:54:17 PST 2015
sw/inc/doc.hxx | 2 -
sw/source/core/doc/docfmt.cxx | 42 ++++++++++++++++++++++++++++++++++++
sw/source/core/docnode/nodedump.cxx | 27 -----------------------
3 files changed, 43 insertions(+), 28 deletions(-)
New commits:
commit 9a93b3c671835267433b7dc9eb71aa9f1c79dd67
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Feb 28 10:41:27 2015 +0100
Extract SwDoc::dumpAsXml() from docnode
Change-Id: I49a35270d6ff2ea5c840a1f4f73d1f6a0701b2d5
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e030ff9..7178c0d 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 59d08aa..0d31901 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 ad37ca1..57b4835 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);
More information about the Libreoffice-commits
mailing list