summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuconcustomshape.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx8
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx14
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext.cxx4
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx14
-rw-r--r--sc/source/ui/inc/fuconarc.hxx2
-rw-r--r--sc/source/ui/inc/fuconcustomshape.hxx2
-rw-r--r--sc/source/ui/inc/fuconpol.hxx2
-rw-r--r--sc/source/ui/inc/fuconrec.hxx2
-rw-r--r--sc/source/ui/inc/fuconuno.hxx2
-rw-r--r--sc/source/ui/inc/fupoor.hxx2
-rw-r--r--sc/source/ui/inc/futext.hxx2
-rw-r--r--sc/source/ui/inc/notemark.hxx2
-rw-r--r--sc/source/ui/undo/undocell.cxx5
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx4
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx4
-rw-r--r--sc/source/ui/view/drawview.cxx8
-rw-r--r--sc/source/ui/view/notemark.cxx3
-rw-r--r--sc/source/ui/view/tabvwsh2.cxx4
-rw-r--r--sc/source/ui/view/tabvwshb.cxx4
-rw-r--r--sc/source/ui/view/tabvwshg.cxx6
-rw-r--r--sc/source/ui/view/viewfun5.cxx4
-rw-r--r--sc/source/ui/view/viewfun7.cxx14
28 files changed, 65 insertions, 69 deletions
diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx
index ef9b2c0fdd8e..77deb115fac8 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -111,13 +111,13 @@ void FuConstArc::Deactivate()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
// case SID_DRAW_ARC:
// case SID_DRAW_PIE:
// case SID_DRAW_CIRCLECUT:
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx
index ec2e7f0836b7..2994187b368e 100644
--- a/sc/source/ui/drawfunc/fuconcustomshape.cxx
+++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx
@@ -112,9 +112,9 @@ void FuConstCustomShape::Deactivate()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
{
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx
index 6ce044ad9d5a..7290b5186ad7 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -174,7 +174,7 @@ void FuConstPolygon::Deactivate()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
// case SID_DRAW_XPOLYGON:
// case SID_DRAW_XPOLYGON_NOFILL:
@@ -185,7 +185,7 @@ SdrObjectUniquePtr FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, con
// case SID_DRAW_FREELINE:
// case SID_DRAW_FREELINE_NOFILL:
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index 8e31015e8ae3..6c2d548094bb 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -344,9 +344,9 @@ void FuConstRectangle::Deactivate()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index e4e3c3e3764b..f113b1825051 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -100,11 +100,11 @@ void FuConstUnoControl::Deactivate()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
{
// case SID_FM_CREATE_CONTROL:
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 1e2791b12e16..9816bdb1e363 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -179,7 +179,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj(
+ rtl::Reference<SdrGrafObj> pObj = new SdrGrafObj(
pView->getSdrModelFromSdrView(), // TTTT pView should be reference
rGraphic1,
aRect);
@@ -198,7 +198,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
// don't select if from (dispatch) API, to allow subsequent cell operations
SdrInsertFlags nInsOptions = (bApi && !comphelper::LibreOfficeKit::isActive()) ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE;
- bool bSuccess = pView->InsertObjectAtView( pObj, *pPV, nInsOptions );
+ bool bSuccess = pView->InsertObjectAtView( pObj.get(), *pPV, nInsOptions );
// SetGraphicLink has to be used after inserting the object,
// otherwise an empty graphic is swapped in and the contact stuff crashes.
@@ -247,12 +247,12 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
if (!bRet) { return; }
}
- SdrMediaObj* pObj = new SdrMediaObj(
+ rtl::Reference<SdrMediaObj> pObj = new SdrMediaObj(
*rData.GetDocument().GetDrawLayer(),
tools::Rectangle(aInsertPos, aSize));
pObj->setURL( realURL, ""/*TODO?*/ );
- pView->InsertObjectAtView( pObj, *pPV, bApi ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE );
+ pView->InsertObjectAtView( pObj.get(), *pPV, bApi ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE );
}
#endif
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 945de4ac9268..ba7c2cba3573 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -342,13 +342,13 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView*
if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
aPnt.AdjustX( -(aSize.Width()) ); // move position to left edge
tools::Rectangle aRect (aPnt, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj(
+ rtl::Reference<SdrOle2Obj> pObj = new SdrOle2Obj(
*pDoc, // TTTT should be reference
aObjRef,
aName,
aRect);
SdrPageView* pPV = pView->GetSdrPageView();
- bool bSuccess = pView->InsertObjectAtView(pObj, *pPV);
+ bool bSuccess = pView->InsertObjectAtView(pObj.get(), *pPV);
if (bSuccess && nAspect != embed::Aspects::MSOLE_ICON)
{
@@ -383,7 +383,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView*
}
else if (bSuccess)
{
- rViewShell.ActivateObject(pObj, embed::EmbedVerbs::MS_OLEVERB_SHOW);
+ rViewShell.ActivateObject(pObj.get(), embed::EmbedVerbs::MS_OLEVERB_SHOW);
}
}
@@ -583,7 +583,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
Point aStart = rViewSh.GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj(
+ rtl::Reference<SdrOle2Obj> pObj = new SdrOle2Obj(
*pDoc, // TTTT should be reference
svt::EmbeddedObjectRef(xObj, nAspect),
aName,
@@ -598,9 +598,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
// use the page instead of the view to insert, so no undo action is created yet
SdrPage* pPage = pPV->GetPage();
- pPage->InsertObject( pObj );
+ pPage->InsertObject( pObj.get() );
pView->UnmarkAllObj();
- pView->MarkObj( pObj, pPV );
+ pView->MarkObj( pObj.get(), pPV );
if (rReq.IsAPI())
{
@@ -613,7 +613,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
// only activate object if not called via API (e.g. macro)
if (!comphelper::LibreOfficeKit::isActive())
- rViewShell.ActivateObject(pObj, embed::EmbedVerbs::MS_OLEVERB_SHOW);
+ rViewShell.ActivateObject(pObj.get(), embed::EmbedVerbs::MS_OLEVERB_SHOW);
//open wizard
//@todo get context from calc if that has one
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index decfacebe85c..a10aa185b54f 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -216,7 +216,7 @@ void FuPoor::StopDragTimer()
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuPoor::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& /* rRectangle */)
+rtl::Reference<SdrObject> FuPoor::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& /* rRectangle */)
{
// empty base implementation
return nullptr;
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index d907a0a72bf8..7f0ec1281484 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -620,14 +620,14 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
}
// Create default drawing objects via keyboard
-SdrObjectUniquePtr FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
+rtl::Reference<SdrObject> FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
// case SID_DRAW_TEXT:
// case SID_DRAW_TEXT_VERTICAL:
// case SID_DRAW_TEXT_MARQUEE:
// case SID_DRAW_NOTEEDIT:
- SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
*pDrDoc,
pView->GetCurrentObjInventor(),
pView->GetCurrentObjIdentifier()));
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index c4487d45d724..9252dffa7695 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -120,11 +120,11 @@ void ScGraphicShell::ExecuteFilter( const SfxRequest& rReq )
if( pPageView )
{
- SdrGrafObj* pFilteredObj(static_cast<SdrGrafObj*>(pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject())));
+ rtl::Reference<SdrGrafObj> pFilteredObj = SdrObject::Clone(*pGraphicObj, pGraphicObj->getSdrModelFromSdrObject());
OUString aStr = pView->GetDescriptionOfMarkedObjects() + " " + ScResId(SCSTR_UNDO_GRAFFILTER);
pView->BegUndo( aStr );
pFilteredObj->SetGraphicObject( aFilterObj );
- pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj.get() );
pView->EndUndo();
}
}
@@ -169,7 +169,7 @@ void ScGraphicShell::ExecuteExternalEdit( SAL_UNUSED_PARAMETER SfxRequest& )
{
GraphicObject aGraphicObject( pGraphicObj->GetGraphicObject() );
m_ExternalEdits.push_back( std::make_unique<SdrExternalToolEdit>(
- pView, pObj));
+ pView, pGraphicObj));
m_ExternalEdits.back()->Edit( &aGraphicObject );
}
}
@@ -210,11 +210,11 @@ void ScGraphicShell::ExecuteCompressGraphic( SAL_UNUSED_PARAMETER SfxRequest& )
CompressGraphicsDialog dialog(GetViewData().GetDialogParent(), pGraphicObj, GetViewData().GetBindings());
if (dialog.run() == RET_OK)
{
- SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
+ rtl::Reference<SdrGrafObj> pNewObject = dialog.GetCompressedSdrGrafObj();
SdrPageView* pPageView = pView->GetSdrPageView();
OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Compress";
pView->BegUndo( aUndoString );
- pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject.get() );
pView->EndUndo();
}
}
@@ -343,12 +343,12 @@ void ScGraphicShell::ExecuteChangePicture( SAL_UNUSED_PARAMETER SfxRequest& /*rR
ErrCode nError = aDlg.GetGraphic(aGraphic);
if( nError == ERRCODE_NONE )
{
- SdrGrafObj* pNewObject(pGraphicObj->CloneSdrObject(pGraphicObj->getSdrModelFromSdrObject()));
+ rtl::Reference<SdrGrafObj> pNewObject(SdrObject::Clone(*pGraphicObj, pGraphicObj->getSdrModelFromSdrObject()));
pNewObject->SetGraphic( aGraphic );
SdrPageView* pPageView = pView->GetSdrPageView();
OUString aUndoString = pView->GetDescriptionOfMarkedObjects() + " Change";
pView->BegUndo( aUndoString );
- pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
+ pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject.get() );
pView->EndUndo();
}
}
diff --git a/sc/source/ui/inc/fuconarc.hxx b/sc/source/ui/inc/fuconarc.hxx
index d1fb31aada2e..a330840ed078 100644
--- a/sc/source/ui/inc/fuconarc.hxx
+++ b/sc/source/ui/inc/fuconarc.hxx
@@ -37,7 +37,7 @@ public:
virtual void Deactivate() override;
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/fuconcustomshape.hxx b/sc/source/ui/inc/fuconcustomshape.hxx
index 89f22d17a5bb..b491b48fe5e6 100644
--- a/sc/source/ui/inc/fuconcustomshape.hxx
+++ b/sc/source/ui/inc/fuconcustomshape.hxx
@@ -40,7 +40,7 @@ public:
virtual void Deactivate() override;
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject( const sal_uInt16 nID, const tools::Rectangle& rRectangle ) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject( const sal_uInt16 nID, const tools::Rectangle& rRectangle ) override;
// #i33136#
virtual bool doConstructOrthogonal() const override;
diff --git a/sc/source/ui/inc/fuconpol.hxx b/sc/source/ui/inc/fuconpol.hxx
index e09225136649..8cebc3b03a76 100644
--- a/sc/source/ui/inc/fuconpol.hxx
+++ b/sc/source/ui/inc/fuconpol.hxx
@@ -38,7 +38,7 @@ public:
virtual void Deactivate() override;
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/fuconrec.hxx b/sc/source/ui/inc/fuconrec.hxx
index 1f3fbb8ee770..865ad5b2b425 100644
--- a/sc/source/ui/inc/fuconrec.hxx
+++ b/sc/source/ui/inc/fuconrec.hxx
@@ -38,7 +38,7 @@ public:
static void SetLineEnds(SfxItemSet& rAttr, const SdrObject& rObj, sal_uInt16 nSlotId);
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/fuconuno.hxx b/sc/source/ui/inc/fuconuno.hxx
index 1c58d5db3f12..a1034c3ed4b6 100644
--- a/sc/source/ui/inc/fuconuno.hxx
+++ b/sc/source/ui/inc/fuconuno.hxx
@@ -44,7 +44,7 @@ public:
SC_DLLPUBLIC virtual void Deactivate() override;
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/fupoor.hxx b/sc/source/ui/inc/fupoor.hxx
index 978a2ca095ed..6f226776b03f 100644
--- a/sc/source/ui/inc/fupoor.hxx
+++ b/sc/source/ui/inc/fupoor.hxx
@@ -94,7 +94,7 @@ public:
void StopDragTimer();
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle);
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle);
protected:
static void ImpForceQuadratic(tools::Rectangle& rRect);
diff --git a/sc/source/ui/inc/futext.hxx b/sc/source/ui/inc/futext.hxx
index c53a5b38892d..fc8e75dc15c0 100644
--- a/sc/source/ui/inc/futext.hxx
+++ b/sc/source/ui/inc/futext.hxx
@@ -47,7 +47,7 @@ public:
void StopEditMode();
// Create default drawing objects via keyboard
- virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
+ virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle) override;
private:
std::unique_ptr<SdrOutliner> MakeOutliner();
diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx
index 5fb1d6e94704..31965be07802 100644
--- a/sc/source/ui/inc/notemark.hxx
+++ b/sc/source/ui/inc/notemark.hxx
@@ -49,7 +49,7 @@ private:
tools::Rectangle m_aRect;
std::unique_ptr<SdrModel> m_pModel;
- ScCaptionPtr m_xObject;
+ rtl::Reference<SdrCaptionObj> m_xObject;
bool m_bVisible;
DECL_LINK( TimeHdl, Timer*, void );
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index b306dcd83a07..5d15ac26a677 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -22,6 +22,7 @@
#include <scitems.hxx>
#include <editeng/editobj.hxx>
#include <sfx2/app.hxx>
+#include <svx/svdocapt.hxx>
#include <comphelper/lok.hxx>
#include <osl/diagnose.h>
@@ -731,12 +732,10 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP
if (bInsert)
{
maNewData = rNoteData;
- maNewData.mxCaption.setNotOwner();
}
else
{
maOldData = rNoteData;
- maOldData.mxCaption.setNotOwner();
}
}
@@ -750,8 +749,6 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP
{
OSL_ENSURE( maOldData.mxCaption || maNewData.mxCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" );
OSL_ENSURE( !maOldData.mxInitData && !maNewData.mxInitData, "ScUndoReplaceNote::ScUndoReplaceNote - unexpected uninitialized note" );
- maOldData.mxCaption.setNotOwner();
- maNewData.mxCaption.setNotOwner();
}
ScUndoReplaceNote::~ScUndoReplaceNote()
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index b3a32cd457a0..da5fc9f2f19d 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -150,7 +150,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
xReceiver->setArguments(aArgs);
}
- SdrOle2Obj* pObject = new SdrOle2Obj(
+ rtl::Reference<SdrOle2Obj> pObject = new SdrOle2Obj(
*pModel,
svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
aName,
@@ -159,7 +159,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
if (xObject.is())
xObject->setVisualAreaSize(nAspect, aAwtSize);
- pPage->InsertObject(pObject);
+ pPage->InsertObject(pObject.get());
pModel->AddUndo(std::make_unique<SdrUndoInsertObj>(*pObject));
}
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 4b74bdf9c6d0..4d4ea02c3e24 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -248,7 +248,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
- SdrOle2Obj* pObj = new SdrOle2Obj(
+ rtl::Reference<SdrOle2Obj> pObj = new SdrOle2Obj(
*pModel,
::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
aName,
@@ -262,7 +262,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
// Add here again if this is wanted (see task description for details)
// ChartHelper::AdaptDefaultsForChart( xObj );
- pPage->InsertObject( pObj );
+ pPage->InsertObject( pObj.get() );
pModel->AddUndo( std::make_unique<SdrUndoInsertObj>( *pObj ) );
}
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 2774e962aa67..24aec4aa5da2 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -1129,19 +1129,19 @@ SdrObject* ScDrawView::ApplyGraphicToObject(
const OUString& rBeginUndoText,
const OUString& rFile)
{
- if(dynamic_cast< SdrGrafObj* >(&rHitObject))
+ if(auto pGrafHitObj = dynamic_cast< SdrGrafObj* >(&rHitObject))
{
- SdrGrafObj* pNewGrafObj(static_cast<SdrGrafObj*>(rHitObject.CloneSdrObject(rHitObject.getSdrModelFromSdrObject())));
+ rtl::Reference<SdrGrafObj> pNewGrafObj = SdrObject::Clone(*pGrafHitObj, rHitObject.getSdrModelFromSdrObject());
pNewGrafObj->SetGraphic(rGraphic);
BegUndo(rBeginUndoText);
- ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj);
+ ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj.get());
// set in all cases - the Clone() will have copied an existing link (!)
pNewGrafObj->SetGraphicLink( rFile );
EndUndo();
- return pNewGrafObj;
+ return pNewGrafObj.get();
}
else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
{
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index 0c5774957080..2824a453e7e9 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -65,8 +65,7 @@ ScNoteMarker::ScNoteMarker( vcl::Window* pWin, vcl::Window* pRight, vcl::Window*
ScNoteMarker::~ScNoteMarker()
{
- if (m_pModel)
- m_xObject.release(); // deleting pModel also deletes the SdrCaptionObj
+ m_xObject.clear();
InvalidateWin();
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index a1cf1879c12e..c25d3412d3fa 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -361,13 +361,13 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
return;
// create the default object
- SdrObjectUniquePtr pObj = pFuActual->CreateDefaultObject(nNewId, aNewObjectRectangle);
+ rtl::Reference<SdrObject> pObj = pFuActual->CreateDefaultObject(nNewId, aNewObjectRectangle);
if(!pObj)
return;
// insert into page
- pView->InsertObjectAtView(pObj.release(), *pPageView);
+ pView->InsertObjectAtView(pObj.get(), *pPageView);
switch ( nNewId )
{
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 75a359e6c9ef..d718a2e2cd00 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -507,7 +507,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
if(pPageView)
{
svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
- SdrObjectUniquePtr pNewDBField = pDrView->CreateFieldControl(aDescriptor);
+ rtl::Reference<SdrObject> pNewDBField = pDrView->CreateFieldControl(aDescriptor);
if(pNewDBField)
{
@@ -539,7 +539,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
}
}
- pView->InsertObjectAtView(pNewDBField.release(), *pPageView);
+ pView->InsertObjectAtView(pNewDBField.get(), *pPageView);
}
}
}
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index 365d51117292..f4fc1f02bae0 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -60,12 +60,12 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
ScDrawView* pDrView = pView->GetScDrawView();
SdrModel* pModel = pDrView->GetModel();
- SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ rtl::Reference<SdrObject> pObj = SdrObjFactory::MakeNewObject(
*pModel,
SdrInventor::FmForm,
SdrObjKind::FormButton);
- SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
+ SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj.get() );
OSL_ENSURE( pUnoCtrl, "no SdrUnoObj");
if( !pUnoCtrl )
return;
@@ -114,7 +114,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
// that seems not to be needed with UnoControls
// do not mark when Ole
- pDrView->InsertObjectSafe( pObj, *pDrView->GetSdrPageView() );
+ pDrView->InsertObjectSafe( pObj.get(), *pDrView->GetSdrPageView() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 714a759ed7c4..d1a6e5965fca 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -497,7 +497,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
{
MakeDrawLayer();
ScDrawView* pScDrawView = GetScDrawView();
- SdrObjectUniquePtr pObj = pScDrawView->CreateFieldControl( svx::OColumnTransferable::extractColumnDescriptor( aDataHelper ) );
+ rtl::Reference<SdrObject> pObj = pScDrawView->CreateFieldControl( svx::OColumnTransferable::extractColumnDescriptor( aDataHelper ) );
if (pObj)
{
Point aInsPos = aPos;
@@ -527,7 +527,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
}
}
- pScDrawView->InsertObjectSafe(pObj.release(), *pScDrawView->GetSdrPageView());
+ pScDrawView->InsertObjectSafe(pObj.get(), *pScDrawView->GetSdrPageView());
GetViewData().GetViewShell()->SetDrawShell( true );
bRet = true;
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index d83d6867fd87..d42860dad5fc 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -153,18 +153,18 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
const SdrObject* pObj=pM->GetMarkedSdrObj();
// Directly Clone to target SdrModel
- SdrObject* pNewObj(pObj->CloneSdrObject(*pDrawModel));
+ rtl::Reference<SdrObject> pNewObj(pObj->CloneSdrObject(*pDrawModel));
if (pNewObj!=nullptr)
{
// copy graphics within the same model - always needs new name
- if ( dynamic_cast<const SdrGrafObj*>( pNewObj) != nullptr && !bPasteIsMove )
+ if ( dynamic_cast<const SdrGrafObj*>( pNewObj.get()) != nullptr && !bPasteIsMove )
pNewObj->SetName(static_cast<ScDrawLayer*>(pDrawModel)->GetNewGraphicName());
if (nDiffX!=0 || nDiffY!=0)
pNewObj->NbcMove(Size(nDiffX,nDiffY));
if (pDestPage)
- pDestPage->InsertObject( pNewObj );
+ pDestPage->InsertObject( pNewObj.get() );
pScDrawView->AddUndo(std::make_unique<SdrUndoInsertObj>( *pNewObj ));
if (ScDrawLayer::IsCellAnchored(*pNewObj))
@@ -348,14 +348,14 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X
tools::Rectangle aRect( aInsPos, aSize );
ScDrawView* pDrView = GetScDrawView();
- SdrOle2Obj* pSdrObj = new SdrOle2Obj(
+ rtl::Reference<SdrOle2Obj> pSdrObj = new SdrOle2Obj(
pDrView->getSdrModelFromSdrView(),
aObjRef,
aName,
aRect);
SdrPageView* pPV = pDrView->GetSdrPageView();
- pDrView->InsertObjectSafe( pSdrObj, *pPV ); // don't mark if OLE
+ pDrView->InsertObjectSafe( pSdrObj.get(), *pPV ); // don't mark if OLE
GetViewData().GetViewShell()->SetDrawShell( true );
return true;
}
@@ -430,7 +430,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
GetViewData().GetViewShell()->SetDrawShell( true );
tools::Rectangle aRect(aPos, aSize);
- SdrGrafObj* pGrafObj = new SdrGrafObj(
+ rtl::Reference<SdrGrafObj> pGrafObj = new SdrGrafObj(
pScDrawView->getSdrModelFromSdrView(),
rGraphic,
aRect);
@@ -442,7 +442,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
pGrafObj->SetName(aName);
// don't mark if OLE
- bool bSuccess = pScDrawView->InsertObjectSafe(pGrafObj, *pScDrawView->GetSdrPageView());
+ bool bSuccess = pScDrawView->InsertObjectSafe(pGrafObj.get(), *pScDrawView->GetSdrPageView());
// SetGraphicLink has to be used after inserting the object,
// otherwise an empty graphic is swapped in and the contact stuff crashes.