sw/source/core/unocore/unotext.cxx |   15 ++++++-------
 sw/source/filter/xml/xmltbli.cxx   |    5 +---
 sw/source/ui/vba/vbarows.cxx       |   41 +++++++++++++++++++------------------
 sw/source/ui/vba/vbarows.hxx       |    9 +++++---
 sw/source/ui/vba/vbaselection.cxx  |   14 +++++++++---
 sw/source/ui/vba/vbaselection.hxx  |    4 ++-
 sw/source/ui/vba/vbatable.cxx      |   36 ++++++++++++--------------------
 sw/source/ui/vba/vbatable.hxx      |    5 ++--
 sw/source/ui/vba/vbatables.cxx     |    6 +++--
 sw/source/ui/vba/wordvbahelper.cxx |    5 ++--
 10 files changed, 74 insertions(+), 66 deletions(-)

New commits:
commit 634cf166e04760f198b0019698d1f23ab8a67e9a
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Feb 9 17:03:43 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Feb 10 15:20:10 2026 +0100

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

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index e53e322aac70..94c4531c0128 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1795,11 +1795,11 @@ namespace {
 // Move previously imported paragraphs into a new text table.
 struct VerticallyMergedCell
 {
-    std::vector<uno::Reference< beans::XPropertySet > > aCells;
+    std::vector<rtl::Reference< SwXCell > > aCells;
     sal_Int32                                           nLeftPosition;
     bool                                                bOpen;
 
-    VerticallyMergedCell(uno::Reference< beans::XPropertySet > const& rxCell,
+    VerticallyMergedCell(rtl::Reference< SwXCell > const& rxCell,
             const sal_Int32 nLeft)
         : nLeftPosition( nLeft )
         , bOpen( true )
@@ -2074,10 +2074,9 @@ static void
 lcl_ApplyCellProperties(
     const sal_Int32 nLeftPos,
     const uno::Sequence< beans::PropertyValue >& rCellProperties,
-    const uno::Reference< uno::XInterface >& xCell,
+    const rtl::Reference< SwXCell >& xCell,
     std::vector<VerticallyMergedCell> & rMergedCells)
 {
-    const uno::Reference< beans::XPropertySet > xCellPS(xCell, uno::UNO_QUERY);
     for (const auto& rCellProperty : rCellProperties)
     {
         const OUString & rName  = rCellProperty.Name;
@@ -2100,7 +2099,7 @@ lcl_ApplyCellProperties(
                     }
                 }
                 // add the new group of merged cells
-                rMergedCells.emplace_back(xCellPS, nLeftPos);
+                rMergedCells.emplace_back(xCell, nLeftPos);
             }
             else
             {
@@ -2110,7 +2109,7 @@ lcl_ApplyCellProperties(
                 {
                     if (aMergedCell.bOpen && 
lcl_SimilarPosition(aMergedCell.nLeftPosition, nLeftPos))
                     {
-                        aMergedCell.aCells.push_back( xCellPS );
+                        aMergedCell.aCells.push_back( xCell );
                         bFound = true;
                     }
                 }
@@ -2138,7 +2137,7 @@ lcl_ApplyCellProperties(
                 };
                 if (std::find(vDenylist.begin(), vDenylist.end(), rName) == 
vDenylist.end())
                 {
-                    xCellPS->setPropertyValue(rName, rValue);
+                    xCell->setPropertyValue(rName, rValue);
                 }
             }
             catch (const uno::Exception&)
@@ -2325,7 +2324,7 @@ SwXText::convertToSwTable(
             {
                 lcl_ApplyCellProperties(lcl_GetLeftPos(nCell, 
aRowSeparators[nRow]),
                     rCellProps,
-                    xRet->getCellByPosition(nCell, nRow),
+                    xRet->getSwCellByPosition(nCell, nRow),
                     aMergedCells);
                 ++nCell;
             }
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index ef873fcf3838..f592ed21c2b2 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1223,10 +1223,9 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& 
rImport,
     // xml:id for RDF metadata
     GetImport().SetXmlId(uno::Reference<XTextTable>(xTable), sXmlId);
 
-    Reference < XCell > xCell = xTable->getCellByPosition( 0, 0 );
-    Reference < XText> xText( xCell, UNO_QUERY );
+    rtl::Reference< SwXCell > xCell = xTable->getSwCellByPosition( 0, 0 );
     m_xOldCursor = GetImport().GetTextImport()->GetCursor();
-    GetImport().GetTextImport()->SetCursor( xText->createTextCursor() );
+    GetImport().GetTextImport()->SetCursor( xCell->createTextCursor() );
 
     // take care of open redlines for tables
     GetImport().GetTextImport()->RedlineAdjustStartNodeCursor();
diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx
index e33f732e7638..1ad673b6c431 100644
--- a/sw/source/ui/vba/vbarows.cxx
+++ b/sw/source/ui/vba/vbarows.cxx
@@ -30,6 +30,7 @@
 #include "vbatablehelper.hxx"
 #include "wordvbahelper.hxx"
 #include <unotxdoc.hxx>
+#include <unotbl.hxx>
 
 using namespace ::ooo::vba;
 using namespace ::ooo::vba::word;
@@ -67,13 +68,22 @@ public:
 
 }
 
-SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const 
uno::Reference< uno::XComponentContext > & xContext, uno::Reference< 
text::XTextTable >  xTextTable, const uno::Reference< table::XTableRows >& 
xTableRows ) : SwVbaRows_BASE( xParent, xContext, uno::Reference< 
container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), 
mxTextTable(std::move( xTextTable )), mxTableRows( xTableRows )
+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent,
+                      const uno::Reference< uno::XComponentContext > & 
xContext,
+                      rtl::Reference< SwXTextTable > xTextTable,
+                      const uno::Reference< table::XTableRows >& xTableRows )
+: SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess 
>( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable(std::move( xTextTable )), 
mxTableRows( xTableRows )
 {
     mnStartRowIndex = 0;
     mnEndRowIndex = m_xIndexAccess->getCount() - 1;
 }
 
-SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const 
uno::Reference< uno::XComponentContext > & xContext, uno::Reference< 
text::XTextTable >  xTextTable, const uno::Reference< table::XTableRows >& 
xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) : SwVbaRows_BASE( 
xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, 
uno::UNO_QUERY_THROW ) ), mxTextTable(std::move( xTextTable )), mxTableRows( 
xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( nEndIndex )
+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent,
+                      const uno::Reference< uno::XComponentContext > & 
xContext,
+                      rtl::Reference< SwXTextTable > xTextTable,
+                      const uno::Reference< table::XTableRows >& xTableRows,
+                      sal_Int32 nStarIndex, sal_Int32 nEndIndex )
+: SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess 
>( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable(std::move( xTextTable )), 
mxTableRows( xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( 
nEndIndex )
 {
     if( mnEndRowIndex < mnStartRowIndex )
         throw uno::RuntimeException();
@@ -87,8 +97,7 @@ SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface 
>& xParent, const u
 ::sal_Int32 SAL_CALL SwVbaRows::getAlignment()
 {
     sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, 
uno::UNO_QUERY_THROW );
-    xTableProps->getPropertyValue(u"HoriOrient"_ustr) >>= nAlignment;
+    mxTextTable->getPropertyValue(u"HoriOrient"_ustr) >>= nAlignment;
     sal_Int32 nRet = 0;
     switch( nAlignment )
     {
@@ -130,8 +139,7 @@ void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 
_alignment )
             nAlignment = text::HoriOrientation::LEFT;
         }
     }
-    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, 
uno::UNO_QUERY_THROW );
-    xTableProps->setPropertyValue(u"HoriOrient"_ustr, uno::Any( nAlignment ) );
+    mxTextTable->setPropertyValue(u"HoriOrient"_ustr, uno::Any( nAlignment ) );
 }
 
 uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages()
