editeng/source/editeng/impedit.cxx | 12 ++---- editeng/source/editeng/impedit.hxx | 2 - editeng/source/uno/unoipset.cxx | 2 - editeng/source/xml/xmltxtexp.cxx | 2 - include/editeng/unoipset.hxx | 5 +- include/svx/svdotable.hxx | 3 + include/svx/unoshape.hxx | 2 - include/vcl/dndhelp.hxx | 2 - svx/source/inc/tablemodel.hxx | 6 ++- svx/source/table/cellcursor.cxx | 22 ++++++------ svx/source/table/svdotable.cxx | 14 +++++--- svx/source/table/tablecontroller.cxx | 50 +++++++++++++---------------- svx/source/table/tablehtmlimporter.cxx | 6 +-- svx/source/table/tablelayouter.cxx | 2 - svx/source/table/tablemodel.cxx | 4 +- svx/source/table/tablertfexporter.cxx | 8 ++-- svx/source/table/tablertfimporter.cxx | 6 +-- svx/source/table/viewcontactoftableobj.cxx | 4 +- svx/source/unodraw/unoshape.cxx | 2 - 19 files changed, 79 insertions(+), 75 deletions(-)
New commits: commit d39e7878b32a68aa34759737000aa6e138b87999 Author: Noel Grandin <[email protected]> AuthorDate: Wed Sep 11 16:20:35 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Sep 12 08:09:27 2024 +0200 use less dynamic_cast in svx table stuff we already statically know the types of all these objects Change-Id: I976dbf2b150fcd2176df18a07c2e9f21b1d2fe65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173214 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 9abacce2b9ff..e22ef60a48b7 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -39,6 +39,7 @@ namespace sdr::table { class TableLayouter; struct ImplTableShadowPaintInfo; +class TableModel; #ifndef CellRef class Cell; @@ -116,6 +117,8 @@ public: void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize ); css::uno::Reference< css::table::XTable > getTable() const; + /// Get the concrete UNO class for the table + rtl::Reference< sdr::table::TableModel > getUnoTable() const; bool isValid( const sdr::table::CellPos& rPos ) const; static CellPos getFirstCell(); diff --git a/svx/source/inc/tablemodel.hxx b/svx/source/inc/tablemodel.hxx index 3446604bc722..a82163f7b874 100644 --- a/svx/source/inc/tablemodel.hxx +++ b/svx/source/inc/tablemodel.hxx @@ -26,6 +26,7 @@ #include <comphelper/compbase.hxx> #include <comphelper/interfacecontainer4.hxx> #include "celltypes.hxx" +#include <svx/svxdllapi.h> struct _xmlTextWriter; typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -50,7 +51,7 @@ protected: typedef ::comphelper::WeakComponentImplHelper< css::table::XTable, css::util::XBroadcaster > TableModelBase; -class TableModel final : +class SVXCORE_DLLPUBLIC TableModel final : public TableModelBase, public ICellRange { @@ -135,6 +136,8 @@ public: virtual void SAL_CALL lockBroadcasts() override; virtual void SAL_CALL unlockBroadcasts() override; + CellRef getCell( sal_Int32 nCol, sal_Int32 nRow ) const; + private: void notifyModification(); @@ -147,7 +150,6 @@ private: sal_Int32 getColumnCountImpl() const; CellRef createCell(); - CellRef getCell( ::sal_Int32 nCol, ::sal_Int32 nRow ) const; void UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount ); void UndoRemoveRows( sal_Int32 nIndex, RowVector& aNewRows ); diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx index 78358ca465d5..b4d9ce812869 100644 --- a/svx/source/table/cellcursor.cxx +++ b/svx/source/table/cellcursor.cxx @@ -165,14 +165,14 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) // single cell merge is never valid if( mxTable.is() && ((mnLeft != mnRight) || (mnTop != mnBottom)) ) try { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnLeft, mnTop ).get() ) ); + CellRef xCell = mxTable->getCell( mnLeft, mnTop ); // check if first cell is merged if( xCell.is() && xCell->isMerged() ) findMergeOrigin( mxTable, mnLeft, mnTop, rStart.mnCol, rStart.mnRow ); // check if last cell is merged - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnRight, mnBottom ).get() ) ); + xCell = mxTable->getCell( mnRight, mnBottom ); if( xCell.is() ) { if( xCell->isMerged() ) @@ -181,7 +181,7 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) // merge not possible if selection is only one cell and all its merges if( rEnd == rStart ) return false; - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rEnd.mnCol, rEnd.mnRow ).get() ) ); + xCell = mxTable->getCell( rEnd.mnCol, rEnd.mnRow ); } } if( xCell.is() ) @@ -196,7 +196,7 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) { for( nCol = rStart.mnCol; nCol <= rEnd.mnCol; nCol++ ) { - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + xCell = mxTable->getCell( nCol, nRow ); if( !xCell.is() ) continue; @@ -208,7 +208,7 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) if( (nOriginCol < rStart.mnCol) || (nOriginRow < rStart.mnRow) ) return false; - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nOriginCol, nOriginRow ).get() ) ); + xCell = mxTable->getCell( nOriginCol, nOriginRow ); if( xCell.is() ) { nOriginCol += xCell->getColumnSpan()-1; @@ -277,7 +277,7 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< // first check how many columns we need to add for( nRow = mnTop; nRow <= mnBottom; ++nRow ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell = mxTable->getCell( nCol, nRow ); if( xCell.is() && !xCell->isMerged() ) nNewCols = std::max( nNewCols, nColumns - xCell->getColumnSpan() + 1 - rLeftOvers[nRow] ); } @@ -307,13 +307,13 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< for( nRow = 0; nRow < nRowCount; ++nRow ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell = mxTable->getCell( nCol, nRow ); if( !xCell.is() || xCell->isMerged() ) { if( nNewCols > 0 ) { // merged cells are ignored, but newly added columns will be added to leftovers - xCell.set( dynamic_cast< Cell* >(mxTable->getCellByPosition( nCol+1, nRow ).get() ) ); + xCell = mxTable->getCell( nCol+1, nRow ); if( !xCell.is() || !xCell->isMerged() ) rLeftOvers[nRow] += nNewCols; } @@ -391,7 +391,7 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In // first check how many columns we need to add for( nCol = mnLeft; nCol <= mnRight; ++nCol ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell = mxTable->getCell( nCol, nRow ); if( xCell.is() && !xCell->isMerged() ) nNewRows = std::max( nNewRows, nRows - xCell->getRowSpan() + 1 - rLeftOvers[nCol] ); } @@ -421,13 +421,13 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In for( nCol = 0; nCol < nColCount; ++nCol ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell = mxTable->getCell( nCol, nRow ); if( !xCell.is() || xCell->isMerged() ) { if( nNewRows ) { // merged cells are ignored, but newly added columns will be added to leftovers - xCell.set( dynamic_cast< Cell* >(mxTable->getCellByPosition( nCol, nRow+1 ).get() ) ); + xCell = mxTable->getCell( nCol, nRow+1 ); if( !xCell.is() || !xCell->isMerged() ) rLeftOvers[nCol] += nNewRows; } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 43a4d7be5a0a..610cfcc748de 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -251,9 +251,9 @@ void SdrTableObjImpl::CropTableModelToSelection(const CellPos& rStart, const Cel { for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol ) try { - CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xTargetCell( mxTable->getCell( nCol, nRow ) ); if( xTargetCell.is() ) - xTargetCell->cloneFrom( dynamic_cast< Cell* >( xOldTable->getCellByPosition( rStart.mnCol + nCol, rStart.mnRow + nRow ).get() ) ); + xTargetCell->cloneFrom( xOldTable->getCell( rStart.mnCol + nCol, rStart.mnRow + nRow ) ); } catch( Exception& ) { @@ -723,7 +723,7 @@ CellRef SdrTableObjImpl::getCell( const CellPos& rPos ) const CellRef xCell; if( mxTable.is() ) try { - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) ); + xCell = mxTable->getCell( rPos.mnCol, rPos.mnRow ); } catch( Exception& ) { @@ -912,6 +912,10 @@ Reference< XTable > SdrTableObj::getTable() const return mpImpl->mxTable; } +rtl::Reference< TableModel > SdrTableObj::getUnoTable() const +{ + return mpImpl->mxTable; +} bool SdrTableObj::isValid( const CellPos& rPos ) const { @@ -1585,12 +1589,12 @@ void SdrTableObj::setActiveCell( const CellPos& rPos ) try { - mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) ); + mpImpl->mxActiveCell = mpImpl->mxTable->getCell( rPos.mnCol, rPos.mnRow ); if( mpImpl->mxActiveCell.is() && mpImpl->mxActiveCell->isMerged() ) { CellPos aOrigin; findMergeOrigin( mpImpl->mxTable, rPos.mnCol, rPos.mnRow, aOrigin.mnCol, aOrigin.mnRow ); - mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( aOrigin.mnCol, aOrigin.mnRow ).get() ) ); + mpImpl->mxActiveCell = mpImpl->mxTable->getCell( aOrigin.mnCol, aOrigin.mnRow ); mpImpl->maEditPos = aOrigin; } else diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 29a3a4304c4f..2cd2040dec6a 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -190,13 +190,11 @@ SvxTableController::SvxTableController( rObj.getActiveCellPos( maCursorFirstPos ); maCursorLastPos = maCursorFirstPos; - Reference< XTable > xTable( mxTableObj.get()->getTable() ); - if( xTable.is() ) + mxTable = mxTableObj.get()->getUnoTable(); + if( mxTable ) { mxModifyListener = new SvxTableControllerModifyListener( this ); - xTable->addModifyListener( mxModifyListener ); - - mxTable.set( dynamic_cast< TableModel* >( xTable.get() ) ); + mxTable->addModifyListener( mxModifyListener ); } } @@ -209,7 +207,7 @@ SvxTableController::~SvxTableController() if( mxModifyListener.is() && mxTableObj.get() ) { - Reference< XTable > xTable( mxTableObj.get()->getTable() ); + rtl::Reference< TableModel > xTable( mxTableObj.get()->getUnoTable() ); if( xTable.is() ) { xTable->removeModifyListener( mxModifyListener ); @@ -603,7 +601,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) for( sal_Int32 nRow = 0; nRow < mxTable->getRowCount(); ++nRow ) { - CellRef xSourceCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nPropSrcCol, nRow ).get() ) ); + CellRef xSourceCell( mxTable->getCell( nPropSrcCol, nRow ) ); // When we insert new COLUMNs, we want to copy ROW spans. if (xSourceCell.is() && nRowSpan == 0) @@ -626,7 +624,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) // Look for the top-left cell in the span. for( nSpanInfoCol = nPropSrcCol - 1; nSpanInfoCol >= 0; --nSpanInfoCol ) { - CellRef xMergeInfoCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nSpanInfoCol, nRow ).get() ) ); + CellRef xMergeInfoCell( mxTable->getCell( nSpanInfoCol, nRow ) ); if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged()) { nRowSpan = xMergeInfoCell->getRowSpan(); @@ -646,7 +644,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) // Now copy the properties from the source to the targets for( sal_Int32 nOffset = 0; nOffset < nNewColumns; nOffset++ ) { - CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nNewStartColumn + nOffset, nRow ).get() ) ); + CellRef xTargetCell( mxTable->getCell( nNewStartColumn + nOffset, nRow ) ); if( xTargetCell.is() ) { if( nRowSpan > 0 ) @@ -707,7 +705,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) for( sal_Int32 nCol = 0; nCol < mxTable->getColumnCount(); ++nCol ) { - CellRef xSourceCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nPropSrcRow ).get() ) ); + CellRef xSourceCell( mxTable->getCell( nCol, nPropSrcRow ) ); if (!xSourceCell.is()) continue; @@ -733,7 +731,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) // Look for the top-left cell in the span. for( nSpanInfoRow = nPropSrcRow - 1; nSpanInfoRow >= 0; --nSpanInfoRow ) { - CellRef xMergeInfoCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nSpanInfoRow ).get() ) ); + CellRef xMergeInfoCell( mxTable->getCell( nCol, nSpanInfoRow ) ); if (xMergeInfoCell.is() && !xMergeInfoCell->isMerged()) { nColSpan = xMergeInfoCell->getColumnSpan(); @@ -753,7 +751,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) // Now copy the properties from the source to the targets for( sal_Int32 nOffset = 0; nOffset < nNewRows; ++nOffset ) { - CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nNewRowStart + nOffset ).get() ) ); + CellRef xTargetCell( mxTable->getCell( nCol, nNewRowStart + nOffset ) ); if( xTargetCell.is() ) { if( nColSpan > 0 ) @@ -1150,7 +1148,7 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs ) { for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ ) try { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) { SfxItemSet aSet( xCell->GetItemSet() ); @@ -1283,7 +1281,7 @@ void SvxTableController::SetVertical( sal_uInt16 nSId ) { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) { if (bUndo) @@ -1449,7 +1447,7 @@ bool SvxTableController::DeleteMarked() { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if (xCell.is() && xCell->hasText()) { if (bUndo) @@ -1489,7 +1487,7 @@ bool SvxTableController::GetStyleSheet( SfxStyleSheet*& rpStyleSheet ) const { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) { SfxStyleSheet* pSS=xCell->GetStyleSheet(); @@ -1525,7 +1523,7 @@ bool SvxTableController::SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRe { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) xCell->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); } @@ -2250,7 +2248,7 @@ bool SvxTableController::ChangeFontSize(bool bGrow, const FontList* pFontList) { for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) { - CellRef xCell(dynamic_cast< Cell* >(mxTable->getCellByPosition(nCol, nRow).get())); + CellRef xCell(mxTable->getCell(nCol, nRow)); if (xCell.is()) { if (rModel.IsUndoEnabled()) @@ -2419,7 +2417,7 @@ void SvxTableController::MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnl { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() && !xCell->isMerged() ) { const SfxItemSet& rSet = xCell->GetItemSet(); @@ -2652,7 +2650,7 @@ void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr ) for( sal_Int32 nCol = std::max( aStart.mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( !xCell.is() ) continue; @@ -2729,7 +2727,7 @@ void SvxTableController::SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bR { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) { if( bUndo ) @@ -2863,7 +2861,7 @@ bool SvxTableController::PasteObject( SdrTableObj const * pPasteTableObj ) if( !pPasteTableObj ) return false; - Reference< XTable > xPasteTable( pPasteTableObj->getTable() ); + rtl::Reference< TableModel > xPasteTable( pPasteTableObj->getUnoTable() ); if( !xPasteTable.is() ) return false; @@ -2898,10 +2896,10 @@ bool SvxTableController::PasteObject( SdrTableObj const * pPasteTableObj ) { for( sal_Int32 nCol = 0, nTargetCol = aStart.mnCol; nCol < nPasteColumns; ++nCol ) { - CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nTargetCol, aStart.mnRow + nRow ).get() ) ); + CellRef xTargetCell( mxTable->getCell( nTargetCol, aStart.mnRow + nRow ) ); if( xTargetCell.is() && !xTargetCell->isMerged() ) { - CellRef xSourceCell(dynamic_cast<Cell*>(xPasteTable->getCellByPosition(nCol, nRow).get())); + CellRef xSourceCell(xPasteTable->getCell(nCol, nRow)); if (xSourceCell.is()) { xTargetCell->AddUndo(); @@ -2949,7 +2947,7 @@ bool SvxTableController::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 { for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() ) { if (bUndo) @@ -3204,7 +3202,7 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox for( sal_Int32 nCol = std::max( aStart.mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( !xCell.is() ) continue; diff --git a/svx/source/table/tablehtmlimporter.cxx b/svx/source/table/tablehtmlimporter.cxx index b540ccc2934b..7f7aace887cc 100644 --- a/svx/source/table/tablehtmlimporter.cxx +++ b/svx/source/table/tablehtmlimporter.cxx @@ -150,7 +150,7 @@ private: HTMLCellDefault* mpActDefault; sal_Int32 mnCellInRow; - Reference<XTable> mxTable; + rtl::Reference<TableModel> mxTable; HTMLColumnVectorPtr mxLastRow; // Copy assignment is forbidden and not implemented. @@ -169,7 +169,7 @@ SdrTableHTMLParser::SdrTableHTMLParser(SdrTableObj& rTableObj) , mnVMergeIdx(0) , mpActDefault(nullptr) , mnCellInRow(-1) - , mxTable(rTableObj.getTable()) + , mxTable(rTableObj.getUnoTable()) { mpOutliner->SetUpdateLayout(true); mpOutliner->SetStyleSheet(0, mrTableObj.GetStyleSheet()); @@ -310,7 +310,7 @@ void SdrTableHTMLParser::FillTable() { HTMLCellInfoPtr xCellInfo((*xColumn)[nIdx]); - CellRef xCell(dynamic_cast<Cell*>(mxTable->getCellByPosition(nCol, nRow).get())); + CellRef xCell(mxTable->getCell(nCol, nRow)); if (xCell.is() && xCellInfo) { const SfxPoolItem* pPoolItem = nullptr; diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 275b7705c808..8756734ff288 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -933,7 +933,7 @@ CellRef TableLayouter::getCell( const CellPos& rPos ) const CellRef xCell; if( mxTable.is() ) try { - xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) ); + xCell = mxTable->getCell( rPos.mnCol, rPos.mnRow ); } catch( Exception& ) { diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index c2d0af6444ef..83facdaaaa99 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -1050,7 +1050,7 @@ void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_ } // merge first cell - CellRef xOriginCell( dynamic_cast< Cell* >( getCellByPosition( nCol, nRow ).get() ) ); + CellRef xOriginCell( getCell( nCol, nRow ) ); if(!xOriginCell.is()) return; @@ -1065,7 +1065,7 @@ void TableModel::merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_ { for( ; nTempCol < nLastCol; nTempCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( getCellByPosition( nTempCol, nRow ).get() ) ); + CellRef xCell( getCell( nTempCol, nRow ) ); if( xCell.is() && !xCell->isMerged() ) { if( bUndo ) diff --git a/svx/source/table/tablertfexporter.cxx b/svx/source/table/tablertfexporter.cxx index 447f88cbf3f1..adc97e6c754f 100644 --- a/svx/source/table/tablertfexporter.cxx +++ b/svx/source/table/tablertfexporter.cxx @@ -59,7 +59,7 @@ public: private: SvStream& mrStrm; SdrTableObj& mrObj; - Reference< XTable > mxTable; + rtl::Reference< TableModel > mxTable; }; void ExportAsRTF( SvStream& rStrm, SdrTableObj& rObj ) @@ -73,7 +73,7 @@ constexpr OUString gsSize( u"Size"_ustr ); SdrTableRtfExporter::SdrTableRtfExporter( SvStream& rStrm, SdrTableObj& rObj ) : mrStrm( rStrm ) , mrObj( rObj ) -, mxTable( rObj.getTable() ) +, mxTable( rObj.getUnoTable() ) { } @@ -131,7 +131,7 @@ void SdrTableRtfExporter::WriteRow( const Reference< XPropertySet >& xRowSet, sa const sal_Int32 nColCount = mxTable->getColumnCount(); for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( !xCell.is() ) continue; @@ -158,7 +158,7 @@ void SdrTableRtfExporter::WriteRow( const Reference< XPropertySet >& xRowSet, sa void SdrTableRtfExporter::WriteCell( sal_Int32 nCol, sal_Int32 nRow ) { - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( !xCell.is() || xCell->isMerged() ) { diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 9b34e5fe7a48..c411636ebdd1 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -132,7 +132,7 @@ private: RTFCellDefault* mpActDefault; RTFCellDefault* mpDefMerge; - Reference< XTable > mxTable; + rtl::Reference< TableModel > mxTable; RTFColumnVectorPtr mxLastRow; // Copy assignment is forbidden and not implemented. @@ -152,7 +152,7 @@ SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj ) , mnVMergeIdx ( 0 ) , mpActDefault( nullptr ) , mpDefMerge( nullptr ) -, mxTable( rTableObj.getTable() ) +, mxTable( rTableObj.getUnoTable() ) { mpOutliner->SetUpdateLayout(true); mpOutliner->SetStyleSheet( 0, mrTableObj.GetStyleSheet() ); @@ -308,7 +308,7 @@ void SdrTableRTFParser::FillTable() { RTFCellInfoPtr xCellInfo( (*xColumn)[nIdx] ); - CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); + CellRef xCell( mxTable->getCell( nCol, nRow ) ); if( xCell.is() && xCellInfo ) { const SfxPoolItem *pPoolItem = nullptr; diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index f533e9b6f6a3..7d7babba6618 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -193,7 +193,7 @@ namespace sdr::contact bool const isTaggedPDF, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) { - const uno::Reference< css::table::XTable > xTable = rTableObj.getTable(); + const rtl::Reference< table::TableModel > xTable = rTableObj.getUnoTable(); if(xTable.is()) { @@ -245,7 +245,7 @@ namespace sdr::contact } // access the cell - xCurrentCell.set(dynamic_cast< sdr::table::Cell* >(xTable->getCellByPosition(aCellPos.mnCol, aCellPos.mnRow).get())); + xCurrentCell = xTable->getCell(aCellPos.mnCol, aCellPos.mnRow); if(xCurrentCell.is()) { commit 5ba893dfb8838b0ef946b52de9ef1336d2ab0512 Author: Noel Grandin <[email protected]> AuthorDate: Wed Sep 11 11:29:10 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Sep 12 08:09:16 2024 +0200 use more concrete UNO type in editeng Change-Id: I5cad4808a1e5f10022f8a0441eb81a279d9b6386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173196 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index cdf309a20e0a..a7497f629868 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -2688,12 +2688,10 @@ void ImpEditView::AddDragAndDropListeners() uno::Reference<datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY); if (xDragGestureRecognizer.is()) { - uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY); - xDragGestureRecognizer->addDragGestureListener(xDGL); + xDragGestureRecognizer->addDragGestureListener(mxDnDListener); } - uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY); - xDropTarget->addDropTargetListener(xDTL); + xDropTarget->addDropTargetListener(mxDnDListener); xDropTarget->setActive(true); xDropTarget->setDefaultActions(datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE); @@ -2716,12 +2714,10 @@ void ImpEditView::RemoveDragAndDropListeners() uno::Reference<datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY); if (xDragGestureRecognizer.is()) { - uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY); - xDragGestureRecognizer->removeDragGestureListener(xDGL); + xDragGestureRecognizer->removeDragGestureListener(mxDnDListener); } - uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY); - xDropTarget->removeDropTargetListener(xDTL); + xDropTarget->removeDropTargetListener(mxDnDListener); } if ( mxDnDListener.is() ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index d62edc53419b..d9d8f6ea8b4a 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -275,7 +275,7 @@ private: std::optional<PointerStyle> mxPointer; std::unique_ptr<DragAndDropInfo> mpDragAndDropInfo; - css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> mxDnDListener; + rtl::Reference<vcl::unohelper::DragAndDropWrapper> mxDnDListener; tools::Long mnInvalidateMore; EVControlBits mnControl; diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 8737b2ea77d1..a17783637818 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -215,7 +215,7 @@ const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(const OUS } -uno::Reference< beans::XPropertySetInfo > const & SvxItemPropertySet::getPropertySetInfo() const +rtl::Reference< SfxItemPropertySetInfo > const & SvxItemPropertySet::getPropertySetInfo() const { if( !m_xInfo.is() ) m_xInfo = new SfxItemPropertySetInfo( m_aPropertyMap ); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 13a836bd7625..461924192c3e 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -254,7 +254,7 @@ public: virtual void ExportContent_() override; private: - css::uno::Reference< css::text::XText > mxText; + rtl::Reference< SvxUnoText > mxText; }; } diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx index 7ffff801a27e..e1e84b8270ac 100644 --- a/include/editeng/unoipset.hxx +++ b/include/editeng/unoipset.hxx @@ -21,6 +21,7 @@ #define INCLUDED_EDITENG_UNOIPSET_HXX #include <editeng/editengdllapi.h> +#include <rtl/ref.hxx> #include <svl/itemprop.hxx> #include <vector> @@ -32,7 +33,7 @@ class SvxItemPropertySetUsrAnys; class EDITENG_DLLPUBLIC SvxItemPropertySet { SfxItemPropertyMap m_aPropertyMap; - mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo; + mutable rtl::Reference<SfxItemPropertySetInfo> m_xInfo; SfxItemPool& mrItemPool; public: @@ -50,7 +51,7 @@ public: css::uno::Any getPropertyValue( const SfxItemPropertyMapEntry* pMap, SvxItemPropertySetUsrAnys& rAnys ) const; static void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rVal, SvxItemPropertySetUsrAnys& rAnys ); - css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const; + rtl::Reference< SfxItemPropertySetInfo > const & getPropertySetInfo() const; const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} const SfxItemPropertyMapEntry* getPropertyMapEntry(const OUString& rName) const; }; diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 4ae84a2bc74e..763e70e210b3 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -194,7 +194,7 @@ public: // access methods for master objects /// @throws css::uno::RuntimeException - css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo( ); + rtl::Reference< SfxItemPropertySetInfo > const & _getPropertySetInfo( ); /// @throws css::beans::UnknownPropertyException /// @throws css::beans::PropertyVetoException /// @throws css::lang::IllegalArgumentException diff --git a/include/vcl/dndhelp.hxx b/include/vcl/dndhelp.hxx index b7297773ebfa..0d1af70d69e8 100644 --- a/include/vcl/dndhelp.hxx +++ b/include/vcl/dndhelp.hxx @@ -83,7 +83,7 @@ public: void SAL_CALL release() noexcept override { OWeakObject::release(); } // css::lang::XEventListener - void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + VCL_DLLPUBLIC void SAL_CALL disposing( const css::lang::EventObject& Source ) override; // css::datatransfer::dnd::XDragGestureListener void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 09513fe6ddc9..b9878ffd2998 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1230,7 +1230,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL } } -Reference< beans::XPropertySetInfo > const & +rtl::Reference< SfxItemPropertySetInfo > const & SvxShape::_getPropertySetInfo() { return mpPropSet->getPropertySetInfo();
