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 b73dd7cc1a52e66751df949769f5abe8b1dc425f Author: Miklos Vajna <[email protected]> AuthorDate: Thu Oct 9 08:32:26 2025 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Oct 10 15:04:36 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/+/192163 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[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 305eb3a8c480..a36861197252 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -82,6 +82,8 @@ class SfxItemPool; class SfxStyleSheetBasePool; namespace svl { class IndexedStyleSheets; } +typedef struct _xmlTextWriter* xmlTextWriterPtr; + /* Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts. @@ -189,6 +191,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 */ @@ -235,6 +239,8 @@ class SAL_DLLPUBLIC_TEMPLATE SfxStyleSheetBasePool_Base : public cppu::WeakImplH { }; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + class SVL_DLLPUBLIC SfxStyleSheetBasePool : public SfxBroadcaster, public SfxStyleSheetBasePool_Base { friend class SfxStyleSheetIterator; @@ -294,6 +300,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 9a568272372a..97a183bb05a8 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> @@ -268,6 +271,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 */ @@ -677,6 +692,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 f0f16e55218e..4e4f4013d759 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);
