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>
This commit is contained in:
@@ -12,7 +12,10 @@
|
|||||||
#ifndef INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
#ifndef INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
||||||
#define INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
#define INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
||||||
|
|
||||||
|
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
|
#include <cppuhelper/implbase.hxx>
|
||||||
|
#include <xmloff/dllapi.h>
|
||||||
|
|
||||||
namespace com::sun::star::beans { struct PropertyValue; }
|
namespace com::sun::star::beans { struct PropertyValue; }
|
||||||
namespace com::sun::star::embed { class XStorage; }
|
namespace com::sun::star::embed { class XStorage; }
|
||||||
@@ -20,7 +23,9 @@ namespace com::sun::star::uno { template <typename > class Reference; }
|
|||||||
|
|
||||||
// Scans list of properties for certain URL properties that could refer
|
// Scans list of properties for certain URL properties that could refer
|
||||||
// to internal objects, and initializes from these.
|
// to internal objects, and initializes from these.
|
||||||
class SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") DocumentSettingsSerializer {
|
class XMLOFF_DLLPUBLIC DocumentSettingsSerializer:
|
||||||
|
public cppu::WeakImplHelper<css::lang::XUnoTunnel>
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
// Import objects and update properties (eliding URLs)
|
// Import objects and update properties (eliding URLs)
|
||||||
virtual css::uno::Sequence<css::beans::PropertyValue>
|
virtual css::uno::Sequence<css::beans::PropertyValue>
|
||||||
@@ -34,8 +39,11 @@ public:
|
|||||||
const css::uno::Reference< css::embed::XStorage > &xStorage,
|
const css::uno::Reference< css::embed::XStorage > &xStorage,
|
||||||
const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps ) = 0;
|
const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps ) = 0;
|
||||||
|
|
||||||
|
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
|
||||||
|
static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~DocumentSettingsSerializer() {}
|
~DocumentSettingsSerializer() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
#endif // INCLUDED_XMLOFF_SETTINGSSTORE_HXX
|
||||||
|
@@ -97,6 +97,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
|
|||||||
ucbhelper \
|
ucbhelper \
|
||||||
utl \
|
utl \
|
||||||
vcl \
|
vcl \
|
||||||
|
xo \
|
||||||
$(if $(ENABLE_NSS),xmlsecurity) \
|
$(if $(ENABLE_NSS),xmlsecurity) \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@@ -69,9 +69,10 @@ namespace sd
|
|||||||
{
|
{
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class DocumentSettings : public WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >,
|
class DocumentSettings : public ImplInheritanceHelper<
|
||||||
public comphelper::PropertySetHelper,
|
DocumentSettingsSerializer, XPropertySet, XMultiPropertySet,
|
||||||
public DocumentSettingsSerializer
|
XServiceInfo >,
|
||||||
|
public comphelper::PropertySetHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DocumentSettings( SdXImpressDocument* pModel );
|
explicit DocumentSettings( SdXImpressDocument* pModel );
|
||||||
@@ -1336,17 +1337,17 @@ DocumentSettings::_getPropertyValues(
|
|||||||
// XInterface
|
// XInterface
|
||||||
Any SAL_CALL DocumentSettings::queryInterface( const Type& aType )
|
Any SAL_CALL DocumentSettings::queryInterface( const Type& aType )
|
||||||
{
|
{
|
||||||
return WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
|
return ImplInheritanceHelper::queryInterface( aType );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL DocumentSettings::acquire( ) noexcept
|
void SAL_CALL DocumentSettings::acquire( ) noexcept
|
||||||
{
|
{
|
||||||
WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
|
ImplInheritanceHelper::acquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL DocumentSettings::release( ) noexcept
|
void SAL_CALL DocumentSettings::release( ) noexcept
|
||||||
{
|
{
|
||||||
WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
|
ImplInheritanceHelper::release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// XPropertySet
|
// XPropertySet
|
||||||
|
@@ -154,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
|
|||||||
xmloff/source/draw/sdpropls \
|
xmloff/source/draw/sdpropls \
|
||||||
xmloff/source/draw/sdxmlexp \
|
xmloff/source/draw/sdxmlexp \
|
||||||
xmloff/source/draw/sdxmlimp \
|
xmloff/source/draw/sdxmlimp \
|
||||||
|
xmloff/source/draw/settingsstore \
|
||||||
xmloff/source/draw/shapeexport \
|
xmloff/source/draw/shapeexport \
|
||||||
xmloff/source/draw/shapeimport \
|
xmloff/source/draw/shapeimport \
|
||||||
xmloff/source/draw/SignatureLineContext \
|
xmloff/source/draw/SignatureLineContext \
|
||||||
|
@@ -52,6 +52,7 @@
|
|||||||
#include <rtl/ustrbuf.hxx>
|
#include <rtl/ustrbuf.hxx>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
#include <comphelper/diagnose_ex.hxx>
|
#include <comphelper/diagnose_ex.hxx>
|
||||||
|
#include <comphelper/servicehelper.hxx>
|
||||||
#include <tools/gen.hxx>
|
#include <tools/gen.hxx>
|
||||||
#include <sax/tools/converter.hxx>
|
#include <sax/tools/converter.hxx>
|
||||||
#include <xmloff/xmlaustp.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 );
|
Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
|
||||||
if( xProps.is() )
|
if( xProps.is() )
|
||||||
SvXMLUnitConverter::convertPropertySet( rProps, xProps );
|
SvXMLUnitConverter::convertPropertySet( rProps, xProps );
|
||||||
DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get()));
|
DocumentSettingsSerializer *pFilter(
|
||||||
|
comphelper::getFromUnoTunnel<DocumentSettingsSerializer>(xProps));
|
||||||
if (!pFilter)
|
if (!pFilter)
|
||||||
return;
|
return;
|
||||||
const uno::Reference< embed::XStorage > xStorage(GetTargetStorage());
|
const uno::Reference< embed::XStorage > xStorage(GetTargetStorage());
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
#include <comphelper/sequence.hxx>
|
#include <comphelper/sequence.hxx>
|
||||||
|
#include <comphelper/servicehelper.hxx>
|
||||||
|
|
||||||
#include <xmloff/xmlscripti.hxx>
|
#include <xmloff/xmlscripti.hxx>
|
||||||
#include "sdxmlimp_impl.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;
|
const uno::Sequence<beans::PropertyValue>* pValues = &aConfigProps;
|
||||||
|
|
||||||
DocumentSettingsSerializer *pFilter;
|
DocumentSettingsSerializer *pFilter;
|
||||||
pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
|
pFilter = comphelper::getFromUnoTunnel<DocumentSettingsSerializer>(xProps);
|
||||||
uno::Sequence<beans::PropertyValue> aFiltered;
|
uno::Sequence<beans::PropertyValue> aFiltered;
|
||||||
if( pFilter )
|
if( pFilter )
|
||||||
{
|
{
|
||||||
|
28
xmloff/source/draw/settingsstore.cxx
Normal file
28
xmloff/source/draw/settingsstore.cxx
Normal file
@@ -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: */
|
Reference in New Issue
Block a user