summaryrefslogtreecommitdiff
path: root/svtools/source/misc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-10 12:34:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-14 12:56:52 +0000
commit56e17186ffcda7e93530bef3a06120584bb7d579 (patch)
tree71f3de002cb1e822da6d7fc5d5241dd94f45d8f8 /svtools/source/misc
parent8bdb85f8c7f31e51328afa51a584c3cfdea1c06f (diff)
[API CHANGE] Merge sfx2::XmlDump into css::qa::XDumper
Both sfx2::XmlDump and css::qa::XDumper were (only) used to dump various data from ChartModel and ChartView instances in debugging (e.g., F12 and Shift-F12 in an SW_DEBUG=1 Writer) and testing scenarios. The problem with XmlDump was that it was used as the target of a dynamic_cast from a UNO type, which is dangerous (see the upcoming commit introducing loplugin:unocast for details). One fix would have been to replace that dynamic_cast with a use of XUnoTunnel, and make ChartModel and ChartView implement that. But those classes already implement XDumper, so it looks more natural to use XDumper for that purpose too. However, the information that was obtained via XDumper was rather different from the information that was obtained via XmlDump. So make an incompatible change to the (unpublished) XDumper, adding a kind parameter distinguishing the original behavior of XDumper (kind == "shapes") from the original behavior of XmlDump (kind == ""). Change-Id: Ia7379bedfc45ab62a298fdc2f030cebaf21c4885 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144145 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svtools/source/misc')
-rw-r--r--svtools/source/misc/embedhlp.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 053a30835d2d..d784b20a4a39 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -51,12 +51,12 @@
#include <com/sun/star/embed/XStateChangeListener.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
+#include <com/sun/star/qa/XDumper.hpp>
#include <embeddedobj/embeddedupdate.hxx>
#include <cppuhelper/implbase.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <tools/debug.hxx>
-#include <sfx2/xmldump.hxx>
#include <memory>
using namespace com::sun::star;
@@ -287,10 +287,14 @@ struct EmbeddedObjectRef_Impl
(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)
+ css::uno::Reference<css::qa::XDumper> pComponent(
+ mxObj->getComponent(), css::uno::UNO_QUERY);
+ if (pComponent.is())
{
- pComponent->dumpAsXml(pWriter);
+ auto const s = pComponent->dump("");
+ auto const s1 = OUStringToOString(s, RTL_TEXTENCODING_ISO_8859_1); //TODO
+ (void)xmlTextWriterWriteRawLen(
+ pWriter, reinterpret_cast<xmlChar const *>(s1.getStr()), s1.getLength());
}
(void)xmlTextWriterEndElement(pWriter);