include/cppuhelper/queryinterface.hxx |  248 ++++++++++++++++++++++++++++++++++
 sc/inc/miscuno.hxx                    |   10 -
 sc/source/ui/unoobj/cellsuno.cxx      |  133 ++++++++++--------
 sc/source/ui/unoobj/cursuno.cxx       |   11 -
 sc/source/ui/unoobj/dapiuno.cxx       |    9 -
 sc/source/ui/unoobj/docuno.cxx        |   37 ++---
 sc/source/ui/unoobj/viewuno.cxx       |   50 ++++--
 7 files changed, 385 insertions(+), 113 deletions(-)

New commits:
commit fbe8cc7feb9ead5918b0c52d4211caf4a10c8212
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Sep 8 11:28:30 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Sep 8 14:03:14 2023 +0200

    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 <[email protected]>

diff --git a/include/cppuhelper/queryinterface.hxx 
b/include/cppuhelper/queryinterface.hxx
index df9c9916cf8e..25961154b4d1 100644
--- a/include/cppuhelper/queryinterface.hxx
+++ b/include/cppuhelper/queryinterface.hxx
@@ -519,6 +519,254 @@ inline css::uno::Any SAL_CALL queryInterface(
         return css::uno::Any();
 }
 
+/** Compares demanded type to given template argument types.
+    @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class 
Interface4, class Interface5,
+          class Interface6, class Interface7, class Interface8, class 
Interface9, class Interface10,
+          class Interface11, class Interface12, class Interface13 >
+inline css::uno::Any SAL_CALL queryInterface(
+    const css::uno::Type & rType,
+    Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, 
Interface5 * p5,
+    Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, 
Interface10 * p10,
+    Interface11 * p11, Interface12 * p12, Interface13 * p13 )
+{
+    if (rType == Interface1::static_type())
+        return css::uno::Any( &p1, rType );
+    else if (rType == Interface2::static_type())
+        return css::uno::Any( &p2, rType );
+    else if (rType == Interface3::static_type())
+        return css::uno::Any( &p3, rType );
+    else if (rType == Interface4::static_type())
+        return css::uno::Any( &p4, rType );
+    else if (rType == Interface5::static_type())
+        return css::uno::Any( &p5, rType );
+    else if (rType == Interface6::static_type())
+        return css::uno::Any( &p6, rType );
+    else if (rType == Interface7::static_type())
+        return css::uno::Any( &p7, rType );
+    else if (rType == Interface8::static_type())
+        return css::uno::Any( &p8, rType );
+    else if (rType == Interface9::static_type())
+        return css::uno::Any( &p9, rType );
+    else if (rType == Interface10::static_type())
+        return css::uno::Any( &p10, rType );
+    else if (rType == Interface11::static_type())
+        return css::uno::Any( &p11, rType );
+    else if (rType == Interface12::static_type())
+        return css::uno::Any( &p12, rType );
+    else if (rType == Interface13::static_type())
+        return css::uno::Any( &p13, rType );
+    else
+        return css::uno::Any();
+}
+
+/** Compares demanded type to given template argument types.
+    @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class 
Interface4, class Interface5,
+          class Interface6, class Interface7, class Interface8, class 
Interface9, class Interface10,
+          class Interface11, class Interface12, class Interface13, class 
Interface14 >
+inline css::uno::Any SAL_CALL queryInterface(
+    const css::uno::Type & rType,
+    Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, 
Interface5 * p5,
+    Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, 
Interface10 * p10,
+    Interface11 * p11, Interface12 * p12, Interface13 * p13, Interface14 * p14 
)
+{
+    if (rType == Interface1::static_type())
+        return css::uno::Any( &p1, rType );
+    else if (rType == Interface2::static_type())
+        return css::uno::Any( &p2, rType );
+    else if (rType == Interface3::static_type())
+        return css::uno::Any( &p3, rType );
+    else if (rType == Interface4::static_type())
+        return css::uno::Any( &p4, rType );
+    else if (rType == Interface5::static_type())
+        return css::uno::Any( &p5, rType );
+    else if (rType == Interface6::static_type())
+        return css::uno::Any( &p6, rType );
+    else if (rType == Interface7::static_type())
+        return css::uno::Any( &p7, rType );
+    else if (rType == Interface8::static_type())
+        return css::uno::Any( &p8, rType );
+    else if (rType == Interface9::static_type())
+        return css::uno::Any( &p9, rType );
+    else if (rType == Interface10::static_type())
+        return css::uno::Any( &p10, rType );
+    else if (rType == Interface11::static_type())
+        return css::uno::Any( &p11, rType );
+    else if (rType == Interface12::static_type())
+        return css::uno::Any( &p12, rType );
+    else if (rType == Interface13::static_type())
+        return css::uno::Any( &p13, rType );
+    else if (rType == Interface14::static_type())
+        return css::uno::Any( &p14, rType );
+    else
+        return css::uno::Any();
+}
+
+/** Compares demanded type to given template argument types.
+    @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class 
Interface4, class Interface5,
+          class Interface6, class Interface7, class Interface8, class 
Interface9, class Interface10,
+          class Interface11, class Interface12, class Interface13, class 
Interface14, class Interface15,
+          class Interface16, class Interface17 >
+inline css::uno::Any SAL_CALL queryInterface(
+    const css::uno::Type & rType,
+    Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, 
Interface5 * p5,
+    Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, 
Interface10 * p10,
+    Interface11 * p11, Interface12 * p12, Interface13 * p13, Interface14 * 
p14, Interface15 * p15,
+    Interface16 * p16, Interface17 * p17 )
+{
+    if (rType == Interface1::static_type())
+        return css::uno::Any( &p1, rType );
+    else if (rType == Interface2::static_type())
+        return css::uno::Any( &p2, rType );
+    else if (rType == Interface3::static_type())
+        return css::uno::Any( &p3, rType );
+    else if (rType == Interface4::static_type())
+        return css::uno::Any( &p4, rType );
+    else if (rType == Interface5::static_type())
+        return css::uno::Any( &p5, rType );
+    else if (rType == Interface6::static_type())
+        return css::uno::Any( &p6, rType );
+    else if (rType == Interface7::static_type())
+        return css::uno::Any( &p7, rType );
+    else if (rType == Interface8::static_type())
+        return css::uno::Any( &p8, rType );
+    else if (rType == Interface9::static_type())
+        return css::uno::Any( &p9, rType );
+    else if (rType == Interface10::static_type())
+        return css::uno::Any( &p10, rType );
+    else if (rType == Interface11::static_type())
+        return css::uno::Any( &p11, rType );
+    else if (rType == Interface12::static_type())
+        return css::uno::Any( &p12, rType );
+    else if (rType == Interface13::static_type())
+        return css::uno::Any( &p13, rType );
+    else if (rType == Interface14::static_type())
+        return css::uno::Any( &p14, rType );
+    else if (rType == Interface15::static_type())
+        return css::uno::Any( &p15, rType );
+    else if (rType == Interface16::static_type())
+        return css::uno::Any( &p16, rType );
+    else if (rType == Interface17::static_type())
+        return css::uno::Any( &p17, rType );
+    else
+        return css::uno::Any();
+}
+
+/** Compares demanded type to given template argument types.
+    @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class 
Interface4, class Interface5,
+          class Interface6, class Interface7, class Interface8, class 
Interface9, class Interface10,
+          class Interface11, class Interface12, class Interface13, class 
Interface14, class Interface15,
+          class Interface16, class Interface17, class Interface18 >
+inline css::uno::Any SAL_CALL queryInterface(
+    const css::uno::Type & rType,
+    Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, 
Interface5 * p5,
+    Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, 
Interface10 * p10,
+    Interface11 * p11, Interface12 * p12, Interface13 * p13, Interface14 * 
p14, Interface15 * p15,
+    Interface16 * p16, Interface17 * p17, Interface18 * p18 )
+{
+    if (rType == Interface1::static_type())
+        return css::uno::Any( &p1, rType );
+    else if (rType == Interface2::static_type())
+        return css::uno::Any( &p2, rType );
+    else if (rType == Interface3::static_type())
+        return css::uno::Any( &p3, rType );
+    else if (rType == Interface4::static_type())
+        return css::uno::Any( &p4, rType );
+    else if (rType == Interface5::static_type())
+        return css::uno::Any( &p5, rType );
+    else if (rType == Interface6::static_type())
+        return css::uno::Any( &p6, rType );
+    else if (rType == Interface7::static_type())
+        return css::uno::Any( &p7, rType );
+    else if (rType == Interface8::static_type())
+        return css::uno::Any( &p8, rType );
+    else if (rType == Interface9::static_type())
+        return css::uno::Any( &p9, rType );
+    else if (rType == Interface10::static_type())
+        return css::uno::Any( &p10, rType );
+    else if (rType == Interface11::static_type())
+        return css::uno::Any( &p11, rType );
+    else if (rType == Interface12::static_type())
+        return css::uno::Any( &p12, rType );
+    else if (rType == Interface13::static_type())
+        return css::uno::Any( &p13, rType );
+    else if (rType == Interface14::static_type())
+        return css::uno::Any( &p14, rType );
+    else if (rType == Interface15::static_type())
+        return css::uno::Any( &p15, rType );
+    else if (rType == Interface16::static_type())
+        return css::uno::Any( &p16, rType );
+    else if (rType == Interface17::static_type())
+        return css::uno::Any( &p17, rType );
+    else if (rType == Interface18::static_type())
+        return css::uno::Any( &p18, rType );
+    else
+        return css::uno::Any();
+}
+
+/** Compares demanded type to given template argument types.
+    @return acquired interface of demanded type or empty Any
+*/
+template< class Interface1, class Interface2, class Interface3, class 
Interface4, class Interface5,
+          class Interface6, class Interface7, class Interface8, class 
Interface9, class Interface10,
+          class Interface11, class Interface12, class Interface13, class 
Interface14, class Interface15,
+          class Interface16, class Interface17, class Interface18, class 
Interface19 >
+inline css::uno::Any SAL_CALL queryInterface(
+    const css::uno::Type & rType,
+    Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, 
Interface5 * p5,
+    Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, 
Interface10 * p10,
+    Interface11 * p11, Interface12 * p12, Interface13 * p13, Interface14 * 
p14, Interface15 * p15,
+    Interface16 * p16, Interface17 * p17, Interface18 * p18, Interface19 * p19 
)
+{
+    if (rType == Interface1::static_type())
+        return css::uno::Any( &p1, rType );
+    else if (rType == Interface2::static_type())
+        return css::uno::Any( &p2, rType );
+    else if (rType == Interface3::static_type())
+        return css::uno::Any( &p3, rType );
+    else if (rType == Interface4::static_type())
+        return css::uno::Any( &p4, rType );
+    else if (rType == Interface5::static_type())
+        return css::uno::Any( &p5, rType );
+    else if (rType == Interface6::static_type())
+        return css::uno::Any( &p6, rType );
+    else if (rType == Interface7::static_type())
+        return css::uno::Any( &p7, rType );
+    else if (rType == Interface8::static_type())
+        return css::uno::Any( &p8, rType );
+    else if (rType == Interface9::static_type())
+        return css::uno::Any( &p9, rType );
+    else if (rType == Interface10::static_type())
+        return css::uno::Any( &p10, rType );
+    else if (rType == Interface11::static_type())
+        return css::uno::Any( &p11, rType );
+    else if (rType == Interface12::static_type())
+        return css::uno::Any( &p12, rType );
+    else if (rType == Interface13::static_type())
+        return css::uno::Any( &p13, rType );
+    else if (rType == Interface14::static_type())
+        return css::uno::Any( &p14, rType );
+    else if (rType == Interface15::static_type())
+        return css::uno::Any( &p15, rType );
+    else if (rType == Interface16::static_type())
+        return css::uno::Any( &p16, rType );
+    else if (rType == Interface17::static_type())
+        return css::uno::Any( &p17, rType );
+    else if (rType == Interface18::static_type())
+        return css::uno::Any( &p18, rType );
+    else if (rType == Interface19::static_type())
+        return css::uno::Any( &p19, rType );
+    else
+        return css::uno::Any();
+}
+
 }
 
 #endif
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);
 }
 

Reply via email to