summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-11 15:40:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-12 09:56:01 +0200
commit389da66dfc96d06c407bff156c4ea21e940c5e06 (patch)
tree2d1ebce6bdb2d952700ed5aaeb808289e9f72a7d /sc
parenta651dbcfca9e198b5c2561076961504586bc6bea (diff)
remove unused uno::Reference vars
found by temporarily marking Reference as SAL_WARN_UNUSED. Change-Id: I18809b62654467f890016adcc92576980ced393b Reviewed-on: https://gerrit.libreoffice.org/37511 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/globalx.cxx4
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx2
-rw-r--r--sc/source/ui/app/seltrans.cxx6
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx1
-rw-r--r--sc/source/ui/navipi/content.cxx13
-rw-r--r--sc/source/ui/undo/undoblk.cxx5
-rw-r--r--sc/source/ui/unoobj/PivotTableDataProvider.cxx1
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx1
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx1
-rw-r--r--sc/source/ui/vba/vbarange.cxx6
-rw-r--r--sc/source/ui/view/cellsh1.cxx5
-rw-r--r--sc/source/ui/view/drawvie4.cxx10
-rw-r--r--sc/source/ui/view/gridwin.cxx13
-rw-r--r--sc/source/ui/view/select.cxx5
-rw-r--r--sc/source/ui/view/tabcont.cxx5
-rw-r--r--sc/source/ui/view/tabview3.cxx5
-rw-r--r--sc/source/ui/view/viewfun3.cxx21
17 files changed, 36 insertions, 68 deletions
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index 9a558ae458c0..5b60bf912094 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -86,9 +86,7 @@ void ScGlobal::InitAddIns()
if ( xResultSet.is() )
{
- Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY );
- Reference< XContentAccess >
- xContentAccess( xResultSet, UNO_QUERY );
+ Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
try
{
if ( xResultSet->first() )
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 92c83e06aaa3..72d2985e536f 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -310,8 +310,6 @@ void importSheetFragments( WorkbookFragment& rWorkbookHandler, SheetFragmentVect
{
rWorkbookHandler.getDocImport().initForSheets();
- Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
-
// test sequential read in this mode
comphelper::ThreadPool &rSharedPool = comphelper::ThreadPool::getSharedOptimalPool();
std::shared_ptr<comphelper::ThreadTaskTag> pTag = comphelper::ThreadPool::createThreadTaskTag();
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index ed181469bd70..9fcbf4aaec8a 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -285,8 +285,7 @@ void ScSelectionTransferObj::CreateCellData()
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
// SetDragHandlePos is not used - there is no mouse position
//? pTransferObj->SetVisibleTab( nTab );
@@ -338,8 +337,7 @@ void ScSelectionTransferObj::CreateDrawData()
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScDrawTransferObj ctor
- ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
SfxObjectShellRef aPersistRef( aDragShellRef.get() );
pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 69ffd28bc62e..b261e56b60c1 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -73,7 +73,6 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFram
return;
uno::Reference<frame::XFrame> xFrame = pFrame->GetFrame().GetFrameInterface();
- uno::Reference<frame::XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
"_beamer",
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 8fd837c3c5b5..ec66b99e073b 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1267,13 +1267,12 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScDrawTransferObj ctor
- ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pDragModel, pSrcShell, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( pDragModel, pSrcShell, aObjDesc );
pTransferObj->SetDragSourceObj( pObject, nTab );
pTransferObj->SetDragSourceFlags(ScDragSrc::Navigator);
- SC_MOD()->SetDragObject( nullptr, pTransferObj );
+ SC_MOD()->SetDragObject( nullptr, pTransferObj.get() );
pWin->ReleaseMouse();
pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
}
@@ -1301,13 +1300,12 @@ static void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDra
aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
pTransferObj->SetDragSource( pSrcShell, aMark );
pTransferObj->SetDragSourceFlags( nFlags );
- SC_MOD()->SetDragObject( pTransferObj, nullptr ); // for internal D&D
+ SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
pWin->ReleaseMouse();
pTransferObj->StartDrag( pWin, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
}
@@ -1446,8 +1444,7 @@ void ScContentTree::DoDrag()
if (bDoLinkTrans)
{
- ScLinkTransferObj* pTransferObj = new ScLinkTransferObj;
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScLinkTransferObj> pTransferObj = new ScLinkTransferObj;
if ( !aLinkURL.isEmpty() )
pTransferObj->SetLinkURL( aLinkURL, aLinkText );
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 1141e75655b7..291151d11a6d 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1080,11 +1080,10 @@ void ScUndoPaste::Repeat(SfxRepeatTarget& rTarget)
if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
{
ScTabViewShell* pViewSh = static_cast<ScTabViewTarget&>(rTarget).GetViewShell();
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pViewSh->GetActiveWin() );
+ // keep a reference in case the clipboard is changed during PasteFromClip
+ rtl::Reference<ScTransferObj> pOwnClip = ScTransferObj::GetOwnClipboard( pViewSh->GetActiveWin() );
if (pOwnClip)
{
- // keep a reference in case the clipboard is changed during PasteFromClip
- css::uno::Reference<css::datatransfer::XTransferable> aOwnClipRef( pOwnClip );
pViewSh->PasteFromClip( nFlags, pOwnClip->GetDocument(),
aPasteOptions.nFunction, aPasteOptions.bSkipEmpty, aPasteOptions.bTranspose,
aPasteOptions.bAsLink, aPasteOptions.eMoveMode, InsertDeleteFlags::NONE,
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index f02b1361109f..ce7844e6ee7c 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -331,7 +331,6 @@ void PivotTableDataProvider::collectPivotTableData()
{
uno::Reference<uno::XInterface> xDim = ScUnoHelpFunctions::AnyToInterface(xDims->getByIndex(nDim));
uno::Reference<beans::XPropertySet> xDimProp(xDim, uno::UNO_QUERY);
- uno::Reference<container::XNamed> xDimName(xDim, uno::UNO_QUERY);
uno::Reference<sheet::XHierarchiesSupplier> xDimSupp(xDim, uno::UNO_QUERY);
if (!xDimProp.is() || !xDimSupp.is())
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 36a33957c118..ba0de26e515c 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -777,7 +777,6 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
{
- uno::Reference< uno::XInterface > xAnchor;
if (ScDrawLayer::GetAnchorType(*pObj) == SCA_CELL)
{
awt::Size aUnoSize;
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 5c500d62f137..a1471475d540 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -553,7 +553,6 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll )
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet();
ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
ScGridWindow* gridWindow = static_cast<ScGridWindow*>(pShell->GetWindow());
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 8f715d6b8d54..4e3352b79edd 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4239,8 +4239,7 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
return uno::Reference<excel::XRange>();
}
- ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
- uno::Reference< excel::XRange > xVbSheetRange( pRange );
+ rtl::Reference<ScVbaRange> pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
return pRange->Range( Cell1, Cell2, true );
}
@@ -4385,7 +4384,6 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
if ( xDataBaseRange.is() )
bHasAuto = true;
- uno::Reference< table::XCellRange > xFilterRange;
if ( !bHasAuto )
{
if ( m_Areas->getCount() > 1 )
@@ -5221,7 +5219,6 @@ ScVbaRange::Merge( const uno::Any& Across )
}
return;
}
- uno::Reference< table::XCellRange > oCellRange;
bool bAcross = false;
Across >>= bAcross;
if ( !bAcross )
@@ -5451,7 +5448,6 @@ ScVbaRange::SpecialCellsImpl( sal_Int32 nType, const uno::Any& _oValue)
try
{
uno::Reference< sheet::XCellRangesQuery > xQuery( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XRange > oLocRangeImpl;
uno::Reference< sheet::XSheetCellRanges > xLocSheetCellRanges;
switch(nType)
{
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index ce3fe707a663..c4a580f9be4c 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1335,15 +1335,14 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
vcl::Window* pWin = GetViewData()->GetActiveWin();
ScDocument* pDoc = GetViewData()->GetDocument();
bool bOtherDoc = !pDoc->IsClipboardSource();
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
+ // keep a reference in case the clipboard is changed during dialog or PasteFromClip
+ rtl::Reference<ScTransferObj> pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
if ( pOwnClip )
{
bool bSkipEmpty = false;
bool bTranspose = false;
bool bAsLink = false;
- // keep a reference in case the clipboard is changed during dialog or PasteFromClip
- uno::Reference<datatransfer::XTransferable> aOwnClipRef( pOwnClip );
if ( pReqArgs!=nullptr && pTabViewShell->SelectionEditable() )
{
const SfxPoolItem* pItem;
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 18a82ae2ed00..5a5ac3de2b23 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -123,13 +123,12 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos )
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScDrawTransferObj ctor
- ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
pTransferObj->SetDrawPersist( aDragShellRef.get() ); // keep persist for ole objects alive
pTransferObj->SetDragSource( this ); // copies selection
- SC_MOD()->SetDragObject( nullptr, pTransferObj ); // for internal D&D
+ SC_MOD()->SetDragObject( nullptr, pTransferObj.get() ); // for internal D&D
pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
}
}
@@ -379,8 +378,7 @@ void ScDrawView::DoCopy()
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScDrawTransferObj ctor
- ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
if ( ScGlobal::xDrawClipDocShellRef.is() )
{
@@ -388,7 +386,7 @@ void ScDrawView::DoCopy()
}
pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( nullptr, pTransferObj ); // internal clipboard
+ SC_MOD()->SetClipObject( nullptr, pTransferObj.get() ); // internal clipboard
}
uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable()
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9255837a9e3f..95ffc0e67ba5 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4333,21 +4333,18 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
{
// within Calc
- ScTransferObj* pCellTransfer = pOwnSelection->GetCellData();
+ // keep a reference to the data in case the selection is changed during paste
+ rtl::Reference<ScTransferObj> pCellTransfer = pOwnSelection->GetCellData();
if ( pCellTransfer )
{
- // keep a reference to the data in case the selection is changed during paste
- uno::Reference<datatransfer::XTransferable> xRef( pCellTransfer );
- DropTransferObj( pCellTransfer, nPosX, nPosY, aLogicPos, DND_ACTION_COPY );
+ DropTransferObj( pCellTransfer.get(), nPosX, nPosY, aLogicPos, DND_ACTION_COPY );
}
else
{
- ScDrawTransferObj* pDrawTransfer = pOwnSelection->GetDrawData();
+ // keep a reference to the data in case the selection is changed during paste
+ rtl::Reference<ScDrawTransferObj> pDrawTransfer = pOwnSelection->GetDrawData();
if ( pDrawTransfer )
{
- // keep a reference to the data in case the selection is changed during paste
- uno::Reference<datatransfer::XTransferable> xRef( pDrawTransfer );
-
// bSameDocClipboard argument for PasteDraw is needed
// because only DragData is checked directly inside PasteDraw
pViewData->GetView()->PasteDraw(
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 8fd89540a1ff..1579bcc82e6d 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -184,8 +184,7 @@ void ScViewFunctionSet::BeginDrag()
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
// set position of dragged cell within range
ScRange aMarkRange = pTransferObj->GetRange();
@@ -203,7 +202,7 @@ void ScViewFunctionSet::BeginDrag()
if ( pWindow->IsTracking() )
pWindow->EndTracking( TrackingEventFlags::Cancel ); // abort selecting
- SC_MOD()->SetDragObject( pTransferObj, nullptr ); // for internal D&D
+ SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
pTransferObj->StartDrag( pWindow, nDragActions );
return; // dragging started
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 8534373ba48b..88143e9ac594 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -488,8 +488,7 @@ void ScTabControl::DoDrag( const vcl::Region& /* rRegion */ )
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
- css::uno::Reference<css::datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
pTransferObj->SetDragSourceFlags(ScDragSrc::Table);
@@ -498,7 +497,7 @@ void ScTabControl::DoDrag( const vcl::Region& /* rRegion */ )
pTransferObj->SetSourceCursorPos( pViewData->GetCurX(), pViewData->GetCurY() );
vcl::Window* pWindow = pViewData->GetActiveWin();
- SC_MOD()->SetDragObject( pTransferObj, nullptr ); // for internal D&D
+ SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 6a1087c6b135..f789a34021e5 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -418,7 +418,7 @@ void ScTabView::CheckSelectionTransfer()
{
ScModule* pScMod = SC_MOD();
ScSelectionTransferObj* pOld = pScMod->GetSelectionTransfer();
- ScSelectionTransferObj* pNew = ScSelectionTransferObj::CreateFromView( this );
+ rtl::Reference<ScSelectionTransferObj> pNew = ScSelectionTransferObj::CreateFromView( this );
if ( pNew )
{
// create new selection
@@ -426,8 +426,7 @@ void ScTabView::CheckSelectionTransfer()
if (pOld)
pOld->ForgetView();
- uno::Reference<datatransfer::XTransferable> xRef( pNew );
- pScMod->SetSelectionTransfer( pNew );
+ pScMod->SetSelectionTransfer( pNew.get() );
pNew->CopyToSelection( GetActiveWin() ); // may delete pOld
}
else if ( pOld && pOld->GetView() == this )
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 67bef8e7db04..e5a630d7a708 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -269,8 +269,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
if ( ScGlobal::xDrawClipDocShellRef.is() )
{
SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef.get() );
@@ -278,7 +277,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() );
- SC_MOD()->SetClipObject( pTransferObj, nullptr );
+ SC_MOD()->SetClipObject( pTransferObj.get(), nullptr );
}
bDone = true;
@@ -377,8 +376,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc );
- uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc );
if ( ScGlobal::xDrawClipDocShellRef.is() )
{
@@ -387,7 +385,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( pTransferObj, nullptr ); // internal clipboard
+ SC_MOD()->SetClipObject( pTransferObj.get(), nullptr ); // internal clipboard
}
bSuccess = true;
@@ -463,12 +461,10 @@ void ScViewFunc::PasteFromSystem()
vcl::Window* pWin = GetActiveWin();
ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard();
-
+ // keep a reference in case the clipboard is changed during PasteFromClip
+ rtl::Reference<ScDrawTransferObj> pDrawClip = ScDrawTransferObj::GetOwnClipboard();
if (pOwnClip)
{
- // keep a reference in case the clipboard is changed during PasteFromClip
- uno::Reference<datatransfer::XTransferable> aOwnClipRef( pOwnClip );
PasteFromClip( InsertDeleteFlags::ALL, pOwnClip->GetDocument(),
ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE,
true ); // allow warning dialog
@@ -706,11 +702,10 @@ bool ScViewFunc::PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi )
bool bRet = true;
vcl::Window* pWin = GetActiveWin();
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
+ // keep a reference in case the clipboard is changed during PasteFromClip
+ rtl::Reference<ScTransferObj> pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
if ( nFormatId == SotClipboardFormatId::NONE && pOwnClip )
{
- // keep a reference in case the clipboard is changed during PasteFromClip
- uno::Reference<datatransfer::XTransferable> aOwnClipRef( pOwnClip );
PasteFromClip( InsertDeleteFlags::ALL, pOwnClip->GetDocument(),
ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE,
!bApi ); // allow warning dialog