summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-02-17 08:33:04 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-02-17 09:21:34 +0100
commit4e9a52c7f5ed12e4bb2a716d992edff7aa6c2a7d (patch)
treee3b29370e54626e6aca7c765d89a3be2848910f9 /svtools
parent8942956e05f2208ffb666a2118f5db092c30ce6a (diff)
svtools: extract EmbeddedObjectRef::dumpAsXml() from SwOLEObj
Because sw/ doesn't have access to the internals, but dumping should show the state as-is, without calling getters that change the state. Especially GetGraphic() is not a trivial wrapper around mpImpl->pGraphic. Change-Id: I2cf43130d4eeab63611e37b4a978bb7aa546c7f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130056 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/misc/embedhlp.cxx40
2 files changed, 41 insertions, 0 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 31685bbd300c..643481368caa 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -64,6 +64,7 @@ $(eval $(call gb_Library_use_externals,svt,\
icui18n \
icuuc \
icu_headers \
+ libxml2 \
))
$(eval $(call gb_Library_add_exception_objects,svt,\
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 1ef6cd579b0e..4f4a5ce3e364 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <libxml/xmlwriter.h>
#include <svtools/embedhlp.hxx>
#include <vcl/graphicfilter.hxx>
@@ -54,6 +55,7 @@
#include <vcl/svapp.hxx>
#include <tools/diagnose_ex.h>
#include <tools/debug.hxx>
+#include <sfx2/xmldump.hxx>
#include <memory>
using namespace com::sun::star;
@@ -275,6 +277,34 @@ struct EmbeddedObjectRef_Impl
if (r.pGraphic && !r.bNeedUpdate)
pGraphic.reset( new Graphic(*r.pGraphic) );
}
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const
+ {
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("EmbeddedObjectRef_Impl"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mxObj"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"),
+ BAD_CAST(typeid(*mxObj).name()));
+ auto pComponent = dynamic_cast<sfx2::XmlDump*>(mxObj->getComponent().get());
+ if (pComponent)
+ {
+ pComponent->dumpAsXml(pWriter);
+ }
+ (void)xmlTextWriterEndElement(pWriter);
+
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pGraphic"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pGraphic.get());
+ if (pGraphic)
+ {
+ (void)xmlTextWriterWriteAttribute(
+ pWriter, BAD_CAST("is-none"),
+ BAD_CAST(OString::boolean(pGraphic->IsNone()).getStr()));
+ }
+ (void)xmlTextWriterEndElement(pWriter);
+
+ (void)xmlTextWriterEndElement(pWriter);
+ }
};
const uno::Reference <embed::XEmbeddedObject>& EmbeddedObjectRef::operator->() const
@@ -993,6 +1023,16 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
xSizeTransmitter->setDefaultSize( mpImpl->aDefaultSizeForChart_In_100TH_MM );
}
+void EmbeddedObjectRef::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("EmbeddedObjectRef"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+ mpImpl->dumpAsXml(pWriter);
+
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
} // namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */