odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
| 23 +---
odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
| 4
odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
| 4
odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx
| 55 +++-------
odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
| 10 -
odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
| 9 -
odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
| 10 -
odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
| 11 --
8 files changed, 39 insertions(+), 87 deletions(-)
New commits:
commit 4f63a5fa269678cdc021f5c280f697e53771545a
Author: Alexandre Vicenzi <[email protected]>
Date: Fri Jan 31 02:42:47 2014 -0200
fdo#54938 Convert odk to cppu::supportsService
Change-Id: Ia5095367be90dd5383e7701ea2587f79a7505a67
Signed-off-by: Stephan Bergmann <[email protected]>
diff --git
a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
index 7ad15d7..4f9ed11 100644
---
a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
+++
b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
@@ -34,8 +34,6 @@
*************************************************************************/
#include <addon.hxx>
-#include <osl/diagnose.h>
-#include <rtl/ustring.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XController.hpp>
@@ -44,6 +42,9 @@
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/XMessageBox.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/supportsservice.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
using rtl::OUString;
using namespace com::sun::star::uno;
@@ -193,22 +194,13 @@ void SAL_CALL Addon::removeStatusListener( const
Reference< XStatusListener >& x
{
}
-//##################################################################################################
-//#### Helper functions for the implementation of UNO component interfaces
#########################
-//##################################################################################################
-
+// Helper functions for the implementation of UNO component interfaces.
OUString Addon_getImplementationName()
throw (RuntimeException)
{
return OUString ( IMPLEMENTATION_NAME );
}
-sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName )
-throw (RuntimeException)
-{
- return ServiceName == SERVICE_NAME;
-}
-
Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames()
throw (RuntimeException)
{
@@ -224,10 +216,7 @@ Reference< XInterface > SAL_CALL Addon_createInstance(
const Reference< XCompone
return (cppu::OWeakObject*) new Addon( rContext );
}
-//##################################################################################################
-//#### Implementation of the recommended/mandatory interfaces of a UNO
component ###################
-//##################################################################################################
-
+// Implementation of the recommended/mandatory interfaces of a UNO component.
// XServiceInfo
::rtl::OUString SAL_CALL Addon::getImplementationName( )
throw (RuntimeException)
@@ -238,7 +227,7 @@ Reference< XInterface > SAL_CALL Addon_createInstance(
const Reference< XCompone
sal_Bool SAL_CALL Addon::supportsService( const ::rtl::OUString& rServiceName )
throw (RuntimeException)
{
- return Addon_supportsService( rServiceName );
+ return cppu::supportsService(this, rServiceName);
}
Sequence< ::rtl::OUString > SAL_CALL Addon::getSupportedServiceNames( )
diff --git
a/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
index 37c4b61..ab82348 100644
--- a/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx
@@ -38,6 +38,7 @@
#include <rtl/uuid.h>
#include <rtl/instance.hxx>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
@@ -226,8 +227,7 @@ OUString MyService1Impl::getImplementationName()
sal_Bool MyService1Impl::supportsService( OUString const & serviceName )
throw (RuntimeException)
{
- // this object only supports one service, so the test is simple
- return serviceName == "my_module.MyService1";
+ return cppu::supportsService(this, serviceName);
}
Sequence< OUString > MyService1Impl::getSupportedServiceNames()
throw (RuntimeException)
diff --git
a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
index abb288e..a443dfe 100644
--- a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
+++ b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx
@@ -36,6 +36,7 @@
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <uno/lbnames.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -154,8 +155,7 @@ OUString MyService2Impl::getImplementationName()
sal_Bool MyService2Impl::supportsService( OUString const & serviceName )
throw (RuntimeException)
{
- // this object only supports one service, so the test is simple
- return serviceName == "my_module.MyService2";
+ return cppu::supportsService(this, serviceName);
}
Sequence< OUString > MyService2Impl::getSupportedServiceNames()
diff --git
a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx
b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx
index 05bba10..52d02ef 100644
--- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx
+++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx
@@ -36,10 +36,11 @@
#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/interfacecontainer.h>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
@@ -60,6 +61,7 @@ namespace com
}
}
}
+
namespace connectivity
{
@@ -71,9 +73,7 @@ namespace connectivity
::com::sun::star::lang::XComponent* _pObject);
void checkDisposed(sal_Bool _bThrow) throw (
::com::sun::star::lang::DisposedException );
- //************************************************************
- // OSubComponent
- //************************************************************
+
template <class SELF, class WEAK> class OSubComponent
{
protected:
@@ -107,7 +107,6 @@ namespace connectivity
}
};
-
template <class TYPE>
class OPropertyArrayUsageHelper
{
@@ -157,7 +156,6 @@ namespace connectivity
template<class TYPE>
::osl::Mutex OPropertyArrayUsageHelper< TYPE
>::s_aMutex;
- //------------------------------------------------------------------
template <class TYPE>
OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper()
{
@@ -165,7 +163,6 @@ namespace connectivity
++s_nRefCount;
}
- //------------------------------------------------------------------
template <class TYPE>
::cppu::IPropertyArrayHelper*
OPropertyArrayUsageHelper<TYPE>::getArrayHelper()
{
@@ -182,8 +179,6 @@ namespace connectivity
return s_pProps;
}
-
-
class OBase_Mutex
{
public:
@@ -199,7 +194,7 @@ namespace connectivity
*_pDest = *_pSource;
}
}
-
//-------------------------------------------------------------------------
+
/// concat two sequences
template <class T>
::com::sun::star::uno::Sequence<T> concatSequences(const
::com::sun::star::uno::Sequence<T>& _rLeft, const
::com::sun::star::uno::Sequence<T>& _rRight)
@@ -219,34 +214,26 @@ namespace connectivity
}
-#define DECLARE_SERVICE_INFO() \
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw
(::com::sun::star::uno::RuntimeException); \
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
+#define DECLARE_SERVICE_INFO()
\
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw
(::com::sun::star::uno::RuntimeException); \
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString&
ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \
-#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \
+#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname)
\
::rtl::OUString SAL_CALL classname::getImplementationName( ) throw
(::com::sun::star::uno::RuntimeException) \
- { \
- return ::rtl::OUString::createFromAscii(implasciiname); \
- } \
+ {
\
+ return ::rtl::OUString::createFromAscii(implasciiname);
\
+ }
\
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
classname::getSupportedServiceNames( )
throw(::com::sun::star::uno::RuntimeException) \
- { \
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \
- aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \
- return aSupported; \
- } \
+ {
\
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
\
+ aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname);
\
+ return aSupported;
\
+ }
\
sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString&
_rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
- { \
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
\
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
\
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
\
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName);
++pSupported) \
- ;
\
-
\
- return pSupported != pEnd;
\
- } \
-
-
+ {
\
+ return cppu::supportsService(this, _rServiceName);
\
+ }
\
}
}
#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_
diff --git
a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
index eb4e4f3..84731ba 100644
---
a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
+++
b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
@@ -55,7 +55,7 @@
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-
+#include <cppuhelper/supportsservice.hxx>
using namespace com::sun::star::uno;
using namespace com::sun::star::document;
@@ -212,12 +212,6 @@ OUString FilterDetect_getImplementationName ()
#define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection"
-sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName )
- throw (RuntimeException)
-{
- return ServiceName == SERVICE_NAME1;
-}
-
Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
throw (RuntimeException)
{
@@ -245,7 +239,7 @@ OUString SAL_CALL FilterDetect::getImplementationName( )
sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
throw (RuntimeException)
{
- return FilterDetect_supportsService( rServiceName );
+ return cppu::supportsService(this, rServiceName);
}
Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( )
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
index 3a00c16..bb7580b 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <cppuhelper/supportsservice.hxx>
using rtl::OUString;
using com::sun::star::uno::Sequence;
@@ -57,12 +58,6 @@ OUString MyJob_getImplementationName ()
#define SERVICE_NAME "com.sun.star.task.Job"
-sal_Bool SAL_CALL MyJob_supportsService( const OUString& ServiceName )
- throw (RuntimeException)
-{
- return ServiceName == SERVICE_NAME;
-}
-
Sequence< OUString > SAL_CALL MyJob_getSupportedServiceNames( )
throw (RuntimeException)
{
@@ -90,7 +85,7 @@ OUString SAL_CALL MyJob::getImplementationName( )
sal_Bool SAL_CALL MyJob::supportsService( const OUString& rServiceName )
throw (RuntimeException)
{
- return MyJob_supportsService( rServiceName );
+ return cppu::supportsService(this, rServiceName);
}
Sequence< OUString > SAL_CALL MyJob::getSupportedServiceNames( )
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
index bea9976..82f8d01 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyListener.cxx
@@ -23,16 +23,15 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <cppuhelper/supportsservice.hxx>
MyListener::MyListener(const css::uno::Reference<
css::lang::XMultiServiceFactory >& xSMGR)
: m_xSMGR(xSMGR)
{}
-
MyListener::~MyListener()
{}
-
css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence<
css::beans::NamedValue >& lArguments)
throw (css::lang::IllegalArgumentException,
css::uno::Exception,
@@ -105,14 +104,12 @@ css::uno::Any SAL_CALL MyListener::execute(const
css::uno::Sequence< css::beans:
return css::uno::Any();
}
-
::rtl::OUString SAL_CALL MyListener::getImplementationName()
throw (css::uno::RuntimeException)
{
return ::rtl::OUString( MYLISTENER_IMPLEMENTATIONNAME );
}
-
css::uno::Sequence< ::rtl::OUString > SAL_CALL
MyListener::getSupportedServiceNames()
throw (css::uno::RuntimeException)
{
@@ -121,15 +118,12 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL
MyListener::getSupportedServiceNa
return lNames;
}
-
sal_Bool SAL_CALL MyListener::supportsService(const ::rtl::OUString&
sServiceName)
throw (css::uno::RuntimeException)
{
- return sServiceName== MYLISTENER_SERVICENAME ||
- sServiceName == "com.sun.star.task.Job";
+ return cppu::supportsService(this, sServiceName);
}
-
css::uno::Reference< css::uno::XInterface >
MyListener::st_createInstance(const css::uno::Reference<
css::lang::XMultiServiceFactory >& xSMGR)
{
MyListener* pListener = new MyListener(xSMGR);
diff --git a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
index 61ab750..41fc283 100644
--- a/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
+++ b/odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <cppuhelper/supportsservice.hxx>
using namespace com::sun::star::awt;
using namespace com::sun::star::frame;
@@ -167,13 +168,6 @@ Sequence < Reference< XDispatch > > SAL_CALL
MyProtocolHandler::queryDispatches(
return ::rtl::OUString( MYPROTOCOLHANDLER_IMPLEMENTATIONNAME );
}
-sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString&
ServiceName )
- throw (RuntimeException)
-{
- return ServiceName == MYPROTOCOLHANDLER_SERVICENAME ||
- ServiceName == "com.sun.star.frame.ProtocolHandler";
-}
-
Sequence< ::rtl::OUString > SAL_CALL
MyProtocolHandler_getSupportedServiceNames( )
throw (RuntimeException)
{
@@ -200,7 +194,7 @@ Reference< XInterface > SAL_CALL
MyProtocolHandler_createInstance( const Referen
sal_Bool SAL_CALL MyProtocolHandler::supportsService( const ::rtl::OUString&
rServiceName )
throw (RuntimeException)
{
- return MyProtocolHandler_supportsService( rServiceName );
+ return cppu::supportsService(this, rServiceName);
}
Sequence< ::rtl::OUString > SAL_CALL
MyProtocolHandler::getSupportedServiceNames( )
@@ -500,7 +494,6 @@ BaseDispatch::BaseDispatch( const Reference<
XComponentContext > &rxContext,
{
}
-
BaseDispatch::~BaseDispatch()
{
mxFrame.clear();
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits