diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-08 11:28:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-08 14:03:14 +0200 |
commit | fbe8cc7feb9ead5918b0c52d4211caf4a10c8212 (patch) | |
tree | 4a6897961edcfa4d23977285315bcffbc6ce883e /sc | |
parent | b69e14038288387b5f288a06821fb5df66dcf94e (diff) |
inline SC_QUERYINTERFACE macros
which means we need a few more cppu::queryInterface variants
Change-Id: I5cf7805ab9576919bfd66a3b239917e48a7f8f61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/miscuno.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 133 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cursuno.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/unoobj/dapiuno.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 37 | ||||
-rw-r--r-- | sc/source/ui/unoobj/viewuno.cxx | 50 |
6 files changed, 137 insertions, 113 deletions
diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx index 362212c1564b..23289affbdba 100644 --- a/sc/inc/miscuno.hxx +++ b/sc/inc/miscuno.hxx @@ -83,16 +83,6 @@ css::uno::Sequence< OUString > const uno::Reference<beans::XVetoableChangeListener>&) \ { OSL_FAIL("not implemented"); } -#define SC_QUERYINTERFACE(x) \ - if (rType == cppu::UnoType<x>::get()) \ - { return uno::Any(uno::Reference<x>(this)); } - -// SC_QUERY_MULTIPLE( XElementAccess, XIndexAccess ): -// use if interface is used several times in one class - -#define SC_QUERY_MULTIPLE(x,y) \ - if (rType == cppu::UnoType<x>::get()) \ - { uno::Any aR; aR <<= uno::Reference<x>(static_cast<y*>(this)); return aR; } class ScIndexEnumeration final : public cppu::WeakImplHelper< css::container::XEnumeration, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 2a1eb141e165..27f1f739c003 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -3931,14 +3931,17 @@ void ScCellRangesObj::RefChanged() uno::Any SAL_CALL ScCellRangesObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer ) - SC_QUERYINTERFACE( sheet::XSheetCellRanges ) - SC_QUERYINTERFACE( container::XIndexAccess ) - SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess ) - SC_QUERYINTERFACE( container::XEnumerationAccess ) - SC_QUERYINTERFACE( container::XNameContainer ) - SC_QUERYINTERFACE( container::XNameReplace ) - SC_QUERYINTERFACE( container::XNameAccess ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XSheetCellRangeContainer*>(this), + static_cast<sheet::XSheetCellRanges*>(this), + static_cast<container::XIndexAccess*>(this), + static_cast<container::XElementAccess*>(static_cast<container::XIndexAccess*>(this)), + static_cast<container::XEnumerationAccess*>(this), + static_cast<container::XNameContainer*>(this), + static_cast<container::XNameReplace*>(this), + static_cast<container::XNameAccess*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangesBase::queryInterface( rType ); } @@ -4504,25 +4507,28 @@ void ScCellRangeObj::RefChanged() uno::Any SAL_CALL ScCellRangeObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XCellRangeAddressable ) - SC_QUERYINTERFACE( table::XCellRange ) - SC_QUERYINTERFACE( sheet::XSheetCellRange ) - SC_QUERYINTERFACE( sheet::XArrayFormulaRange ) - SC_QUERYINTERFACE( sheet::XArrayFormulaTokens ) - SC_QUERYINTERFACE( sheet::XCellRangeData ) - SC_QUERYINTERFACE( sheet::XCellRangeFormula ) - SC_QUERYINTERFACE( sheet::XMultipleOperation ) - SC_QUERYINTERFACE( util::XMergeable ) - SC_QUERYINTERFACE( sheet::XCellSeries ) - SC_QUERYINTERFACE( table::XAutoFormattable ) - SC_QUERYINTERFACE( util::XSortable ) - SC_QUERYINTERFACE( sheet::XSheetFilterableEx ) - SC_QUERYINTERFACE( sheet::XSheetFilterable ) - SC_QUERYINTERFACE( sheet::XSubTotalCalculatable ) - SC_QUERYINTERFACE( table::XColumnRowRange ) - SC_QUERYINTERFACE( util::XImportable ) - SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier ) - SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XCellRangeAddressable*>(this), + static_cast<table::XCellRange*>(this), + static_cast<sheet::XSheetCellRange*>(this), + static_cast<sheet::XArrayFormulaRange*>(this), + static_cast<sheet::XArrayFormulaTokens*>(this), + static_cast<sheet::XCellRangeData*>(this), + static_cast<sheet::XCellRangeFormula*>(this), + static_cast<sheet::XMultipleOperation*>(this), + static_cast<util::XMergeable*>(this), + static_cast<sheet::XCellSeries*>(this), + static_cast<table::XAutoFormattable*>(this), + static_cast<util::XSortable*>(this), + static_cast<sheet::XSheetFilterableEx*>(this), + static_cast<sheet::XSheetFilterable*>(this), + static_cast<sheet::XSubTotalCalculatable*>(this), + static_cast<table::XColumnRowRange*>(this), + static_cast<util::XImportable*>(this), + static_cast<sheet::XCellFormatRangesSupplier*>(this), + static_cast<sheet::XUniqueCellFormatRangesSupplier*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangesBase::queryInterface( rType ); } @@ -5741,18 +5747,21 @@ void ScCellObj::RefChanged() uno::Any SAL_CALL ScCellObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( table::XCell ) - SC_QUERYINTERFACE( table::XCell2 ) - SC_QUERYINTERFACE( sheet::XFormulaTokens ) - SC_QUERYINTERFACE( sheet::XCellAddressable ) - SC_QUERYINTERFACE( text::XText ) - SC_QUERYINTERFACE( text::XSimpleText ) - SC_QUERYINTERFACE( text::XTextRange ) - SC_QUERYINTERFACE( container::XEnumerationAccess ) - SC_QUERYINTERFACE( container::XElementAccess ) - SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor ) - SC_QUERYINTERFACE( text::XTextFieldsSupplier ) - SC_QUERYINTERFACE( document::XActionLockable ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<table::XCell*>(this), + static_cast<table::XCell2*>(this), + static_cast<sheet::XFormulaTokens*>(this), + static_cast<sheet::XCellAddressable*>(this), + static_cast<text::XText*>(this), + static_cast<text::XSimpleText*>(this), + static_cast<text::XTextRange*>(this), + static_cast<container::XEnumerationAccess*>(this), + static_cast<container::XElementAccess*>(this), + static_cast<sheet::XSheetAnnotationAnchor*>(this), + static_cast<text::XTextFieldsSupplier*>(this), + static_cast<document::XActionLockable*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangeObj::queryInterface( rType ); } @@ -6496,25 +6505,28 @@ void ScTableSheetObj::InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab) uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XSpreadsheet ) - SC_QUERYINTERFACE( container::XNamed ) - SC_QUERYINTERFACE( sheet::XSheetPageBreak ) - SC_QUERYINTERFACE( sheet::XCellRangeMovement ) - SC_QUERYINTERFACE( table::XTableChartsSupplier ) - SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier ) - SC_QUERYINTERFACE( sheet::XScenariosSupplier ) - SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier ) - SC_QUERYINTERFACE( drawing::XDrawPageSupplier ) - SC_QUERYINTERFACE( sheet::XPrintAreas ) - SC_QUERYINTERFACE( sheet::XSheetAuditing ) - SC_QUERYINTERFACE( sheet::XSheetOutline ) - SC_QUERYINTERFACE( util::XProtectable ) - SC_QUERYINTERFACE( sheet::XScenario ) - SC_QUERYINTERFACE( sheet::XScenarioEnhanced ) - SC_QUERYINTERFACE( sheet::XSheetLinkable ) - SC_QUERYINTERFACE( sheet::XExternalSheetName ) - SC_QUERYINTERFACE( document::XEventsSupplier ) - SC_QUERYINTERFACE( table::XTablePivotChartsSupplier ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XSpreadsheet*>(this), + static_cast<container::XNamed*>(this), + static_cast<sheet::XSheetPageBreak*>(this), + static_cast<sheet::XCellRangeMovement*>(this), + static_cast<table::XTableChartsSupplier*>(this), + static_cast<sheet::XDataPilotTablesSupplier*>(this), + static_cast<sheet::XScenariosSupplier*>(this), + static_cast<sheet::XSheetAnnotationsSupplier*>(this), + static_cast<drawing::XDrawPageSupplier*>(this), + static_cast<sheet::XPrintAreas*>(this), + static_cast<sheet::XSheetAuditing*>(this), + static_cast<sheet::XSheetOutline*>(this), + static_cast<util::XProtectable*>(this), + static_cast<sheet::XScenario*>(this), + static_cast<sheet::XScenarioEnhanced*>(this), + static_cast<sheet::XSheetLinkable*>(this), + static_cast<sheet::XExternalSheetName*>(this), + static_cast<document::XEventsSupplier*>(this), + static_cast<table::XTablePivotChartsSupplier*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangeObj::queryInterface( rType ); } @@ -8229,7 +8241,10 @@ ScTableColumnObj::~ScTableColumnObj() uno::Any SAL_CALL ScTableColumnObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( container::XNamed ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<container::XNamed*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangeObj::queryInterface( rType ); } diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 800b4be824ac..545e0e1e7571 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -20,7 +20,7 @@ #include <vcl/svapp.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> - +#include <cppuhelper/queryinterface.hxx> #include <cursuno.hxx> #include <cellsuno.hxx> #include <docsh.hxx> @@ -43,9 +43,12 @@ ScCellCursorObj::~ScCellCursorObj() uno::Any SAL_CALL ScCellCursorObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XSheetCellCursor ) - SC_QUERYINTERFACE( sheet::XUsedAreaCursor ) - SC_QUERYINTERFACE( table::XCellCursor ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XSheetCellCursor*>(this), + static_cast<sheet::XUsedAreaCursor*>(this), + static_cast<table::XCellCursor*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScCellRangeObj::queryInterface( rType ); } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index ab98584947d0..4fed56dd2000 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -989,9 +989,12 @@ Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType ) { // since we manually do resolve the query for XDataPilotTable2 // we also need to do the same for XDataPilotTable - SC_QUERYINTERFACE( XDataPilotTable ) - SC_QUERYINTERFACE( XDataPilotTable2 ) - SC_QUERYINTERFACE( XModifyBroadcaster ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<XDataPilotTable*>(this), + static_cast<XDataPilotTable2*>(this), + static_cast<XModifyBroadcaster*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return ScDataPilotDescriptorBase::queryInterface( rType ); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 86333bbd4b43..9100b6668066 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1318,23 +1318,26 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XSpreadsheetDocument ) - SC_QUERYINTERFACE( document::XActionLockable ) - SC_QUERYINTERFACE( sheet::XCalculatable ) - SC_QUERYINTERFACE( util::XProtectable ) - SC_QUERYINTERFACE( drawing::XDrawPagesSupplier ) - SC_QUERYINTERFACE( sheet::XGoalSeek ) - SC_QUERYINTERFACE( sheet::XConsolidatable ) - SC_QUERYINTERFACE( sheet::XDocumentAuditing ) - SC_QUERYINTERFACE( style::XStyleFamiliesSupplier ) - SC_QUERYINTERFACE( view::XRenderable ) - SC_QUERYINTERFACE( document::XLinkTargetSupplier ) - SC_QUERYINTERFACE( beans::XPropertySet ) - SC_QUERYINTERFACE( lang::XMultiServiceFactory ) - SC_QUERYINTERFACE( lang::XServiceInfo ) - SC_QUERYINTERFACE( util::XChangesNotifier ) - SC_QUERYINTERFACE( sheet::opencl::XOpenCLSelection ) - SC_QUERYINTERFACE( chart2::XDataProviderAccess ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast< sheet::XSpreadsheetDocument *>(this), + static_cast< document::XActionLockable *>(this), + static_cast< sheet::XCalculatable *>(this), + static_cast< util::XProtectable *>(this), + static_cast< drawing::XDrawPagesSupplier *>(this), + static_cast< sheet::XGoalSeek *>(this), + static_cast< sheet::XConsolidatable *>(this), + static_cast< sheet::XDocumentAuditing *>(this), + static_cast< style::XStyleFamiliesSupplier *>(this), + static_cast< view::XRenderable *>(this), + static_cast< document::XLinkTargetSupplier *>(this), + static_cast< beans::XPropertySet *>(this), + static_cast< lang::XMultiServiceFactory *>(this), + static_cast< lang::XServiceInfo *>(this), + static_cast< util::XChangesNotifier *>(this), + static_cast< sheet::opencl::XOpenCLSelection *>(this), + static_cast< chart2::XDataProviderAccess *>(this)); + if ( aReturn.hasValue() ) + return aReturn; uno::Any aRet(SfxBaseModel::queryInterface( rType )); if ( !aRet.hasValue() diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 96cf0e96efbe..e4bd505a5e09 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -40,6 +40,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/queryinterface.hxx> #include <toolkit/helper/convert.hxx> #include <vcl/svapp.hxx> @@ -146,12 +147,15 @@ void ScViewPaneBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) uno::Any SAL_CALL ScViewPaneBase::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XViewPane ) - SC_QUERYINTERFACE( sheet::XCellRangeReferrer ) - SC_QUERYINTERFACE( view::XFormLayerAccess ) - SC_QUERYINTERFACE( view::XControlAccess ) - SC_QUERYINTERFACE( lang::XServiceInfo ) - SC_QUERYINTERFACE( lang::XTypeProvider ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XViewPane*>(this), + static_cast<sheet::XCellRangeReferrer*>(this), + static_cast<view::XFormLayerAccess*>(this), + static_cast<view::XControlAccess*>(this), + static_cast<lang::XServiceInfo*>(this), + static_cast<lang::XTypeProvider*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return uno::Any(); // OWeakObject is in derived objects } @@ -469,19 +473,22 @@ ScTabViewObj::~ScTabViewObj() uno::Any SAL_CALL ScTabViewObj::queryInterface( const uno::Type& rType ) { - SC_QUERYINTERFACE( sheet::XSpreadsheetView ) - SC_QUERYINTERFACE( sheet::XEnhancedMouseClickBroadcaster ) - SC_QUERYINTERFACE( sheet::XActivationBroadcaster ) - SC_QUERYINTERFACE( container::XEnumerationAccess ) - SC_QUERYINTERFACE( container::XIndexAccess ) - SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess ) - SC_QUERYINTERFACE( view::XSelectionSupplier ) - SC_QUERYINTERFACE( beans::XPropertySet ) - SC_QUERYINTERFACE( sheet::XViewSplitable ) - SC_QUERYINTERFACE( sheet::XViewFreezable ) - SC_QUERYINTERFACE( sheet::XRangeSelection ) - SC_QUERYINTERFACE( datatransfer::XTransferableSupplier ) - SC_QUERYINTERFACE( sheet::XSelectedSheetsSupplier ) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XSpreadsheetView*>(this), + static_cast<sheet::XEnhancedMouseClickBroadcaster*>(this), + static_cast<sheet::XActivationBroadcaster*>(this), + static_cast<container::XEnumerationAccess*>(this), + static_cast<container::XIndexAccess*>(this), + static_cast<container::XElementAccess*>(static_cast<container::XIndexAccess*>(this)), + static_cast<view::XSelectionSupplier*>(this), + static_cast<beans::XPropertySet*>(this), + static_cast<sheet::XViewSplitable*>(this), + static_cast<sheet::XViewFreezable*>(this), + static_cast<sheet::XRangeSelection*>(this), + static_cast<sheet::XSelectedSheetsSupplier*>(this), + static_cast<datatransfer::XTransferableSupplier*>(this)); + if ( aReturn.hasValue() ) + return aReturn; uno::Any aRet(ScViewPaneBase::queryInterface( rType )); if (!aRet.hasValue()) @@ -2186,7 +2193,10 @@ ScPreviewObj::~ScPreviewObj() uno::Any ScPreviewObj::queryInterface(const uno::Type& rType) { - SC_QUERYINTERFACE(sheet::XSelectedSheetsSupplier) + uno::Any aReturn = ::cppu::queryInterface(rType, + static_cast<sheet::XSelectedSheetsSupplier*>(this)); + if ( aReturn.hasValue() ) + return aReturn; return SfxBaseController::queryInterface(rType); } |