[Libreoffice-commits] core.git: Branch 'distro/vector/vector-7.0-10.0' - embeddedobj/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 11 11:20:05 UTC 2021
embeddedobj/source/commonembedding/miscobj.cxx | 46 +++++++++++++++++++
embeddedobj/source/commonembedding/specialobject.cxx | 18 +++++++
embeddedobj/source/general/dummyobject.cxx | 16 ++++++
embeddedobj/source/inc/commonembobj.hxx | 12 ++++
embeddedobj/source/inc/dummyobject.hxx | 8 ++-
embeddedobj/source/inc/oleembobj.hxx | 9 +++
embeddedobj/source/inc/specialobject.hxx | 5 ++
embeddedobj/source/msole/olemisc.cxx | 16 ++++++
8 files changed, 128 insertions(+), 2 deletions(-)
New commits:
commit d8b550deae18c3c13aa8abb0dc4878a00f832515
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Aug 10 16:37:15 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Aug 11 13:18:59 2021 +0200
embeddedobj: implement XServiceInfo in the various embedded obj implementations
This gives UNO clients a reliable way to detect e.g.
OSpecialEmbeddedObject, where it's expected that double-clicking on the
object doesn't do anything.
(cherry picked from commit 15a524a1ed2bf464b0b727e628bb5af9685f49b9)
Conflicts:
embeddedobj/source/commonembedding/miscobj.cxx
embeddedobj/source/general/dummyobject.cxx
embeddedobj/source/inc/commonembobj.hxx
embeddedobj/source/inc/oleembobj.hxx
Change-Id: I595453490b157b64214cd7359da1e3a3c959191d
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index ea2a3cb3c110..8a1dd801f6ea 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -32,6 +32,7 @@
#include <comphelper/mimeconfighelper.hxx>
#include <vcl/svapp.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include "persistence.hxx"
@@ -341,6 +342,16 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType
void* p = static_cast<embed::XEmbedPersist2*>(this);
return uno::Any(&p, rType);
}
+ else if (rType == cppu::UnoType<lang::XServiceInfo>::get())
+ {
+ void* p = static_cast<lang::XServiceInfo*>(this);
+ return uno::Any(&p, rType);
+ }
+ else if (rType == cppu::UnoType<lang::XTypeProvider>::get())
+ {
+ void* p = static_cast<lang::XTypeProvider*>(this);
+ return uno::Any(&p, rType);
+ }
else
aReturn = ::cppu::queryInterface(
rType,
@@ -583,4 +594,39 @@ void SAL_CALL OCommonEmbeddedObject::removeEventListener( const uno::Reference<
xListener );
}
+OUString SAL_CALL OCommonEmbeddedObject::getImplementationName()
+{
+ return "com.sun.star.comp.embed.OCommonEmbeddedObject";
+}
+
+sal_Bool SAL_CALL OCommonEmbeddedObject::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence<OUString> SAL_CALL OCommonEmbeddedObject::getSupportedServiceNames()
+{
+ return { "com.sun.star.comp.embed.OCommonEmbeddedObject" };
+}
+
+uno::Sequence<uno::Type> SAL_CALL OCommonEmbeddedObject::getTypes()
+{
+ static const uno::Sequence<uno::Type> aTypes{
+ cppu::UnoType<embed::XEmbeddedObject>::get(),
+ cppu::UnoType<embed::XEmbedPersist2>::get(),
+ cppu::UnoType<embed::XLinkageSupport>::get(),
+ cppu::UnoType<embed::XInplaceObject>::get(),
+ cppu::UnoType<container::XChild>::get(),
+ cppu::UnoType<chart2::XDefaultSizeTransmitter>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ };
+ return aTypes;
+}
+
+uno::Sequence<sal_Int8> SAL_CALL OCommonEmbeddedObject::getImplementationId()
+{
+ return uno::Sequence<sal_Int8>();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/specialobject.cxx b/embeddedobj/source/commonembedding/specialobject.cxx
index 683fe0aab3f2..809ffce1f2c4 100644
--- a/embeddedobj/source/commonembedding/specialobject.cxx
+++ b/embeddedobj/source/commonembedding/specialobject.cxx
@@ -28,6 +28,7 @@
#include <cppuhelper/queryinterface.hxx>
#include <osl/diagnose.h>
+#include <cppuhelper/supportsservice.hxx>
#include <specialobject.hxx>
@@ -51,6 +52,8 @@ uno::Any SAL_CALL OSpecialEmbeddedObject::queryInterface( const uno::Type& rType
static_cast< embed::XClassifiedObject* >( this ),
static_cast< embed::XComponentSupplier* >( this ),
static_cast< util::XCloseable* >( this ),
+ static_cast< lang::XServiceInfo* >( this ),
+ static_cast< lang::XTypeProvider* >( this ),
static_cast< document::XEventBroadcaster* >( this ) );
if ( aReturn.hasValue() )
return aReturn;
@@ -160,4 +163,19 @@ void SAL_CALL OSpecialEmbeddedObject::doVerb( sal_Int32 nVerbID )
OCommonEmbeddedObject::doVerb( nVerbID );
}
+OUString SAL_CALL OSpecialEmbeddedObject::getImplementationName()
+{
+ return "com.sun.star.comp.embed.OSpecialEmbeddedObject";
+}
+
+sal_Bool SAL_CALL OSpecialEmbeddedObject::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence<OUString> SAL_CALL OSpecialEmbeddedObject::getSupportedServiceNames()
+{
+ return { "com.sun.star.comp.embed.OSpecialEmbeddedObject" };
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx
index e37aca939b9b..cb251571222b 100644
--- a/embeddedobj/source/general/dummyobject.cxx
+++ b/embeddedobj/source/general/dummyobject.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/NoSupportException.hpp>
+#include <cppuhelper/supportsservice.hxx>
#include <dummyobject.hxx>
@@ -620,4 +621,19 @@ void SAL_CALL ODummyEmbeddedObject::removeEventListener( const uno::Reference< d
xListener );
}
+OUString SAL_CALL ODummyEmbeddedObject::getImplementationName()
+{
+ return "com.sun.star.comp.embed.ODummyEmbeddedObject";
+}
+
+sal_Bool SAL_CALL ODummyEmbeddedObject::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence<OUString> SAL_CALL ODummyEmbeddedObject::getSupportedServiceNames()
+{
+ return { "com.sun.star.comp.embed.ODummyEmbeddedObject" };
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index 61e939a0c62f..922ecf50d59f 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/weak.hxx>
#include <rtl/ref.hxx>
#include <map>
@@ -78,6 +79,8 @@ class OCommonEmbeddedObject : public css::embed::XEmbeddedObject
, public css::embed::XInplaceObject
, public css::container::XChild
, public css::chart2::XDefaultSizeTransmitter
+ , public css::lang::XServiceInfo
+ , public css::lang::XTypeProvider
, public ::cppu::OWeakObject
{
protected:
@@ -394,6 +397,15 @@ public:
// XDefaultSizeTransmitter
//#i103460# charts do not necessarily have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
virtual void SAL_CALL setDefaultSize( const css::awt::Size& rSize_100TH_MM ) override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XTypeProvider
+ css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+ css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
};
#endif
diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx
index 60bca914b636..e8004cbcf28e 100644
--- a/embeddedobj/source/inc/dummyobject.hxx
+++ b/embeddedobj/source/inc/dummyobject.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.hxx>
@@ -54,7 +55,8 @@ namespace cppu {
*/
class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
< css::embed::XEmbeddedObject
- , css::embed::XEmbedPersist >
+ , css::embed::XEmbedPersist
+ , css::lang::XServiceInfo >
{
::osl::Mutex m_aMutex;
std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper>
@@ -199,6 +201,10 @@ public:
virtual void SAL_CALL removeEventListener(
const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
};
#endif
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
index 051d63294af4..f1480e08d71e 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/util/XCloseListener.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
@@ -115,7 +116,8 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
, css::embed::XInplaceObject
, css::container::XChild
, css::io::XActiveDataStreamer
- , css::lang::XInitialization >
+ , css::lang::XInitialization
+ , css::lang::XServiceInfo >
{
friend class OleComponent;
@@ -445,6 +447,11 @@ public:
// XInitialization
void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
};
#endif
diff --git a/embeddedobj/source/inc/specialobject.hxx b/embeddedobj/source/inc/specialobject.hxx
index 32ad61a7a582..695aad730cd9 100644
--- a/embeddedobj/source/inc/specialobject.hxx
+++ b/embeddedobj/source/inc/specialobject.hxx
@@ -48,6 +48,11 @@ public:
virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
};
#endif
diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx
index 6de6a9cdca75..c87812fc73fc 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -30,6 +30,7 @@
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/sequenceashashmap.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <oleembobj.hxx>
#include "olepersist.hxx"
@@ -688,4 +689,19 @@ void OleEmbeddedObject::initialize(const uno::Sequence<uno::Any>& rArguments)
}
}
+OUString SAL_CALL OleEmbeddedObject::getImplementationName()
+{
+ return "com.sun.star.comp.embed.OleEmbeddedObject";
+}
+
+sal_Bool SAL_CALL OleEmbeddedObject::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence<OUString> SAL_CALL OleEmbeddedObject::getSupportedServiceNames()
+{
+ return { "com.sun.star.comp.embed.OleEmbeddedObject" };
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list