Kaydet (Commit) 9a93b3c6 authored tarafından Miklos Vajna's avatar Miklos Vajna

Extract SwDoc::dumpAsXml() from docnode

Change-Id: I49a35270d6ff2ea5c840a1f4f73d1f6a0701b2d5
üst 8a231fb2
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
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