@@ -170,8 +178,7 @@ void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const 
uno::Any& _allowbreakac
 float SAL_CALL SwVbaRows::getSpaceBetweenColumns()
 {
     // just get the first spacing of the first cell
-    uno::Reference< table::XCellRange > xCellRange( mxTextTable, 
uno::UNO_QUERY_THROW );
-    uno::Reference< beans::XPropertySet > xCellProps( 
xCellRange->getCellByPosition( 0, mnStartRowIndex ), uno::UNO_QUERY_THROW );
+    rtl::Reference< SwXCell > xCellProps( mxTextTable->getSwCellByPosition( 0, 
mnStartRowIndex ) );
     sal_Int32 nLeftBorderDistance = 0;
     sal_Int32 nRightBorderDistance = 0;
     xCellProps->getPropertyValue(u"LeftBorderDistance"_ustr) >>= 
nLeftBorderDistance;
@@ -183,14 +190,13 @@ void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float 
_spacebetweencolumns )
 {
     sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( 
_spacebetweencolumns ) / 2;
     uno::Reference< container::XIndexAccess > xColumnAccess( 
mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-    uno::Reference< table::XCellRange > xCellRange( mxTextTable, 
uno::UNO_QUERY_THROW );
     SwVbaTableHelper aTableHelper( mxTextTable );
     for( sal_Int32 row = mnStartRowIndex; row <= mnEndRowIndex; ++row )
     {
         sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
         for( sal_Int32 column = 0; column < nColumns; ++column )
         {
-            uno::Reference< beans::XPropertySet > xCellProps( 
xCellRange->getCellByPosition( column, row ), uno::UNO_QUERY_THROW );
+            rtl::Reference< SwXCell > xCellProps( 
mxTextTable->getSwCellByPosition( column, row ) );
             xCellProps->setPropertyValue(u"LeftBorderDistance"_ustr, uno::Any( 
nSpace ) );
             xCellProps->setPropertyValue(u"RightBorderDistance"_ustr, 
uno::Any( nSpace ) );
         }
@@ -237,11 +243,10 @@ void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, 
::sal_Int32 RulerStyle
 
 void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent )
 {
-    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, 
uno::UNO_QUERY_THROW );
     sal_Int32 nMargin = 0;
-    xTableProps->getPropertyValue(u"LeftMargin"_ustr) >>= nMargin;
+    mxTextTable->getPropertyValue(u"LeftMargin"_ustr) >>= nMargin;
     nMargin += indent;
-    xTableProps->setPropertyValue(u"LeftMargin"_ustr, uno::Any( nMargin ) );
+    mxTextTable->setPropertyValue(u"LeftMargin"_ustr, uno::Any( nMargin ) );
 }
 
  void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< 
word::XColumns >& xColumns, sal_Int32 indent )
@@ -260,9 +265,8 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent )
 )
  {
     // calculate the new width and get the proportion between old and new
-    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, 
uno::UNO_QUERY_THROW );
     sal_Int32 nWidth = 0;
