loplugin:unocast (css::embed::EmbeddedUpdate)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: Ia0f628be9adf749ffdd9ad36ca9b1e8c98e29936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144755 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
420165ab0e
commit
73df933f5f
@ -25,11 +25,13 @@
|
||||
#include <com/sun/star/embed/XInplaceClient.hpp>
|
||||
#include <com/sun/star/lang/DisposedException.hpp>
|
||||
#include <com/sun/star/lang/NoSupportException.hpp>
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
|
||||
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
|
||||
#include <com/sun/star/io/TempFile.hpp>
|
||||
#include <comphelper/multicontainer2.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <comphelper/storagehelper.hxx>
|
||||
|
||||
#include <cppuhelper/queryinterface.hxx>
|
||||
@ -762,6 +764,7 @@ uno::Sequence<uno::Type> SAL_CALL OCommonEmbeddedObject::getTypes()
|
||||
cppu::UnoType<lang::XServiceInfo>::get(),
|
||||
cppu::UnoType<lang::XInitialization>::get(),
|
||||
cppu::UnoType<lang::XTypeProvider>::get(),
|
||||
cppu::UnoType<lang::XUnoTunnel>::get(),
|
||||
};
|
||||
return aTypes;
|
||||
}
|
||||
@ -771,6 +774,10 @@ uno::Sequence<sal_Int8> SAL_CALL OCommonEmbeddedObject::getImplementationId()
|
||||
return uno::Sequence<sal_Int8>();
|
||||
}
|
||||
|
||||
sal_Int64 OCommonEmbeddedObject::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) {
|
||||
return comphelper::getSomethingImpl(aIdentifier, static_cast<EmbeddedUpdate *>(this));
|
||||
}
|
||||
|
||||
void SAL_CALL OCommonEmbeddedObject::initialize(const uno::Sequence<uno::Any>& rArguments)
|
||||
{
|
||||
if (!rArguments.hasElements())
|
||||
|
@ -35,11 +35,12 @@
|
||||
#include <com/sun/star/io/XTempFile.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
#include <cppuhelper/weak.hxx>
|
||||
#include <embeddedobj/embeddedupdate.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <svtools/embeddedupdate.hxx>
|
||||
#include <svtools/filechangedchecker.hxx>
|
||||
|
||||
namespace com::sun::star {
|
||||
@ -87,6 +88,7 @@ class OCommonEmbeddedObject : public css::embed::XEmbeddedObject
|
||||
, public css::lang::XServiceInfo
|
||||
, public css::lang::XInitialization
|
||||
, public css::lang::XTypeProvider
|
||||
, public css::lang::XUnoTunnel
|
||||
, public ::cppu::OWeakObject
|
||||
{
|
||||
protected:
|
||||
@ -434,6 +436,9 @@ public:
|
||||
// XTypeProvider
|
||||
css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
|
||||
css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
|
||||
|
||||
// XUnoTunnel
|
||||
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -9,7 +9,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <embeddedobj/embobjdllapi.h>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <sal/types.h>
|
||||
#include <svtools/svtdllapi.h>
|
||||
|
||||
namespace com
|
||||
{
|
||||
@ -24,7 +26,7 @@ namespace embed
|
||||
|
||||
@since LibreOffice 7.4
|
||||
*/
|
||||
class EMBOBJ_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") EmbeddedUpdate
|
||||
class SVT_DLLPUBLIC EmbeddedUpdate
|
||||
{
|
||||
/** By "Refresh all" is used to perform an OLE update and a link update.
|
||||
In the case of a link update, the class OCommonEmbeddedObject is
|
||||
@ -40,6 +42,8 @@ public:
|
||||
EmbeddedUpdate() = default;
|
||||
virtual ~EmbeddedUpdate() = default;
|
||||
|
||||
static css::uno::Sequence<sal_Int8> const& getUnoTunnelId();
|
||||
|
||||
private:
|
||||
EmbeddedUpdate(const EmbeddedUpdate&) = delete;
|
||||
EmbeddedUpdate& operator=(const EmbeddedUpdate&) = delete;
|
@ -125,6 +125,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
|
||||
svtools/source/misc/cliplistener \
|
||||
svtools/source/misc/dialogclosedlistener \
|
||||
svtools/source/misc/ehdl \
|
||||
svtools/source/misc/embeddedupdate \
|
||||
svtools/source/misc/embedhlp \
|
||||
svtools/source/misc/embedtransfer \
|
||||
svtools/source/misc/filechangedchecker \
|
||||
|
22
svtools/source/misc/embeddedupdate.cxx
Normal file
22
svtools/source/misc/embeddedupdate.cxx
Normal file
@ -0,0 +1,22 @@
|
||||
/* -*- 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 <sal/types.h>
|
||||
#include <svtools/embeddedupdate.hxx>
|
||||
|
||||
css::uno::Sequence<sal_Int8> const& css::embed::EmbeddedUpdate::getUnoTunnelId()
|
||||
{
|
||||
static comphelper::UnoIdInit const id;
|
||||
return id.getSeq();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <libxml/xmlwriter.h>
|
||||
|
||||
#include <svtools/embeddedupdate.hxx>
|
||||
#include <svtools/embedhlp.hxx>
|
||||
#include <vcl/graphicfilter.hxx>
|
||||
#include <vcl/gdimtf.hxx>
|
||||
@ -30,6 +31,7 @@
|
||||
#include <sal/log.hxx>
|
||||
#include <comphelper/fileformat.h>
|
||||
#include <comphelper/embeddedobjectcontainer.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <toolkit/helper/vclunohelper.hxx>
|
||||
#include <unotools/ucbstreamhelper.hxx>
|
||||
#include <unotools/streamwrap.hxx>
|
||||
@ -52,7 +54,6 @@
|
||||
#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>
|
||||
@ -933,7 +934,7 @@ void EmbeddedObjectRef::UpdateReplacement( bool bUpdateOle )
|
||||
|
||||
void EmbeddedObjectRef::UpdateOleObject( bool bUpdateOle )
|
||||
{
|
||||
embed::EmbeddedUpdate* pObj = dynamic_cast<embed::EmbeddedUpdate*> (GetObject().get());
|
||||
embed::EmbeddedUpdate* pObj = comphelper::getFromUnoTunnel<embed::EmbeddedUpdate> (GetObject());
|
||||
if( pObj )
|
||||
pObj->SetOleState( bUpdateOle );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user