diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-12-05 19:19:16 -0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-09 16:39:00 +0100 |
commit | 326aa3ff4d86c5709ae85ab71fd2c6828bbe7559 (patch) | |
tree | d5422ede96e614e074883b8f608fd2482f039edd /sc | |
parent | cf8a54e48c24b2b2b3ca31b0c2d2faef9f2fca0d (diff) |
fdo#54938: Convert sc to use cppu::supportsService
Change-Id: I1f1606244fbb6e6ddd5b6427322564a0033de78b
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/oox/ooxformulaparser.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleContextBase.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/unoobj/addruno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/celllistsource.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellvaluebinding.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cursuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/datauno.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/unoobj/exceldetect.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/unoobj/funcuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/miscuno.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/nameuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/pageuno.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/scdetect.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/unoobj/shapeuno.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/srchuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/styleuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/viewuno.cxx | 5 | ||||
-rw-r--r-- | sc/workben/addin.cxx | 20 |
22 files changed, 56 insertions, 167 deletions
diff --git a/sc/source/filter/oox/ooxformulaparser.cxx b/sc/source/filter/oox/ooxformulaparser.cxx index 6b80335b4731..fac24f25416b 100644 --- a/sc/source/filter/oox/ooxformulaparser.cxx +++ b/sc/source/filter/oox/ooxformulaparser.cxx @@ -20,6 +20,7 @@ #include "ooxformulaparser.hxx" #include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/supportsservice.hxx> #include "formulaparser.hxx" namespace oox { @@ -132,7 +133,6 @@ OOXMLFormulaParser::~OOXMLFormulaParser() } // com.sun.star.lang.XServiceInfo interface ----------------------------------- - OUString SAL_CALL OOXMLFormulaParser::getImplementationName() throw( RuntimeException ) { return OOXMLFormulaParser_getImplementationName(); @@ -140,10 +140,7 @@ OUString SAL_CALL OOXMLFormulaParser::getImplementationName() throw( RuntimeExce sal_Bool SAL_CALL OOXMLFormulaParser::supportsService( const OUString& rService ) throw( RuntimeException ) { - const Sequence< OUString > aServices( OOXMLFormulaParser_getSupportedServiceNames() ); - const OUString* pArray = aServices.getConstArray(); - const OUString* pArrayEnd = pArray + aServices.getLength(); - return ::std::find( pArray, pArrayEnd, rService ) != pArrayEnd; + return cppu::supportsService(this, rService); } Sequence< OUString > SAL_CALL OOXMLFormulaParser::getSupportedServiceNames() throw( RuntimeException ) diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx index 7db34ef6f9ec..d81cacbd6af6 100644 --- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx @@ -29,6 +29,7 @@ #include <svl/smplhint.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <vcl/unohelp.hxx> #include <comphelper/accessibleeventnotifier.hxx> @@ -462,28 +463,16 @@ void SAL_CALL ScAccessibleContextBase::notifyEvent( } //===== XServiceInfo ======================================================== - -OUString SAL_CALL - ScAccessibleContextBase::getImplementationName(void) +OUString SAL_CALL ScAccessibleContextBase::getImplementationName(void) throw (uno::RuntimeException) { return OUString("ScAccessibleContextBase"); } -sal_Bool SAL_CALL - ScAccessibleContextBase::supportsService(const OUString& sServiceName) +sal_Bool SAL_CALL ScAccessibleContextBase::supportsService(const OUString& sServiceName) throw (uno::RuntimeException) { - // Iterate over all supported service names and return true if on of them - // matches the given name. - uno::Sequence< OUString> aSupportedServices ( - getSupportedServiceNames ()); - sal_Int32 nLength(aSupportedServices.getLength()); - const OUString* pServiceNames = aSupportedServices.getConstArray(); - for (int i=0; i<nLength; ++i, ++pServiceNames) - if (sServiceName == *pServiceNames) - return sal_True; - return false; + return cppu::supportsService(this, sServiceName); } uno::Sequence< OUString> SAL_CALL diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index b675a6435197..0cf18e6f131d 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/table/CellRangeAddress.hpp> +#include <cppuhelper/supportsservice.hxx> #include <svl/itemprop.hxx> #include <vcl/svapp.hxx> @@ -296,9 +297,7 @@ OUString SAL_CALL ScAddressConversionObj::getImplementationName() throw(uno::Run sal_Bool SAL_CALL ScAddressConversionObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - OUString aServiceStr( rServiceName ); - return aServiceStr.equalsAscii( bIsRange ? SC_SERVICENAME_RANGEADDRESS - : SC_SERVICENAME_CELLADDRESS ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScAddressConversionObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/celllistsource.cxx b/sc/source/ui/unoobj/celllistsource.cxx index 468d48709da5..da3e1a7bd1da 100644 --- a/sc/source/ui/unoobj/celllistsource.cxx +++ b/sc/source/ui/unoobj/celllistsource.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <cppuhelper/supportsservice.hxx> //......................................................................... namespace calc @@ -165,7 +166,6 @@ namespace calc // TODO: is it worth having an error message here? } - //-------------------------------------------------------------------- void OCellListSource::checkInitialized() SAL_THROW( ( RuntimeException ) ) { if ( !m_bInitialized ) @@ -173,26 +173,16 @@ namespace calc // TODO: error message } - //-------------------------------------------------------------------- OUString SAL_CALL OCellListSource::getImplementationName( ) throw (RuntimeException) { return OUString( "com.sun.star.comp.sheet.OCellListSource" ); } - //-------------------------------------------------------------------- sal_Bool SAL_CALL OCellListSource::supportsService( const OUString& _rServiceName ) throw (RuntimeException) { - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - const OUString* pLookup = aSupportedServices.getConstArray(); - const OUString* pLookupEnd = aSupportedServices.getConstArray() + aSupportedServices.getLength(); - while ( pLookup != pLookupEnd ) - if ( *pLookup++ == _rServiceName ) - return sal_True; - - return false; + return cppu::supportsService(this, _rServiceName); } - //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL OCellListSource::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< OUString > aServices( 2 ); @@ -201,7 +191,6 @@ namespace calc return aServices; } - //-------------------------------------------------------------------- CellRangeAddress OCellListSource::getRangeAddress( ) const { OSL_PRECOND( m_xRange.is(), "OCellListSource::getRangeAddress: invalid range!" ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 8da119885af9..78b59f2b33fc 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -41,6 +41,7 @@ #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <float.h> #include <com/sun/star/awt/XBitmap.hpp> @@ -4749,7 +4750,6 @@ sal_Bool SAL_CALL ScCellRangesObj::hasElements() throw(uno::RuntimeException) } // XServiceInfo - OUString SAL_CALL ScCellRangesObj::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScCellRangesObj" ); @@ -4758,11 +4758,7 @@ OUString SAL_CALL ScCellRangesObj::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL ScCellRangesObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - OUString aServiceStr(rServiceName); - return aServiceStr.equalsAscii( SCSHEETCELLRANGES_SERVICE ) || - aServiceStr.equalsAscii( SCCELLPROPERTIES_SERVICE ) || - aServiceStr.equalsAscii( SCCHARPROPERTIES_SERVICE ) || - aServiceStr.equalsAscii( SCPARAPROPERTIES_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames() @@ -4777,8 +4773,6 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames() return aRet; } -//------------------------------------------------------------------------ - uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR ) { SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); @@ -6052,11 +6046,7 @@ OUString SAL_CALL ScCellRangeObj::getImplementationName() throw(uno::RuntimeExce sal_Bool SAL_CALL ScCellRangeObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCSHEETCELLRANGE_SERVICE ) || - rServiceName.equalsAscii( SCCELLRANGE_SERVICE ) || - rServiceName.equalsAscii( SCCELLPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCCHARPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCPARAPROPERTIES_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames() @@ -6784,17 +6774,7 @@ OUString SAL_CALL ScCellObj::getImplementationName() throw(uno::RuntimeException sal_Bool SAL_CALL ScCellObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - // CellRange/SheetCellRange are not in SheetCell service description, - // but ScCellObj is used instead of ScCellRangeObj in CellRanges collections, - // so it must support them - - return rServiceName.equalsAscii( SCSHEETCELL_SERVICE ) || - rServiceName.equalsAscii( SCCELL_SERVICE ) || - rServiceName.equalsAscii( SCCELLPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCCHARPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCPARAPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCSHEETCELLRANGE_SERVICE ) || - rServiceName.equalsAscii( SCCELLRANGE_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScCellObj::getSupportedServiceNames() @@ -8705,13 +8685,7 @@ OUString SAL_CALL ScTableSheetObj::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL ScTableSheetObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCSPREADSHEET_SERVICE ) || - rServiceName.equalsAscii( SCSHEETCELLRANGE_SERVICE ) || - rServiceName.equalsAscii( SCCELLRANGE_SERVICE ) || - rServiceName.equalsAscii( SCCELLPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCCHARPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCPARAPROPERTIES_SERVICE ) || - rServiceName.equalsAscii( SCLINKTARGET_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index 3aeb54715f7d..b72e1f0a0032 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/util/XNumberFormatTypes.hpp> #include <com/sun/star/util/NumberFormat.hpp> +#include <cppuhelper/supportsservice.hxx> //......................................................................... namespace calc @@ -466,7 +467,6 @@ namespace calc } } - //-------------------------------------------------------------------- OUString SAL_CALL OCellValueBinding::getImplementationName( ) throw (RuntimeException) { DBG_CHKTHIS( OCellValueBinding, checkConsistency_static ); @@ -474,22 +474,11 @@ namespace calc return OUString( "com.sun.star.comp.sheet.OCellValueBinding" ); } - //-------------------------------------------------------------------- sal_Bool SAL_CALL OCellValueBinding::supportsService( const OUString& _rServiceName ) throw (RuntimeException) { - DBG_CHKTHIS( OCellValueBinding, checkConsistency_static ); - - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - const OUString* pLookup = aSupportedServices.getConstArray(); - const OUString* pLookupEnd = aSupportedServices.getConstArray() + aSupportedServices.getLength(); - while ( pLookup != pLookupEnd ) - if ( *pLookup++ == _rServiceName ) - return sal_True; - - return false; + return cppu::supportsService(this, _rServiceName); } - //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL OCellValueBinding::getSupportedServiceNames( ) throw (RuntimeException) { DBG_CHKTHIS( OCellValueBinding, checkConsistency_static ); @@ -502,7 +491,6 @@ namespace calc return aServices; } - //-------------------------------------------------------------------- void SAL_CALL OCellValueBinding::addModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException) { if ( _rxListener.is() ) diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index ebb4c0bd8fcc..b28a62865e12 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -30,6 +30,7 @@ #include "sc.hrc" #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <cppuhelper/supportsservice.hxx> #include <sfx2/printer.hxx> #include <xmloff/xmluconv.hxx> #include <rtl/ustrbuf.hxx> @@ -37,8 +38,6 @@ using namespace com::sun::star; -#define SCCOMPSCPREADSHEETSETTINGS_SERVICE "com.sun.star.comp.SpreadsheetSettings" -#define SCDOCUMENTSETTINGS_SERVICE "com.sun.star.document.Settings" #define SCSAVEVERSION "SaveVersionOnClose" @@ -464,7 +463,6 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration ) // XServiceInfo - OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScDocumentConfiguration" ); @@ -473,8 +471,7 @@ OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::Ru sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCCOMPSCPREADSHEETSETTINGS_SERVICE ) || - rServiceName.equalsAscii( SCDOCUMENTSETTINGS_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames() @@ -482,11 +479,9 @@ uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNam { uno::Sequence<OUString> aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = OUString( SCCOMPSCPREADSHEETSETTINGS_SERVICE ); - pArray[1] = OUString( SCDOCUMENTSETTINGS_SERVICE ); + pArray[0] = "com.sun.star.comp.SpreadsheetSettings"; + pArray[1] = "com.sun.star.document.Settings"; return aRet; } -//------------------------------------------------------------------------- - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 691ee3ea8657..fdde15a41036 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -22,6 +22,7 @@ #include <svl/zforlist.hxx> #include <vcl/svapp.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include "cursuno.hxx" #include "cellsuno.hxx" @@ -464,9 +465,7 @@ OUString SAL_CALL ScCellCursorObj::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL ScCellCursorObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCSHEETCELLCURSOR_SERVICE ) || - rServiceName.equalsAscii( SCCELLCURSOR_SERVICE ) || - ScCellRangeObj::supportsService(rServiceName); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScCellCursorObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 8886776e76c2..62d72a585b3b 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -54,6 +54,7 @@ #include <comphelper/extract.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <svx/dataaccessdescriptor.hxx> #include <limits> @@ -129,7 +130,6 @@ static const SfxItemPropertyMapEntry* lcl_GetDBRangePropertyMap() //------------------------------------------------------------------------ -#define SCDATABASERANGEOBJ_SERVICE "com.sun.star.sheet.DatabaseRange" SC_SIMPLE_SERVICE_INFO( ScConsolidationDescriptor, "ScConsolidationDescriptor", "com.sun.star.sheet.ConsolidationDescriptor" ) SC_SIMPLE_SERVICE_INFO( ScDatabaseRangesObj, "ScDatabaseRangesObj", "com.sun.star.sheet.DatabaseRanges" ) @@ -2205,7 +2205,6 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDatabaseRangeObj ) // XServiceInfo - OUString SAL_CALL ScDatabaseRangeObj::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScDatabaseRangeObj" ); @@ -2214,8 +2213,7 @@ OUString SAL_CALL ScDatabaseRangeObj::getImplementationName() throw(uno::Runtime sal_Bool SAL_CALL ScDatabaseRangeObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCDATABASERANGEOBJ_SERVICE ) || - rServiceName.equalsAscii( SCLINKTARGET_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScDatabaseRangeObj::getSupportedServiceNames() @@ -2223,7 +2221,7 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangeObj::getSupportedServiceNames() { uno::Sequence<OUString> aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = OUString( SCDATABASERANGEOBJ_SERVICE ); + pArray[0] = "com.sun.star.sheet.DatabaseRange"; pArray[1] = OUString( SCLINKTARGET_SERVICE ); return aRet; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index af9ede871094..b909df959fe6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -57,6 +57,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/string.hxx> +#include <cppuhelper/supportsservice.hxx> #include "docuno.hxx" #include "cellsuno.hxx" @@ -2030,7 +2031,6 @@ uno::Sequence<OUString> SAL_CALL ScModelObj::getAvailableServiceNames() } // XServiceInfo - OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScModelObj" ); @@ -2039,17 +2039,16 @@ OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeExceptio sal_Bool SAL_CALL ScModelObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCMODELOBJ_SERVICE ) || - rServiceName.equalsAscii( SCDOCSETTINGS_SERVICE ) || - rServiceName.equalsAscii( SCDOC_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScModelObj::getSupportedServiceNames() throw(uno::RuntimeException) { - uno::Sequence<OUString> aRet(2); + uno::Sequence<OUString> aRet(3); aRet[0] = SCMODELOBJ_SERVICE; aRet[1] = SCDOCSETTINGS_SERVICE; + aRet[2] = SCDOC_SERVICE; return aRet; } diff --git a/sc/source/ui/unoobj/exceldetect.cxx b/sc/source/ui/unoobj/exceldetect.cxx index 5440c621ebdb..69dc7731196e 100644 --- a/sc/source/ui/unoobj/exceldetect.cxx +++ b/sc/source/ui/unoobj/exceldetect.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/ucb/XContent.hpp> +#include <cppuhelper/supportsservice.hxx> #include "svl/itemset.hxx" #include "svl/eitem.hxx" @@ -33,14 +34,7 @@ OUString ScExcelBiffDetect::getImplementationName() throw (uno::RuntimeException sal_Bool ScExcelBiffDetect::supportsService( const OUString& aName ) throw (uno::RuntimeException) { - uno::Sequence<OUString> aSrvNames = getSupportedServiceNames(); - const OUString* pArray = aSrvNames.getConstArray(); - for (sal_Int32 i = 0; i < aSrvNames.getLength(); ++i, ++pArray) - { - if (*pArray == aName) - return true; - } - return false; + return cppu::supportsService(this, aName); } uno::Sequence<OUString> ScExcelBiffDetect::getSupportedServiceNames() throw (uno::RuntimeException) diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index cddb4ea1d2e6..54d182076e85 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -38,6 +38,7 @@ #include <editeng/editobj.hxx> #include <editeng/flditem.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> @@ -144,8 +145,6 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue ) } -#define SCTEXTFIELD_SERVICE "com.sun.star.text.TextField" -#define SCTEXTCONTENT_SERVICE "com.sun.star.text.TextContent" SC_SIMPLE_SERVICE_INFO( ScCellFieldsObj, "ScCellFieldsObj", "com.sun.star.text.TextFields" ) SC_SIMPLE_SERVICE_INFO( ScHeaderFieldsObj, "ScHeaderFieldsObj", "com.sun.star.text.TextFields" ) @@ -1439,7 +1438,7 @@ OUString SAL_CALL ScEditFieldObj::getImplementationName() throw(uno::RuntimeExce sal_Bool SAL_CALL ScEditFieldObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName == SCTEXTFIELD_SERVICE || rServiceName == SCTEXTCONTENT_SERVICE; + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames() @@ -1447,8 +1446,8 @@ uno::Sequence<OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames() { uno::Sequence<OUString> aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = SCTEXTFIELD_SERVICE; - pArray[1] = SCTEXTCONTENT_SERVICE; + pArray[0] = "com.sun.star.text.TextField"; + pArray[1] = "com.sun.star.text.TextContent"; return aRet; } diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 174b6a6731e2..bcc3dde3a402 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <cppuhelper/supportsservice.hxx> #include <sfx2/app.hxx> #include <svl/itemprop.hxx> @@ -234,7 +235,6 @@ uno::Sequence<OUString> ScFunctionAccess::getSupportedServiceNames_Static() } // XServiceInfo - OUString SAL_CALL ScFunctionAccess::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScFunctionAccess"); @@ -243,8 +243,7 @@ OUString SAL_CALL ScFunctionAccess::getImplementationName() throw(uno::RuntimeEx sal_Bool SAL_CALL ScFunctionAccess::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCFUNCTIONACCESS_SERVICE ) || - rServiceName.equalsAscii( SCDOCSETTINGS_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScFunctionAccess::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/miscuno.cxx b/sc/source/ui/unoobj/miscuno.cxx index f5f6719b1123..a08fac52189e 100644 --- a/sc/source/ui/unoobj/miscuno.cxx +++ b/sc/source/ui/unoobj/miscuno.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include "miscuno.hxx" @@ -230,7 +231,7 @@ OUString SAL_CALL ScIndexEnumeration::getImplementationName() sal_Bool SAL_CALL ScIndexEnumeration::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) { - return sServiceName == ServiceName; + return cppu::supportsService(this, ServiceName); } ::com::sun::star::uno::Sequence< OUString > diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index ef920d230295..269104aa22d3 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -430,8 +431,7 @@ OUString SAL_CALL ScNamedRangeObj::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL ScNamedRangeObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.startsWith( SCNAMEDRANGEOBJ_SERVICE ) || - rServiceName.startsWith( SCLINKTARGET_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScNamedRangeObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/pageuno.cxx b/sc/source/ui/unoobj/pageuno.cxx index dec73c931c0b..1b16b550646e 100644 --- a/sc/source/ui/unoobj/pageuno.cxx +++ b/sc/source/ui/unoobj/pageuno.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <cppuhelper/supportsservice.hxx> #include <rtl/ustring.hxx> #include "pageuno.hxx" #include "shapeuno.hxx" @@ -52,7 +53,7 @@ OUString SAL_CALL ScPageObj::getImplementationName() sal_Bool SAL_CALL ScPageObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( "com.sun.star.sheet.SpreadsheetDrawPage" ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScPageObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index f477cf91e008..217033122e46 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> @@ -659,16 +660,7 @@ OUString SAL_CALL ScFilterDetect::getImplementationName() throw (uno::RuntimeExc sal_Bool ScFilterDetect::supportsService( const OUString& sServiceName ) throw (uno::RuntimeException) { - uno::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 false ; + return cppu::supportsService(this, sServiceName); } com::sun::star::uno::Sequence<OUString> ScFilterDetect::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index b84ab2712a0b..0609869452d5 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -31,6 +31,7 @@ #include <svx/shapepropertynotifier.hxx> #include <toolkit/helper/convert.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -1525,14 +1526,7 @@ OUString SAL_CALL ScShapeObj::getImplementationName( ) throw (uno::RuntimeExcep ::sal_Bool SAL_CALL ScShapeObj::supportsService( const OUString& _ServiceName ) throw (uno::RuntimeException) { - uno::Sequence< OUString > aSupported( getSupportedServiceNames() ); - for ( const OUString* pSupported = aSupported.getConstArray(); - pSupported != aSupported.getConstArray() + aSupported.getLength(); - ++pSupported - ) - if ( _ServiceName == *pSupported ) - return sal_True; - return false; + return cppu::supportsService(this, _ServiceName); } uno::Sequence< OUString > SAL_CALL ScShapeObj::getSupportedServiceNames( ) throw (uno::RuntimeException) diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx index d1022920f81c..d52428aeae12 100644 --- a/sc/source/ui/unoobj/srchuno.cxx +++ b/sc/source/ui/unoobj/srchuno.cxx @@ -22,6 +22,7 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include "srchuno.hxx" #include "docsh.hxx" @@ -199,8 +200,7 @@ OUString SAL_CALL ScCellSearchObj::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL ScCellSearchObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCSEARCHDESCRIPTOR_SERVICE ) || - rServiceName.equalsAscii( SCREPLACEDESCRIPTOR_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScCellSearchObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 82cd940027c6..ec64c93b45c5 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <cppuhelper/supportsservice.hxx> #include "styleuno.hxx" #include "docsh.hxx" @@ -1986,9 +1987,7 @@ OUString SAL_CALL ScStyleObj::getImplementationName() throw(uno::RuntimeExceptio sal_Bool SAL_CALL ScStyleObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - bool bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE ); - return rServiceName.startsWith( SCSTYLE_SERVICE ) || - ( bPage ? rServiceName.startsWith( SCPAGESTYLE_SERVICE ) : rServiceName.startsWith( SCCELLSTYLE_SERVICE ) ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScStyleObj::getSupportedServiceNames() diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index ea7bb416bdb4..db7675ed4ae0 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -40,6 +40,7 @@ #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/convert.hxx> #include <vcl/svapp.hxx> @@ -2199,7 +2200,6 @@ void ScTabViewObj::RangeSelChanged( const OUString& rText ) } // XServiceInfo - OUString SAL_CALL ScTabViewObj::getImplementationName() throw(uno::RuntimeException) { return OUString( "ScTabViewObj" ); @@ -2208,8 +2208,7 @@ OUString SAL_CALL ScTabViewObj::getImplementationName() throw(uno::RuntimeExcept sal_Bool SAL_CALL ScTabViewObj::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - return rServiceName.equalsAscii( SCTABVIEWOBJ_SERVICE ) || - rServiceName.equalsAscii( SCVIEWSETTINGS_SERVICE ); + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL ScTabViewObj::getSupportedServiceNames() diff --git a/sc/workben/addin.cxx b/sc/workben/addin.cxx index dbc538b6165f..1d4d38a1d338 100644 --- a/sc/workben/addin.cxx +++ b/sc/workben/addin.cxx @@ -40,18 +40,10 @@ using namespace com::sun::star; -//------------------------------------------------------------------------ - - -//------------------------------------------------------------------------ - SMART_UNO_IMPLEMENTATION( ScTestAddIn, UsrObject ); -#define SCADDIN_SERVICE L"com.sun.star.sheet.AddIn" #define SCTESTADDIN_SERVICE L"stardiv.one.sheet.DemoAddIn" -//------------------------------------------------------------------------ - extern "C" { sal_Bool SAL_CALL component_writeInfo( @@ -127,7 +119,7 @@ UString ScTestAddIn::getImplementationName_Static() { uno::Sequence< OUString > aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = SCADDIN_SERVICE; + pArray[0] = L"com.sun.star.sheet.AddIn"; pArray[1] = SCTESTADDIN_SERVICE; return aRet; } @@ -539,16 +531,13 @@ OUString SAL_CALL ScTestAddIn::repeatMultiple( sal_Int32 nCount, const ::com::su } } - // XServiceName - OUString SAL_CALL ScTestAddIn::getServiceName( ) throw(::com::sun::star::uno::RuntimeException) { return SCTESTADDIN_SERVICE; // name of specific AddIn service } // XServiceInfo - OUString SAL_CALL ScTestAddIn::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return getImplementationName_Static(); @@ -556,8 +545,7 @@ OUString SAL_CALL ScTestAddIn::getImplementationName( ) throw(::com::sun::star: sal_Bool SAL_CALL ScTestAddIn::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) { - return ServiceName == SCADDIN_SERVICE || - ServiceName == SCTESTADDIN_SERVICE; + return cppu::supportsService(this, ServiceName); } ::com::sun::star::uno::Sequence< OUString > SAL_CALL ScTestAddIn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) @@ -565,8 +553,4 @@ sal_Bool SAL_CALL ScTestAddIn::supportsService( const OUString& ServiceName ) th return getSupportedServiceNames_Static(); } -//------------------------------------------------------------------------ - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |