editeng/source/items/numitem.cxx | 17 ++++++++++++++++- include/svl/style.hxx | 8 ++++++++ svl/source/items/style.cxx | 30 ++++++++++++++++++++++++++++++ svx/source/svdraw/svdmodel.cxx | 5 +++++ 4 files changed, 59 insertions(+), 1 deletion(-)
New commits: commit e96f2ef1a299c95d83c6a7945fcc92f8f1833112 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Oct 9 08:32:26 2025 +0200 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Oct 10 09:22:22 2025 +0200 sd doc model xml dump: show styles editeng paragraphs can refer to styles, but what are those styles, stored in SdrModel was not visible previously. Change-Id: Ic32795341595a4d8b61c8c686cd0b140034c1a7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192088 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index bf9dbf47466e..08c7f1429c01 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -580,6 +580,21 @@ void SvxNumberFormat::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OUString(&cBullet, 1).toUtf8().getStr())); (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("position-and-space-mode")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::number(mePositionAndSpaceMode).getStr())); + (void)xmlTextWriterEndElement(pWriter); + + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("first-line-offset")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::number(nFirstLineOffset).getStr())); + (void)xmlTextWriterEndElement(pWriter); + + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("abs-l-space")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::number(nAbsLSpace).getStr())); + (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterEndElement(pWriter); } @@ -874,7 +889,7 @@ void SvxNumRule::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("aFmts")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("i"), BAD_CAST(OString::number(i).getStr())); - (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", aFmts[i].get()); + aFmts[i]->dumpAsXml(pWriter); (void)xmlTextWriterEndElement(pWriter); } } diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 216aef4a1ad7..4c9d34272bdb 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -83,6 +83,8 @@ class SfxStyleSheetBasePool; class SvStream; namespace svl { class IndexedStyleSheets; } +typedef struct _xmlTextWriter* xmlTextWriterPtr; + /* Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts. @@ -185,6 +187,8 @@ public: /// Fix for expensive dynamic_cast virtual bool isScStyleSheet() const { return false; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; /* Class to iterate and search on a SfxStyleSheetBasePool */ @@ -226,6 +230,8 @@ friend class SfxStyleSheetBasePool; class SfxStyleSheetBasePool_Impl; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public cppu::WeakImplHelper<> { friend class SfxStyleSheetIterator; @@ -285,6 +291,8 @@ public: * Not an actual public function. Do not call it from non-subclasses. */ void Add( const SfxStyleSheetBase& ); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index a5144962632e..26fefac02922 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -18,6 +18,9 @@ */ #include <memory> + +#include <libxml/xmlwriter.h> + #include <svl/style.hxx> #include <com/sun/star/lang/XComponent.hpp> @@ -269,6 +272,18 @@ std::optional<SfxItemSet> SfxStyleSheetBase::GetItemSetForPreview() return GetItemSet(); } +void SfxStyleSheetBase::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxStyleSheetBase")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(aName.toUtf8().getStr())); + if (pSet) + { + pSet->dumpAsXml(pWriter); + } + (void)xmlTextWriterEndElement(pWriter); +} + /** * Set help file and ID and return it */ @@ -679,6 +694,21 @@ void SfxStyleSheetBasePool::Add( const SfxStyleSheetBase& rSheet ) Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetChanged, *xNew)); } +void SfxStyleSheetBasePool::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxStyleSheetBasePool")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + + std::shared_ptr<SfxStyleSheetIterator> aSSSI + = std::make_shared<SfxStyleSheetIterator>(this, SfxStyleFamily::All); + for (SfxStyleSheetBase* pStyle = aSSSI->First(); pStyle; pStyle = aSSSI->Next()) + { + pStyle->dumpAsXml(pWriter); + } + + (void)xmlTextWriterEndElement(pWriter); +} + SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r ) { if( &r != this ) diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index e3da9decea16..9ad14bc203f5 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -1964,6 +1964,11 @@ void SdrModel::dumpAsXml(xmlTextWriterPtr pWriter) const } (void)xmlTextWriterEndElement(pWriter); + if (mxStyleSheetPool) + { + mxStyleSheetPool->dumpAsXml(pWriter); + } + if (mpImpl->mpTheme) { mpImpl->mpTheme->dumpAsXml(pWriter);