-    xTableProps->getPropertyValue(u"Width"_ustr) >>= nWidth;
+    mxTextTable->getPropertyValue(u"Width"_ustr) >>= nWidth;
     sal_Int32 nNewWidth = nWidth - indent;
     if ((nNewWidth <= 0) || (nWidth <= 0))
     {
@@ -286,15 +290,14 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent 
)
 
     // set the width and position of the table
     setIndentWithAdjustNone( indent );
-    xTableProps->setPropertyValue(u"Width"_ustr, uno::Any( nNewWidth ) );
+    mxTextTable->setPropertyValue(u"Width"_ustr, uno::Any( nNewWidth ) );
  }
 
  void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< 
word::XColumns >& xColumns, sal_Int32 indent )
  {
     // calculate the new width and get the width of all columns
-    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, 
uno::UNO_QUERY_THROW );
     sal_Int32 nWidth = 0;
-    xTableProps->getPropertyValue(u"Width"_ustr) >>= nWidth;
+    mxTextTable->getPropertyValue(u"Width"_ustr) >>= nWidth;
     sal_Int32 nNewWidth = nWidth - indent;
 
     // get all columns, calculate and set the new width of the columns
@@ -309,7 +312,7 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent )
 
     // set the width and position of the table
     setIndentWithAdjustNone( indent );
-    xTableProps->setPropertyValue(u"Width"_ustr, uno::Any( nNewWidth ) );
+    mxTextTable->setPropertyValue(u"Width"_ustr, uno::Any( nNewWidth ) );
  }
 
 void SAL_CALL SwVbaRows::Select(  )
diff --git a/sw/source/ui/vba/vbarows.hxx b/sw/source/ui/vba/vbarows.hxx
index 98a1069fa8a4..2023dae53bc3 100644
--- a/sw/source/ui/vba/vbarows.hxx
+++ b/sw/source/ui/vba/vbarows.hxx
@@ -24,13 +24,16 @@
 #include <ooo/vba/word/XColumns.hpp>
 #include <com/sun/star/table/XTableRows.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
+#include <rtl/ref.hxx>
+
+class SwXTextTable;
 
 typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
 
 class SwVbaRows : public SwVbaRows_BASE
 {
 private:
-    css::uno::Reference< css::text::XTextTable > mxTextTable;
+    rtl::Reference< SwXTextTable > mxTextTable;
     css::uno::Reference< css::table::XTableRows > mxTableRows;
     sal_Int32 mnStartRowIndex;
     sal_Int32 mnEndRowIndex;
@@ -47,9 +50,9 @@ private:
 
 public:
     /// @throws css::uno::RuntimeException
-    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, 
const css::uno::Reference< css::uno::XComponentContext > & xContext, 
css::uno::Reference< css::text::XTextTable >  xTextTable, const 
css::uno::Reference< css::table::XTableRows >& xTableRows );
+    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, 
const css::uno::Reference< css::uno::XComponentContext > & xContext, 
rtl::Reference< SwXTextTable >  xTextTable, const css::uno::Reference< 
css::table::XTableRows >& xTableRows );
     /// @throws css::uno::RuntimeException
-    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, 
const css::uno::Reference< css::uno::XComponentContext > & xContext, 
css::uno::Reference< css::text::XTextTable >  xTextTable, const 
css::uno::Reference< css::table::XTableRows >& xTableRows, sal_Int32 
nStarIndex, sal_Int32 nEndIndex );
+    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, 
const css::uno::Reference< css::uno::XComponentContext > & xContext, 
rtl::Reference< SwXTextTable >  xTextTable, const css::uno::Reference< 
css::table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex 
);
 
     // Attributes
     virtual ::sal_Int32 SAL_CALL getAlignment() override;
diff --git a/sw/source/ui/vba/vbaselection.cxx 
b/sw/source/ui/vba/vbaselection.cxx
index 88d2d6a47b76..549e2da4f701 100644
--- a/sw/source/ui/vba/vbaselection.cxx
+++ b/sw/source/ui/vba/vbaselection.cxx
@@ -805,7 +805,9 @@ SwVbaSelection::Tables( const uno::Any& aIndex )
     xCursorProps->getPropertyValue(u"TextTable"_ustr) >>= xTextTable;
     if( xTextTable.is() )
     {
-            uno::Reference< word::XTable > xVBATable = new SwVbaTable( 
mxParent, mxContext, mxModel, xTextTable );
+            auto pSwTextTable = dynamic_cast<SwXTextTable*>(xTextTable.get());
+            assert(pSwTextTable);
+            uno::Reference< word::XTable > xVBATable = new SwVbaTable( 
mxParent, mxContext, mxModel, pSwTextTable );
             aRet <<= xVBATable;
             return aRet;
     }
@@ -910,7 +912,7 @@ uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& 
index )
 
     sal_Int32 nStartRow = 0;
     sal_Int32 nEndRow = 0;
