use more concrete UNO
Change-Id: Ibcb65cefccf2c940c7ca450d2dbd502a3830c2b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199004
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 634cf166e04760f198b0019698d1f23ab8a67e9a)
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/363
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index d034060..0d13fa0 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1795,11 +1795,11 @@
// 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 @@
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 @@
}
}
// add the new group of merged cells
- rMergedCells.emplace_back(xCellPS, nLeftPos);
+ rMergedCells.emplace_back(xCell, nLeftPos);
}
else
{
@@ -2110,7 +2109,7 @@
{
if (aMergedCell.bOpen && lcl_SimilarPosition(aMergedCell.nLeftPosition, nLeftPos))
{
- aMergedCell.aCells.push_back( xCellPS );
+ aMergedCell.aCells.push_back( xCell );
bFound = true;
}
}
@@ -2138,7 +2137,7 @@
};
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 @@
{
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 74e08b4..7247b09 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1223,10 +1223,9 @@
// 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 26afd1f..27ec630 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 @@
}
-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 @@
::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 @@
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 @@
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 @@
{
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 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 @@
)
{
// 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 @@
// 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 @@
// 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 860bc48..0b2ca2c 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 @@
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 6e6a8ac..be4488b 100644
--- a/sw/source/ui/vba/vbaselection.cxx
+++ b/sw/source/ui/vba/vbaselection.cxx
@@ -805,7 +805,9 @@
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 @@
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 @@
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 6a4388e..a2b7cef 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 @@
/// @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 ba33fa4..409feb3 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 @@
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 @@
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 @@
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 @@
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 abc1d4e..7574108 100644
--- a/sw/source/ui/vba/vbatable.hxx
+++ b/sw/source/ui/vba/vbatable.hxx
@@ -28,16 +28,17 @@
#include <rtl/ref.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 f4dd41f..5ddc81d 100644
--- a/sw/source/ui/vba/vbatables.cxx
+++ b/sw/source/ui/vba/vbatables.cxx
@@ -43,7 +43,9 @@
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 @@
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 c7a8748..00f5983 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< 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();
}
}