summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-08 11:10:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-22 14:19:22 +0000
commitf481f036deb1b1b46f3038074c4659f3a91b9c6c (patch)
tree2fd2eef4e0277255d85a77def76777a69dee1d64 /xmloff
parent73df933f5fa5932f94e5a1b338a3eda00a9ce354 (diff)
loplugin:unocast (DocumentSettingsSerializer)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I803f62085264511976ed9bb0744ee301de2a7dab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144754 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/Library_xo.mk1
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx3
-rw-r--r--xmloff/source/draw/settingsstore.cxx28
4 files changed, 34 insertions, 2 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index 14401f9eea8f..4450b0031c26 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -154,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/draw/sdpropls \
xmloff/source/draw/sdxmlexp \
xmloff/source/draw/sdxmlimp \
+ xmloff/source/draw/settingsstore \
xmloff/source/draw/shapeexport \
xmloff/source/draw/shapeimport \
xmloff/source/draw/SignatureLineContext \
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 7c336989496b..ac6719868b85 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -52,6 +52,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <comphelper/diagnose_ex.hxx>
+#include <comphelper/servicehelper.hxx>
#include <tools/gen.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmlaustp.hxx>
@@ -2473,7 +2474,8 @@ void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&
Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
if( xProps.is() )
SvXMLUnitConverter::convertPropertySet( rProps, xProps );
- DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get()));
+ DocumentSettingsSerializer *pFilter(
+ comphelper::getFromUnoTunnel<DocumentSettingsSerializer>(xProps));
if (!pFilter)
return;
const uno::Reference< embed::XStorage > xStorage(GetTargetStorage());
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 6e556ac84a31..dbdb910775b1 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <xmloff/xmlscripti.hxx>
#include "sdxmlimp_impl.hxx"
@@ -552,7 +553,7 @@ void SdXMLImport::SetConfigurationSettings(const css::uno::Sequence<css::beans::
const uno::Sequence<beans::PropertyValue>* pValues = &aConfigProps;
DocumentSettingsSerializer *pFilter;
- pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
+ pFilter = comphelper::getFromUnoTunnel<DocumentSettingsSerializer>(xProps);
uno::Sequence<beans::PropertyValue> aFiltered;
if( pFilter )
{
diff --git a/xmloff/source/draw/settingsstore.cxx b/xmloff/source/draw/settingsstore.cxx
new file mode 100644
index 000000000000..0b41473ea211
--- /dev/null
+++ b/xmloff/source/draw/settingsstore.cxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <sal/config.h>
+
+#include <comphelper/servicehelper.hxx>
+#include <xmloff/settingsstore.hxx>
+
+sal_Int64 DocumentSettingsSerializer::getSomething(css::uno::Sequence<sal_Int8> const& aIdentifier)
+{
+ return comphelper::getSomethingImpl(aIdentifier, this);
+}
+
+css::uno::Sequence<sal_Int8> const& DocumentSettingsSerializer::getUnoTunnelId()
+{
+ static comphelper::UnoIdInit const id;
+ return id.getSeq();
+}
+
+DocumentSettingsSerializer::~DocumentSettingsSerializer() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */