include/svx/sdmetitm.hxx | 2 + include/svx/sdooitm.hxx | 2 + include/svx/sdprcitm.hxx | 2 + include/svx/xcolit.hxx | 1 svx/source/svdraw/svdattr.cxx | 54 +++++++++++++++++++++++++++++++++++++++++ svx/source/xoutdev/xattr.cxx | 16 ++++++++++++ sw/qa/extras/layout/layout.cxx | 12 ++++++--- 7 files changed, 85 insertions(+), 4 deletions(-)
New commits: commit a7505356872f981c951b2ec64383a95538890876 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Nov 30 17:44:35 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Nov 30 19:54:25 2020 +0100 tdf#129961 svx: add doc model xml dump for shadow-related pool items It seems that sdr::table::SdrTableObj is already capable of storing shadow properties, but this is not easy to inspect, extend the xml dumper to improve the situation. Change-Id: Ideef43dfd6b844e0227632ec2cb6ab5d16171d8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106902 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/include/svx/sdmetitm.hxx b/include/svx/sdmetitm.hxx index 0e7e3a7897b4..8819c5e2a2b4 100644 --- a/include/svx/sdmetitm.hxx +++ b/include/svx/sdmetitm.hxx @@ -38,6 +38,8 @@ public: MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/svx/sdooitm.hxx b/include/svx/sdooitm.hxx index a0e7cfe570e5..2cc2fce42738 100644 --- a/include/svx/sdooitm.hxx +++ b/include/svx/sdooitm.hxx @@ -35,6 +35,8 @@ public: virtual OUString GetValueTextByVal(bool bVal) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/svx/sdprcitm.hxx b/include/svx/sdprcitm.hxx index af5cb65d852d..0316c4d0e452 100644 --- a/include/svx/sdprcitm.hxx +++ b/include/svx/sdprcitm.hxx @@ -35,6 +35,8 @@ public: virtual SdrPercentItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; + + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx index 12788d6fa901..9f35416b56ae 100644 --- a/include/svx/xcolit.hxx +++ b/include/svx/xcolit.hxx @@ -50,6 +50,7 @@ public: const Color& GetColorValue() const; void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); } + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; #endif diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index abd037967390..8810427d926b 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -727,6 +727,18 @@ bool SdrOnOffItem::GetPresentation(SfxItemPresentation ePres, return true; } +void SdrOnOffItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("SdrOnOffItem")); + if (Which() == SDRATTR_SHADOW) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOW")); + } + + SfxBoolItem::dumpAsXml(pWriter); + + xmlTextWriterEndElement(pWriter); +} SdrYesNoItem* SdrYesNoItem::Clone(SfxItemPool* /*pPool*/) const { @@ -770,6 +782,20 @@ bool SdrPercentItem::GetPresentation( return true; } +void SdrPercentItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("SdrPercentItem")); + if (Which() == SDRATTR_SHADOWTRANSPARENCE) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), + BAD_CAST("SDRATTR_SHADOWTRANSPARENCE")); + } + + SfxUInt16Item::dumpAsXml(pWriter); + + xmlTextWriterEndElement(pWriter); +} + SdrAngleItem* SdrAngleItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrAngleItem(Which(),GetValue()); @@ -869,6 +895,34 @@ bool SdrMetricItem::GetPresentation(SfxItemPresentation ePres, return true; } +void SdrMetricItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("SdrMetricItem")); + if (Which() == SDRATTR_SHADOWXDIST) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWXDIST")); + } + else if (Which() == SDRATTR_SHADOWYDIST) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWYDIST")); + } + else if (Which() == SDRATTR_SHADOWSIZEX) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWSIZEX")); + } + else if (Which() == SDRATTR_SHADOWSIZEY) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWSIZEY")); + } + else if (Which() == SDRATTR_SHADOWBLUR) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWBLUR")); + } + + SfxInt32Item::dumpAsXml(pWriter); + + xmlTextWriterEndElement(pWriter); +} // items of the legend object diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 43f0e6c1a2f2..5d3caa64fa1d 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -78,6 +78,7 @@ #include <svx/xftshcit.hxx> #include <svx/xftshxy.hxx> #include <svx/xftadit.hxx> +#include <svx/svddef.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <unotools/intlwrapper.hxx> #include <unotools/syslocale.hxx> @@ -329,6 +330,21 @@ bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) return true; } +void XColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("XColorItem")); + if (Which() == SDRATTR_SHADOWCOLOR) + { + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWCOLOR")); + } + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aColor"), + BAD_CAST(aColor.AsRGBHexString().toUtf8().getStr())); + + NameOrIndex::dumpAsXml(pWriter); + + xmlTextWriterEndElement(pWriter); +} + // --- line attributes --- diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 124b6749fe82..ba9aed2ff496 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -801,21 +801,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) CPPUNIT_ASSERT(pXmlDoc); // Check the layout xml + // SDRATTR_TEXT_LEFTDIST assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject" - "/DefaultProperties/SfxItemSet/SfxInt32Item[3]", + "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1071']", "value", "567"); + // SDRATTR_TEXT_RIGHTDIST assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject" - "/DefaultProperties/SfxItemSet/SfxInt32Item[4]", + "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1072']", "value", "1134"); + // SDRATTR_TEXT_UPPERDIST assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject" - "/DefaultProperties/SfxItemSet/SfxInt32Item[5]", + "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1073']", "value", "1701"); + // SDRATTR_TEXT_LOWERDIST assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject/SdrObject" - "/DefaultProperties/SfxItemSet/SfxInt32Item[6]", + "/DefaultProperties/SfxItemSet/SdrMetricItem/SfxInt32Item[@whichId='1074']", "value", "2268"); // Check the textbox-shape import too _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits