add more dumpAsXml()
and make it format the output nicely, so I don't have to use 'xmllint --format' before I can read it. Change-Id: I065ee93193f3c6c7bab87212ab96021fb0d7c5ed Reviewed-on: https://gerrit.libreoffice.org/29407 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
bc4715ddac
commit
ba3521f288
@ -1944,6 +1944,7 @@ bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const
|
|||||||
void ContentAttribs::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
void ContentAttribs::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
{
|
{
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("contentAttribs"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("contentAttribs"));
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("style"), "%s", pStyle->GetName().toUtf8().getStr());
|
||||||
aAttribSet.dumpAsXml(pWriter);
|
aAttribSet.dumpAsXml(pWriter);
|
||||||
xmlTextWriterEndElement(pWriter);
|
xmlTextWriterEndElement(pWriter);
|
||||||
}
|
}
|
||||||
@ -2742,6 +2743,8 @@ void EditDoc::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
|||||||
if (!pWriter)
|
if (!pWriter)
|
||||||
{
|
{
|
||||||
pWriter = xmlNewTextWriterFilename("editdoc.xml", 0);
|
pWriter = xmlNewTextWriterFilename("editdoc.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
bOwns = true;
|
bOwns = true;
|
||||||
}
|
}
|
||||||
|
@ -462,6 +462,8 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
if (!pWriter)
|
if (!pWriter)
|
||||||
{
|
{
|
||||||
pWriter = xmlNewTextWriterFilename("editTextObject.xml", 0);
|
pWriter = xmlNewTextWriterFilename("editTextObject.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
bOwns = true;
|
bOwns = true;
|
||||||
}
|
}
|
||||||
@ -470,9 +472,7 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
sal_Int32 nCount = GetParagraphCount();
|
sal_Int32 nCount = GetParagraphCount();
|
||||||
for (sal_Int32 i = 0; i < nCount; ++i)
|
for (sal_Int32 i = 0; i < nCount; ++i)
|
||||||
{
|
{
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("paragraph"));
|
|
||||||
mpImpl->aContents[i]->dumpAsXml(pWriter);
|
mpImpl->aContents[i]->dumpAsXml(pWriter);
|
||||||
xmlTextWriterEndElement(pWriter);
|
|
||||||
}
|
}
|
||||||
xmlTextWriterEndElement(pWriter);
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include <editeng/svxfont.hxx>
|
#include <editeng/svxfont.hxx>
|
||||||
#include <editeng/brushitem.hxx>
|
#include <editeng/brushitem.hxx>
|
||||||
#include <svl/itempool.hxx>
|
#include <svl/itempool.hxx>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
|
|
||||||
// calculate if it's RTL or not
|
// calculate if it's RTL or not
|
||||||
#include <unicode/ubidi.h>
|
#include <unicode/ubidi.h>
|
||||||
@ -2193,4 +2194,27 @@ void Outliner::ClearOverflowingParaNum()
|
|||||||
pEditEngine->ClearOverflowingParaNum();
|
pEditEngine->ClearOverflowingParaNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Outliner::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
bool bOwns = false;
|
||||||
|
if (!pWriter)
|
||||||
|
{
|
||||||
|
pWriter = xmlNewTextWriterFilename("outliner.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
|
bOwns = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("outliner"));
|
||||||
|
pParaList->dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
|
||||||
|
if (bOwns)
|
||||||
|
{
|
||||||
|
xmlTextWriterEndDocument(pWriter);
|
||||||
|
xmlFreeTextWriter(pWriter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -227,7 +227,9 @@ void OutlinerParaObject::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
{
|
{
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("outlinerParaObject"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("outlinerParaObject"));
|
||||||
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
|
||||||
GetTextObject().dumpAsXml(pWriter);
|
mpImpl->mpEditTextObject->dumpAsXml(pWriter);
|
||||||
|
for (Paragraph const & p : mpImpl->maParagraphDataVector)
|
||||||
|
p.dumpAsXml(pWriter);
|
||||||
xmlTextWriterEndElement(pWriter);
|
xmlTextWriterEndElement(pWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
@ -96,6 +97,15 @@ void Paragraph::SetParaIsNumberingRestart( bool bParaIsNumberingRestart )
|
|||||||
mnNumberingStartValue = -1;
|
mnNumberingStartValue = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Paragraph::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("paragraph"));
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nDepth"), "%" SAL_PRIdINT32, (sal_Int32)nDepth);
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mnNumberingStartValue"), "%" SAL_PRIdINT32, (sal_Int32)mnNumberingStartValue);
|
||||||
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mbParaIsNumberingRestart"), "%" SAL_PRIdINT32, (sal_Int32)mbParaIsNumberingRestart);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
void ParagraphList::Clear()
|
void ParagraphList::Clear()
|
||||||
{
|
{
|
||||||
std::vector<Paragraph*>::iterator iter;
|
std::vector<Paragraph*>::iterator iter;
|
||||||
@ -254,4 +264,12 @@ sal_Int32 ParagraphList::GetAbsPos( Paragraph* pParent ) const
|
|||||||
return EE_PARA_NOT_FOUND;
|
return EE_PARA_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParagraphList::dumpAsXml(struct _xmlTextWriter* pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("paragraphList"));
|
||||||
|
for (const Paragraph* pParagraph : maEntries)
|
||||||
|
pParagraph->dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
|
|
||||||
void SetVisibleStateChangedHdl( const Link<Paragraph&,void>& rLink ) { aVisibleStateChangedHdl = rLink; }
|
void SetVisibleStateChangedHdl( const Link<Paragraph&,void>& rLink ) { aVisibleStateChangedHdl = rLink; }
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Link<Paragraph&,void> aVisibleStateChangedHdl;
|
Link<Paragraph&,void> aVisibleStateChangedHdl;
|
||||||
|
@ -166,6 +166,8 @@ private:
|
|||||||
void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
|
void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
|
||||||
void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
|
void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
|
||||||
bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); }
|
bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); }
|
||||||
|
public:
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ParaRange
|
struct ParaRange
|
||||||
@ -679,6 +681,8 @@ public:
|
|||||||
Outliner( SfxItemPool* pPool, OutlinerMode nOutlinerMode );
|
Outliner( SfxItemPool* pPool, OutlinerMode nOutlinerMode );
|
||||||
virtual ~Outliner() override;
|
virtual ~Outliner() override;
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
void Init( OutlinerMode nOutlinerMode );
|
void Init( OutlinerMode nOutlinerMode );
|
||||||
OutlinerMode GetMode() const { return nOutlinerMode; }
|
OutlinerMode GetMode() const { return nOutlinerMode; }
|
||||||
|
|
||||||
|
@ -206,6 +206,8 @@ public:
|
|||||||
|
|
||||||
static const SfxItemPool* GetStoringPool();
|
static const SfxItemPool* GetStoringPool();
|
||||||
|
|
||||||
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const SfxItemPool& operator=(const SfxItemPool &) = delete;
|
const SfxItemPool& operator=(const SfxItemPool &) = delete;
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ void ScGridWindow::dumpCellProperties()
|
|||||||
|
|
||||||
OString aOutputFile("dump.xml");
|
OString aOutputFile("dump.xml");
|
||||||
xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 );
|
xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 );
|
||||||
|
xmlTextWriterSetIndent(writer,1);
|
||||||
|
xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
|
||||||
|
|
||||||
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
|
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
|
||||||
|
|
||||||
|
@ -1096,12 +1096,16 @@ void SdDrawDocument::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
if (!pWriter)
|
if (!pWriter)
|
||||||
{
|
{
|
||||||
pWriter = xmlNewTextWriterFilename("model.xml", 0);
|
pWriter = xmlNewTextWriterFilename("model.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
bOwns = true;
|
bOwns = true;
|
||||||
}
|
}
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("sdDrawDocument"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("sdDrawDocument"));
|
||||||
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
|
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
|
||||||
|
|
||||||
|
if (mpOutliner)
|
||||||
|
mpOutliner->dumpAsXml(pWriter);
|
||||||
FmFormModel::dumpAsXml(pWriter);
|
FmFormModel::dumpAsXml(pWriter);
|
||||||
if (GetUndoManager())
|
if (GetUndoManager())
|
||||||
GetUndoManager()->dumpAsXml(pWriter);
|
GetUndoManager()->dumpAsXml(pWriter);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <svl/itempool.hxx>
|
#include <svl/itempool.hxx>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
|
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
@ -993,4 +994,15 @@ void SfxItemPool::SetFileFormatVersion( sal_uInt16 nFileFormatVersion )
|
|||||||
|
|
||||||
const SfxItemPool* SfxItemPool::pStoringPool_ = nullptr;
|
const SfxItemPool* SfxItemPool::pStoringPool_ = nullptr;
|
||||||
|
|
||||||
|
void SfxItemPool::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(pWriter, BAD_CAST("sfxItemPool"));
|
||||||
|
for (auto const & rArrayPtr : pImpl->maPoolItems)
|
||||||
|
if (rArrayPtr)
|
||||||
|
for (auto const & rItem : *rArrayPtr)
|
||||||
|
if (rItem)
|
||||||
|
rItem->dumpAsXml(pWriter);
|
||||||
|
xmlTextWriterEndElement(pWriter);
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -1269,6 +1269,8 @@ void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
if (!pWriter)
|
if (!pWriter)
|
||||||
{
|
{
|
||||||
pWriter = xmlNewTextWriterFilename("undo.xml", 0);
|
pWriter = xmlNewTextWriterFilename("undo.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
bOwns = true;
|
bOwns = true;
|
||||||
}
|
}
|
||||||
|
@ -261,6 +261,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
|
|||||||
void NameOrIndex::dumpAsXml(xmlTextWriterPtr pWriter) const
|
void NameOrIndex::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||||
{
|
{
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("nameOrIndex"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("nameOrIndex"));
|
||||||
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
|
||||||
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("isIndex"), BAD_CAST(OString::boolean(IsIndex()).getStr()));
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("isIndex"), BAD_CAST(OString::boolean(IsIndex()).getStr()));
|
||||||
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
|
||||||
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
|
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
|
||||||
|
@ -1920,6 +1920,8 @@ void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const
|
|||||||
if (!pWriter)
|
if (!pWriter)
|
||||||
{
|
{
|
||||||
pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
|
pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
|
||||||
bOwns = true;
|
bOwns = true;
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,8 @@ namespace
|
|||||||
xmlTextWriterPtr lcl_createDefaultWriter()
|
xmlTextWriterPtr lcl_createDefaultWriter()
|
||||||
{
|
{
|
||||||
xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
|
xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
|
||||||
|
xmlTextWriterSetIndent(writer,1);
|
||||||
|
xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
|
||||||
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
|
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,8 @@ namespace writerfilter
|
|||||||
fileName += ".xml";
|
fileName += ".xml";
|
||||||
|
|
||||||
pWriter = xmlNewTextWriterFilename( fileName.c_str(), 0 );
|
pWriter = xmlNewTextWriterFilename( fileName.c_str(), 0 );
|
||||||
|
xmlTextWriterSetIndent(pWriter,1);
|
||||||
|
xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
|
||||||
xmlTextWriterSetIndent( pWriter, 4 );
|
xmlTextWriterSetIndent( pWriter, 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user