-    uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
+    rtl::Reference< SwXTextTable > xTextTable = GetXTextTable();
     SwVbaTableHelper aTableHelper( xTextTable );
     nStartRow = aTableHelper.getTabRowIndex( sTLName );
     if( !sBRName.isEmpty() )
@@ -954,12 +956,16 @@ uno::Any SAL_CALL SwVbaSelection::Columns( const 
uno::Any& index )
     return uno::Any( xCol );
 }
 
-uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() const
+rtl::Reference< SwXTextTable > SwVbaSelection::GetXTextTable() const
 {
     uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, 
uno::UNO_QUERY_THROW );
     uno::Reference< text::XTextTable > xTextTable;
     xCursorProps->getPropertyValue(u"TextTable"_ustr) >>= xTextTable;
-    return xTextTable;
+    if (!xTextTable)
+        return nullptr;
+    auto pSwTextTable = dynamic_cast<SwXTextTable*>(xTextTable.get());
+    assert(pSwTextTable);
+    return pSwTextTable;
 }
 
 bool SwVbaSelection::IsInTable() const
diff --git a/sw/source/ui/vba/vbaselection.hxx 
b/sw/source/ui/vba/vbaselection.hxx
index 92f92a9503fa..a4a4199dab86 100644
--- a/sw/source/ui/vba/vbaselection.hxx
+++ b/sw/source/ui/vba/vbaselection.hxx
@@ -30,6 +30,8 @@
 #include <ooo/vba/word/XHeaderFooter.hpp>
 #include "wordvbahelper.hxx"
 
+class SwXTextTable;
+
 typedef InheritedHelperInterfaceWeakImpl< ooo::vba::word::XSelection > 
SwVbaSelection_BASE;
 
 class SwVbaSelection : public SwVbaSelection_BASE
@@ -50,7 +52,7 @@ private:
     /// @throws css::uno::RuntimeException
     void GetSelectedCellRange( OUString& sTLName, OUString& sBRName );
     /// @throws css::uno::RuntimeException
-    css::uno::Reference< css::text::XTextTable > GetXTextTable() const;
+    rtl::Reference< SwXTextTable > GetXTextTable() const;
     /// @throws css::uno::RuntimeException
     bool IsInTable() const;
     /// @throws css::uno::RuntimeException
diff --git a/sw/source/ui/vba/vbatable.cxx b/sw/source/ui/vba/vbatable.cxx
index af247f7154f9..5c6866cc2406 100644
--- a/sw/source/ui/vba/vbatable.cxx
+++ b/sw/source/ui/vba/vbatable.cxx
@@ -34,6 +34,7 @@
 #include "vbacolumns.hxx"
 #include "vbaapplication.hxx"
 #include <unotxdoc.hxx>
+#include <unotbl.hxx>
 
 #include <tools/UnitConversion.hxx>
 
@@ -45,11 +46,11 @@ using namespace ::com::sun::star;
 SwVbaTable::SwVbaTable(  const uno::Reference< ooo::vba::XHelperInterface >& 
rParent,
                          const uno::Reference< uno::XComponentContext >& 
rContext,
                          rtl::Reference< SwXTextDocument > xDocument,
-                         const  uno::Reference< text::XTextTable >& xTextTable)
+                         const rtl::Reference< SwXTextTable >& xTextTable)
 : SwVbaTable_BASE( rParent, rContext ),
   mxTextDocument(std::move( xDocument ))
 {
-    mxTextTable.set( xTextTable, uno::UNO_SET_THROW );
+    mxTextTable = xTextTable;
 }
 
 uno::Reference< word::XRange > SAL_CALL
@@ -67,7 +68,7 @@ SwVbaTable::Select(  )
     uno::Reference< view::XSelectionSupplier > xSelectionSupplier( 
xController, uno::UNO_QUERY_THROW );
 
     // set the view cursor to the start of the table.
