summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2013-10-21 19:04:05 -0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-22 10:28:10 +0000
commitee5661ecd3bbeae38b04cd3f582a320a231d11bd (patch)
tree381d9afa0c831145551ade40b6d68f22919baaf6 /scripting
parentc82a36f9c7d89fa434d3dff896c290964326f5bf (diff)
fdo#54938: Adapt supportsService implementations..
to cppu::supportsService Change-Id: I0b03d3910f094f2183bf9859db9d5bcaf35d1f14 Reviewed-on: https://gerrit.libreoffice.org/6370 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basprov.cxx16
-rw-r--r--scripting/source/dlgprov/DialogModelProvider.cxx8
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx13
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx16
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx18
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx13
-rw-r--r--scripting/source/stringresource/stringresource.cxx33
7 files changed, 18 insertions, 99 deletions
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 04e279faa2a4..cc0f4f9ce230 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <rtl/uri.hxx>
#include <osl/process.h>
#include <osl/file.hxx>
@@ -180,30 +181,17 @@ namespace basprov
return bIsShared;
}
- // -----------------------------------------------------------------------------
// XServiceInfo
- // -----------------------------------------------------------------------------
-
OUString BasicProviderImpl::getImplementationName( ) throw (RuntimeException)
{
return getImplementationName_BasicProviderImpl();
}
- // -----------------------------------------------------------------------------
-
sal_Bool BasicProviderImpl::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- Sequence< OUString > aNames( getSupportedServiceNames() );
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
+ return cppu::supportsService(this, rServiceName);
}
- // -----------------------------------------------------------------------------
-
Sequence< OUString > BasicProviderImpl::getSupportedServiceNames( ) throw (RuntimeException)
{
return getSupportedServiceNames_BasicProviderImpl();
diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx
index aee0a9a16ec5..2c1268bdf910 100644
--- a/scripting/source/dlgprov/DialogModelProvider.cxx
+++ b/scripting/source/dlgprov/DialogModelProvider.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/resource/XStringResourceManager.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <cppuhelper/supportsservice.hxx>
// component helper namespace
namespace comp_DialogModelProvider {
@@ -165,12 +166,7 @@ OUString SAL_CALL DialogModelProvider::getImplementationName() throw (css::uno::
::sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException)
{
- css::uno::Sequence< OUString > serviceNames = comp_DialogModelProvider::_getSupportedServiceNames();
- for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
- if (serviceNames[i] == serviceName)
- return sal_True;
- }
- return sal_False;
+ return cppu::supportsService(this, serviceName);
}
css::uno::Sequence< OUString > SAL_CALL DialogModelProvider::getSupportedServiceNames() throw (css::uno::RuntimeException)
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index e7954d8c2b41..281eb24d8523 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -44,6 +44,7 @@
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
@@ -592,21 +593,11 @@ static OUString aResourceResolverPropName("ResourceResolver");
return getImplementationName_DialogProviderImpl();
}
- // -----------------------------------------------------------------------------
-
sal_Bool DialogProviderImpl::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- Sequence< OUString > aNames( getSupportedServiceNames() );
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
+ return cppu::supportsService(this, rServiceName);
}
- // -----------------------------------------------------------------------------
-
Sequence< OUString > DialogProviderImpl::getSupportedServiceNames( ) throw (RuntimeException)
{
return getSupportedServiceNames_DialogProviderImpl();
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 1fa6eb6c03c8..391a97baa896 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -44,6 +44,7 @@
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <framework/documentundoguard.hxx>
#include "com/sun/star/uno/XComponentContext.hpp"
@@ -414,21 +415,10 @@ throw( RuntimeException )
}
/* XServiceInfo */
-sal_Bool SAL_CALL ScriptProtocolHandler::supportsService(
-const OUString& sServiceName )
+sal_Bool SAL_CALL ScriptProtocolHandler::supportsService(const OUString& sServiceName )
throw( RuntimeException )
{
- Sequence< OUString > seqServiceNames = getSupportedServiceNames();
- const OUString* pArray = seqServiceNames.getConstArray();
- for ( sal_Int32 nCounter = 0; nCounter < seqServiceNames.getLength(); nCounter++ )
- {
- if ( pArray[ nCounter ] == sServiceName )
- {
- return sal_True ;
- }
- }
-
- return sal_False ;
+ return cppu::supportsService(this, sServiceName);
}
/* XServiceInfo */
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index a57c9f7124a6..569c5bd363e1 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -23,6 +23,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -755,23 +756,10 @@ BrowseNodeFactoryImpl::getSupportedServiceNames()
return bnf_getSupportedServiceNames();
}
-sal_Bool BrowseNodeFactoryImpl::supportsService(
- OUString const & serviceName )
+sal_Bool BrowseNodeFactoryImpl::supportsService(OUString const & serviceName )
throw (RuntimeException)
{
-// check();
-
- Sequence< OUString > supported_services(
- getSupportedServiceNames() );
-
- OUString const * ar = supported_services.getConstArray();
-
- for ( sal_Int32 pos = supported_services.getLength(); pos--; )
- {
- if (ar[ pos ].equals( serviceName ))
- return sal_True;
- }
- return sal_False;
+ return cppu::supportsService(this, serviceName);
}
} // namespace browsenodefactory
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index cb3783f0eb4d..19e1134a66af 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -23,6 +23,7 @@
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/frame/XModel.hpp>
@@ -807,20 +808,10 @@ throw( RuntimeException )
return OUString( "com.sun.star.script.provider.MasterScriptProvider" );
}
-//*************************************************************************
sal_Bool SAL_CALL MasterScriptProvider::supportsService( const OUString& serviceName )
throw( RuntimeException )
{
- Sequence< OUString > serviceNames( getSupportedServiceNames() );
- OUString const * pNames = serviceNames.getConstArray();
- for ( sal_Int32 nPos = serviceNames.getLength(); nPos--; )
- {
- if ( serviceName.equals( pNames[ nPos ] ) )
- {
- return sal_True;
- }
- }
- return sal_False;
+ return cppu::supportsService(this, serviceName);
}
//*************************************************************************
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 33a2e30f4c28..196998a0bcfb 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <cppuhelper/implementationentry.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -139,13 +140,7 @@ OUString StringResourceImpl::getImplementationName( ) throw (RuntimeException)
sal_Bool StringResourceImpl::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- Sequence< OUString > aNames( getSupportedServiceNames() );
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
+ return cppu::supportsService(this, rServiceName);
}
Sequence< OUString > StringResourceImpl::getSupportedServiceNames( ) throw (RuntimeException)
@@ -2315,21 +2310,11 @@ OUString StringResourceWithStorageImpl::getImplementationName( ) throw (Runtime
return getImplementationName_StringResourceWithStorageImpl();
}
-// -----------------------------------------------------------------------------
-
sal_Bool StringResourceWithStorageImpl::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- Sequence< OUString > aNames( getSupportedServiceNames() );
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
+ return cppu::supportsService(this, rServiceName);
}
-// -----------------------------------------------------------------------------
-
Sequence< OUString > StringResourceWithStorageImpl::getSupportedServiceNames( ) throw (RuntimeException)
{
return getSupportedServiceNames_StringResourceWithStorageImpl();
@@ -2652,21 +2637,11 @@ OUString StringResourceWithLocationImpl::getImplementationName( ) throw (Runtim
return getImplementationName_StringResourceWithLocationImpl();
}
-// -----------------------------------------------------------------------------
-
sal_Bool StringResourceWithLocationImpl::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- Sequence< OUString > aNames( getSupportedServiceNames() );
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
- ;
-
- return pNames != pEnd;
+ return cppu::supportsService(this, rServiceName);
}
-// -----------------------------------------------------------------------------
-
Sequence< OUString > StringResourceWithLocationImpl::getSupportedServiceNames( ) throw (RuntimeException)
{
return getSupportedServiceNames_StringResourceWithLocationImpl();