sc/inc/cellsuno.hxx                        |    9 +++--
 sc/inc/docuno.hxx                          |    8 +++-
 sc/source/filter/inc/workbookhelper.hxx    |    2 -
 sc/source/filter/inc/worksheethelper.hxx   |    2 -
 sc/source/filter/oox/commentsbuffer.cxx    |    2 -
 sc/source/filter/oox/scenariobuffer.cxx    |   45 ++++++++++++-------------
 sc/source/filter/oox/viewsettings.cxx      |    4 +-
 sc/source/filter/oox/workbookhelper.cxx    |   12 +++---
 sc/source/filter/oox/worksheethelper.cxx   |   52 +++++++++++++----------------
 sc/source/filter/oox/worksheetsettings.cxx |    9 ++---
 sc/source/ui/unoobj/cellsuno.cxx           |   10 +++++
 sc/source/ui/unoobj/docuno.cxx             |   22 ++++++++++--
 12 files changed, 105 insertions(+), 72 deletions(-)

New commits:
commit 68f3831bed8907ad67df666e0a7b90dccc665253
Author:     Noel Grandin <[email protected]>
AuthorDate: Sun Feb 22 19:50:54 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Feb 23 09:50:28 2026 +0100

    use more concrete UNO classes
    
    Change-Id: I1c90b783108cd6e221de47c5af7d0a0d7f2ba415
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199991
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 989b0d014c8c..d73613bb6cd8 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -113,8 +113,10 @@ class SfxItemPropertyMap;
 class SfxItemPropertySet;
 struct SfxItemPropertyMapEntry;
 class ScTableRowsObj;
+class ScTableColumnsObj;
 class ScTableValidationObj;
 class ScCellObj;
+class ScScenariosObj;
 class SolarMutexGuard;
 class SvxUnoTextRangeBase;
 
@@ -266,7 +268,7 @@ public:
                             // XPropertySet
     virtual css::uno::Reference< css::beans::XPropertySetInfo >
                             SAL_CALL getPropertySetInfo() override;
-    virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
+    SC_DLLPUBLIC virtual void SAL_CALL   setPropertyValue( const OUString& 
aPropertyName,
                                     const css::uno::Any& aValue ) override;
     virtual css::uno::Any SAL_CALL getPropertyValue(
                                     const OUString& PropertyName ) override;
@@ -629,7 +631,8 @@ public:
     rtl::Reference< ScTableRowsObj >
                             getScRowsByPosition( SolarMutexGuard& rGuard, 
sal_Int32 nLeft, sal_Int32 nTop,
                                 sal_Int32 nRight, sal_Int32 nBottom );
-    rtl::Reference< ScTableRowsObj > getScRows();
+    SC_DLLPUBLIC rtl::Reference< ScTableColumnsObj > getScColumns();
+    SC_DLLPUBLIC rtl::Reference< ScTableRowsObj > getScRows();
     SC_DLLPUBLIC rtl::Reference< ScCellObj >
                             getScCellByPosition( sal_Int32 nColumn, sal_Int32 
nRow );
 };
@@ -958,6 +961,8 @@ public:
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
+    rtl::Reference< ScScenariosObj > getScScenarios() const;
+
 protected:
     void AdjustUpdatedRanges(UpdateRefMode mode) override;
 };
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 5d62c5a13a35..16f4d7fb780e 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -515,6 +515,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
     rtl::Reference<ScTableSheetObj> GetSheetByIndex(sal_Int32 nIndex) const;
+    rtl::Reference<ScTableSheetObj> GetSheetByName(const OUString& rName) 
const;
 };
 
 class ScTableColumnsObj final : public cppu::WeakImplHelper<
@@ -582,6 +583,8 @@ public:
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
+
+    SC_DLLPUBLIC rtl::Reference<ScTableColumnObj> getScTableColumnByIndex( 
sal_Int32 Index ) const;
 };
 
 class ScTableRowsObj final : public cppu::WeakImplHelper<
@@ -644,6 +647,7 @@ public:
 
     void setPropertyValueIsFiltered( SolarMutexGuard& rGuard, bool b );
     bool getPropertyValueOHeight( SolarMutexGuard& rGuard );
