diff options
-rw-r--r-- | chart2/Library_chartcore.mk | 1 | ||||
-rw-r--r-- | chart2/inc/ChartModel.hxx | 6 | ||||
-rw-r--r-- | chart2/inc/ChartView.hxx | 5 | ||||
-rw-r--r-- | chart2/source/inc/chartview/DrawModelWrapper.hxx | 2 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 14 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 14 | ||||
-rw-r--r-- | chart2/source/view/main/DrawModelWrapper.cxx | 11 | ||||
-rw-r--r-- | include/sfx2/xmldump.hxx | 29 | ||||
-rw-r--r-- | sw/source/core/ole/ndole.cxx | 9 |
9 files changed, 90 insertions, 1 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index f42dfecd42fe..063e77d42305 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -27,6 +27,7 @@ $(eval $(call gb_Library_set_precompiled_header,chartcore,chart2/inc/pch/precomp $(eval $(call gb_Library_use_externals,chartcore,\ boost_headers \ + libxml2 \ )) ifeq ($(DISABLE_GUI),) diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 8c9c4ad69344..8f1defa197be 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -52,6 +52,7 @@ #include <cppuhelper/implbase.hxx> #include <comphelper/interfacecontainer2.hxx> #include <vcl/GraphicObject.hxx> +#include <sfx2/xmldump.hxx> #include <memory> @@ -105,7 +106,7 @@ typedef cppu::WeakImplHelper< class UndoManager; class ChartView; -class OOO_DLLPUBLIC_CHARTTOOLS ChartModel final : public impl::ChartModel_Base +class OOO_DLLPUBLIC_CHARTTOOLS ChartModel final : public impl::ChartModel_Base, public sfx2::XmlDump { private: @@ -465,6 +466,9 @@ public: void removeDataProviders(); + /// See sfx2::XmlDump::dumpAsXml(). + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + private: sal_Int32 mnStart; sal_Int32 mnEnd; diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index de9459ed6573..437d49527974 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -39,6 +39,7 @@ #include <memory> #include <vcl/timer.hxx> +#include <sfx2/xmldump.hxx> namespace com::sun::star::drawing { class XDrawPage; } namespace com::sun::star::drawing { class XShapes; } @@ -92,6 +93,7 @@ class ChartView final : public ::cppu::WeakImplHelper< > , public ExplicitValueProvider , private SfxListener + , public sfx2::XmlDump { private: void init(); @@ -179,6 +181,9 @@ public: void setViewDirty(); + /// See sfx2::XmlDump::dumpAsXml(). + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + private: //methods void createShapes(); void createShapes2D( const css::awt::Size& rPageSize ); diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx index 3bc0b4fef2cf..bd9189dbff88 100644 --- a/chart2/source/inc/chartview/DrawModelWrapper.hxx +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -86,6 +86,8 @@ public: static SdrObject* getNamedSdrObject( const OUString& rName, SdrObjList const * pObjList ); static bool removeShape( const css::uno::Reference< css::drawing::XShape >& xShape ); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; } //namespace chart #endif diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 96c49fb56655..4f1d055f6a13 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -56,6 +56,7 @@ #include <sal/log.hxx> #include <svl/zforlist.hxx> #include <tools/diagnose_ex.h> +#include <libxml/xmlwriter.h> using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; @@ -738,6 +739,19 @@ void ChartModel::removeDataProviders() m_xDataProvider.clear(); } +void ChartModel::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("ChartModel")); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + + if (mxChartView.is()) + { + mxChartView->dumpAsXml(pWriter); + } + + xmlTextWriterEndElement(pWriter); +} + sal_Bool SAL_CALL ChartModel::hasInternalDataProvider() { return m_xDataProvider.is() && m_xInternalDataProvider.is(); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 4b6b1fa9b48f..faa7fbe3511a 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -103,6 +103,7 @@ #include <tools/stream.hxx> #include <memory> +#include <libxml/xmlwriter.h> namespace com::sun::star::chart2 { class XChartDocument; } namespace chart { @@ -2890,6 +2891,19 @@ OUString ChartView::dump() #endif } +void ChartView::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("ChartView")); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + + if (m_pDrawModelWrapper) + { + m_pDrawModelWrapper->dumpAsXml(pWriter); + } + + xmlTextWriterEndElement(pWriter); +} + void ChartView::setViewDirty() { osl::MutexGuard aGuard(maTimeMutex); diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 6403e0eea192..1d9bc2914ce2 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -33,6 +33,7 @@ #include <editeng/unolingu.hxx> #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> +#include <libxml/xmlwriter.h> #include <com/sun/star/container/XChild.hpp> @@ -324,6 +325,16 @@ bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xSh return false; } +void DrawModelWrapper::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("DrawModelWrapper")); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + + SdrModel::dumpAsXml(pWriter); + + xmlTextWriterEndElement(pWriter); +} + } //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/xmldump.hxx b/include/sfx2/xmldump.hxx new file mode 100644 index 000000000000..245a07b2285f --- /dev/null +++ b/include/sfx2/xmldump.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/types.h> + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +namespace sfx2 +{ +/// Implemented by objects that can be dumped to xml for debugging purposes. +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI XmlDump +{ +public: + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0; + +protected: + ~XmlDump() noexcept = default; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 3c32309efef9..a480f0a9bae5 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -54,6 +54,7 @@ #include <atomic> #include <deque> #include <libxml/xmlwriter.h> +#include <sfx2/xmldump.hxx> using namespace utl; using namespace com::sun::star::uno; @@ -1138,6 +1139,14 @@ void SwOLEObj::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterStartElement(pWriter, BAD_CAST("m_xOLERef")); 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); + } + xmlTextWriterEndElement(pWriter); xmlTextWriterEndElement(pWriter); |