summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-09-30 16:49:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-03 06:08:14 +0000
commitba3521f28831f41c92aa863ba6ba6da7c91c56f7 (patch)
tree23cd127507e7b6f0268de65716c8ed559874cd25
parenttdf#100726 Improve readability of OUString concatination (diff)
downloadcore-ba3521f28831f41c92aa863ba6ba6da7c91c56f7.tar.gz
core-ba3521f28831f41c92aa863ba6ba6da7c91c56f7.zip
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>
-rw-r--r--editeng/source/editeng/editdoc.cxx5
-rw-r--r--editeng/source/editeng/editobj.cxx4
-rw-r--r--editeng/source/outliner/outliner.cxx40
-rw-r--r--editeng/source/outliner/outlobj.cxx4
-rw-r--r--editeng/source/outliner/paralist.cxx18
-rw-r--r--editeng/source/outliner/paralist.hxx2
-rw-r--r--include/editeng/outliner.hxx6
-rw-r--r--include/svl/itempool.hxx2
-rw-r--r--sc/source/ui/view/gridwin_dbgutil.cxx2
-rw-r--r--sd/source/core/drawdoc.cxx4
-rw-r--r--svl/source/items/itempool.cxx12
-rw-r--r--svl/source/undo/undo.cxx2
-rw-r--r--svx/source/xoutdev/xattr.cxx1
-rw-r--r--sw/source/core/doc/docfmt.cxx2
-rw-r--r--sw/source/core/text/xmldump.cxx2
-rw-r--r--writerfilter/source/dmapper/TagLogger.cxx2
16 files changed, 95 insertions, 13 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index b67c97ca4c4f..cdc06a8c9e41 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1651,7 +1651,7 @@ void ContentNode::SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyl
GetCharAttribs().GetDefFont() = rFontFromStyle;
// ... then iron out the hard paragraph formatting...
CreateFont( GetCharAttribs().GetDefFont(),
- GetContentAttribs().GetItems(), pS == nullptr );
+ GetContentAttribs().GetItems(), pS == nullptr );
}
void ContentNode::SetStyleSheet( SfxStyleSheet* pS, bool bRecalcFont )
@@ -1944,6 +1944,7 @@ bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const
void ContentAttribs::dumpAsXml(struct _xmlTextWriter* pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("contentAttribs"));
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("style"), "%s", pStyle->GetName().toUtf8().getStr());
aAttribSet.dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
@@ -2742,6 +2743,8 @@ void EditDoc::dumpAsXml(struct _xmlTextWriter* pWriter) const
if (!pWriter)
{
pWriter = xmlNewTextWriterFilename("editdoc.xml", 0);
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
bOwns = true;
}
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 8e53e3d646fc..5fcc8c790a24 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -462,6 +462,8 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
if (!pWriter)
{
pWriter = xmlNewTextWriterFilename("editTextObject.xml", 0);
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
bOwns = true;
}
@@ -470,9 +472,7 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
sal_Int32 nCount = GetParagraphCount();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- xmlTextWriterStartElement(pWriter, BAD_CAST("paragraph"));
mpImpl->aContents[i]->dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
}
xmlTextWriterEndElement(pWriter);
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 4876df86961d..1a2861054105 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -51,6 +51,7 @@
#include <editeng/svxfont.hxx>
#include <editeng/brushitem.hxx>
#include <svl/itempool.hxx>
+#include <libxml/xmlwriter.h>
// calculate if it's RTL or not
#include <unicode/ubidi.h>
@@ -675,19 +676,19 @@ OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara,
void Outliner::SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle )
{
Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- {
- pEditEngine->SetStyleSheet( nPara, pStyle );
- pPara->nFlags |= ParaFlag::SETBULLETTEXT;
- ImplCheckNumBulletItem( nPara );
- }
+ if (pPara)
+ {
+ pEditEngine->SetStyleSheet( nPara, pStyle );
+ pPara->nFlags |= ParaFlag::SETBULLETTEXT;
+ ImplCheckNumBulletItem( nPara );
+ }
}
void Outliner::ImplCheckNumBulletItem( sal_Int32 nPara )
{
Paragraph* pPara = pParaList->GetParagraph( nPara );
- if (pPara)
- pPara->aBulSize.Width() = -1;
+ if (pPara)
+ pPara->aBulSize.Width() = -1;
}
void Outliner::ImplSetLevelDependendStyleSheet( sal_Int32 nPara )
@@ -2193,4 +2194,27 @@ void Outliner::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: */
diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx
index 9e67af1dee54..209d6d0842ef 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -227,7 +227,9 @@ void OutlinerParaObject::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("outlinerParaObject"));
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);
}
diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx
index c50e576d6096..544da1e5c71d 100644
--- a/editeng/source/outliner/paralist.cxx
+++ b/editeng/source/outliner/paralist.cxx
@@ -25,6 +25,7 @@
#include <osl/diagnose.h>
#include <tools/debug.hxx>
+#include <libxml/xmlwriter.h>
#include <iterator>
@@ -96,6 +97,15 @@ void Paragraph::SetParaIsNumberingRestart( bool bParaIsNumberingRestart )
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()
{
std::vector<Paragraph*>::iterator iter;
@@ -254,4 +264,12 @@ sal_Int32 ParagraphList::GetAbsPos( Paragraph* pParent ) const
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: */
diff --git a/editeng/source/outliner/paralist.hxx b/editeng/source/outliner/paralist.hxx
index a4e6ebb7be6b..abadc15b365e 100644
--- a/editeng/source/outliner/paralist.hxx
+++ b/editeng/source/outliner/paralist.hxx
@@ -68,6 +68,8 @@ public:
void SetVisibleStateChangedHdl( const Link<Paragraph&,void>& rLink ) { aVisibleStateChangedHdl = rLink; }
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+
private:
Link<Paragraph&,void> aVisibleStateChangedHdl;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index a9e8e3bad686..0d53ab150ebf 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -148,7 +148,7 @@ private:
void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
void Invalidate() { aBulSize.Width() = -1; }
void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
- const OUString& GetText() const { return aBulText; }
+ const OUString& GetText() const { return aBulText; }
Paragraph( sal_Int16 nDepth );
Paragraph( const Paragraph& ) = delete;
@@ -166,6 +166,8 @@ private:
void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); }
+public:
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
struct ParaRange
@@ -679,6 +681,8 @@ public:
Outliner( SfxItemPool* pPool, OutlinerMode nOutlinerMode );
virtual ~Outliner() override;
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+
void Init( OutlinerMode nOutlinerMode );
OutlinerMode GetMode() const { return nOutlinerMode; }
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index c2e1e2a2f2dd..6c9327fc0303 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -206,6 +206,8 @@ public:
static const SfxItemPool* GetStoringPool();
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+
private:
const SfxItemPool& operator=(const SfxItemPool &) = delete;
diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx
index abbf0f97f849..10b67ca1aa1f 100644
--- a/sc/source/ui/view/gridwin_dbgutil.cxx
+++ b/sc/source/ui/view/gridwin_dbgutil.cxx
@@ -74,6 +74,8 @@ void ScGridWindow::dumpCellProperties()
OString aOutputFile("dump.xml");
xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 );
+ xmlTextWriterSetIndent(writer,1);
+ xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index d3a4fea7c100..3df30906acf2 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -1096,12 +1096,16 @@ void SdDrawDocument::dumpAsXml(xmlTextWriterPtr pWriter) const
if (!pWriter)
{
pWriter = xmlNewTextWriterFilename("model.xml", 0);
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
bOwns = true;
}
xmlTextWriterStartElement(pWriter, BAD_CAST("sdDrawDocument"));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ if (mpOutliner)
+ mpOutliner->dumpAsXml(pWriter);
FmFormModel::dumpAsXml(pWriter);
if (GetUndoManager())
GetUndoManager()->dumpAsXml(pWriter);
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index a2fd333b0470..3fc63112f6be 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -20,6 +20,7 @@
#include <svl/itempool.hxx>
#include <string.h>
+#include <libxml/xmlwriter.h>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -993,4 +994,15 @@ void SfxItemPool::SetFileFormatVersion( sal_uInt16 nFileFormatVersion )
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: */
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index ec847a95b705..b0932c9d8e6d 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1269,6 +1269,8 @@ void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const
if (!pWriter)
{
pWriter = xmlNewTextWriterFilename("undo.xml", 0);
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
bOwns = true;
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 1eea3d8ddca3..656e70e88a21 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -261,6 +261,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
void NameOrIndex::dumpAsXml(xmlTextWriterPtr pWriter) const
{
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("name"), BAD_CAST(GetName().toUtf8().getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 3393d13ff379..e20d29fe20e9 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1920,6 +1920,8 @@ void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const
if (!pWriter)
{
pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
bOwns = true;
}
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 8a69c3af2b6c..32b11961f6eb 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -216,6 +216,8 @@ namespace
xmlTextWriterPtr lcl_createDefaultWriter()
{
xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
+ xmlTextWriterSetIndent(writer,1);
+ xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
return writer;
}
diff --git a/writerfilter/source/dmapper/TagLogger.cxx b/writerfilter/source/dmapper/TagLogger.cxx
index 90d0f46e9c9c..24cc791d34b0 100644
--- a/writerfilter/source/dmapper/TagLogger.cxx
+++ b/writerfilter/source/dmapper/TagLogger.cxx
@@ -67,6 +67,8 @@ namespace writerfilter
fileName += ".xml";
pWriter = xmlNewTextWriterFilename( fileName.c_str(), 0 );
+ xmlTextWriterSetIndent(pWriter,1);
+ xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
xmlTextWriterSetIndent( pWriter, 4 );
}