-    xSelectionSupplier->select( uno::Any( mxTextTable ) );
+    xSelectionSupplier->select( uno::Any( 
uno::Reference<text::XTextTable>(mxTextTable) ) );
 
     // go to the end of the table and span the view
     uno::Reference< text::XTextViewCursor > xCursor = 
xViewCursorSupplier->getViewCursor();
@@ -85,14 +86,13 @@ SwVbaTable::Delete(  )
 OUString SAL_CALL
 SwVbaTable::getName(  )
 {
-    uno::Reference< container::XNamed > xNamed( mxTextTable, 
uno::UNO_QUERY_THROW );
-    return xNamed->getName();
+    return mxTextTable->getName();
 }
 
 uno::Any SAL_CALL
 SwVbaTable::Borders( const uno::Any& index )
 {
-    uno::Reference< table::XCellRange > aCellRange( mxTextTable, 
uno::UNO_QUERY_THROW );
+    uno::Reference< table::XCellRange > aCellRange( mxTextTable );
     VbaPalette aPalette;
     uno::Reference< XCollection > xCol( new SwVbaBorders( this, mxContext, 
aCellRange, aPalette ) );
     if ( index.hasValue() )
@@ -103,77 +103,69 @@ SwVbaTable::Borders( const uno::Any& index )
 float SAL_CALL
 SwVbaTable::getBottomPadding()
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
-    xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
+    mxTextTable->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
     return convertMm100ToPoint<double>(aTableBorderDistances.BottomDistance);
 }
 
 void SAL_CALL
 SwVbaTable::setBottomPadding( float fValue )
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
     aTableBorderDistances.IsBottomDistanceValid = true;
     aTableBorderDistances.BottomDistance = convertPointToMm100(fValue);
-    xPropertySet->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
+    mxTextTable->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
 }
 
 float SAL_CALL
 SwVbaTable::getLeftPadding()
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
-    xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
+    mxTextTable->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
     return convertMm100ToPoint<double>(aTableBorderDistances.LeftDistance);
 }
 
 void SAL_CALL
 SwVbaTable::setLeftPadding( float fValue )
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
     aTableBorderDistances.IsLeftDistanceValid = true;
     aTableBorderDistances.LeftDistance = convertPointToMm100(fValue);
-    xPropertySet->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
+    mxTextTable->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
 }
 
 float SAL_CALL
 SwVbaTable::getRightPadding()
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
-    xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
+    mxTextTable->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
     return convertMm100ToPoint<double>(aTableBorderDistances.RightDistance);
 }
 
 void SAL_CALL
 SwVbaTable::setRightPadding( float fValue )
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
     aTableBorderDistances.IsRightDistanceValid = true;
     aTableBorderDistances.RightDistance = convertPointToMm100(fValue);
-    xPropertySet->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
+    mxTextTable->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
 }
 
 float SAL_CALL
 SwVbaTable::getTopPadding()
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
-    xPropertySet->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
+    mxTextTable->getPropertyValue(u"TableBorderDistances"_ustr) >>= 
aTableBorderDistances;
     return convertMm100ToPoint<double>(aTableBorderDistances.TopDistance);
 }
 
 void SAL_CALL
 SwVbaTable::setTopPadding( float fValue )
 {
-    uno::Reference< beans::XPropertySet > xPropertySet( mxTextTable, 
uno::UNO_QUERY_THROW);
     table::TableBorderDistances aTableBorderDistances;
     aTableBorderDistances.IsTopDistanceValid = true;
     aTableBorderDistances.TopDistance = convertPointToMm100(fValue);
-    xPropertySet->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
+    mxTextTable->setPropertyValue( u"TableBorderDistances"_ustr, uno::Any( 
aTableBorderDistances ) );
 }
 
 uno::Any SAL_CALL
diff --git a/sw/source/ui/vba/vbatable.hxx b/sw/source/ui/vba/vbatable.hxx
index ca744d933110..8c52f721b5c0 100644
--- a/sw/source/ui/vba/vbatable.hxx
+++ b/sw/source/ui/vba/vbatable.hxx
@@ -30,16 +30,17 @@
 #include <unotxdoc.hxx>
 
 class SwXTextDocument;
