diff options
-rw-r--r-- | include/svtools/embedhlp.hxx | 3 | ||||
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/misc/embedhlp.cxx | 40 | ||||
-rw-r--r-- | sw/source/core/ole/ndole.cxx | 13 |
4 files changed, 45 insertions, 12 deletions
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx index 05b0b5644122..9ba2a0166c2b 100644 --- a/include/svtools/embedhlp.hxx +++ b/include/svtools/embedhlp.hxx @@ -37,6 +37,7 @@ namespace com::sun::star::embed { } class OutputDevice; +typedef struct _xmlTextWriter* xmlTextWriterPtr; namespace svt { @@ -122,6 +123,8 @@ public: // fetching the Graphic what would be too expensive e.g. for charts sal_uInt32 getGraphicVersion() const; void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessarily have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method + + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; } 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: */ diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 531a76a30c48..0b77de3e3742 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -1162,18 +1162,7 @@ void SwOLEObj::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLEObj")); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_xOLERef")); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"), - BAD_CAST(typeid(*m_xOLERef.GetObject()).name())); - - uno::Reference<embed::XEmbeddedObject> xIP = m_xOLERef.GetObject(); - auto pComponent = dynamic_cast<sfx2::XmlDump*>(xIP->getComponent().get()); - if (pComponent) - { - pComponent->dumpAsXml(pWriter); - } - - (void)xmlTextWriterEndElement(pWriter); + m_xOLERef.dumpAsXml(pWriter); (void)xmlTextWriterEndElement(pWriter); } |