summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-11-30 17:44:35 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-11 08:05:47 +0100
commit3728f19f1abc949dc0ff6cc627c6dbff9c667cfa (patch)
tree9bc25645052f8706bff165130e3fa7ab628d2d4e
parent1c24e27eea98dbb2ea6cfb2a65361715957d61d5 (diff)
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 <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit a7505356872f981c951b2ec64383a95538890876) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107563
-rw-r--r--include/svx/sdmetitm.hxx2
-rw-r--r--include/svx/sdooitm.hxx2
-rw-r--r--include/svx/sdprcitm.hxx2
-rw-r--r--include/svx/xcolit.hxx1
-rw-r--r--svx/source/svdraw/svdattr.cxx54
-rw-r--r--svx/source/xoutdev/xattr.cxx16
-rw-r--r--sw/qa/extras/layout/layout.cxx12
7 files changed, 85 insertions, 4 deletions
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 2e007ea7d513..28bbfe39afce 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -730,6 +730,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
{
@@ -773,6 +785,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());
@@ -872,6 +898,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 f8b532ab554e..4929430bb17a 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 4b6e9c22bd62..15e33d74d18e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -824,21 +824,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