add operator* to tools::WeakReference
which fixes warnings from
commit ef37ab245b8095895f715217236e8e2fb90613c6
Date: Thu Mar 19 09:21:45 2020 +0200
loplugin:redundantpointerops add some more smart pointer types
which I pushed earlier, where I added tools::WeakReference to the list
of smart pointer types, but of course the conversion it recommended is
not possible without an operator*
Change-Id: I9433b7aba46a3a15f9d833847ae3659367388109
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90735
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -97,6 +97,9 @@ public:
|
||||
/** returns the pointer to the reference object or null */
|
||||
inline reference_type * operator->() const;
|
||||
|
||||
/** returns a ref to the reference object */
|
||||
inline reference_type& operator*() const;
|
||||
|
||||
/** returns true if this instance references pReferenceObject */
|
||||
inline bool operator== (const reference_type * pReferenceObject) const;
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ inline reference_type * WeakReference< reference_type >::operator->() const
|
||||
return get();
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline reference_type& WeakReference< reference_type >::operator*() const
|
||||
{
|
||||
return *get();
|
||||
}
|
||||
|
||||
template< class reference_type >
|
||||
inline bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const
|
||||
{
|
||||
|
||||
@@ -1450,7 +1450,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
|
||||
|
||||
if (GetModel() && mxTextEditObj.is())
|
||||
{
|
||||
SdrHint aHint(SdrHintKind::EndEdit, *mxTextEditObj.get());
|
||||
SdrHint aHint(SdrHintKind::EndEdit, *mxTextEditObj);
|
||||
GetModel()->Broadcast(aHint);
|
||||
}
|
||||
|
||||
@@ -2168,8 +2168,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
|
||||
if (bUndo)
|
||||
{
|
||||
BegUndo(ImpGetDescriptionString(STR_EditSetAttributes));
|
||||
AddUndo(
|
||||
GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
|
||||
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj));
|
||||
|
||||
// If this is a text object also rescue the OutlinerParaObject since
|
||||
// applying attributes to the object may change text layout when
|
||||
@@ -2179,7 +2178,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
|
||||
bool bRescueText = mxTextEditObj.get();
|
||||
|
||||
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(
|
||||
*mxTextEditObj.get(), false, !bNoEEItems || bRescueText));
|
||||
*mxTextEditObj, false, !bNoEEItems || bRescueText));
|
||||
EndUndo();
|
||||
}
|
||||
|
||||
@@ -2216,10 +2215,8 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
|
||||
if (IsUndoEnabled())
|
||||
{
|
||||
BegUndo(ImpGetDescriptionString(STR_EditSetAttributes));
|
||||
AddUndo(
|
||||
GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
|
||||
AddUndo(
|
||||
GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get()));
|
||||
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj));
|
||||
AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj));
|
||||
EndUndo();
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ bool SvxTableController::onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWindow
|
||||
if(!checkTableObject())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
|
||||
// check if we are read only
|
||||
@@ -429,7 +429,7 @@ void SvxTableController::GetState( SfxItemSet& rSet )
|
||||
if(!mxTable.is() || !mxTableObj.is())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
std::unique_ptr<SfxItemSet> xSet;
|
||||
bool bVertDone(false);
|
||||
@@ -519,7 +519,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
bool bInsertAfter = true;
|
||||
sal_uInt16 nCount = 0;
|
||||
@@ -893,7 +893,7 @@ void SvxTableController::onFormatTable(const SfxRequest& rReq)
|
||||
if(!mxTableObj.is())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const SfxItemSet* pArgs = rReq.GetArgs();
|
||||
|
||||
@@ -1057,7 +1057,7 @@ void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
|
||||
if(!pArgs || (SfxItemState::SET != pArgs->GetItemState(SID_TABLE_STYLE, false)))
|
||||
@@ -1143,7 +1143,7 @@ void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
|
||||
TableStyleSettings aSettings(rTableObj.getTableStyleSettings() );
|
||||
@@ -1189,7 +1189,7 @@ void SvxTableController::SetVertical( sal_uInt16 nSId )
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
|
||||
TableModelNotifyGuard aGuard( mxTable.get() );
|
||||
@@ -1278,7 +1278,7 @@ void SvxTableController::SplitMarkedCells(const SfxRequest& rReq)
|
||||
Reference< XMergeableCellRange > xRange( mxTable->createCursorByRange( mxTable->getCellRangeByPosition( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow ) ), UNO_QUERY_THROW );
|
||||
const sal_Int32 nRowCount = mxTable->getRowCount();
|
||||
const sal_Int32 nColCount = mxTable->getColumnCount();
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
|
||||
if( rTableObj.IsTextEditActive() )
|
||||
mrView.SdrEndTextEdit(true);
|
||||
@@ -1317,7 +1317,7 @@ void SvxTableController::DistributeColumns(const bool bOptimize, const bool bMin
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -1340,7 +1340,7 @@ void SvxTableController::DistributeRows(const bool bOptimize, const bool bMinimi
|
||||
if(!checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -1368,7 +1368,7 @@ bool SvxTableController::DeleteMarked()
|
||||
if(!checkTableObject() || !HasMarked())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -1480,7 +1480,7 @@ void SvxTableController::changeTableEdge(const SfxRequest& rReq)
|
||||
const sal_uInt16 nIndex = pIndex->GetValue();
|
||||
const sal_Int32 nOffset = convertTwipToMm100(pOffset->GetValue());
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
|
||||
sal_Int32 nEdgeIndex = -1;
|
||||
bool bHorizontal = sType.startsWith("row");
|
||||
@@ -1895,7 +1895,7 @@ void SvxTableController::MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, s
|
||||
|
||||
if( xRange->isMergeable() )
|
||||
{
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -1961,7 +1961,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl
|
||||
if(nullptr == pPV || !checkTableObject())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
|
||||
if(rTableObj.getSdrPageFromSdrObject() == pPV->GetPage())
|
||||
{
|
||||
@@ -2142,7 +2142,7 @@ bool SvxTableController::ChangeFontSize(bool bGrow, const FontList* pFontList)
|
||||
if(!checkTableObject() || !mxTable.is())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
|
||||
if (mrView.IsTextEdit())
|
||||
@@ -2618,7 +2618,7 @@ void SvxTableController::SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bR
|
||||
if(!checkTableObject() || !mxTable.is())
|
||||
return;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -2828,7 +2828,7 @@ bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNo
|
||||
if(!checkTableObject())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
|
||||
const bool bUndo(rModel.IsUndoEnabled());
|
||||
|
||||
@@ -3210,7 +3210,7 @@ bool SvxTableController::isRowHeader()
|
||||
if(!checkTableObject())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
TableStyleSettings aSettings(rTableObj.getTableStyleSettings());
|
||||
|
||||
return aSettings.mbUseFirstRow;
|
||||
@@ -3221,7 +3221,7 @@ bool SvxTableController::isColumnHeader()
|
||||
if(!checkTableObject())
|
||||
return false;
|
||||
|
||||
SdrTableObj& rTableObj(*mxTableObj.get());
|
||||
SdrTableObj& rTableObj(*mxTableObj);
|
||||
TableStyleSettings aSettings(rTableObj.getTableStyleSettings());
|
||||
|
||||
return aSettings.mbUseFirstColumn;
|
||||
|
||||
@@ -102,7 +102,7 @@ bool CellUndo::Merge( SfxUndoAction *pNextAction )
|
||||
void CellUndo::setDataToCell( const Data& rData )
|
||||
{
|
||||
if( rData.mpProperties )
|
||||
mxCell->mpProperties.reset(Cell::CloneProperties( rData.mpProperties, *mxObjRef.get(), *mxCell ));
|
||||
mxCell->mpProperties.reset(Cell::CloneProperties( rData.mpProperties, *mxObjRef, *mxCell ));
|
||||
else
|
||||
mxCell->mpProperties.reset();
|
||||
|
||||
@@ -132,7 +132,7 @@ void CellUndo::getDataFromCell( Data& rData )
|
||||
if( mxObjRef.is() && mxCell.is() )
|
||||
{
|
||||
if( mxCell->mpProperties )
|
||||
rData.mpProperties = mxCell->CloneProperties( *mxObjRef.get(), *mxCell);
|
||||
rData.mpProperties = mxCell->CloneProperties( *mxObjRef, *mxCell);
|
||||
|
||||
if( mxCell->GetOutlinerParaObject() )
|
||||
rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject());
|
||||
|
||||
Reference in New Issue
Block a user