summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/select.cxx8
-rw-r--r--sc/source/ui/view/tabcont.cxx6
-rw-r--r--sc/source/ui/view/viewfun3.cxx10
3 files changed, 11 insertions, 13 deletions
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index d15db4c3e5b0..0c4e171cd097 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -169,9 +169,9 @@ void ScViewFunctionSet::BeginDrag()
rMark.MarkToSimple();
if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
{
- ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
+ ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
// bApi = TRUE -> no error messages
- bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc, false, true );
+ bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc.get(), false, true );
if ( bCopied )
{
sal_Int8 nDragActions = pViewData->GetView()->SelectionEditable() ?
@@ -184,7 +184,7 @@ void ScViewFunctionSet::BeginDrag()
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
// set position of dragged cell within range
ScRange aMarkRange = pTransferObj->GetRange();
@@ -207,8 +207,6 @@ void ScViewFunctionSet::BeginDrag()
return; // dragging started
}
- else
- delete pClipDoc;
}
}
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 62d270613978..5e0d005d513f 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -483,16 +483,16 @@ void ScTabControl::DoDrag()
aTabMark.ResetMark(); // doesn't change marked table information
aTabMark.SetMarkArea( aTabRange );
- ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
+ ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
ScClipParam aClipParam(aTabRange, false);
- rDoc.CopyToClip(aClipParam, pClipDoc, &aTabMark, false, false);
+ rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aTabMark, false, false);
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
pTransferObj->SetDragSourceFlags(ScDragSrc::Table);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 570cf5f3f06e..d052717e7a57 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -279,7 +279,7 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
+ ScTransferObj* pTransferObj = new ScTransferObj( ScDocumentUniquePtr(pClipDoc), aObjDesc );
uno::Reference<css::datatransfer::XTransferable2> xTransferObj = pTransferObj;
if ( ScGlobal::xDrawClipDocShellRef.is() )
{
@@ -396,7 +396,7 @@ bool ScViewFunc::CopyToClipMultiRange( ScDocument* pInputClipDoc, const ScRangeL
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
// maSize is set in ScTransferObj ctor
- ScTransferObj* pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc );
+ ScTransferObj* pTransferObj = new ScTransferObj( std::move(pDocClip), aObjDesc );
uno::Reference<css::datatransfer::XTransferable2> xTransferObj = pTransferObj;
if ( ScGlobal::xDrawClipDocShellRef.is() )
{
@@ -429,13 +429,13 @@ ScTransferObj* ScViewFunc::CopyToTransferable()
aRange.aEnd.Col(), aRange.aEnd.Row(),
rMark ) )
{
- ScDocument *pClipDoc = new ScDocument( SCDOCMODE_CLIP ); // create one (deleted by ScTransferObj)
+ ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); // create one (deleted by ScTransferObj)
bool bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark );
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
ScClipParam aClipParam(aRange, false);
- pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, true);
+ pDoc->CopyToClip(aClipParam, pClipDoc.get(), &rMark, false, true);
ScDrawLayer::SetGlobalDrawPersist(nullptr);
pClipDoc->ExtendMerge( aRange, true );
@@ -444,7 +444,7 @@ ScTransferObj* ScViewFunc::CopyToTransferable()
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
- ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
+ ScTransferObj* pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
return pTransferObj;
}
}