+    SC_DLLPUBLIC rtl::Reference<ScTableRowObj> GetTableRowByIndex( sal_Int32 
nIndex) const;
 };
 
 class ScSpreadsheetSettingsObj final : public cppu::WeakImplHelper<
@@ -741,13 +745,13 @@ public:
     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint 
) override;
 
                             /// XScenarios
-    virtual void SAL_CALL   addNewByName( const OUString& aName,
+    SC_DLLPUBLIC virtual void SAL_CALL   addNewByName( const OUString& aName,
                                 const css::uno::Sequence< 
css::table::CellRangeAddress >& aRanges,
                                 const OUString& aComment ) override;
     virtual void SAL_CALL   removeByName( const OUString& aName ) override;
 
                             /// XNameAccess
-    virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
+    SC_DLLPUBLIC virtual css::uno::Any SAL_CALL getByName( const OUString& 
aName ) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
     virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
 
diff --git a/sc/source/filter/inc/workbookhelper.hxx 
b/sc/source/filter/inc/workbookhelper.hxx
index 0f33fcdec84e..83c97cd4ca8b 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -196,7 +196,7 @@ public:
     rtl::Reference< ScTableSheetObj >
                         getSheetFromDoc( sal_Int32 nSheet ) const;
     /** Returns a reference to the specified spreadsheet in the document 
model. */
-    css::uno::Reference< css::sheet::XSpreadsheet >
+    rtl::Reference< ScTableSheetObj >
                         getSheetFromDoc( const OUString& rSheet ) const;
 
     /** Returns the XCellRange interface for the passed cell range address. */
diff --git a/sc/source/filter/inc/worksheethelper.hxx 
b/sc/source/filter/inc/worksheethelper.hxx
index 42e1a6e5f112..364522b5e056 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -181,7 +181,7 @@ public:
     /** Returns the index of the current sheet. */
     SCTAB               getSheetIndex() const;
     /** Returns the XSpreadsheet interface of the current sheet. */
-    const css::uno::Reference< css::sheet::XSpreadsheet >&
+    const rtl::Reference< ScTableSheetObj >&
                         getSheet() const;
 
     /** Returns the XCell interface for the passed cell address. */
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index cc01420cd0a2..1abcb7c8889b 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -198,7 +198,7 @@ void Comment::finalizeImport(const 
VmlDrawing::NoteShapesMap& rNoteShapesMap)
 
     try
     {
-        ScTableSheetObj* pAnnosSupp = 
static_cast<ScTableSheetObj*>(getSheet().get());
+        ScTableSheetObj* pAnnosSupp = getSheet().get();
         rtl::Reference<ScAnnotationsObj> xAnnos = 
static_cast<ScAnnotationsObj*>(pAnnosSupp->getAnnotations().get());
         ScDocShell* pDocShell = xAnnos->GetDocShell();
 
diff --git a/sc/source/filter/oox/scenariobuffer.cxx 
b/sc/source/filter/oox/scenariobuffer.cxx
index cb7ee37b0eae..db7b117c0411 100644
--- a/sc/source/filter/oox/scenariobuffer.cxx
+++ b/sc/source/filter/oox/scenariobuffer.cxx
@@ -119,39 +119,40 @@ void Scenario::finalizeImport()
     {
         /*  Find an unused name for the scenario (Calc stores scenario data in
             hidden sheets named after the scenario following the base sheet). 
*/
-        Reference< XNameAccess > xSheetsNA( getDocument()->getSheets(), 
UNO_QUERY_THROW );
+        rtl::Reference< ScTableSheetsObj > xSheetsNA( 
getDocument()->getScSheets() );
         OUString aScenName = ContainerHelper::getUnusedName( xSheetsNA, 
maModel.maName, '_' );
 
         // create the new scenario sheet
         rtl::Reference< ScTableSheetObj > xScenariosSupp( getSheetFromDoc( 
mnSheet ) );
-        Reference< XScenarios > xScenarios( xScenariosSupp->getScenarios(), 
UNO_SET_THROW );
+        rtl::Reference< ScScenariosObj > xScenarios( 
xScenariosSupp->getScScenarios() );
         xScenarios->addNewByName( aScenName, 
AddressConverter::toApiSequence(aRanges), maModel.maComment );
 
         // write scenario cell values
-        Reference< XSpreadsheet > xSheet( getSheetFromDoc( aScenName ), 
UNO_SET_THROW );
-        for( const auto& rCell : maCells )
+        rtl::Reference< ScTableSheetObj > xSheet( getSheetFromDoc( aScenName ) 
);
+        if (xSheet)
         {
-            if( !rCell.mbDeleted ) try
+            for( const auto& rCell : maCells )
             {
-                // use XCell::setFormula to auto-detect values and strings
-                Reference< XCell > xCell( xSheet->getCellByPosition( 
rCell.maPos.Col(), rCell.maPos.Row() ), UNO_SET_THROW );
-                xCell->setFormula( rCell.maValue );
+                if( !rCell.mbDeleted )
+                {
+                    // use XCell::setFormula to auto-detect values and strings
+                    Reference< XCell > xCell( xSheet->getScCellByPosition( 
rCell.maPos.Col(), rCell.maPos.Row() ) );
+                    if (xCell)
+                        xCell->setFormula( rCell.maValue );
+                }
             }
-            catch( Exception& )
-            {
-            }
-        }
 
-        // scenario properties
-        PropertySet aPropSet( xScenarios->getByName( aScenName ) );
-        aPropSet.setProperty( PROP_IsActive, maModel.mbActive );
-        aPropSet.setProperty( PROP_CopyBack, false );
-        aPropSet.setProperty( PROP_CopyStyles, false );
-        aPropSet.setProperty( PROP_CopyFormulas, false );
-        aPropSet.setProperty( PROP_Protected, maModel.mbLocked );
-        // #112621# do not show/print scenario border
-        aPropSet.setProperty( PROP_ShowBorder, false );
-        aPropSet.setProperty( PROP_PrintBorder, false );
+            // scenario properties
+            PropertySet aPropSet( xScenarios->getByName( aScenName ) );
+            aPropSet.setProperty( PROP_IsActive, maModel.mbActive );
+            aPropSet.setProperty( PROP_CopyBack, false );
+            aPropSet.setProperty( PROP_CopyStyles, false );
+            aPropSet.setProperty( PROP_CopyFormulas, false );
+            aPropSet.setProperty( PROP_Protected, maModel.mbLocked );
+            // #112621# do not show/print scenario border
+            aPropSet.setProperty( PROP_ShowBorder, false );
+            aPropSet.setProperty( PROP_PrintBorder, false );
+        }
     }
     catch( Exception& )
     {
diff --git a/sc/source/filter/oox/viewsettings.cxx 
b/sc/source/filter/oox/viewsettings.cxx
index 33a1beb35f38..4dd52420e198 100644
--- a/sc/source/filter/oox/viewsettings.cxx
+++ b/sc/source/filter/oox/viewsettings.cxx
@@ -44,6 +44,7 @@
 #include <worksheetbuffer.hxx>
 #include <vcl/svapp.hxx>
 #include <docuno.hxx>
+#include <cellsuno.hxx>
 
 namespace com::sun::star::container { class XNameContainer; }
 
@@ -354,8 +355,7 @@ void SheetViewSettings::finalizeImport()
     {
         // active tab/sheet cannot be hidden
         // always force it to be displayed
-        PropertySet aPropSet( getSheet() );
-        aPropSet.setProperty( PROP_IsVisible, true );
+        getSheet()->setPropertyValue( u"IsVisible"_ustr, Any(true) );
     }
     // visible area and current cursor position (selection not supported via 
API)
     ScAddress aFirstPos = xModel->maFirstPos;
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 1a204aa97312..1b9e2ed4617a 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -866,13 +866,12 @@ rtl::Reference< ScTableSheetObj > 
WorkbookHelper::getSheetFromDoc( sal_Int32 nSh
     return xSheetsIA->GetSheetByIndex( nSheet );
 }
 
-Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( const OUString& 
rSheet ) const
+rtl::Reference< ScTableSheetObj > WorkbookHelper::getSheetFromDoc( const 
OUString& rSheet ) const
 {
-    Reference< XSpreadsheet > xSheet;
+    rtl::Reference< ScTableSheetObj > xSheet;
     try
     {
-        Reference< XNameAccess > xSheetsNA( getDocument()->getSheets(), 
UNO_QUERY_THROW );
-        xSheet.set( xSheetsNA->getByName( rSheet ), UNO_QUERY );
+        xSheet = getDocument()->getScSheets()->GetSheetByName( rSheet );
     }
     catch( Exception& )
     {
@@ -885,8 +884,9 @@ Reference< XCellRange > 
WorkbookHelper::getCellRangeFromDoc( const ScRange& rRan
     Reference< XCellRange > xRange;
     try
     {
-        Reference< XSpreadsheet > xSheet( getSheetFromDoc( rRange.aStart.Tab() 
), UNO_SET_THROW );
-        xRange = xSheet->getCellRangeByPosition( rRange.aStart.Col(), 
rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() );
+        rtl::Reference< ScTableSheetObj > xSheet( getSheetFromDoc( 
rRange.aStart.Tab() ) );
+        if (xSheet)
+            xRange = xSheet->getCellRangeByPosition( rRange.aStart.Col(), 
rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() );
     }
     catch( Exception& )
     {
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index f16a962d858e..5734bfd8ea24 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -224,7 +224,7 @@ public:
     /** Returns the index of the current sheet. */
     SCTAB        getSheetIndex() const { return maUsedArea.aStart.Tab(); }
     /** Returns the XSpreadsheet interface of the current sheet. */
-    const Reference< XSpreadsheet >& getSheet() const { return mxSheet; }
+    const rtl::Reference< ScTableSheetObj >& getSheet() const { return 
mxSheet; }
 
     /** Returns the XCell interface for the passed cell address. */
     rtl::Reference< ScCellObj > getCell( const ScAddress& rAddress ) const;
@@ -398,7 +398,7 @@ private:
     ISegmentProgressBarRef mxRowProgress;   /// Progress bar for row/cell 
processing.
     ISegmentProgressBarRef mxFinalProgress; /// Progress bar for finalization.
     WorksheetType       meSheetType;        /// Type of this sheet.
-    Reference< XSpreadsheet > mxSheet;      /// Reference to the current sheet.
+    rtl::Reference< ScTableSheetObj > mxSheet;      /// Reference to the 
current sheet.
     bool                mbHasDefWidth;      /// True = default column width is 
set from defaultColWidth attribute.
 };
 
@@ -476,17 +476,15 @@ rtl::Reference<ScCellRangesObj> 
WorksheetGlobals::getCellRangeList( const ScRang
 
 Reference< XCellRange > WorksheetGlobals::getColumn( sal_Int32 nCol ) const
 {
-    Reference< XCellRange > xColumn;
     try
     {
-        Reference< XColumnRowRange > xColRowRange( mxSheet, UNO_QUERY_THROW );
-        Reference< XTableColumns > xColumns( xColRowRange->getColumns(), 
UNO_SET_THROW );
-        xColumn.set( xColumns->getByIndex( nCol ), UNO_QUERY );
+        if (mxSheet)
+            return mxSheet->getScColumns()->getScTableColumnByIndex( nCol );
     }
     catch( Exception& )
     {
     }
-    return xColumn;
+    return {};
 }
 
 Reference< XCellRange > WorksheetGlobals::getRow( sal_Int32 nRow ) const
@@ -494,9 +492,7 @@ Reference< XCellRange > WorksheetGlobals::getRow( sal_Int32 
nRow ) const
     Reference< XCellRange > xRow;
     try
     {
-        Reference< XColumnRowRange > xColRowRange( mxSheet, UNO_QUERY_THROW );
-        Reference< XTableRows > xRows( xColRowRange->getRows(), UNO_SET_THROW 
);
-        xRow.set( xRows->getByIndex( nRow ), UNO_QUERY );
+        xRow = mxSheet->getScRows()->GetTableRowByIndex( nRow );
     }
     catch( Exception& )
     {
@@ -509,7 +505,8 @@ Reference< XDrawPage > WorksheetGlobals::getDrawPage() const
     Reference< XDrawPage > xDrawPage;
     try
     {
-        xDrawPage = Reference< XDrawPageSupplier >( mxSheet, UNO_QUERY_THROW 
)->getDrawPage();
+        if (mxSheet)
+            xDrawPage = mxSheet->getDrawPage();
     }
     catch( Exception& )
     {
@@ -1314,20 +1311,22 @@ void WorksheetGlobals::groupColumnsOrRows( sal_Int32 
nFirstColRow, sal_Int32 nLa
 {
     try
     {
-        Reference< XSheetOutline > xOutline( mxSheet, UNO_QUERY_THROW );
-        if( bRows )
+        if (mxSheet)
         {
-            CellRangeAddress aRange( getSheetIndex(), 0, nFirstColRow, 0, 
nLastColRow );
-            xOutline->group( aRange, TableOrientation_ROWS );
-            if( bCollapse )
-                xOutline->hideDetail( aRange );
-        }
-        else
-        {
-            CellRangeAddress aRange( getSheetIndex(), nFirstColRow, 0, 
nLastColRow, 0 );
-            xOutline->group( aRange, TableOrientation_COLUMNS );
-            if( bCollapse )
-                xOutline->hideDetail( aRange );
+            if( bRows )
+            {
+                CellRangeAddress aRange( getSheetIndex(), 0, nFirstColRow, 0, 
nLastColRow );
+                mxSheet->group( aRange, TableOrientation_ROWS );
+                if( bCollapse )
+                    mxSheet->hideDetail( aRange );
+            }
+            else
+            {
+                CellRangeAddress aRange( getSheetIndex(), nFirstColRow, 0, 
nLastColRow, 0 );
+                mxSheet->group( aRange, TableOrientation_COLUMNS );
+                if( bCollapse )
+                    mxSheet->hideDetail( aRange );
+            }
         }
     }
     catch( Exception& )
@@ -1390,8 +1389,7 @@ void WorksheetGlobals::finalizeDrawings()
         drawing shapes to simplify calculation of shape coordinates. */
     if( maSheetViewSett.isSheetRightToLeft() )
     {
-        PropertySet aPropSet( mxSheet );
-        aPropSet.setProperty( PROP_TableLayout, WritingMode2::RL_TB );
+        mxSheet->setPropertyValue( u"TableLayout"_ustr, 
Any(WritingMode2::RL_TB) );
     }
 }
 
@@ -1425,7 +1423,7 @@ SCTAB WorksheetHelper::getSheetIndex() const
     return mrSheetGlob.getSheetIndex();
 }
 
-const Reference< XSpreadsheet >& WorksheetHelper::getSheet() const
+const rtl::Reference< ScTableSheetObj >& WorksheetHelper::getSheet() const
 {
     return mrSheetGlob.getSheet();
 }
diff --git a/sc/source/filter/oox/worksheetsettings.cxx 
b/sc/source/filter/oox/worksheetsettings.cxx
index 9cc98952049f..ab079b2bface 100644
--- a/sc/source/filter/oox/worksheetsettings.cxx
+++ b/sc/source/filter/oox/worksheetsettings.cxx
@@ -32,6 +32,7 @@
 #include <document.hxx>
 #include <addressconverter.hxx>
 #include <biffhelper.hxx>
+#include <cellsuno.hxx>
 
 namespace oox::xls {
 
@@ -278,20 +279,20 @@ void WorksheetSettings::finalizeImport()
     }
 
     // VBA code name
-    PropertySet aPropSet( getSheet() );
-    aPropSet.setProperty( PROP_CodeName, maSheetSettings.maCodeName );
+    auto xSheet = getSheet();
+    xSheet->setPropertyValue( u"CodeName"_ustr, 
Any(maSheetSettings.maCodeName) );
 
     // sheet tab color
     if( !maSheetSettings.maTabColor.isAuto() )
     {
         ::Color nColor = maSheetSettings.maTabColor.getColor( 
getBaseFilter().getGraphicHelper() );
-        aPropSet.setProperty( PROP_TabColor, nColor );
+        xSheet->setPropertyValue( u"TabColor"_ustr, Any(nColor) );
     }
 
     // Summary data below or above the contents
     if ( !maSheetSettings.mbSummaryBelow )
     {
-        aPropSet.setProperty( PROP_TotalsRowBelow, false );
+        xSheet->setPropertyValue( u"TotalsRowBelow"_ustr, Any(false) );
     }
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 65db2956d28c..e70cf51591a6 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4692,6 +4692,11 @@ rtl::Reference<ScCellRangeObj> 
ScCellRangeObj::getScCellRangeByName(
 // XColumnRowRange
 
 uno::Reference<table::XTableColumns> SAL_CALL ScCellRangeObj::getColumns()
+{
+    return getScColumns();
+}
+
+rtl::Reference<ScTableColumnsObj> ScCellRangeObj::getScColumns()
 {
     SolarMutexGuard aGuard;
     ScDocShell* pDocSh = GetDocShell();
@@ -6528,6 +6533,11 @@ uno::Reference<sheet::XDataPilotTables> SAL_CALL 
ScTableSheetObj::getDataPilotTa
 }
 
 uno::Reference<sheet::XScenarios> SAL_CALL ScTableSheetObj::getScenarios()
+{
+    return getScScenarios();
+}
+
+rtl::Reference<ScScenariosObj> ScTableSheetObj::getScScenarios() const
 {
     SolarMutexGuard aGuard;
     ScDocShell* pDocSh = GetDocShell();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 36864d1c266e..ccc8397575de 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4534,13 +4534,18 @@ sal_Bool SAL_CALL ScTableSheetsObj::hasElements()
 // XNameAccess
 
 uno::Any SAL_CALL ScTableSheetsObj::getByName( const OUString& aName )
+{
+    return 
uno::Any(uno::Reference<sheet::XSpreadsheet>(GetSheetByName(aName)));
+}
+
+rtl::Reference<ScTableSheetObj> ScTableSheetsObj::GetSheetByName( const 
OUString& aName ) const
 {
     SolarMutexGuard aGuard;
     rtl::Reference<ScTableSheetObj> xSheet(GetObjectByName_Impl(aName));
     if (!xSheet.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(uno::Reference<sheet::XSpreadsheet>(xSheet));
+    return xSheet;
 }
 
 uno::Sequence<OUString> SAL_CALL ScTableSheetsObj::getElementNames()
@@ -4680,14 +4685,18 @@ sal_Int32 SAL_CALL ScTableColumnsObj::getCount()
 }
 
 uno::Any SAL_CALL ScTableColumnsObj::getByIndex( sal_Int32 nIndex )
+{
+    return 
uno::Any(uno::Reference<table::XCellRange>(getScTableColumnByIndex(nIndex)));
+}
+
+rtl::Reference<ScTableColumnObj> ScTableColumnsObj::getScTableColumnByIndex( 
sal_Int32 nIndex ) const
 {
     SolarMutexGuard aGuard;
     rtl::Reference<ScTableColumnObj> xColumn(GetObjectByIndex_Impl(nIndex));
     if (!xColumn.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(uno::Reference<table::XCellRange>(xColumn));
-
+    return xColumn;
 }
 
 uno::Type SAL_CALL ScTableColumnsObj::getElementType()
@@ -4922,13 +4931,18 @@ sal_Int32 SAL_CALL ScTableRowsObj::getCount()
 }
 
 uno::Any SAL_CALL ScTableRowsObj::getByIndex( sal_Int32 nIndex )
+{
+    return 
uno::Any(uno::Reference<table::XCellRange>(GetTableRowByIndex(nIndex)));
+}
+
+rtl::Reference<ScTableRowObj> ScTableRowsObj::GetTableRowByIndex( sal_Int32 
nIndex ) const
 {
     SolarMutexGuard aGuard;
     rtl::Reference<ScTableRowObj> xRow(GetObjectByIndex_Impl(nIndex));
     if (!xRow.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(uno::Reference<table::XCellRange>(xRow));
+    return xRow;
 }
 
 uno::Type SAL_CALL ScTableRowsObj::getElementType()

Reply via email to