summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/inc/drawpage.hxx9
-rw-r--r--sc/qa/extras/anchor.cxx2
-rw-r--r--sc/qa/unit/ucalc.cxx14
-rw-r--r--sc/qa/unit/ucalc_sort.cxx2
-rw-r--r--sc/source/core/data/documen9.cxx6
-rw-r--r--sc/source/core/data/drawpage.cxx30
-rw-r--r--sc/source/core/data/drwlayer.cxx22
-rw-r--r--sc/source/core/data/postit.cxx11
-rw-r--r--sc/source/core/tool/detfunc.cxx23
-rw-r--r--sc/source/filter/excel/xichart.cxx2
-rw-r--r--sc/source/filter/excel/xiescher.cxx72
-rw-r--r--sc/source/filter/html/htmlexp2.cxx3
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx6
-rw-r--r--sc/source/ui/app/drwtrans.cxx10
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuconcustomshape.cxx9
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx21
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx12
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx18
-rw-r--r--sc/source/ui/drawfunc/futext.cxx5
-rw-r--r--sc/source/ui/inc/drawview.hxx7
-rw-r--r--sc/source/ui/navipi/content.cxx2
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx7
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx16
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx129
-rw-r--r--sc/source/ui/view/drawvie3.cxx6
-rw-r--r--sc/source/ui/view/gridwin4.cxx5
-rw-r--r--sc/source/ui/view/preview.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx5
-rw-r--r--sc/source/ui/view/tabvwshg.cxx7
-rw-r--r--sc/source/ui/view/viewfun7.cxx21
35 files changed, 193 insertions, 317 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 8c7382cd1050..f86c9048fe03 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -124,9 +124,6 @@ private:
protected:
const SfxItemPropertySet& GetPropertySet() const { return aPropSet; }
- /** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const override;
-
public:
ScModelObj(ScDocShell* pDocSh);
virtual ~ScModelObj() override;
diff --git a/sc/inc/drawpage.hxx b/sc/inc/drawpage.hxx
index cbbaff987a6c..8f9348220172 100644
--- a/sc/inc/drawpage.hxx
+++ b/sc/inc/drawpage.hxx
@@ -24,18 +24,21 @@
class ScDrawLayer;
-class ScDrawPage : public FmFormPage
+class ScDrawPage: public FmFormPage
{
ScDrawPage& operator=(const ScDrawPage&) = delete;
- ScDrawPage(const ScDrawPage&) = delete;
public:
explicit ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage);
virtual ~ScDrawPage() override;
- virtual ScDrawPage* Clone(SdrModel* pNewModel = nullptr) const override;
+ virtual ScDrawPage* Clone() const override;
+ virtual ScDrawPage* Clone(SdrModel* pNewModel) const override;
virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override;
+
+private:
+ ScDrawPage(const ScDrawPage& rSrcPage);
};
#endif
diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx
index baa609a154a6..e1130b792b39 100644
--- a/sc/qa/extras/anchor.cxx
+++ b/sc/qa/extras/anchor.cxx
@@ -170,7 +170,7 @@ void ScAnchorTest::testTdf76183()
// Add a circle somewhere below first row.
const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
- SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
// Anchor to cell
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, 0, false);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 907c8f6a04ae..eff48bfd5581 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2708,7 +2708,7 @@ void Test::testGraphicsInGroup()
{
//Add a square
tools::Rectangle aOrigRect(2,2,100,100);
- SdrRectObj *pObj = new SdrRectObj(*pDrawLayer, aOrigRect);
+ SdrRectObj *pObj = new SdrRectObj(aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle &rNewRect = pObj->GetLogicRect();
CPPUNIT_ASSERT_EQUAL_MESSAGE("must have equal position and size",
@@ -2749,7 +2749,7 @@ void Test::testGraphicsInGroup()
{
// Add a circle.
tools::Rectangle aOrigRect = tools::Rectangle(10,10,210,210); // 200 x 200
- SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle& rNewRect = pObj->GetLogicRect();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Position and size of the circle shouldn't change when inserted into the page.",
@@ -2781,7 +2781,7 @@ void Test::testGraphicsInGroup()
tools::Rectangle aOrigRect(10,200,110,300); // 100 x 100
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pObj = new SdrPathObj(*pDrawLayer, OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pObj = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
pObj->NbcSetLogicRect(aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle& rNewRect = pObj->GetLogicRect();
@@ -2822,7 +2822,7 @@ void Test::testGraphicsOnSheetMove()
// Insert an object.
tools::Rectangle aObjRect(2,2,100,100);
- SdrObject* pObj = new SdrRectObj(*pDrawLayer, aObjRect);
+ SdrObject* pObj = new SdrRectObj(aObjRect);
pPage->InsertObject(pObj);
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, false);
@@ -5342,7 +5342,7 @@ void Test::testNoteLifeCycle()
SdrCaptionObj* pCaption = pNote->GetOrCreateCaption(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to create a caption object.", pCaption);
CPPUNIT_ASSERT_EQUAL_MESSAGE("This caption should belong to the drawing layer of the document.",
- m_pDoc->GetDrawLayer(), static_cast<ScDrawLayer*>(&pCaption->getSdrModelFromSdrObject()));
+ m_pDoc->GetDrawLayer(), static_cast<ScDrawLayer*>(pCaption->GetModel()));
// Copy B2 with note to a clipboard.
@@ -5648,7 +5648,7 @@ void Test::testAnchoredRotatedShape()
tools::Rectangle aRect( 4000, 5000, 10000, 7000 );
tools::Rectangle aRotRect( 6000, 3000, 8000, 9000 );
- SdrRectObj *pObj = new SdrRectObj(*pDrawLayer, aRect);
+ SdrRectObj *pObj = new SdrRectObj(aRect);
pPage->InsertObject(pObj);
Point aRef1(pObj->GetSnapRect().Center());
int nAngle = 9000; //90 deg.
@@ -6421,7 +6421,7 @@ void Test::testUndoDataAnchor()
// Insert an object.
tools::Rectangle aObjRect(2,1000,100,1100);
- SdrObject* pObj = new SdrRectObj(*pDrawLayer, aObjRect);
+ SdrObject* pObj = new SdrRectObj(aObjRect);
pPage->InsertObject(pObj);
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, false);
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 38c3e1aebcdb..048b53b33969 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -1911,7 +1911,7 @@ void Test::testSortImages()
// Insert graphic in cell B2.
const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
- SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT(pPage);
pPage->InsertObject(pObj);
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 8b9b4de19e63..70b99bdf03e5 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -84,9 +84,11 @@ void ScDocument::TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDes
SdrObject* pOldObject = aIter.Next();
while (pOldObject)
{
- // Clone to target SdrModel
- SdrObject* pNewObject = pOldObject->Clone(mpDrawLayer);
+ SdrObject* pNewObject = pOldObject->Clone();
+ // SdrObject* pNewObject = pOldObject->Clone( pNewPage, mpDrawLayer );
+ pNewObject->SetModel(mpDrawLayer);
pNewObject->SetPage(pNewPage);
+
pNewObject->NbcMove(Size(0,0));
pNewPage->InsertObject( pNewObject );
diff --git a/sc/source/core/data/drawpage.cxx b/sc/source/core/data/drawpage.cxx
index 5ccd3cdd5598..5d445983b69e 100644
--- a/sc/source/core/data/drawpage.cxx
+++ b/sc/source/core/data/drawpage.cxx
@@ -24,25 +24,37 @@
#include <document.hxx>
#include <pageuno.hxx>
-ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage)
-: FmFormPage(rNewModel, bMasterPage)
+ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage) :
+ FmFormPage(rNewModel, bMasterPage)
{
SetSize( Size( RECT_MAX, RECT_MAX ) );
}
+ScDrawPage::ScDrawPage(const ScDrawPage& rSrcPage)
+ : FmFormPage(rSrcPage)
+{
+}
+
ScDrawPage::~ScDrawPage()
{
}
+ScDrawPage* ScDrawPage::Clone() const
+{
+ return Clone(nullptr);
+}
+
ScDrawPage* ScDrawPage::Clone(SdrModel* const pNewModel) const
{
- ScDrawLayer& rScDrawLayer(static_cast< ScDrawLayer& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
- ScDrawPage* pClonedScDrawPage(
- new ScDrawPage(
- rScDrawLayer,
- IsMasterPage()));
- pClonedScDrawPage->FmFormPage::lateInit(*this);
- return pClonedScDrawPage;
+ ScDrawPage* const pNewPage = new ScDrawPage(*this);
+ FmFormModel* pScDrawModel = nullptr;
+ if (pNewModel)
+ {
+ pScDrawModel = dynamic_cast<FmFormModel*>(pNewModel);
+ assert(pScDrawModel);
+ }
+ pNewPage->lateInit(*this, pScDrawModel);
+ return pNewPage;
}
css::uno::Reference< css::uno::XInterface > ScDrawPage::createUnoPage()
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 0665e0942188..e694fed7c25a 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -155,10 +155,10 @@ ScUndoAnchorData::~ScUndoAnchorData()
void ScUndoAnchorData::Undo()
{
// Trigger Object Change
- if (pObj->IsInserted() && pObj->GetPage())
+ if (pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->getSdrModelFromSdrObject().Broadcast(aHint);
+ pObj->GetModel()->Broadcast(aHint);
}
if (mbWasCellAnchored)
@@ -175,10 +175,10 @@ void ScUndoAnchorData::Redo()
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *mpDoc, mnTab, mbWasResizeWithCell);
// Trigger Object Change
- if (pObj->IsInserted() && pObj->GetPage())
+ if (pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->getSdrModelFromSdrObject().Broadcast(aHint);
+ pObj->GetModel()->Broadcast(aHint);
}
}
@@ -463,10 +463,10 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
pOldData->maStart.SetTab(nOldTab);
pOldData->maEnd.SetTab(nOldTab);
}
-
- // Clone to target SdrModel
- SdrObject* pNewObject = pOldObject->Clone(this);
+ SdrObject* pNewObject = pOldObject->Clone();
+ pNewObject->SetModel(this);
pNewObject->SetPage(pNewPage);
+
pNewObject->NbcMove(Size(0,0));
pNewPage->InsertObject( pNewObject );
ScDrawObjData* pNewData = GetObjData(pNewObject);
@@ -1492,8 +1492,8 @@ void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rec
OSL_ENSURE( pDestPage, "no page" );
if (pDestPage)
{
- // Clone to target SdrModel
- SdrObject* pNewObject = pOldObject->Clone(pDestModel);
+ SdrObject* pNewObject = pOldObject->Clone();
+ pNewObject->SetModel(pDestModel);
pNewObject->SetPage(pDestPage);
uno::Reference< chart2::XChartDocument > xOldChart( ScChartHelper::GetChartFromSdrObject( pOldObject ) );
@@ -1667,8 +1667,8 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
if (bObjectInArea && (pOldObject->GetLayer() != SC_LAYER_INTERN)
&& !IsNoteCaption(pOldObject))
{
- // Clone to target SdrModel
- SdrObject* pNewObject = pOldObject->Clone(this);
+ SdrObject* pNewObject = pOldObject->Clone();
+ pNewObject->SetModel(this);
pNewObject->SetPage(pDestPage);
if ( bMirrorObj )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 676a0dafb35a..d70e87f528c1 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -375,11 +375,7 @@ void ScCaptionCreator::CreateCaption( bool bShown, bool bTailFront )
// create the caption drawing object
tools::Rectangle aTextRect( Point( 0 , 0 ), Size( SC_NOTECAPTION_WIDTH, SC_NOTECAPTION_HEIGHT ) );
Point aTailPos = CalcTailPos( bTailFront );
- mxCaption.reset(
- new SdrCaptionObj(
- *mrDoc.GetDrawLayer(), // TTTT should ret a ref?
- aTextRect,
- aTailPos));
+ mxCaption.reset( new SdrCaptionObj( aTextRect, aTailPos ));
// basic caption settings
ScCaptionUtil::SetBasicCaptionSettings( *mxCaption, bShown );
}
@@ -758,7 +754,7 @@ void ScCaptionPtr::removeFromDrawPageAndFree( bool bIgnoreUndo )
bool bRecording = false;
if (!bIgnoreUndo)
{
- ScDrawLayer* pDrawLayer(dynamic_cast< ScDrawLayer* >(&mpCaption->getSdrModelFromSdrObject()));
+ ScDrawLayer* pDrawLayer = dynamic_cast<ScDrawLayer*>(mpCaption->GetModel());
SAL_WARN_IF( !pDrawLayer, "sc.core", "ScCaptionPtr::removeFromDrawPageAndFree - object without drawing layer");
// create drawing undo action (before removing the object to have valid draw page in undo action)
bRecording = (pDrawLayer && pDrawLayer->IsRecording());
@@ -1141,9 +1137,8 @@ void ScPostIt::RemoveCaption()
/* Remove caption object only, if this note is its owner (e.g. notes in
undo documents refer to captions in original document, do not remove
them from drawing layer here). */
- // TTTT maybe no longer needed - can that still happen?
ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer();
- if (pDrawLayer == &maNoteData.mxCaption->getSdrModelFromSdrObject())
+ if (pDrawLayer == maNoteData.mxCaption->GetModel())
maNoteData.mxCaption.removeFromDrawPageAndFree();
SAL_INFO("sc.core","ScPostIt::RemoveCaption - refs: " << maNoteData.mxCaption.getRefs() <<
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 77f19b2e39c5..f8f5ac045c68 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -453,9 +453,7 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
// insert the rectangle before the arrow - this is relied on in FindFrameForObject
tools::Rectangle aRect = GetDrawRect( nRefStartCol, nRefStartRow, nRefEndCol, nRefEndRow );
- SdrRectObj* pBox = new SdrRectObj(
- *pModel,
- aRect);
+ SdrRectObj* pBox = new SdrRectObj( aRect );
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -496,10 +494,7 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
basegfx::B2DPolygon aTempPoly;
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pArrow = new SdrPathObj(
- *pModel,
- OBJ_LINE,
- basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -531,9 +526,7 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
if (bArea)
{
tools::Rectangle aRect = GetDrawRect( nStartCol, nStartRow, nEndCol, nEndRow );
- SdrRectObj* pBox = new SdrRectObj(
- *pModel,
- aRect);
+ SdrRectObj* pBox = new SdrRectObj( aRect );
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -566,10 +559,7 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
basegfx::B2DPolygon aTempPoly;
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pArrow = new SdrPathObj(
- *pModel,
- OBJ_LINE,
- basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -635,10 +625,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
aRect.AdjustTop( -70 );
aRect.AdjustBottom(70 );
- SdrCircObj* pCircle = new SdrCircObj(
- *pModel,
- OBJ_CIRC,
- aRect);
+ SdrCircObj* pCircle = new SdrCircObj( OBJ_CIRC, aRect );
SfxItemSet& rAttrSet = rData.GetCircleSet();
pCircle->SetMergedItemSetAndBroadcast(rAttrSet);
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 055663df4782..cad44b77ea43 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -4221,7 +4221,7 @@ void XclImpChartDrawing::ConvertObjects( XclImpDffConverter& rDffConv,
Reference< XDrawPageSupplier > xDrawPageSupp( rxModel, UNO_QUERY_THROW );
Reference< XDrawPage > xDrawPage( xDrawPageSupp->getDrawPage(), UNO_SET_THROW );
pSdrPage = ::GetSdrPageFromXDrawPage( xDrawPage );
- pSdrModel = pSdrPage ? &pSdrPage->getSdrModelFromSdrPage() : nullptr;
+ pSdrModel = pSdrPage ? pSdrPage->GetModel() : nullptr;
}
catch( Exception& )
{
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 989c9b693d0f..94b2d0130d0b 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -425,7 +425,8 @@ SdrObjectPtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffConv, c
else
{
xSdrObj = DoCreateSdrObj( rDffConv, rAnchorRect );
-
+ if( xSdrObj )
+ xSdrObj->SetModel( rDffConv.GetModel() );
//added for exporting OCX control
/* mnObjType value set should be as below table:
0x0000 Group 0x0001 Line
@@ -1011,9 +1012,7 @@ std::size_t XclImpGroupObj::DoGetProgressSize() const
SdrObjectPtr XclImpGroupObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& /*rAnchorRect*/ ) const
{
- std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj(
- new SdrObjGroup(
- *GetDoc().GetDrawLayer()));
+ std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj( new SdrObjGroup );
// child objects in BIFF2-BIFF5 have absolute size, not needed to pass own anchor rectangle
SdrObjList& rObjList = *xSdrObj->GetSubList(); // SdrObjGroup always returns existing sublist
for( ::std::vector< XclImpDrawObjRef >::const_iterator aIt = maChildren.begin(), aEnd = maChildren.end(); aIt != aEnd; ++aIt )
@@ -1081,11 +1080,7 @@ SdrObjectPtr XclImpLineObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
aB2DPolygon.append( ::basegfx::B2DPoint( rAnchorRect.Right(), rAnchorRect.Top() ) );
break;
}
- SdrObjectPtr xSdrObj(
- new SdrPathObj(
- *GetDoc().GetDrawLayer(),
- OBJ_LINE,
- ::basegfx::B2DPolyPolygon(aB2DPolygon)));
+ SdrObjectPtr xSdrObj( new SdrPathObj( OBJ_LINE, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
ConvertLineStyle( *xSdrObj, maLineData );
// line ends
@@ -1200,10 +1195,7 @@ void XclImpRectObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uI
SdrObjectPtr XclImpRectObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj(
- new SdrRectObj(
- *GetDoc().GetDrawLayer(),
- rAnchorRect));
+ SdrObjectPtr xSdrObj( new SdrRectObj( rAnchorRect ) );
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1216,11 +1208,7 @@ XclImpOvalObj::XclImpOvalObj( const XclImpRoot& rRoot ) :
SdrObjectPtr XclImpOvalObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj(
- new SdrCircObj(
- *GetDoc().GetDrawLayer(),
- OBJ_CIRC,
- rAnchorRect));
+ SdrObjectPtr xSdrObj( new SdrCircObj( OBJ_CIRC, rAnchorRect ) );
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1292,13 +1280,7 @@ SdrObjectPtr XclImpArcObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const t
break;
}
SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_SECT : OBJ_CARC;
- SdrObjectPtr xSdrObj(
- new SdrCircObj(
- *GetDoc().GetDrawLayer(),
- eObjKind,
- aNewRect,
- nStartAngle,
- nEndAngle));
+ SdrObjectPtr xSdrObj( new SdrCircObj( eObjKind, aNewRect, nStartAngle, nEndAngle ) );
ConvertFillStyle( *xSdrObj, maFillData );
ConvertLineStyle( *xSdrObj, maLineData );
rDffConv.Progress();
@@ -1376,11 +1358,7 @@ SdrObjectPtr XclImpPolygonObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, con
aB2DPolygon.append( lclGetPolyPoint( rAnchorRect, maCoords.front() ) );
// create the SdrObject
SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_PATHPOLY : OBJ_PATHPLIN;
- xSdrObj.reset(
- new SdrPathObj(
- *GetDoc().GetDrawLayer(),
- eObjKind,
- ::basegfx::B2DPolyPolygon(aB2DPolygon)));
+ xSdrObj.reset( new SdrPathObj( eObjKind, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
ConvertRectStyle( *xSdrObj );
}
rDffConv.Progress();
@@ -1442,9 +1420,7 @@ void XclImpTextObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uI
SdrObjectPtr XclImpTextObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- std::unique_ptr<SdrObjCustomShape, SdrObjectFree> xSdrObj(
- new SdrObjCustomShape(
- *GetDoc().GetDrawLayer()));
+ std::unique_ptr<SdrObjCustomShape, SdrObjectFree> xSdrObj( new SdrObjCustomShape );
xSdrObj->NbcSetSnapRect( rAnchorRect );
OUString aRectType = "rectangle";
xSdrObj->MergeDefaultAttributes( &aRectType );
@@ -1734,12 +1710,7 @@ SdrObjectPtr XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
// ChartHelper::AdaptDefaultsForChart( xEmbObj );
// create the container OLE object
- xSdrObj.reset(
- new SdrOle2Obj(
- *GetDoc().GetDrawLayer(),
- svt::EmbeddedObjectRef(xEmbObj, nAspect),
- aEmbObjName,
- rAnchorRect));
+ xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) );
}
return xSdrObj;
@@ -2982,11 +2953,7 @@ SdrObjectPtr XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, con
// no OLE - create a plain picture from IMGDATA record data
if( !xSdrObj && (maGraphic.GetType() != GraphicType::NONE) )
{
- xSdrObj.reset(
- new SdrGrafObj(
- *GetDoc().GetDrawLayer(),
- maGraphic,
- rAnchorRect));
+ xSdrObj.reset( new SdrGrafObj( maGraphic, rAnchorRect ) );
ConvertRectStyle( *xSdrObj );
}
@@ -3467,20 +3434,9 @@ SdrObjectPtr XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicOb
ErrCode nError = ERRCODE_NONE;
namespace cssea = ::com::sun::star::embed::Aspects;
sal_Int64 nAspects = rPicObj.IsSymbol() ? cssea::MSOLE_ICON : cssea::MSOLE_CONTENT;
- xSdrObj.reset(
- CreateSdrOLEFromStorage(
- GetConvData().mrSdrModel,
- aStrgName,
- xSrcStrg,
- pDocShell->GetStorage(),
- aGraphic,
- rAnchorRect,
- aVisArea,
- nullptr,
- nError,
- mnOleImpFlags,
- nAspects,
- GetRoot().GetMedium().GetBaseURL()));
+ xSdrObj.reset( CreateSdrOLEFromStorage(
+ aStrgName, xSrcStrg, pDocShell->GetStorage(), aGraphic,
+ rAnchorRect, aVisArea, nullptr, nError, mnOleImpFlags, nAspects, GetRoot().GetMedium().GetBaseURL()) );
}
}
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index d6887744f517..a6b73fd76631 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -165,7 +165,8 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
break;
default:
{
- Graphic aGraph(SdrExchangeView::GetObjGraphic(*pObject));
+ Graphic aGraph( SdrExchangeView::GetObjGraphic(
+ pDoc->GetDrawLayer(), pObject ) );
OUString aLinkName;
WriteImage( aLinkName, aGraph, aOpt );
pE->bWritten = true;
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index e553df1130ff..d6915302aba4 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -602,11 +602,7 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( pI->pGraphic )
{
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj(
- *pModel,
- *pI->pGraphic,
- aRect);
-
+ SdrGrafObj* pObj = new SdrGrafObj( *pI->pGraphic, aRect );
// calling SetGraphicLink here doesn't work
pObj->SetName( pI->aURL );
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 12cfa00f3bca..1e4c9c868bfc 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -188,7 +188,7 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
// #i71538# use complete SdrViews
// SdrExchangeView aView(pModel);
- SdrView aView(*pModel);
+ SdrView aView(pModel);
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
aSrcSize = aView.GetAllMarkedRect().GetSize();
@@ -395,7 +395,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c
{
// #i71538# use complete SdrViews
// SdrExchangeView aView( pModel );
- SdrView aView(*pModel);
+ SdrView aView( pModel );
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
OSL_ENSURE( pPv, "pPv not there..." );
aView.MarkAllObj( pPv );
@@ -632,7 +632,7 @@ static void lcl_InitMarks( SdrMarkView& rDest, const SdrMarkView& rSource, SCTAB
void ScDrawTransferObj::SetDragSource( const ScDrawView* pView )
{
DELETEZ( pDragSourceView );
- pDragSourceView = new SdrView(pView->getSdrModelFromSdrView()); // TTTT pView should be reference
+ pDragSourceView = new SdrView( pView->GetModel() );
lcl_InitMarks( *pDragSourceView, *pView, pView->GetTab() );
//! add as listener with document, delete pDragSourceView if document gone
@@ -641,7 +641,7 @@ void ScDrawTransferObj::SetDragSource( const ScDrawView* pView )
void ScDrawTransferObj::SetDragSourceObj( SdrObject* pObj, SCTAB nTab )
{
DELETEZ( pDragSourceView );
- pDragSourceView = new SdrView(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
+ pDragSourceView = new SdrView( pObj->GetModel() );
pDragSourceView->ShowSdrPage(pDragSourceView->GetModel()->GetPage(nTab));
SdrPageView* pPV = pDragSourceView->GetSdrPageView();
pDragSourceView->MarkObj(pObj, pPV);
@@ -719,7 +719,7 @@ void ScDrawTransferObj::InitDocShell()
SdrModel* pDestModel = rDestDoc.GetDrawLayer();
// #i71538# use complete SdrViews
// SdrExchangeView aDestView( pDestModel );
- SdrView aDestView(*pDestModel);
+ SdrView aDestView( pDestModel );
aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
aDestView.Paste(
*pModel,
diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx
index d167649a5086..7ada2107c5b3 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -123,9 +123,8 @@ SdrObject* FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const tools::Re
// case SID_DRAW_CIRCLECUT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx
index e028a4d1dcd3..f5a03392f736 100644
--- a/sc/source/ui/drawfunc/fuconcustomshape.cxx
+++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx
@@ -132,10 +132,8 @@ void FuConstCustomShape::Deactivate()
SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
-
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if( pObj )
{
tools::Rectangle aRectangle( rRectangle );
@@ -144,7 +142,6 @@ SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, c
ImpForceQuadratic( aRectangle );
pObj->SetLogicRect( aRectangle );
}
-
return pObj;
}
@@ -171,7 +168,7 @@ void FuConstCustomShape::SetAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->getSdrModelFromSdrObject().GetItemPool(),
+ pObj->GetModel()->GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx
index cc9ec052cea2..330ebf09a41d 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -185,9 +185,8 @@ SdrObject* FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const tools
// case SID_DRAW_FREELINE_NOFILL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index 6aba5faad5fc..d3ae4c990850 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -58,10 +58,10 @@ FuConstRectangle::~FuConstRectangle()
namespace {
-::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel* pDoc)
{
::basegfx::B2DPolyPolygon aRetval;
- XLineEndListRef pLineEndList(rModel.GetLineEndList());
+ XLineEndListRef pLineEndList = pDoc->GetLineEndList();
if( pLineEndList.is() )
{
@@ -116,7 +116,7 @@ bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
if (pObj)
{
- SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool());
+ SfxItemSet aAttr(pObj->GetModel()->GetItemPool());
SetLineEnds(aAttr, pObj, aSfxRequest.GetSlot());
pObj->SetMergedItemSet(aAttr);
}
@@ -216,7 +216,7 @@ void FuConstRectangle::Activate()
void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal_uInt16 nSlotId)
{
- SdrModel& rModel(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
+ SdrModel *pDoc = pObj->GetModel();
if ( nSlotId == SID_LINE_ARROW_START ||
nSlotId == SID_LINE_ARROW_END ||
@@ -230,7 +230,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
// set attributes of line start and ends
// arrowhead
- ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) );
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDoc ) );
if( !aArrow.count() )
{
::basegfx::B2DPolygon aNewArrow;
@@ -242,7 +242,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
}
// Circles
- ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) );
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, pDoc ) );
if( !aCircle.count() )
{
::basegfx::B2DPolygon aNewCircle;
@@ -252,7 +252,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
}
// Square
- ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) );
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, pDoc ) );
if( !aSquare.count() )
{
::basegfx::B2DPolygon aNewSquare;
@@ -264,7 +264,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
aSquare.append(aNewSquare);
}
- SfxItemSet aSet( rModel.GetItemPool() );
+ SfxItemSet aSet( pDoc->GetItemPool() );
long nWidth = 200; // (1/100th mm)
// determine line width and calculate with it the line end width
@@ -356,9 +356,8 @@ void FuConstRectangle::Deactivate()
SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index a3a141a8732e..619ad1c4f79d 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -111,9 +111,8 @@ SdrObject* FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, co
// case SID_FM_CREATE_CONTROL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index d1efc9f2cd33..5574a6f5b6cc 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -177,13 +177,10 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj(
- pView->getSdrModelFromSdrView(), // TTTT pView should be reference
- rGraphic1,
- aRect);
+ SdrGrafObj* pObj = new SdrGrafObj( rGraphic1, aRect );
// calling SetGraphicLink here doesn't work
- // Yes, due to the SdrObject had no SdrModel
+
// Path is no longer used as name for the graphics object
ScDrawLayer* pLayer = static_cast<ScDrawLayer*>(pView->GetModel());
@@ -247,10 +244,9 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
#endif
}
- SdrMediaObj* pObj = new SdrMediaObj(
- *rData.GetDocument()->GetDrawLayer(),
- tools::Rectangle(aInsertPos, aSize));
+ SdrMediaObj* pObj = new SdrMediaObj( tools::Rectangle( aInsertPos, aSize ) );
+ pObj->SetModel(rData.GetDocument()->GetDrawLayer()); // set before setURL
pObj->setURL( realURL, ""/*TODO?*/ );
pView->InsertObjectAtView( pObj, *pPV, bApi ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE );
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index bcee011d6637..b56a1c1d7f0a 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -350,11 +350,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, 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(
- *pDoc, // TTTT should be reference
- aObjRef,
- aName,
- aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
SdrPageView* pPV = pView->GetSdrPageView();
pView->InsertObjectAtView(pObj, *pPV);
@@ -592,11 +588,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj(
- *pDoc, // TTTT should be reference
- svt::EmbeddedObjectRef(xObj, nAspect),
- aName,
- aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
SdrPageView* pPV = pView->GetSdrPageView();
// #i121334# This call will change the chart's default background fill from white to transparent.
@@ -755,11 +747,7 @@ FuInsertChartFromFile::FuInsertChartFromFile( ScTabViewShell* pViewSh, vcl::Wind
ScRange aPositionRange = pViewSh->GetViewData().GetCurPos();
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj(
- *pDoc, // TTTT should be reference
- svt::EmbeddedObjectRef(xObj, nAspect),
- aName,
- aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
SdrPageView* pPV = pView->GetSdrPageView();
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 7914c87a7313..38583597b9d2 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -643,9 +643,8 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectan
// case SID_DRAW_NOTEEDIT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pDrDoc,
- pView->GetCurrentObjInventor(),
- pView->GetCurrentObjIdentifier());
+ pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
+ nullptr, pDrDoc);
if(pObj)
{
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index ad353cdd7a29..9574cdb63900 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -56,11 +56,8 @@ class ScDrawView final : public FmFormView
virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override;
public:
- ScDrawView(
- OutputDevice* pOut,
- ScViewData* pData);
-
- virtual ~ScDrawView() override;
+ ScDrawView( OutputDevice* pOut, ScViewData* pData );
+ virtual ~ScDrawView() override;
virtual void MarkListHasChanged() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index a414160700c7..52c3fb9b4e93 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1248,7 +1248,7 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab );
if (pObject)
{
- SdrView aEditView(*pModel);
+ SdrView aEditView( pModel );
aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab));
SdrPageView* pPV = aEditView.GetSdrPageView();
aEditView.MarkObj(pObject, pPV);
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index 7f150e228572..a8c19f342abc 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -154,11 +154,8 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
xReceiver->setArguments(aArgs);
}
- SdrOle2Obj* pObject = new SdrOle2Obj(
- *pModel,
- svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
- aName,
- aInsRect);
+ SdrOle2Obj* pObject = new SdrOle2Obj(svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
+ aName, aInsRect);
if (xObject.is())
xObject->setVisualAreaSize(nAspect, aAwtSize);
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 1c98dc40c502..c146e3aba2e3 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -246,11 +246,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
- SdrOle2Obj* pObj = new SdrOle2Obj(
- *pModel,
- ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
- aName,
- aInsRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aName, aInsRect );
// set VisArea
if( xObj.is())
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ee46cd116c43..d16bc895a5d1 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -373,18 +373,6 @@ void ScModelObj::CreateAndSet(ScDocShell* pDocSh)
pDocSh->SetBaseModel( new ScModelObj(pDocSh) );
}
-SdrModel* ScModelObj::getSdrModelFromUnoModel() const
-{
- ScDocument& rDoc(pDocShell->GetDocument());
-
- if(!rDoc.GetDrawLayer())
- {
- rDoc.InitDrawLayer();
- }
-
- return rDoc.GetDrawLayer();
-}
-
ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
SfxBaseModel( pDocSh ),
aPropSet( lcl_GetDocOptPropertyMap() ),
@@ -1959,9 +1947,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
if( pModel )
{
- aDrawViewKeeper.mpDrawView = new FmFormView(
- *pModel,
- pDev);
+ aDrawViewKeeper.mpDrawView = new FmFormView( pModel, pDev );
aDrawViewKeeper.mpDrawView->ShowSdrPage(aDrawViewKeeper.mpDrawView->GetModel()->GetPage(nTab));
aDrawViewKeeper.mpDrawView->SetPrintPreview();
}
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 8c590d64a90e..a938851e26fb 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -333,13 +333,11 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
- ScDocument* pDoc(rModel.GetDocument());
-
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -348,7 +346,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
table::CellRangeAddress aAddress = xRangeAdd->getRangeAddress();
if (nTab == aAddress.Sheet)
@@ -465,15 +463,14 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
- ScDocument* pDoc = rModel.GetDocument();
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -564,15 +561,14 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
- ScDocument* pDoc = rModel.GetDocument();
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -661,16 +657,15 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
- ScDocument* pDoc = rModel.GetDocument();
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
@@ -710,16 +705,15 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
- ScDocument* pDoc = rModel.GetDocument();
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -770,16 +764,15 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
-
- if ( pPage )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel && pPage )
{
- ScDocument* pDoc = rModel.GetDocument();
+ ScDocument* pDoc = pModel->GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -1004,26 +997,28 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
- ScDocument* pDoc = rModel.GetDocument();
-
- if ( pPage && pDoc )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ ScDocument* pDoc = pModel->GetDocument();
+ if ( pDoc )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
-
- SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- Point aPos(pObj->GetCurrentBoundRect().TopLeft());
- ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
- // anchor is always the cell
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ {
+ Point aPos(pObj->GetCurrentBoundRect().TopLeft());
+ ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
+
+ // anchor is always the cell
- xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
+ xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
+ }
}
}
}
@@ -1247,23 +1242,25 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
- SdrPage* pPage(pObj->GetPage());
- ScDocument* pDoc = rModel.GetDocument();
-
- if ( pPage && pDoc )
+ ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
+ ScDocument* pDoc = pModel->GetDocument();
+ if ( pDoc )
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
-
- SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
- if( pCaptData )
- return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
+
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ {
+ const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
+ if( pCaptData )
+ return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
+ }
}
}
}
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index bbe58cda31c9..4be43b1354d1 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -34,10 +34,8 @@
#include <tabvwsh.hxx>
#include <docsh.hxx>
-ScDrawView::ScDrawView(
- OutputDevice* pOut,
- ScViewData* pData )
-: FmFormView(*pData->GetDocument()->GetDrawLayer(), pOut),
+ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) :
+ FmFormView( pData->GetDocument()->GetDrawLayer(), pOut ),
pViewData( pData ),
pDev( pOut ),
pDoc( pData->GetDocument() ),
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 0561a41c3d9f..de4ff2c7e003 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1197,10 +1197,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
ScDrawLayer* pModel = pDoc->GetDrawLayer();
if (pModel)
{
- mpLOKDrawView.reset(
- new FmFormView(
- *pModel,
- &rDevice));
+ mpLOKDrawView.reset(new FmFormView(pModel, &rDevice));
mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));
aOutputData.SetDrawView(mpLOKDrawView.get());
aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 11596ac08e5d..ae4a3fc029cf 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -165,9 +165,7 @@ void ScPreview::UpdateDrawView() // nTab must be right
if ( !pDrawView ) // New Drawing?
{
- pDrawView = new FmFormView(
- *pModel,
- this);
+ pDrawView = new FmFormView( pModel, this );
// The DrawView takes over the Design-Mode from the Model
// (Settings "In opening Draftmode"), therefore to restore here
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 58316cf16907..cdafc4580165 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -564,10 +564,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
if( pModel )
{
- pDrawView.reset(
- new FmFormView(
- *pModel,
- pDev));
+ pDrawView.reset(new FmFormView( pModel, pDev ));
pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
pDrawView->SetPrintPreview();
aOutputData.SetDrawView( pDrawView.get() );
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index d081c875c4cb..ba44266d31b0 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -60,11 +60,8 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
ScDrawView* pDrView = pView->GetScDrawView();
SdrModel* pModel = pDrView->GetModel();
- SdrObject* pObj = SdrObjFactory::MakeNewObject(
- *pModel,
- SdrInventor::FmForm,
- OBJ_FM_BUTTON,
- pDrView->GetSdrPageView()->GetPage());
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON,
+ pDrView->GetSdrPageView()->GetPage(), pModel);
SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
OSL_ENSURE( pUnoCtrl, "no SdrUnoObj");
if( !pUnoCtrl )
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index cfbd4bed996f..e1f521ce992f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -153,12 +153,11 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
const SdrMark* pM=aMark.GetMark(nm);
const SdrObject* pObj=pM->GetMarkedSdrObj();
- // Directly Clone to taget SdrModel
- SdrObject* pNewObj(pObj->Clone(pDrawModel));
+ SdrObject* pNewObj=pObj->Clone();
if (pNewObj!=nullptr)
{
- // pNewObj->SetModel(pDrawModel);
+ pNewObj->SetModel(pDrawModel);
pNewObj->SetPage(pDestPage);
// copy graphics within the same model - always needs new name
@@ -194,9 +193,8 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
else
{
bPasteIsMove = false; // no internal move happened
- // TTTT hide all non-direct SdrView constr to disable construct
- // in-between classes in one of the next steps (!)
- SdrView aView(*pModel); // #i71529# never create a base class of SdrView directly!
+
+ SdrView aView(pModel); // #i71529# never create a base class of SdrView directly!
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
Size aSize = aView.GetAllMarkedRect().GetSize();
@@ -355,11 +353,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X
tools::Rectangle aRect( aInsPos, aSize );
ScDrawView* pDrView = GetScDrawView();
- SdrOle2Obj* pSdrObj = new SdrOle2Obj(
- pDrView->getSdrModelFromSdrView(),
- aObjRef,
- aName,
- aRect);
+ SdrOle2Obj* pSdrObj = new SdrOle2Obj( aObjRef, aName, aRect );
SdrPageView* pPV = pDrView->GetSdrPageView();
pDrView->InsertObjectSafe( pSdrObj, *pPV ); // don't mark if OLE
@@ -438,10 +432,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
GetViewData().GetViewShell()->SetDrawShell( true );
tools::Rectangle aRect(aPos, aSize);
- SdrGrafObj* pGrafObj = new SdrGrafObj(
- pScDrawView->getSdrModelFromSdrView(),
- rGraphic,
- aRect);
+ SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect);
// path was the name of the graphic in history