+class SwXTextTable;
 
 typedef InheritedHelperInterfaceWeakImpl< ooo::vba::word::XTable > 
SwVbaTable_BASE;
 
 class SwVbaTable : public SwVbaTable_BASE
 {
     rtl::Reference< SwXTextDocument > mxTextDocument;
-    css::uno::Reference< css::text::XTextTable > mxTextTable;
+    rtl::Reference< SwXTextTable > mxTextTable;
 public:
     /// @throws css::uno::RuntimeException
-    SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& 
rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, 
rtl::Reference< SwXTextDocument > xDocument, const css::uno::Reference< 
css::text::XTextTable >& xTextTable);
+    SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& 
rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, 
rtl::Reference< SwXTextDocument > xDocument, const rtl::Reference< SwXTextTable 
>& xTextTable);
     virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL Range(  ) 
override;
     virtual void SAL_CALL Select(  ) override;
     virtual void SAL_CALL Delete(  ) override;
diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx
index 81ecc0608b73..091f3a4fd964 100644
--- a/sw/source/ui/vba/vbatables.cxx
+++ b/sw/source/ui/vba/vbatables.cxx
@@ -43,7 +43,9 @@ static uno::Any lcl_createTable( const uno::Reference< 
XHelperInterface >& xPare
                                  const uno::Any& aSource )
 {
     uno::Reference< text::XTextTable > xTextTable( aSource, 
uno::UNO_QUERY_THROW );
-    uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, 
xDocument, xTextTable ) );
+    auto pSwTextTable = dynamic_cast<SwXTextTable*>(xTextTable.get());
+    assert(pSwTextTable);
+    uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, 
xDocument, pSwTextTable ) );
     return uno::Any( xTable );
 }
 
@@ -189,7 +191,7 @@ SwVbaTables::Add( const uno::Reference< word::XRange >& 
Range, const uno::Any& N
     xText->insertTextContent( xTextRange, xContext, true );
 
     // move the current cursor to the first table cell
-    uno::Reference< text::XText> xFirstCellText( xTable->getCellByPosition(0, 
0), uno::UNO_QUERY_THROW );
+    rtl::Reference<SwXCell> xFirstCellText( xTable->getSwCellByPosition(0, 0) 
);
     word::getXTextViewCursor( mxDocument )->gotoRange( 
xFirstCellText->getStart(), false );
 
     uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, 
mxContext,  pVbaRange->getDocument(), xTable ) );
diff --git a/sw/source/ui/vba/wordvbahelper.cxx 
b/sw/source/ui/vba/wordvbahelper.cxx
index c74c5243286a..5ae8008c7b58 100644
--- a/sw/source/ui/vba/wordvbahelper.cxx
+++ b/sw/source/ui/vba/wordvbahelper.cxx
@@ -34,6 +34,7 @@
 #include <viewsh.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <unostyle.hxx>
+#include <unotbl.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::ooo::vba;
@@ -97,8 +98,8 @@ uno::Reference< text::XTextRange > getFirstObjectPosition( 
const uno::Reference<
         uno::Reference< lang::XServiceInfo > xServiceInfo( 
xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
         if( xServiceInfo->supportsService(u"com.sun.star.text.TextTable"_ustr) 
)
         {
-            uno::Reference< table::XCellRange > xCellRange( xServiceInfo, 
uno::UNO_QUERY_THROW );
-            uno::Reference< text::XText> xFirstCellText( 
xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
+            rtl::Reference< SwXTextTable > xCellRange = 
dynamic_cast<SwXTextTable*>(xServiceInfo.get());
+            rtl::Reference< SwXCell> xFirstCellText( 
xCellRange->getSwCellByPosition(0, 0) );
             xTextRange = xFirstCellText->getStart();
         }
     }

Reply via email to