summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-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
30 files changed, 302 insertions, 178 deletions
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 70b99bdf03e5..8b9b4de19e63 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -84,11 +84,9 @@ void ScDocument::TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDes
SdrObject* pOldObject = aIter.Next();
while (pOldObject)
{
- SdrObject* pNewObject = pOldObject->Clone();
- // SdrObject* pNewObject = pOldObject->Clone( pNewPage, mpDrawLayer );
- pNewObject->SetModel(mpDrawLayer);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(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 5d445983b69e..5ccd3cdd5598 100644
--- a/sc/source/core/data/drawpage.cxx
+++ b/sc/source/core/data/drawpage.cxx
@@ -24,37 +24,25 @@
#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
{
- ScDrawPage* const pNewPage = new ScDrawPage(*this);
- FmFormModel* pScDrawModel = nullptr;
- if (pNewModel)
- {
- pScDrawModel = dynamic_cast<FmFormModel*>(pNewModel);
- assert(pScDrawModel);
- }
- pNewPage->lateInit(*this, pScDrawModel);
- return pNewPage;
+ ScDrawLayer& rScDrawLayer(static_cast< ScDrawLayer& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ ScDrawPage* pClonedScDrawPage(
+ new ScDrawPage(
+ rScDrawLayer,
+ IsMasterPage()));
+ pClonedScDrawPage->FmFormPage::lateInit(*this);
+ return pClonedScDrawPage;
}
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 e694fed7c25a..0665e0942188 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() && pObj->GetModel())
+ if (pObj->IsInserted() && pObj->GetPage())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->GetModel()->Broadcast(aHint);
+ pObj->getSdrModelFromSdrObject().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() && pObj->GetModel())
+ if (pObj->IsInserted() && pObj->GetPage())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->GetModel()->Broadcast(aHint);
+ pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
}
@@ -463,10 +463,10 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
pOldData->maStart.SetTab(nOldTab);
pOldData->maEnd.SetTab(nOldTab);
}
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(this);
- pNewObject->SetPage(pNewPage);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(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)
{
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(pDestModel);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(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))
{
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(this);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(this);
pNewObject->SetPage(pDestPage);
if ( bMirrorObj )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index d70e87f528c1..676a0dafb35a 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -375,7 +375,11 @@ 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( aTextRect, aTailPos ));
+ mxCaption.reset(
+ new SdrCaptionObj(
+ *mrDoc.GetDrawLayer(), // TTTT should ret a ref?
+ aTextRect,
+ aTailPos));
// basic caption settings
ScCaptionUtil::SetBasicCaptionSettings( *mxCaption, bShown );
}
@@ -754,7 +758,7 @@ void ScCaptionPtr::removeFromDrawPageAndFree( bool bIgnoreUndo )
bool bRecording = false;
if (!bIgnoreUndo)
{
- ScDrawLayer* pDrawLayer = dynamic_cast<ScDrawLayer*>(mpCaption->GetModel());
+ ScDrawLayer* pDrawLayer(dynamic_cast< ScDrawLayer* >(&mpCaption->getSdrModelFromSdrObject()));
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());
@@ -1137,8 +1141,9 @@ 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->GetModel())
+ if (pDrawLayer == &maNoteData.mxCaption->getSdrModelFromSdrObject())
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 f8f5ac045c68..77f19b2e39c5 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -453,7 +453,9 @@ 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( aRect );
+ SdrRectObj* pBox = new SdrRectObj(
+ *pModel,
+ aRect);
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -494,7 +496,10 @@ 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(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(
+ *pModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -526,7 +531,9 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
if (bArea)
{
tools::Rectangle aRect = GetDrawRect( nStartCol, nStartRow, nEndCol, nEndRow );
- SdrRectObj* pBox = new SdrRectObj( aRect );
+ SdrRectObj* pBox = new SdrRectObj(
+ *pModel,
+ aRect);
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -559,7 +566,10 @@ 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(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(
+ *pModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -625,7 +635,10 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
aRect.AdjustTop( -70 );
aRect.AdjustBottom(70 );
- SdrCircObj* pCircle = new SdrCircObj( OBJ_CIRC, aRect );
+ SdrCircObj* pCircle = new SdrCircObj(
+ *pModel,
+ 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 cad44b77ea43..055663df4782 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->GetModel() : nullptr;
+ pSdrModel = pSdrPage ? &pSdrPage->getSdrModelFromSdrPage() : nullptr;
}
catch( Exception& )
{
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 94b2d0130d0b..989c9b693d0f 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -425,8 +425,7 @@ 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
@@ -1012,7 +1011,9 @@ std::size_t XclImpGroupObj::DoGetProgressSize() const
SdrObjectPtr XclImpGroupObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& /*rAnchorRect*/ ) const
{
- std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj( new SdrObjGroup );
+ std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj(
+ new SdrObjGroup(
+ *GetDoc().GetDrawLayer()));
// 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 )
@@ -1080,7 +1081,11 @@ SdrObjectPtr XclImpLineObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
aB2DPolygon.append( ::basegfx::B2DPoint( rAnchorRect.Right(), rAnchorRect.Top() ) );
break;
}
- SdrObjectPtr xSdrObj( new SdrPathObj( OBJ_LINE, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
+ SdrObjectPtr xSdrObj(
+ new SdrPathObj(
+ *GetDoc().GetDrawLayer(),
+ OBJ_LINE,
+ ::basegfx::B2DPolyPolygon(aB2DPolygon)));
ConvertLineStyle( *xSdrObj, maLineData );
// line ends
@@ -1195,7 +1200,10 @@ void XclImpRectObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uI
SdrObjectPtr XclImpRectObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj( new SdrRectObj( rAnchorRect ) );
+ SdrObjectPtr xSdrObj(
+ new SdrRectObj(
+ *GetDoc().GetDrawLayer(),
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1208,7 +1216,11 @@ XclImpOvalObj::XclImpOvalObj( const XclImpRoot& rRoot ) :
SdrObjectPtr XclImpOvalObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj( new SdrCircObj( OBJ_CIRC, rAnchorRect ) );
+ SdrObjectPtr xSdrObj(
+ new SdrCircObj(
+ *GetDoc().GetDrawLayer(),
+ OBJ_CIRC,
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1280,7 +1292,13 @@ SdrObjectPtr XclImpArcObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const t
break;
}
SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_SECT : OBJ_CARC;
- SdrObjectPtr xSdrObj( new SdrCircObj( eObjKind, aNewRect, nStartAngle, nEndAngle ) );
+ SdrObjectPtr xSdrObj(
+ new SdrCircObj(
+ *GetDoc().GetDrawLayer(),
+ eObjKind,
+ aNewRect,
+ nStartAngle,
+ nEndAngle));
ConvertFillStyle( *xSdrObj, maFillData );
ConvertLineStyle( *xSdrObj, maLineData );
rDffConv.Progress();
@@ -1358,7 +1376,11 @@ 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( eObjKind, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
+ xSdrObj.reset(
+ new SdrPathObj(
+ *GetDoc().GetDrawLayer(),
+ eObjKind,
+ ::basegfx::B2DPolyPolygon(aB2DPolygon)));
ConvertRectStyle( *xSdrObj );
}
rDffConv.Progress();
@@ -1420,7 +1442,9 @@ 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 );
+ std::unique_ptr<SdrObjCustomShape, SdrObjectFree> xSdrObj(
+ new SdrObjCustomShape(
+ *GetDoc().GetDrawLayer()));
xSdrObj->NbcSetSnapRect( rAnchorRect );
OUString aRectType = "rectangle";
xSdrObj->MergeDefaultAttributes( &aRectType );
@@ -1710,7 +1734,12 @@ SdrObjectPtr XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
// ChartHelper::AdaptDefaultsForChart( xEmbObj );
// create the container OLE object
- xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) );
+ xSdrObj.reset(
+ new SdrOle2Obj(
+ *GetDoc().GetDrawLayer(),
+ svt::EmbeddedObjectRef(xEmbObj, nAspect),
+ aEmbObjName,
+ rAnchorRect));
}
return xSdrObj;
@@ -2953,7 +2982,11 @@ 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( maGraphic, rAnchorRect ) );
+ xSdrObj.reset(
+ new SdrGrafObj(
+ *GetDoc().GetDrawLayer(),
+ maGraphic,
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
}
@@ -3434,9 +3467,20 @@ 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(
- aStrgName, xSrcStrg, pDocShell->GetStorage(), aGraphic,
- rAnchorRect, aVisArea, nullptr, nError, mnOleImpFlags, nAspects, GetRoot().GetMedium().GetBaseURL()) );
+ xSdrObj.reset(
+ CreateSdrOLEFromStorage(
+ GetConvData().mrSdrModel,
+ 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 a6b73fd76631..d6887744f517 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -165,8 +165,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
break;
default:
{
- Graphic aGraph( SdrExchangeView::GetObjGraphic(
- pDoc->GetDrawLayer(), pObject ) );
+ Graphic aGraph(SdrExchangeView::GetObjGraphic(*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 d6915302aba4..e553df1130ff 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -602,7 +602,11 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( pI->pGraphic )
{
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj( *pI->pGraphic, aRect );
+ SdrGrafObj* pObj = new SdrGrafObj(
+ *pModel,
+ *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 1e4c9c868bfc..12cfa00f3bca 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->GetModel() );
+ pDragSourceView = new SdrView(pView->getSdrModelFromSdrView()); // TTTT pView should be reference
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->GetModel() );
+ pDragSourceView = new SdrView(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
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 7ada2107c5b3..d167649a5086 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -123,8 +123,9 @@ SdrObject* FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const tools::Re
// case SID_DRAW_CIRCLECUT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx
index f5a03392f736..e028a4d1dcd3 100644
--- a/sc/source/ui/drawfunc/fuconcustomshape.cxx
+++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx
@@ -132,8 +132,10 @@ void FuConstCustomShape::Deactivate()
SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
+
if( pObj )
{
tools::Rectangle aRectangle( rRectangle );
@@ -142,6 +144,7 @@ SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, c
ImpForceQuadratic( aRectangle );
pObj->SetLogicRect( aRectangle );
}
+
return pObj;
}
@@ -168,7 +171,7 @@ void FuConstCustomShape::SetAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().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 330ebf09a41d..cc9ec052cea2 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -185,8 +185,9 @@ SdrObject* FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const tools
// case SID_DRAW_FREELINE_NOFILL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index d3ae4c990850..6aba5faad5fc 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* pDoc)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aRetval;
- XLineEndListRef pLineEndList = pDoc->GetLineEndList();
+ XLineEndListRef pLineEndList(rModel.GetLineEndList());
if( pLineEndList.is() )
{
@@ -116,7 +116,7 @@ bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
if (pObj)
{
- SfxItemSet aAttr(pObj->GetModel()->GetItemPool());
+ SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().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 *pDoc = pObj->GetModel();
+ SdrModel& rModel(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
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, pDoc ) );
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) );
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, pDoc ) );
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) );
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, pDoc ) );
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) );
if( !aSquare.count() )
{
::basegfx::B2DPolygon aNewSquare;
@@ -264,7 +264,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
aSquare.append(aNewSquare);
}
- SfxItemSet aSet( pDoc->GetItemPool() );
+ SfxItemSet aSet( rModel.GetItemPool() );
long nWidth = 200; // (1/100th mm)
// determine line width and calculate with it the line end width
@@ -356,8 +356,9 @@ void FuConstRectangle::Deactivate()
SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index 619ad1c4f79d..a3a141a8732e 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -111,8 +111,9 @@ SdrObject* FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, co
// case SID_FM_CREATE_CONTROL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 5574a6f5b6cc..d1efc9f2cd33 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -177,10 +177,13 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj( rGraphic1, aRect );
+ SdrGrafObj* pObj = new SdrGrafObj(
+ pView->getSdrModelFromSdrView(), // TTTT pView should be reference
+ 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());
@@ -244,9 +247,10 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
#endif
}
- SdrMediaObj* pObj = new SdrMediaObj( tools::Rectangle( aInsertPos, aSize ) );
+ SdrMediaObj* pObj = new SdrMediaObj(
+ *rData.GetDocument()->GetDrawLayer(),
+ 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 b56a1c1d7f0a..bcee011d6637 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -350,7 +350,11 @@ 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( aObjRef, aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = pView->GetSdrPageView();
pView->InsertObjectAtView(pObj, *pPV);
@@ -588,7 +592,11 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ 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.
@@ -747,7 +755,11 @@ 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( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ 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 38583597b9d2..7914c87a7313 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -643,8 +643,9 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectan
// case SID_DRAW_NOTEEDIT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 9574cdb63900..ad353cdd7a29 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -56,8 +56,11 @@ 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 52c3fb9b4e93..a414160700c7 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 a8c19f342abc..7f150e228572 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -154,8 +154,11 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
xReceiver->setArguments(aArgs);
}
- SdrOle2Obj* pObject = new SdrOle2Obj(svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
- aName, aInsRect);
+ SdrOle2Obj* pObject = new SdrOle2Obj(
+ *pModel,
+ 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 c146e3aba2e3..1c98dc40c502 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -246,7 +246,11 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
- SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aName, aInsRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pModel,
+ ::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 d16bc895a5d1..ee46cd116c43 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -373,6 +373,18 @@ 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() ),
@@ -1947,7 +1959,9 @@ 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 a938851e26fb..8c590d64a90e 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -333,11 +333,13 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc(rModel.GetDocument());
+
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -346,7 +348,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
table::CellRangeAddress aAddress = xRangeAdd->getRangeAddress();
if (nTab == aAddress.Sheet)
@@ -463,14 +465,15 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -561,14 +564,15 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -657,15 +661,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
@@ -705,15 +710,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -764,15 +770,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -997,28 +1004,26 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+ ScDocument* pDoc = rModel.GetDocument();
+
+ if ( pPage && pDoc )
{
- ScDocument* pDoc = pModel->GetDocument();
- if ( pDoc )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
- {
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
- SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
- {
- Point aPos(pObj->GetCurrentBoundRect().TopLeft());
- ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ {
+ Point aPos(pObj->GetCurrentBoundRect().TopLeft());
+ ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
- // anchor is always the cell
+ // anchor is always the cell
- xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
- }
+ xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
}
}
}
@@ -1242,25 +1247,23 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+ ScDocument* pDoc = rModel.GetDocument();
+
+ if ( pPage && pDoc )
{
- ScDocument* pDoc = pModel->GetDocument();
- if ( pDoc )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
- {
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
+ 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 ) );
- }
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, rModel, 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 4be43b1354d1..bbe58cda31c9 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -34,8 +34,10 @@
#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 de4ff2c7e003..0561a41c3d9f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1197,7 +1197,10 @@ 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 ae4a3fc029cf..11596ac08e5d 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -165,7 +165,9 @@ 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 cdafc4580165..58316cf16907 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -564,7 +564,10 @@ 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 ba44266d31b0..d081c875c4cb 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -60,8 +60,11 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
ScDrawView* pDrView = pView->GetScDrawView();
SdrModel* pModel = pDrView->GetModel();
- SdrObject* pObj = SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON,
- pDrView->GetSdrPageView()->GetPage(), pModel);
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ *pModel,
+ SdrInventor::FmForm,
+ OBJ_FM_BUTTON,
+ pDrView->GetSdrPageView()->GetPage());
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 e1f521ce992f..cfbd4bed996f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -153,11 +153,12 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
const SdrMark* pM=aMark.GetMark(nm);
const SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObject* pNewObj=pObj->Clone();
+ // Directly Clone to taget SdrModel
+ SdrObject* pNewObj(pObj->Clone(pDrawModel));
if (pNewObj!=nullptr)
{
- pNewObj->SetModel(pDrawModel);
+ // pNewObj->SetModel(pDrawModel);
pNewObj->SetPage(pDestPage);
// copy graphics within the same model - always needs new name
@@ -193,8 +194,9 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
else
{
bPasteIsMove = false; // no internal move happened
-
- SdrView aView(pModel); // #i71529# never create a base class of SdrView directly!
+ // 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!
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
Size aSize = aView.GetAllMarkedRect().GetSize();
@@ -353,7 +355,11 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X
tools::Rectangle aRect( aInsPos, aSize );
ScDrawView* pDrView = GetScDrawView();
- SdrOle2Obj* pSdrObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pSdrObj = new SdrOle2Obj(
+ pDrView->getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = pDrView->GetSdrPageView();
pDrView->InsertObjectSafe( pSdrObj, *pPV ); // don't mark if OLE
@@ -432,7 +438,10 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
GetViewData().GetViewShell()->SetDrawShell( true );
tools::Rectangle aRect(aPos, aSize);
- SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect);
+ SdrGrafObj* pGrafObj = new SdrGrafObj(
+ pScDrawView->getSdrModelFromSdrView(),
+ rGraphic,
+ aRect);
// path was the name of the graphic in history