[Libreoffice-commits] core.git: editeng/source include/editeng include/svl sc/source sd/source svl/source svx/source sw/source writerfilter/source
Noel Grandin
noel at peralex.com
Mon Oct 3 06:10:36 UTC 2016
editeng/source/editeng/editdoc.cxx | 5 +++
editeng/source/editeng/editobj.cxx | 4 +--
editeng/source/outliner/outliner.cxx | 40 ++++++++++++++++++++++++------
editeng/source/outliner/outlobj.cxx | 4 ++-
editeng/source/outliner/paralist.cxx | 18 +++++++++++++
editeng/source/outliner/paralist.hxx | 2 +
include/editeng/outliner.hxx | 6 +++-
include/svl/itempool.hxx | 2 +
sc/source/ui/view/gridwin_dbgutil.cxx | 2 +
sd/source/core/drawdoc.cxx | 4 +++
svl/source/items/itempool.cxx | 12 +++++++++
svl/source/undo/undo.cxx | 2 +
svx/source/xoutdev/xattr.cxx | 1
sw/source/core/doc/docfmt.cxx | 2 +
sw/source/core/text/xmldump.cxx | 2 +
writerfilter/source/dmapper/TagLogger.cxx | 2 +
16 files changed, 95 insertions(+), 13 deletions(-)
New commits:
commit ba3521f28831f41c92aa863ba6ba6da7c91c56f7
Author: Noel Grandin <noel at peralex.com>
Date: Fri Sep 30 16:49:56 2016 +0200
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 at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index b67c97c..cdc06a8 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 8e53e3d..5fcc8c7 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 4876df8..1a28610 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 9e67af1..209d6d0 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 c50e576..544da1e 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 a4e6ebb..abadc15 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 a9e8e3b..0d53ab1 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 c2e1e2a..6c9327f 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 abbf0f9..10b67ca 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 d3a4fea..3df3090 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 a2fd333..3fc6311 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 ec847a9..b0932c9 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 1eea3d8..656e70e 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 3393d13..e20d29f 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 8a69c3a..32b1196 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 90d0f46..24cc791 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 );
}
More information about the Libreoffice-commits
mailing list