diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 22:32:24 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 22:32:24 +0200 |
commit | eba4d5b2b76cefde90cb3d6638c736f435023a45 (patch) | |
tree | 43befa620475c11f3dde00e5ea141e1efd95a334 /sd | |
parent | 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (diff) |
Revert "SOSAW080: Added first bunch of basic changes to helpers"
This reverts commit 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91.
Diffstat (limited to 'sd')
43 files changed, 546 insertions, 577 deletions
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx index 53e08b70c4af..6322d365b293 100644 --- a/sd/inc/CustomAnimationEffect.hxx +++ b/sd/inc/CustomAnimationEffect.hxx @@ -25,15 +25,17 @@ #include <com/sun/star/animations/XAudio.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/util/XChangesListener.hpp> + #include <vcl/timer.hxx> + #include "sddllapi.h" + #include <list> #include <vector> #include <map> #include <memory> class SdrPathObj; -class SdrModel; namespace sd { @@ -165,7 +167,7 @@ public: SAL_DLLPRIVATE static sal_Int32 get_node_type( const css::uno::Reference< css::animations::XAnimationNode >& xNode ); SAL_DLLPRIVATE static sal_Int32 getNumberOfSubitems( const css::uno::Any& aTarget, sal_Int16 nIterateType ); - SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath(SdrModel& rTargetModel); + SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath(); SAL_DLLPRIVATE void updateSdrPathObjFromPath( SdrPathObj& rPathObj ); SAL_DLLPRIVATE void updatePathFromSdrPathObj( const SdrPathObj& rPathObj ); diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index 5dedec0d3bb4..42af131102c0 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -93,7 +93,6 @@ namespace sd { class SD_DLLPUBLIC SdPage final : public FmFormPage, public SdrObjUserCall { SdPage& operator=(const SdPage&) = delete; - SdPage(const SdPage&) = delete; friend class SdGenericDrawPage; friend class SdDrawPage; @@ -148,14 +147,15 @@ friend class sd::UndoAttrObject; sal_Int32 mnTransitionFadeColor; double mfTransitionDuration; + SdPage(const SdPage& rSrcPage); void lateInit(const SdPage& rSrcPage); public: SdPage(SdDrawDocument& rNewDoc, bool bMasterPage); virtual ~SdPage() override; - - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override; + virtual SdrPage* Clone() const override; + virtual SdrPage* Clone(SdrModel* pNewModel) const override; virtual void SetSize(const Size& aSize) override; virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) override; @@ -163,6 +163,7 @@ public: virtual void SetRightBorder(sal_Int32 nBorder) override; virtual void SetUpperBorder(sal_Int32 nBorder) override; virtual void SetLowerBorder(sal_Int32 nBorder) override; + virtual void SetModel(SdrModel* pNewModel) override; virtual bool IsReadOnly() const override; sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; } @@ -387,8 +388,6 @@ private: sal_uInt16 mnPageId; /** clone the animations from this and set them to rTargetPage - * TTTT: Order is strange, should be the other way around by - * convention/convenience and makes usage a little dangerous... */ void cloneAnimations( SdPage& rTargetPage ) const; diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 1473358706fc..2d1025db6b61 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1528,9 +1528,9 @@ bool CustomAnimationEffect::getStopAudio() const return mnCommand == EffectCommands::STOPAUDIO; } -SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath(SdrModel& rTargetModel) +SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath() { - SdrPathObj * pPathObj = new SdrPathObj(rTargetModel, OBJ_PATHLINE); + SdrPathObj * pPathObj = new SdrPathObj( OBJ_PATHLINE ); updateSdrPathObjFromPath( *pPathObj ); return pPathObj; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 38c6db785f46..ce442b4f7402 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -69,7 +69,7 @@ public: static sal_uInt32 m_nLastId; SdPage* GetPage() const { return mpPage; } - SdrModel* GetModel() { return (mpPage != nullptr) ? &mpPage->getSdrModelFromSdrPage() : nullptr; } + SdrModel* GetModel() { return (mpPage != nullptr) ? mpPage->GetModel() : nullptr; } sal_uInt32 GetId() const { return m_nId; } // XInterface: @@ -366,7 +366,7 @@ Reference< XText > SAL_CALL Annotation::getTextRange() osl::MutexGuard g(m_aMutex); if( !m_TextRange.is() && (mpPage != nullptr) ) { - m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( &mpPage->getSdrModelFromSdrPage() ) ); + m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( mpPage->GetModel() ) ); } return Reference< XText >( m_TextRange.get() ); } diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 500a88caa103..d6335e3671d3 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -657,7 +657,22 @@ void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode) } mbNewOrLoadCompleted = true; + + // Update all linked pages + sal_uInt16 nMaxSdPages = GetSdPageCount(PageKind::Standard); + + for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++) + { + SdPage* pPage = GetSdPage(nSdPage, PageKind::Standard); + + if (pPage && !pPage->GetFileName().isEmpty() && pPage->GetBookmarkName().getLength()) + { + pPage->SetModel(this); + } + } + UpdateAllLinks(); + SetChanged( false ); } diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 00a605697fa8..9bc68bc98710 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -608,6 +608,7 @@ bool SdDrawDocument::InsertBookmarkAsPage( // Assemble all link names pPage->SetFileName(aBookmarkName); pPage->SetBookmarkName(aName); + pPage->SetModel(this); } nActualInsertPos += 2; @@ -704,6 +705,7 @@ bool SdDrawDocument::InsertBookmarkAsPage( SdPage* pPage = static_cast<SdPage*>( GetPage(nActualInsertPos) ); pPage->SetFileName(aBookmarkName); pPage->SetBookmarkName(aPgName); + pPage->SetModel(this); } if (bReplace) diff --git a/sd/source/core/pglink.cxx b/sd/source/core/pglink.cxx index 6762dcdd9bfa..93180e1b906b 100644 --- a/sd/source/core/pglink.cxx +++ b/sd/source/core/pglink.cxx @@ -57,7 +57,7 @@ SdPageLink::~SdPageLink() ::sfx2::SvBaseLink::UpdateResult SdPageLink::DataChanged( const OUString&, const css::uno::Any& ) { - SdDrawDocument* pDoc = static_cast<SdDrawDocument*>( &pPage->getSdrModelFromSdrPage() ); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>( pPage->GetModel() ); sfx2::LinkManager* pLinkManager = pDoc!=nullptr ? pDoc->GetLinkManager() : nullptr; if (pLinkManager) diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index eed4fa28256c..ad906e23c556 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -129,9 +129,6 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, bool bMasterPage) // presentation template of the outline objects. Therefore, it already // contains the designator for the outline (STR_LAYOUT_OUTLINE). maLayoutName = SdResId(STR_LAYOUT_DEFAULT_NAME)+ SD_LT_SEPARATOR STR_LAYOUT_OUTLINE; - - // Stuff that former SetModel did also: - ConnectLink(); } namespace @@ -270,7 +267,7 @@ void SdPage::EnsureMasterPageDefaultBackground() */ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect ) { - ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager()); + ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr; const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted(); SdrObject* pSdrObj = nullptr; @@ -282,7 +279,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t { case PRESOBJ_TITLE: { - pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TITLETEXT); + pSdrObj = new SdrRectObj(OBJ_TITLETEXT); if (mbMaster) { @@ -293,7 +290,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_OUTLINE: { - pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_OUTLINETEXT); + pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT); if (mbMaster) { @@ -304,7 +301,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_NOTES: { - pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT); + pSdrObj = new SdrRectObj(OBJ_TEXT); if (mbMaster) { @@ -315,7 +312,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_TEXT: { - pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT); + pSdrObj = new SdrRectObj(OBJ_TEXT); } break; @@ -333,7 +330,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t Size aSize = aOutDev.PixelToLogic(aSizePix); Point aPnt (0, 0); ::tools::Rectangle aRect (aPnt, aSize); - pSdrObj = new SdrGrafObj(getSdrModelFromSdrPage(), aGraphic, aRect); + pSdrObj = new SdrGrafObj(aGraphic, aRect); aOutDev.Pop(); } break; @@ -341,7 +338,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_MEDIA: case PRESOBJ_OBJECT: { - pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage()); + pSdrObj = new SdrOle2Obj(); BitmapEx aBmpEx(BMP_PRESOBJ_OBJECT); Graphic aGraphic( aBmpEx ); static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic); @@ -350,7 +347,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_CHART: { - pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage()); + pSdrObj = new SdrOle2Obj(); static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarChart" ); BitmapEx aBmpEx(BMP_PRESOBJ_CHART); Graphic aGraphic( aBmpEx ); @@ -360,7 +357,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_ORGCHART: { - pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage()); + pSdrObj = new SdrOle2Obj(); static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarOrg" ); BitmapEx aBmpEx(BMP_PRESOBJ_ORGCHART); Graphic aGraphic( aBmpEx ); @@ -371,7 +368,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_TABLE: case PRESOBJ_CALC: { - pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage()); + pSdrObj = new SdrOle2Obj(); static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarCalc" ); BitmapEx aBmpEx(BMP_PRESOBJ_TABLE); Graphic aGraphic( aBmpEx ); @@ -384,7 +381,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t // Save the first standard page at SdrPageObj // #i105146# We want no content to be displayed for PageKind::Handout, // so just never set a page as content - pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), nullptr); + pSdrObj = new SdrPageObj(nullptr); } break; @@ -399,13 +396,13 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t nDestPageNum -= 1; } - if (nDestPageNum < getSdrModelFromSdrPage().GetPageCount()) + if (pModel && nDestPageNum < pModel->GetPageCount()) { - pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), getSdrModelFromSdrPage().GetPage(nDestPageNum)); + pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum)); } else { - pSdrObj = new SdrPageObj(getSdrModelFromSdrPage()); + pSdrObj = new SdrPageObj(); } pSdrObj->SetResizeProtect(true); @@ -417,7 +414,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t case PRESOBJ_DATETIME: case PRESOBJ_SLIDENUMBER: { - pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT); + pSdrObj = new SdrRectObj(OBJ_TEXT); bEmptyPresObj = false; bForceText = true; } @@ -440,7 +437,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t if(bVertical) static_cast<SdrTextObj*>(pSdrObj)->SetVerticalWriting(true); - SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool()); + SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); if( bVertical ) aTempAttr.Put( makeSdrTextMinFrameWidthItem( rRect.GetSize().Width() ) ); else @@ -482,7 +479,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t OUString aString = GetPresObjText(eObjKind); if( (!aString.isEmpty() || bForceText) && dynamic_cast< const SdrTextObj *>( pSdrObj ) != nullptr ) { - SdrOutliner* pOutliner = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetInternalOutliner(); + SdrOutliner* pOutliner = static_cast<SdDrawDocument*>( GetModel() )->GetInternalOutliner(); OutlinerMode nOutlMode = pOutliner->GetMode(); pOutliner->Init( OutlinerMode::TextObject ); @@ -497,7 +494,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) ) { - SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool()); + SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) ); aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) ); aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) ); @@ -525,7 +522,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t if (mbMaster) { - SdrLayerAdmin& rLayerAdmin(getSdrModelFromSdrPage().GetLayerAdmin()); + SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin(); // background objects of the master page pSdrObj->SetLayer( rLayerAdmin. @@ -546,7 +543,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++) { OUString aName( maLayoutName + " " + OUString::number( nLevel ) ); - SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page)); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page)); DBG_ASSERT(pSheet, "StyleSheet for outline object not found"); if (pSheet) pSdrObj->StartListening(*pSheet); @@ -559,7 +556,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t eObjKind == PRESOBJ_CALC || eObjKind == PRESOBJ_GRAPHIC ) { - SfxItemSet aSet( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() ); + SfxItemSet aSet( static_cast<SdDrawDocument*>(pModel)->GetPool() ); aSet.Put( makeSdrTextContourFrameItem( true ) ); aSet.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) ); @@ -568,7 +565,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t if( bUndo ) { - pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj)); + pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj)); } if( bUndo ) @@ -607,7 +604,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const aName += STR_LAYOUT_BACKGROUND; - SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool(); + SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool(); SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page); return static_cast<SfxStyleSheet*>(pResult); } @@ -654,7 +651,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const break; } - SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool(); + SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool(); SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page); return static_cast<SfxStyleSheet*>(pResult); } @@ -699,7 +696,7 @@ SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const aStyleName += OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE )); } - SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool(); + SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool(); SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SfxStyleFamily::Page); return dynamic_cast<SdStyleSheet*>(pResult); } @@ -721,7 +718,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools case SdrUserCallType::MoveOnly: case SdrUserCallType::Resize: { - if ( getSdrModelFromSdrPage().isLocked()) + if (!pModel || pModel->isLocked()) break; SdrObject* pObj = const_cast<SdrObject*>(&rObj); @@ -732,7 +729,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools { if( pObj->GetUserCall() ) { - ::svl::IUndoManager* pUndoManager = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager(); + ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager(); const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted(); if( bUndo ) @@ -746,11 +743,11 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools { // Object of the master page changed, therefore adjust // object on all pages - sal_uInt16 nPageCount = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPageCount(mePageKind); + sal_uInt16 nPageCount = static_cast<SdDrawDocument*>(pModel)->GetSdPageCount(mePageKind); for (sal_uInt16 i = 0; i < nPageCount; i++) { - SdPage* pLoopPage = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPage(i, mePageKind); + SdPage* pLoopPage = static_cast<SdDrawDocument*>(pModel)->GetSdPage(i, mePageKind); if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage())) { @@ -780,7 +777,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate ) { - ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager()); + ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr; const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted(); SdPage* pMasterPage = this; @@ -803,7 +800,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate ) pMasterPage->EnsureMasterPageDefaultBackground(); } - if (static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocumentType() == DocumentType::Impress) + if (GetModel() && static_cast<SdDrawDocument*>(GetModel())->GetDocumentType() == DocumentType::Impress) { if( mePageKind == PageKind::Handout && bInit ) { @@ -817,7 +814,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate ) if( bUndo ) { - pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); } else { @@ -826,7 +823,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate ) } std::vector< ::tools::Rectangle > aAreas; - CalculateHandoutAreas( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()), pMasterPage->GetAutoLayout(), false, aAreas ); + CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas ); const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3; std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() ); @@ -900,7 +897,7 @@ void getPresObjProp( const SdPage& rPage, const char* sObjKind, const char* sPag { bool bNoObjectFound = true; //used to break from outer loop - const std::vector< Reference<XNode> >& objectInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetObjectVector(); + const std::vector< Reference<XNode> >& objectInfo = static_cast<const SdDrawDocument*>(rPage.GetModel())->GetObjectVector(); for( std::vector< Reference<XNode> >::const_iterator aIter=objectInfo.begin(); aIter != objectInfo.end(); ++aIter ) { if(bNoObjectFound) @@ -1050,7 +1047,8 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) if( pObject ) { - SdDrawDocument* pDoc(static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage())); + SdDrawDocument *pDoc = static_cast<SdDrawDocument*>(pModel); + const bool bUndo = pDoc->IsUndoEnabled(); if( bUndo ) pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject)); @@ -1115,9 +1113,9 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) nDestPageNum -= 1; } - if(nDestPageNum < getSdrModelFromSdrPage().GetPageCount()) + if(nDestPageNum < pModel->GetPageCount()) { - pRefPage = getSdrModelFromSdrPage().GetPage(nDestPageNum); + pRefPage = pModel->GetPage(nDestPageNum); } if ( pRefPage ) @@ -1364,7 +1362,7 @@ static void CalcAutoLayoutRectangles( SdPage const & rPage,::tools::Rectangle* r const Point aLayoutPos( aLayoutRect.TopLeft() ); double propvalue[] = {0,0,0,0}; - const std::vector< Reference<XNode> >& layoutInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetLayoutVector(); + const std::vector< Reference<XNode> >& layoutInfo = static_cast<const SdDrawDocument*>(rPage.GetModel())->GetLayoutVector(); for( std::vector< Reference<XNode> >::const_iterator aIter=layoutInfo.begin(); aIter != layoutInfo.end(); ++aIter ) { Reference<XNode> layoutNode = *aIter; @@ -1523,10 +1521,10 @@ void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescripto { if( pOle2->IsEmpty() ) bFound = true; - else + else if( rPage.GetModel() ) { - ::comphelper::IEmbeddedHelper* pPersist(rPage.getSdrModelFromSdrPage().GetPersist()); - + SdrModel* pSdrModel = rPage.GetModel(); + ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist(); if( pPersist ) { uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer(). @@ -1600,7 +1598,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate ) const bool bSwitchLayout = eLayout != GetAutoLayout(); - ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager()); + ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr; const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted(); meAutoLayout = eLayout; @@ -1649,7 +1647,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate ) if( pObj->IsEmptyPresObj() ) { if( bUndo ) - pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); RemoveObject( pObj->GetOrdNum() ); @@ -1672,7 +1670,7 @@ void SdPage::NbcInsertObject(SdrObject* pObj, size_t nPos) { FmFormPage::NbcInsertObject(pObj, nPos); - static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).InsertObject(pObj); + static_cast<SdDrawDocument*>(pModel)->InsertObject(pObj); SdrLayerID nId = pObj->GetLayer(); if( mbMaster ) @@ -1735,7 +1733,8 @@ void SdPage::onRemoveObject( SdrObject* pObject ) { RemovePresObj(pObject); - static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).RemoveObject(pObject); + if( pModel ) + static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject); removeAnimations( pObject ); } @@ -1957,7 +1956,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN for (sal_Int32 i=1; i<=9; i++) { OUString sLayoutName( aName + OUString::number( i ) ); - SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page)); + SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>(static_cast<SdDrawDocument*>(pModel)->GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page)); if (pOutlineSheet) { @@ -2078,11 +2077,12 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, const ::tools::Rectangle& rRect) { - SdDrawDocument& rModel(static_cast< SdDrawDocument& >(rPage.getSdrModelFromSdrPage())); - if( !pSourceObj ) + SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() ); + DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" ); + if( !pModel || !pSourceObj ) return pSourceObj; - ::svl::IUndoManager* pUndoManager = rModel.GetUndoManager(); + ::svl::IUndoManager* pUndoManager = pModel->GetUndoManager(); const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted(); SdrObject* pNewObj = pSourceObj; @@ -2096,7 +2096,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P if(pOutlParaObj) { // assign text - SdOutliner* pOutl = rModel.GetInternalOutliner(); + SdOutliner* pOutl = pModel->GetInternalOutliner(); pOutl->Clear(); pOutl->SetText( *pOutlParaObj ); pOutlParaObj = pOutl->CreateParaObject(); @@ -2108,7 +2108,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P { // assign new template OUString aName( rPage.GetLayoutName() + " " + OUString::number( nLevel ) ); - SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( rModel.GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) ); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) ); if (pSheet) { @@ -2125,7 +2125,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P } // Remove LRSpace item - SfxItemSet aSet(rModel.GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); aSet.Put(pNewObj->GetMergedItemSet()); @@ -2134,7 +2134,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P pNewObj->SetMergedItemSet(aSet); if( bUndo ) - pUndoManager->AddUndoAction( rModel.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) ); + pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) ); // Remove outline shape from page rPage.RemoveObject( pSourceObj->GetOrdNum() ); @@ -2154,7 +2154,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P if(pOutlParaObj) { // assign text - SdOutliner* pOutl = rModel.GetInternalOutliner(); + SdOutliner* pOutl = pModel->GetInternalOutliner(); pOutl->Clear(); pOutl->SetText( *pOutlParaObj ); pOutlParaObj = pOutl->CreateParaObject(); @@ -2163,7 +2163,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P pNewObj->SetEmptyPresObj(false); // reset left indent - SfxItemSet aSet(rModel.GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); aSet.Put(pNewObj->GetMergedItemSet()); @@ -2180,7 +2180,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P // Remove subtitle shape from page if( bUndo ) - pUndoManager->AddUndoAction(rModel.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj)); + pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj)); rPage.RemoveObject( pSourceObj->GetOrdNum() ); @@ -2220,7 +2220,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P */ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect, bool bInit) { - ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager()); + ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager(); const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted(); if (!pObj && bInit) @@ -2235,8 +2235,8 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, if( bUndo ) { - pUndoManager->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); - pUndoManager->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoAttrObject( *pObj, true, true ) ); + pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); + pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, true, true ) ); pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) ); } @@ -2262,7 +2262,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, if ( pTextObject->IsAutoGrowHeight() ) { // switch off AutoGrowHeight, set new MinHeight - SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() ); + SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); SdrMetricItem aMinHeight( makeSdrTextMinFrameHeightItem(rRect.GetSize().Height()) ); aTempAttr.Put( aMinHeight ); aTempAttr.Put( makeSdrTextAutoGrowHeightItem(false) ); @@ -2270,7 +2270,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, pTextObject->SetLogicRect(rRect); // switch on AutoGrowHeight - SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() ); + SfxItemSet aAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); aAttr.Put( makeSdrTextAutoGrowHeightItem(true) ); pTextObject->SetMergedItemSet(aAttr); @@ -2279,7 +2279,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, if ( pTextObject->IsAutoGrowWidth() ) { // switch off AutoGrowWidth , set new MinWidth - SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() ); + SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); SdrMetricItem aMinWidth( makeSdrTextMinFrameWidthItem(rRect.GetSize().Width()) ); aTempAttr.Put( aMinWidth ); aTempAttr.Put( makeSdrTextAutoGrowWidthItem(false) ); @@ -2287,7 +2287,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, pTextObject->SetLogicRect(rRect); // switch on AutoGrowWidth - SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() ); + SfxItemSet aAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() ); aAttr.Put( makeSdrTextAutoGrowWidthItem(true) ); pTextObject->SetMergedItemSet(aAttr); } @@ -2389,11 +2389,11 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO if (!pOutliner) { - SfxItemPool* pPool(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDrawOutliner().GetEmptyItemSet().GetPool()); + SfxItemPool* pPool = static_cast<SdDrawDocument*>(GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool(); pOutl = new ::Outliner( pPool, OutlinerMode::OutlineObject ); pOutl->SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); pOutl->SetEditTextObjectPool(pPool); - pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool())); + pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(GetModel()->GetStyleSheetPool())); pOutl->EnableUndo(false); pOutl->SetUpdateMode( false ); } @@ -2549,7 +2549,7 @@ const OUString& SdPage::GetName() const aCreatedPageName = SdResId(STR_PAGE); aCreatedPageName += " "; - if( getSdrModelFromSdrPage().GetPageNumType() == css::style::NumberingType::NUMBER_NONE ) + if( GetModel()->GetPageNumType() == css::style::NumberingType::NUMBER_NONE ) { // if the document has number none as a formatting // for page numbers we still default to arabic numbering @@ -2558,7 +2558,7 @@ const OUString& SdPage::GetName() const } else { - aCreatedPageName += static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).CreatePageNumValue(nNum); + aCreatedPageName += static_cast<SdDrawDocument*>(GetModel())->CreatePageNumValue(nNum); } } else @@ -2721,7 +2721,7 @@ void SdPage::SetName (const OUString& rName) { OUString aOldName( GetName() ); FmFormPage::SetName (rName); - static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).UpdatePageRelativeURLs(aOldName, rName); + static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName); ActionChanged(); } diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 3b6e42fd7b95..61fd29db97f7 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -95,13 +95,13 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, SdPage* pMaster; SdPage* pFoundMaster = nullptr; sal_uInt16 nMaster = 0; - sal_uInt16 nMasterCount = getSdrModelFromSdrPage().GetMasterPageCount(); + sal_uInt16 nMasterCount = pModel->GetMasterPageCount(); if( !bReverseOrder ) { for ( nMaster = 0; nMaster < nMasterCount; nMaster++ ) { - pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().GetMasterPage(nMaster)); + pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster)); if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName) { pFoundMaster = pMaster; @@ -113,7 +113,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, { for ( nMaster = nMasterCount; nMaster > 0; nMaster-- ) { - pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().GetMasterPage(nMaster - 1)); + pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1)); if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName) { pFoundMaster = pMaster; @@ -126,7 +126,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, // this should never happen, but we play failsafe here if( pFoundMaster == nullptr ) - pFoundMaster = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPage( 0, mePageKind ); + pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind ); if( pFoundMaster ) TRG_SetMasterPage(*pFoundMaster); @@ -157,7 +157,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, OUString aFullName; OUString aOldFullName; SfxStyleSheetBase* pSheet = nullptr; - SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool(); + SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool(); for (sal_Int16 i = -1; i < 9; i++) { @@ -261,7 +261,7 @@ void SdPage::EndListenOutlineText() if (pOutlineTextObj) { - SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool()); + SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(pModel->GetStyleSheetPool()); DBG_ASSERT(pSPool, "StyleSheetPool missing"); OUString aTrueLayoutName(maLayoutName); sal_Int32 nIndex = aTrueLayoutName.indexOf( SD_LT_SEPARATOR ); @@ -282,6 +282,22 @@ void SdPage::EndListenOutlineText() /************************************************************************* |* +|* Set new model +|* +\************************************************************************/ + +void SdPage::SetModel(SdrModel* pNewModel) +{ + DisconnectLink(); + + // assign model + FmFormPage::SetModel(pNewModel); + + ConnectLink(); +} + +/************************************************************************* +|* |* Is this page read-only? |* \************************************************************************/ @@ -299,17 +315,17 @@ bool SdPage::IsReadOnly() const void SdPage::ConnectLink() { - sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager()); + sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr; if (pLinkManager && !mpPageLink && !maFileName.isEmpty() && !maBookmarkName.isEmpty() && mePageKind==PageKind::Standard && !IsMasterPage() && - static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).IsNewOrLoadCompleted()) + static_cast<SdDrawDocument*>(pModel)->IsNewOrLoadCompleted()) { /********************************************************************** * Connect * Only standard pages are allowed to be linked **********************************************************************/ - ::sd::DrawDocShell* pDocSh = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocSh(); + ::sd::DrawDocShell* pDocSh = static_cast<SdDrawDocument*>(pModel)->GetDocSh(); if (!pDocSh || pDocSh->GetMedium()->GetOrigURL() != maFileName) { @@ -331,7 +347,7 @@ void SdPage::ConnectLink() void SdPage::DisconnectLink() { - sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager()); + sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr; if (pLinkManager && mpPageLink) { @@ -344,41 +360,57 @@ void SdPage::DisconnectLink() } } -void SdPage::lateInit(const SdPage& rSrcPage) +/************************************************************************* +|* +|* Copy-Ctor +|* +\************************************************************************/ + +SdPage::SdPage(const SdPage& rSrcPage) +: FmFormPage(rSrcPage) +, SdrObjUserCall() +, mpItems(nullptr) +, mnPageId(mnLastPageId++) { - // call parent - FmFormPage::lateInit(rSrcPage); + mePageKind = rSrcPage.mePageKind; + meAutoLayout = rSrcPage.meAutoLayout; - // copy local variables (former stuff from copy constructor) - mePageKind = rSrcPage.mePageKind; - meAutoLayout = rSrcPage.meAutoLayout; - mbSelected = false; - mnTransitionType = rSrcPage.mnTransitionType; + mbSelected = false; + mnTransitionType = rSrcPage.mnTransitionType; mnTransitionSubtype = rSrcPage.mnTransitionSubtype; mbTransitionDirection = rSrcPage.mbTransitionDirection; mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor; mfTransitionDuration = rSrcPage.mfTransitionDuration; - mePresChange = rSrcPage.mePresChange; - mfTime = rSrcPage.mfTime; - mbSoundOn = rSrcPage.mbSoundOn; - mbExcluded = rSrcPage.mbExcluded; - maLayoutName = rSrcPage.maLayoutName; - maSoundFile = rSrcPage.maSoundFile; - mbLoopSound = rSrcPage.mbLoopSound; - mbStopSound = rSrcPage.mbStopSound; + mePresChange = rSrcPage.mePresChange; + mfTime = rSrcPage.mfTime; + mbSoundOn = rSrcPage.mbSoundOn; + mbExcluded = rSrcPage.mbExcluded; + + maLayoutName = rSrcPage.maLayoutName; + maSoundFile = rSrcPage.maSoundFile; + mbLoopSound = rSrcPage.mbLoopSound; + mbStopSound = rSrcPage.mbStopSound; maCreatedPageName.clear(); - maFileName = rSrcPage.maFileName; - maBookmarkName = rSrcPage.maBookmarkName; - mbScaleObjects = rSrcPage.mbScaleObjects; + maFileName = rSrcPage.maFileName; + maBookmarkName = rSrcPage.maBookmarkName; + mbScaleObjects = rSrcPage.mbScaleObjects; mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize; - meCharSet = rSrcPage.meCharSet; - mnPaperBin = rSrcPage.mnPaperBin; - mpPageLink = nullptr; // is set when inserting via ConnectLink() - mbIsPrecious = false; + meCharSet = rSrcPage.meCharSet; + mnPaperBin = rSrcPage.mnPaperBin; + + mpPageLink = nullptr; // is set when inserting via ConnectLink() + + mbIsPrecious = false; +} + +void SdPage::lateInit(const SdPage& rSrcPage) +{ + FmFormPage::lateInit(rSrcPage); // use shape list directly to preserve constness of rSrcPage const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList(); - for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); aIter != rShapeList.end(); ++aIter ) + for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); + aIter != rShapeList.end(); ++aIter ) { SdrObject* pObj = *aIter; InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj)); @@ -386,13 +418,31 @@ void SdPage::lateInit(const SdPage& rSrcPage) // header footer setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() ); +} + +/************************************************************************* +|* +|* Clone +|* +\************************************************************************/ - // animations - rSrcPage.cloneAnimations(*this); +SdrPage* SdPage::Clone() const +{ + return Clone(nullptr); +} + +SdrPage* SdPage::Clone(SdrModel* pNewModel) const +{ + DBG_ASSERT( pNewModel == nullptr, "sd::SdPage::Clone(), new page ignored, please check code! CL" ); + + SdPage* pNewPage = new SdPage(*this); + pNewPage->lateInit( *this ); + + cloneAnimations( *pNewPage ); // fix user calls for duplicated slide - SdrObjListIter aSourceIter( rSrcPage, SdrIterMode::DeepWithGroups ); - SdrObjListIter aTargetIter( *this, SdrIterMode::DeepWithGroups ); + SdrObjListIter aSourceIter( *this, SdrIterMode::DeepWithGroups ); + SdrObjListIter aTargetIter( *pNewPage, SdrIterMode::DeepWithGroups ); while( aSourceIter.IsMore() && aTargetIter.IsMore() ) { @@ -400,25 +450,10 @@ void SdPage::lateInit(const SdPage& rSrcPage) SdrObject* pTarget = aTargetIter.Next(); if( pSource->GetUserCall() ) - pTarget->SetUserCall(this); + pTarget->SetUserCall( pNewPage ); } -} -/************************************************************************* -|* -|* Clone -|* -\************************************************************************/ - -SdrPage* SdPage::Clone(SdrModel* pNewModel) const -{ - SdDrawDocument& rSdDrawDocument(static_cast< SdDrawDocument& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel)); - SdPage* pClonedSdPage( - new SdPage( - rSdDrawDocument, - IsMasterPage())); - pClonedSdPage->lateInit(*this); - return pClonedSdPage; + return pNewPage; } /************************************************************************* @@ -441,7 +476,7 @@ SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const SfxItemSet* SdPage::getOrCreateItems() { if( mpItems == nullptr ) - mpItems = o3tl::make_unique<SfxItemSet>( getSdrModelFromSdrPage().GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} ); + mpItems = o3tl::make_unique<SfxItemSet>( pModel->GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} ); return mpItems.get(); } @@ -569,37 +604,40 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation ); } - if( getSdrModelFromSdrPage().IsUndoEnabled() ) + if( pModel && pModel->IsUndoEnabled() ) { SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true ); if( pAction ) - getSdrModelFromSdrPage().AddUndo( pAction ); + pModel->AddUndo( pAction ); } SetChanged(); - getSdrModelFromSdrPage().SetChanged(); - // TTTT NotifyDocumentEvent should be reference - NotifyDocumentEvent( - static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()), - "OnAnnotationInserted", - Reference<XInterface>(xAnnotation, UNO_QUERY)); + + if( pModel ) + { + pModel->SetChanged(); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted", Reference<XInterface>( xAnnotation, UNO_QUERY ) ); + } } void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation ) { - if( getSdrModelFromSdrPage().IsUndoEnabled() ) + if( pModel && pModel->IsUndoEnabled() ) { SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false ); if( pAction ) - getSdrModelFromSdrPage().AddUndo( pAction ); + pModel->AddUndo( pAction ); } AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation ); if( iter != maAnnotations.end() ) maAnnotations.erase( iter ); - getSdrModelFromSdrPage().SetChanged(); - NotifyDocumentEvent( static_cast< SdDrawDocument* >( &getSdrModelFromSdrPage() ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) ); + if( pModel ) + { + pModel->SetChanged(); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) ); + } } void SdPage::dumpAsXml(xmlTextWriterPtr pWriter) const diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx index d8db1329af56..6b3a4e80876e 100644 --- a/sd/source/core/undo/undoobjects.cxx +++ b/sd/source/core/undo/undoobjects.cxx @@ -58,10 +58,7 @@ UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject ) css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY ); if( pPage->getMainSequence()->hasEffect( xShape ) ) { - mpUndoAnimation.reset( - new UndoAnimation( // TTTT may use ref? Or just *SdrPage? - static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()), - pPage)); + mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) ); } } } @@ -183,10 +180,7 @@ UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText ) css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY ); if( pPage->getMainSequence()->hasEffect( xShape ) ) { - mpUndoAnimation.reset( - new UndoAnimation( - static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()), - pPage)); + mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) ); } } } diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 985d625b04d2..522f2bab8fc4 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -163,66 +163,62 @@ bool SdGRFFilter::Import() const sal_uInt16 nFilter = rGraphicFilter.GetImportFormatNumberForTypeName( mrMedium.GetFilter()->GetTypeName() ); bool bRet = false; - SvStream* pIStm = mrMedium.GetInStream(); - ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1); + SvStream* pIStm = mrMedium.GetInStream(); + ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1); - if( nReturn ) - HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError ); - else - { - if( mrDocument.GetPageCount() == 0 ) - mrDocument.CreateFirstPages(); + if( nReturn ) + HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError ); + else + { + if( mrDocument.GetPageCount() == 0 ) + mrDocument.CreateFirstPages(); - SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard ); - Point aPos; - Size aPagSize( pPage->GetSize() ); - Size aGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), - aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); + SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard ); + Point aPos; + Size aPagSize( pPage->GetSize() ); + Size aGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), + aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); - aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); - aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) ); + aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); + aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) ); - // scale to fit page - if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) && - aGrfSize.Height() && aPagSize.Height() ) - { - double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height(); - double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height(); - - // adjust graphic to page size (scales) - if( fGrfWH < fWinWH ) - { - aGrfSize.setWidth( static_cast<long>( aPagSize.Height() * fGrfWH ) ); - aGrfSize.setHeight( aPagSize.Height() ); - } - else if( fGrfWH > 0.F ) + // scale to fit page + if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) && + aGrfSize.Height() && aPagSize.Height() ) { - aGrfSize.setWidth( aPagSize.Width() ); - aGrfSize.setHeight( static_cast<long>( aPagSize.Width() / fGrfWH ) ); - } - } + double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height(); + double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height(); - // set output rectangle for graphic - aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() ); - aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() ); + // adjust graphic to page size (scales) + if( fGrfWH < fWinWH ) + { + aGrfSize.setWidth( static_cast<long>( aPagSize.Height() * fGrfWH ) ); + aGrfSize.setHeight( aPagSize.Height() ); + } + else if( fGrfWH > 0.F ) + { + aGrfSize.setWidth( aPagSize.Width() ); + aGrfSize.setHeight( static_cast<long>( aPagSize.Width() / fGrfWH ) ); + } + } - pPage->InsertObject( - new SdrGrafObj( - pPage->getSdrModelFromSdrPage(), - aGraphic, - ::tools::Rectangle(aPos, aGrfSize))); - bRet = true; - } + // set output rectangle for graphic + aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() ); + aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() ); + pPage->InsertObject( new SdrGrafObj( aGraphic, ::tools::Rectangle( aPos, aGrfSize ) ) ); + bRet = true; + } return bRet; } bool SdGRFFilter::Export() { // SJ: todo: error handling, the GraphicExportFilter does not support proper errorhandling + bool bRet = false; - uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( xContext ); SdPage* pPage = nullptr; diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 056b2924a6ba..d93fa3dd8280 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2688,9 +2688,8 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi aMediaURL = ReadSound( nRef ); if ( !aMediaURL.isEmpty() ) { - SdrMediaObj* pMediaObj = new SdrMediaObj( - pObj->getSdrModelFromSdrObject(), - pObj->GetSnapRect()); + SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() ); + pMediaObj->SetModel( pObj->GetModel() ); pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() ); //--remove object from maAnimations list and add the new object instead diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index c54d991ba42a..373f25149d87 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -316,7 +316,7 @@ MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, con , msLastPath( pEffect->getPath() ) , mbInUpdatePath( false ) { - mpPathObj = mpEffect->createSdrPathObjFromPath(rView.getSdrModelFromSdrView()); + mpPathObj = mpEffect->createSdrPathObjFromPath(); mxPolyPoly = mpPathObj->GetPathPoly(); if (mxOrigin.is()) maOriginPos = mxOrigin->getPosition(); diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 37a862294b29..e9d185c58758 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -160,7 +160,7 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj(); if( pTextObj ) - pDoc = dynamic_cast< SdDrawDocument* >( &pTextObj->getSdrModelFromSdrObject() ); + pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() ); if( pDoc ) pDocShell = pDoc->GetDocSh(); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 5ca6bab37ebd..a9b324d1fd24 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -777,8 +777,12 @@ void AnimationWindow::AddObj (::sd::View& rView ) for( size_t nObject = 0; nObject < pObjList->GetObjCount(); ++nObject ) { - SdrObject* pSnapShot(pObjList->GetObj(nObject)); - BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pSnapShot).GetBitmapEx()); + SdrObject* pSnapShot = pObjList->GetObj( nObject ); + + BitmapEx *const pBitmapEx = new BitmapEx( + SdrExchangeView::GetObjGraphic( + pSnapShot->GetModel(), pSnapShot).GetBitmapEx() ); + ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( @@ -826,9 +830,14 @@ void AnimationWindow::AddObj (::sd::View& rView ) for( size_t nObject= 0; nObject < nMarkCount; ++nObject ) { // Clone - SdrObject* pObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()); - BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pObject).GetBitmapEx()); + SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj(); + + BitmapEx *const pBitmapEx = new BitmapEx( + SdrExchangeView::GetObjGraphic( + pObject->GetModel(), pObject).GetBitmapEx() ); + ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); + size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( m_FrameList.begin() + nIndex, @@ -843,7 +852,7 @@ void AnimationWindow::AddObj (::sd::View& rView ) } else { - SdrObjGroup* pCloneGroup = new SdrObjGroup(rView.getSdrModelFromSdrView()); + SdrObjGroup* pCloneGroup = new SdrObjGroup; SdrObjList* pObjList = pCloneGroup->GetSubList(); for (size_t nObject= 0; nObject < nMarkCount; ++nObject) @@ -991,9 +1000,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) aAnimation.SetLoopCount( nLoopCount ); } - SdrGrafObj* pGrafObj = new SdrGrafObj( - rView.getSdrModelFromSdrView(), - Graphic(aAnimation)); + SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) ); const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) ); pGrafObj->SetLogicRect( ::tools::Rectangle( aOrg, aMaxSizeLog ) ); @@ -1066,7 +1073,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) if(pTargetSdPage) { // create animation group - SdrObjGroup* pGroup = new SdrObjGroup(rView.getSdrModelFromSdrView()); + SdrObjGroup* pGroup = new SdrObjGroup; SdrObjList* pObjList = pGroup->GetSubList(); for (size_t i = 0; i < nCount; ++i) diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx index f74db13144eb..5fe097765688 100644 --- a/sd/source/ui/func/fucon3d.cxx +++ b/sd/source/ui/func/fucon3d.cxx @@ -89,7 +89,6 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() case SID_3D_CUBE: { p3DObj = new E3dCubeObj( - mpView->getSdrModelFromSdrView(), mpView->Get3DDefaultAttributes(), ::basegfx::B3DPoint(-2500, -2500, -2500), ::basegfx::B3DVector(5000, 5000, 5000)); @@ -99,7 +98,6 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() case SID_3D_SPHERE: { p3DObj = new E3dSphereObj( - mpView->getSdrModelFromSdrView(), mpView->Get3DDefaultAttributes(), ::basegfx::B3DPoint(0, 0, 0), ::basegfx::B3DVector(5000, 5000, 5000)); @@ -116,10 +114,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); /* this is an open object, therefore it has to be handled double- sided by default */ @@ -146,10 +141,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); break; } @@ -160,10 +152,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); break; } @@ -189,10 +178,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); break; } @@ -216,10 +202,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); break; } @@ -243,10 +226,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); p3DObj->SetMergedItem(makeSvx3DHorizontalSegmentsItem(4)); break; } @@ -393,7 +373,7 @@ SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const double fW(aVolume.getWidth()); double fH(aVolume.getHeight()); ::tools::Rectangle a3DRect(0, 0, static_cast<long>(fW), static_cast<long>(fH)); - E3dScene* pScene = new E3dScene(*mpDoc); + E3dScene* pScene = new E3dScene; // copied code from E3dView::InitScene double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0)); @@ -407,9 +387,13 @@ SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const aCam.SetFocalLength(mpView->GetDefaultCamFocal()); aCam.SetDefaults(::basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt); pScene->SetCamera(aCam); + pScene->Insert3DObj(p3DObj); pScene->NbcSetSnapRect(a3DRect); + pScene->SetModel(mpDoc); + ImpPrepareBasic3DShape(p3DObj, pScene); + SfxItemSet aAttr(mpDoc->GetPool()); SetStyleSheet(aAttr, p3DObj); aAttr.Put(XLineStyleItem (drawing::LineStyle_NONE)); diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx index 6967a1495017..7d6aca665a37 100644 --- a/sd/source/ui/func/fuconarc.cxx +++ b/sd/source/ui/func/fuconarc.cxx @@ -91,12 +91,10 @@ void FuConstructArc::DoExecute( SfxRequest& rReq ) Activate(); // sets aObjKind SdrCircObj* pNewCircle = - new SdrCircObj( - mpView->getSdrModelFromSdrView(), - static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()), - aNewRectangle, - static_cast<long>(pPhiStart->GetValue () * 10.0), - static_cast<long>(pPhiEnd->GetValue () * 10.0)); + new SdrCircObj(static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()), + aNewRectangle, + static_cast<long>(pPhiStart->GetValue () * 10.0), + static_cast<long>(pPhiEnd->GetValue () * 10.0)); SdrPageView *pPV = mpView->GetSdrPageView(); mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER); @@ -204,9 +202,8 @@ SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const ::too { SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index cad7080afd6b..e7cc868d495b 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -309,9 +309,8 @@ SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, c // case SID_DRAW_BEZIER_NOFILL: // BASIC SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx index 97a60a302c11..6396eeb46e82 100644 --- a/sd/source/ui/func/fuconcs.cxx +++ b/sd/source/ui/func/fuconcs.cxx @@ -188,7 +188,7 @@ void FuConstructCustomShape::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, @@ -236,9 +236,8 @@ const OUString& FuConstructCustomShape::GetShapeType() const SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const ::tools::Rectangle& rRectangle) { SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if( pObj ) { diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index d78fd866755d..1377429ed056 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -109,10 +109,7 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq ) pCenterY->GetValue () - pAxisY->GetValue () / 2, pCenterX->GetValue () + pAxisX->GetValue () / 2, pCenterY->GetValue () + pAxisY->GetValue () / 2); - SdrCircObj *pNewCircle = new SdrCircObj( - mpView->getSdrModelFromSdrView(), - OBJ_CIRC, - aNewRectangle); + SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle); SdrPageView *pPV = mpView->GetSdrPageView(); mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR); @@ -130,9 +127,7 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq ) pMouseStartY->GetValue (), pMouseEndX->GetValue (), pMouseEndY->GetValue ()); - SdrRectObj *pNewRect = new SdrRectObj( - mpView->getSdrModelFromSdrView(), - aNewRectangle); + SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle); SdrPageView *pPV = mpView->GetSdrPageView(); mpView->InsertObjectAtView(pNewRect, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR); @@ -482,9 +477,9 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj) // dimension line SdPage* pPage = static_cast<SdPage*>( mpView->GetSdrPageView()->GetPage() ); OUString aName(SdResId(STR_POOLSHEET_MEASURE)); - SfxStyleSheet* pSheet( - static_cast< SfxStyleSheet* >( - pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pPage->GetModel()-> + GetStyleSheetPool()-> + Find(aName, SfxStyleFamily::Para)); DBG_ASSERT(pSheet, "StyleSheet missing"); if (pSheet) @@ -501,10 +496,10 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj) /** * set line starts and ends for the object to be created */ -::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel) +::basegfx::B2DPolyPolygon getPolygon(const char* pResId, SdrModel const * pDoc) { ::basegfx::B2DPolyPolygon aRetval; - XLineEndListRef pLineEndList(rModel.GetLineEndList()); + XLineEndListRef pLineEndList = pDoc->GetLineEndList(); if( pLineEndList.is() ) { @@ -541,10 +536,9 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj nSlotId == SID_LINE_SQUARE_ARROW ) { // set attributes of line start and ends - SdrModel& rModel(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference // arrowhead - ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); + ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, mpDoc ) ); if( !aArrow.count() ) { ::basegfx::B2DPolygon aNewArrow; @@ -556,7 +550,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj } // Circles - ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); + ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) ); if( !aCircle.count() ) { ::basegfx::B2DPolygon aNewCircle; @@ -566,7 +560,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj } // Square - ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); + ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) ); if( !aSquare.count() ) { ::basegfx::B2DPolygon aNewSquare; @@ -770,9 +764,8 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const // case SID_CONNECTOR_LINES_CIRCLES: SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index 9e15f47a070a..8f376fb3d72a 100644 --- a/sd/source/ui/func/fuconstr.cxx +++ b/sd/source/ui/func/fuconstr.cxx @@ -318,9 +318,9 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, OUString aName( pPage->GetLayoutName() ); sal_Int32 n = aName.indexOf(SD_LT_SEPARATOR) + strlen(SD_LT_SEPARATOR); aName = aName.copy(0, n) + STR_LAYOUT_BACKGROUNDOBJECTS; - SfxStyleSheet* pSheet( - static_cast< SfxStyleSheet* >( - pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()-> + GetStyleSheetPool()-> + Find(aName, SfxStyleFamily::Page)); DBG_ASSERT(pSheet, "StyleSheet missing"); if (pSheet) { @@ -348,9 +348,9 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, if ( bForceNoFillStyle ) { OUString aName(SdResId(STR_POOLSHEET_OBJWITHOUTFILL)); - SfxStyleSheet* pSheet( - static_cast< SfxStyleSheet* >( - pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()-> + GetStyleSheetPool()-> + Find(aName, SfxStyleFamily::Para)); DBG_ASSERT(pSheet, "Stylesheet missing"); if (pSheet) { diff --git a/sd/source/ui/func/fuconuno.cxx b/sd/source/ui/func/fuconuno.cxx index 8ff99fdb7e00..935cb0c50157 100644 --- a/sd/source/ui/func/fuconuno.cxx +++ b/sd/source/ui/func/fuconuno.cxx @@ -138,9 +138,8 @@ SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const :: // case SID_FM_CREATE_CONTROL: SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index ad22e00dc71b..0cdd22da3807 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -386,11 +386,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) aRect = ::tools::Rectangle(aPos, aSize); } - SdrOle2Obj* pOleObj = new SdrOle2Obj( - mpView->getSdrModelFromSdrView(), - svt::EmbeddedObjectRef( xObj, nAspect ), - aObjName, - aRect); + SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect ); SdrPageView* pPV = mpView->GetSdrPageView(); // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj @@ -617,11 +613,8 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) Point aPnt ((aPageSize.Width() - aSize.Width()) / 2, (aPageSize.Height() - aSize.Height()) / 2); ::tools::Rectangle aRect (aPnt, aSize); - SdrOle2Obj* pObj = new SdrOle2Obj( - mpView->getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + + SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect); if( mpView->InsertObjectAtView(pObj, *pPV, SdrInsertFlags::SETDEFLAYER) ) { diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 5ad65b627063..fae84526e97f 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -506,9 +506,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) } else { - SdrRectObj* pTO = new SdrRectObj( - mpView->getSdrModelFromSdrView(), - OBJ_TEXT); + SdrRectObj* pTO = new SdrRectObj(OBJ_TEXT); pTO->SetOutlinerParaObject(pOPO); const bool bUndo = mpView->IsUndoEnabled(); diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index 03aa0b0ad656..b78c018747ed 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -384,7 +384,7 @@ void FuMorph::ImpInsertPolygons( if ( pPageView ) { SfxItemSet aSet( aSet1 ); - SdrObjGroup* pObjGroup = new SdrObjGroup(mpView->getSdrModelFromSdrView()); + SdrObjGroup* pObjGroup = new SdrObjGroup; SdrObjList* pObjList = pObjGroup->GetSubList(); const size_t nCount = rPolyPolyList3D.size(); const double fStep = 1. / ( nCount + 1 ); @@ -397,10 +397,7 @@ void FuMorph::ImpInsertPolygons( for ( size_t i = 0; i < nCount; i++, fFactor += fStep ) { const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *rPolyPolyList3D[ i ]; - SdrPathObj* pNewObj = new SdrPathObj( - mpView->getSdrModelFromSdrView(), - OBJ_POLY, - rPolyPoly3D); + SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D); // line color if ( bLineColor ) diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index b6d81901f870..300e17c09cc5 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -691,7 +691,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) // outliner object up to now; also it needs to be set back to not // vertical when there was a vertical one used last time. OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject(); - SdrOutliner& rOutl(mxTextObj->getSdrModelFromSdrObject().GetDrawOutliner(GetTextObj())); + SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj()); bool bVertical((pOPO && pOPO->IsVertical()) || nSlotId == SID_ATTR_CHAR_VERTICAL || nSlotId == SID_TEXT_FITTOSIZE_VERTICAL); @@ -1304,11 +1304,10 @@ void FuText::DoubleClick(const MouseEvent& ) */ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) { + SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier(), - nullptr); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx index ab46b90ac8ee..021dc5ba7a02 100644 --- a/sd/source/ui/func/unoaprms.cxx +++ b/sd/source/ui/func/unoaprms.cxx @@ -27,7 +27,7 @@ void SdAnimationPrmsUndoAction::Undo() // no new info created: restore data if (!bInfoCreated) { - SdDrawDocument* pDoc(dynamic_cast< SdDrawDocument* >(&pObject->getSdrModelFromSdrObject())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pObject->GetModel()); if( pDoc ) { SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo( pObject ); diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 381b22be955f..67770cc27313 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -128,10 +128,6 @@ private: sd::DrawViewShell* GetViewShell(); -protected: - /** abstract SdrModel provider */ - virtual SdrModel* getSdrModelFromUnoModel() const override; - public: SdXImpressDocument(::sd::DrawDocShell* pShell, bool bClipBoard); SdXImpressDocument(SdDrawDocument* pDoc, bool bClipBoard); diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index b9336124f9e1..dc76d90a4777 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -53,11 +53,14 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( break; // Check the presence of the source document. - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>( + pMasterPage->GetModel()); + if (pSourceDocument == nullptr) + break; // When the given master page already belongs to the target document // then there is nothing more to do. - if (&rSourceDocument == &rTargetDocument) + if (pSourceDocument == &rTargetDocument) { pNewMasterPage = pMasterPage; break; @@ -67,7 +70,7 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( // present. This is not the case when we are called during the // creation of the slide master page because then the notes master // page is not there. - sal_uInt16 nSourceMasterPageCount = rSourceDocument.GetMasterPageCount(); + sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount(); if (nSourceMasterPageCount%2 == 0) // There should be 1 handout page + n slide masters + n notes // masters = 2*n+1. An even value indicates that a new slide @@ -78,11 +81,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( break; // Get the slide master page. if (pMasterPage != static_cast<SdPage*>( - rSourceDocument.GetMasterPage(nIndex))) + pSourceDocument->GetMasterPage(nIndex))) break; // Get the notes master page. SdPage* pNotesMasterPage = static_cast<SdPage*>( - rSourceDocument.GetMasterPage(nIndex+1)); + pSourceDocument->GetMasterPage(nIndex+1)); if (pNotesMasterPage == nullptr) break; @@ -158,7 +161,7 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage) SdDrawDocument* pDocument = nullptr; if (pMasterPage != nullptr) - pDocument = dynamic_cast< SdDrawDocument* >(&pMasterPage->getSdrModelFromSdrPage()); + pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel()); // Iterate over all pages and check if it references the given master // page. @@ -212,8 +215,10 @@ SdPage* DocumentHelper::AddMasterPage ( pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone()); // Copy the necessary styles. - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); - ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage); + SdDrawDocument* pSourceDocument + = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument != nullptr) + ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage); // Copy the precious flag. pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); @@ -305,7 +310,7 @@ void DocumentHelper::AssignMasterPageToPageList ( ::std::vector<SdPage*> aCleanedList; for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage) { - OSL_ASSERT(*iPage!=nullptr && &(*iPage)->getSdrModelFromSdrPage() == &rTargetDocument); + OSL_ASSERT(*iPage!=nullptr && (*iPage)->GetModel() == &rTargetDocument); if (*iPage != nullptr && (*iPage)->GetLayoutName() != sFullLayoutName) { aCleanedList.push_back(*iPage); @@ -353,24 +358,28 @@ SdPage* DocumentHelper::AddMasterPage ( pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); // Copy the necessary styles. - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); - ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage); - - // Now that the styles are available we can insert the cloned - // master page. - rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex); - - // Adapt the size of the new master page to that of the pages in - // the document. - Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize()); - ::tools::Rectangle aBorders ( - pClonedMasterPage->GetLeftBorder(), - pClonedMasterPage->GetUpperBorder(), - pClonedMasterPage->GetRightBorder(), - pClonedMasterPage->GetLowerBorder()); - pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true); - pClonedMasterPage->SetSize(aNewSize); - pClonedMasterPage->CreateTitleAndLayout(true); + SdDrawDocument* pSourceDocument + = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument != nullptr) + { + ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage); + + // Now that the styles are available we can insert the cloned + // master page. + rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex); + + // Adapt the size of the new master page to that of the pages in + // the document. + Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize()); + ::tools::Rectangle aBorders ( + pClonedMasterPage->GetLeftBorder(), + pClonedMasterPage->GetUpperBorder(), + pClonedMasterPage->GetRightBorder(), + pClonedMasterPage->GetLowerBorder()); + pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true); + pClonedMasterPage->SetSize(aNewSize); + pClonedMasterPage->CreateTitleAndLayout(true); + } } return pClonedMasterPage; @@ -397,24 +406,25 @@ void DocumentHelper::AssignMasterPageToPage ( // Leave early when the parameters are invalid. if (pPage == nullptr || pMasterPage == nullptr) return; - - SdDrawDocument& rDocument(dynamic_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); + SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel()); + if (pDocument == nullptr) + return; if ( ! pPage->IsMasterPage()) { // 1. Remove the background object (so that, if it exists, does // not override the new master page) and assign the master page to // the regular slide. - rDocument.GetDocSh()->GetUndoManager()->AddUndoAction( + pDocument->GetDocSh()->GetUndoManager()->AddUndoAction( new SdBackgroundObjUndoAction( - rDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()), + *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()), true); pPage->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE)); - rDocument.SetMasterPage ( + pDocument->SetMasterPage ( (pPage->GetPageNum()-1)/2, rsBaseLayoutName, - &rDocument, + pDocument, false, false); } @@ -422,10 +432,10 @@ void DocumentHelper::AssignMasterPageToPage ( { // Find first slide that uses the master page. SdPage* pSlide = nullptr; - sal_uInt16 nPageCount = rDocument.GetSdPageCount(PageKind::Standard); + sal_uInt16 nPageCount = pDocument->GetSdPageCount(PageKind::Standard); for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==nullptr; nPage++) { - SdrPage* pCandidate = rDocument.GetSdPage(nPage,PageKind::Standard); + SdrPage* pCandidate = pDocument->GetSdPage(nPage,PageKind::Standard); if (pCandidate != nullptr && pCandidate->TRG_HasMasterPage() && &(pCandidate->TRG_GetMasterPage()) == pPage) @@ -438,10 +448,10 @@ void DocumentHelper::AssignMasterPageToPage ( { // 2. Assign the given master pages to the first slide that was // found above that uses the master page. - rDocument.SetMasterPage ( + pDocument->SetMasterPage ( (pSlide->GetPageNum()-1)/2, rsBaseLayoutName, - &rDocument, + pDocument, false, false); } @@ -449,7 +459,7 @@ void DocumentHelper::AssignMasterPageToPage ( { // 3. Replace the master page A by a copy of the given master // page B. - rDocument.RemoveUnnecessaryMasterPages ( + pDocument->RemoveUnnecessaryMasterPages ( pPage); } } @@ -469,9 +479,11 @@ SdPage* DocumentHelper::ProvideMasterPage ( OSL_ASSERT(pMasterPage != nullptr); return nullptr; } - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument == nullptr) + return nullptr; SdPage* pNotesMasterPage = static_cast<SdPage*>( - rSourceDocument.GetMasterPage(pMasterPage->GetPageNum()+1)); + pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1)); if (pNotesMasterPage == nullptr) { // The model is not in a valid state. Maybe a new master page @@ -509,7 +521,7 @@ SdPage* DocumentHelper::ProvideMasterPage ( } // Clone the master page. - if (&pMasterPage->getSdrModelFromSdrPage() != &rTargetDocument) + if (pMasterPage->GetModel() != &rTargetDocument) { pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex); if( rTargetDocument.IsUndoEnabled() ) @@ -520,7 +532,7 @@ SdPage* DocumentHelper::ProvideMasterPage ( pMasterPageInDocument = pMasterPage; // Clone the notes master. - if (&pNotesMasterPage->getSdrModelFromSdrPage() != &rTargetDocument) + if (pNotesMasterPage->GetModel() != &rTargetDocument) { SdPage* pClonedNotesMasterPage = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1); diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index e85d27a810fb..dd3e6a4f0dd3 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -183,11 +183,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq) aRect = ::tools::Rectangle(aPos, aSize); } - sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( - *GetDoc(), // TTTT should be reference - aRect, - nColumns, - nRows); + sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows ); pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), true ); apply_table_style( pObj, GetDoc(), sTableStyle ); SdrPageView* pPV = mpView->GetSdrPageView(); @@ -275,11 +271,7 @@ void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel ) { Size aSize( 200, 200 ); ::tools::Rectangle aRect (Point(), aSize); - sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( - *pModel, - aRect, - 1, - 1); + sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( pModel, aRect, 1, 1 ); pObj->NbcSetStyleSheet( pModel->GetDefaultStyleSheet(), true ); apply_table_style( pObj, pModel, OUString() ); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 23717ea3d16b..158b1603f00e 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -202,9 +202,15 @@ bool PreviewRenderer::Initialize ( if (pPage == nullptr) return false; + SdrModel* pModel = pPage->GetModel(); + if (pModel == nullptr) + return false; + SetupOutputSize(*pPage, rPixelSize); - SdDrawDocument& rDocument(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - DrawDocShell* pDocShell = rDocument.GetDocSh(); + + SdDrawDocument* pDocument + = static_cast<SdDrawDocument*>(pPage->GetModel()); + DrawDocShell* pDocShell = pDocument->GetDocSh(); // Create view ProvideView (pDocShell); @@ -254,9 +260,9 @@ bool PreviewRenderer::Initialize ( } pPageView->SetApplicationDocumentColor(aApplicationDocumentColor); - SdrOutliner& rOutliner(rDocument.GetDrawOutliner()); + SdrOutliner& rOutliner(pDocument->GetDrawOutliner()); rOutliner.SetBackgroundColor(aApplicationDocumentColor); - rOutliner.SetDefaultLanguage(rDocument.GetLanguage(EE_CHAR_LANGUAGE)); + rOutliner.SetDefaultLanguage(pDocument->GetLanguage(EE_CHAR_LANGUAGE)); mpPreviewDevice->SetBackground(Wallpaper(aApplicationDocumentColor)); mpPreviewDevice->Erase(); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index b6ee7d5d1122..afe7ede9bde5 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2714,11 +2714,6 @@ void SdXImpressDocument::initializeDocument() } } -SdrModel* SdXImpressDocument::getSdrModelFromUnoModel() const -{ - return GetDoc(); -} - void SAL_CALL SdXImpressDocument::dispose() { if( !mbDisposed ) diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 7a34f2a80277..619d84254a7d 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -406,20 +406,23 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape ); if( pObj && ( (pObj->GetObjInventor() != SdrInventor::Default) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - // #i119287# similar to the code in the SdrObject methods the graphic and ole - // SdrObjects need another default style than the rest, see task. Adding here, too. - // TTTT: Same as for #i119287#: Can be removed in branch aw080 again - const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) != nullptr); - const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr); - - if(bIsSdrGrafObj || bIsSdrOle2Obj) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if( pDoc ) { - pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true); - } - else - { - pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true); + // #i119287# similar to the code in the SdrObject methods the graphic and ole + // SdrObjects need another default style than the rest, see task. Adding here, too. + // TTTT: Same as for #i119287#: Can be removed in branch aw080 again + const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) != nullptr); + const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr); + + if(bIsSdrGrafObj || bIsSdrOle2Obj) + { + pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true); + } + else + { + pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheet(), true); + } } } return pObj; @@ -515,8 +518,9 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap pPresObj = SvxFmDrawPage::CreateSdrObject_( xShape ); if( pPresObj ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - pPresObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if( pDoc ) + pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), true ); GetPage()->InsertPresObj( pPresObj, eObjKind ); } } @@ -681,21 +685,21 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName if( eOri != GetPage()->GetOrientation() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetOrientation( eOri ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetOrientation( eOri ); } } @@ -777,10 +781,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)), bVisible); pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); @@ -797,10 +801,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)), bVisible); pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); @@ -1096,36 +1100,39 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) case WID_PAGE_PREVIEW : case WID_PAGE_PREVIEWMETAFILE : { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh(); - if ( pDocShell ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if ( pDoc ) { - sal_uInt16 nPgNum = 0; - sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard ); - sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 ); - while( nPgNum < nPageCount ) + ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); + if ( pDocShell ) { - rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber ); - nPgNum++; - } - std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); - if (xMetaFile) - { - Size aSize( GetPage()->GetSize() ); - xMetaFile->AddAction( static_cast<MetaAction*>(new MetaFillColorAction( COL_WHITE, true )), 0 ); - xMetaFile->AddAction( static_cast<MetaAction*>(new MetaRectAction( ::tools::Rectangle( Point(), aSize ) )), 1 ); - xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM)); - xMetaFile->SetPrefSize( aSize ); - - SvMemoryStream aDestStrm( 65535, 65535 ); - if (nEntry == WID_PAGE_PREVIEW) - // Preview: WMF format. - ConvertGDIMetaFileToWMF(*xMetaFile, aDestStrm, nullptr, false); - else - // PreviewMetafile: SVM format. - xMetaFile->Write(aDestStrm); - Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() ); - aAny <<= aSeq; + sal_uInt16 nPgNum = 0; + sal_uInt16 nPageCount = pDoc->GetSdPageCount( PageKind::Standard ); + sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 ); + while( nPgNum < nPageCount ) + { + pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber ); + nPgNum++; + } + std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); + if (xMetaFile) + { + Size aSize( GetPage()->GetSize() ); + xMetaFile->AddAction( static_cast<MetaAction*>(new MetaFillColorAction( COL_WHITE, true )), 0 ); + xMetaFile->AddAction( static_cast<MetaAction*>(new MetaRectAction( ::tools::Rectangle( Point(), aSize ) )), 1 ); + xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM)); + xMetaFile->SetPrefSize( aSize ); + + SvMemoryStream aDestStrm( 65535, 65535 ); + if (nEntry == WID_PAGE_PREVIEW) + // Preview: WMF format. + ConvertGDIMetaFileToWMF(*xMetaFile, aDestStrm, nullptr, false); + else + // PreviewMetafile: SVM format. + xMetaFile->Write(aDestStrm); + Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() ); + aAny <<= aSeq; + } } } } @@ -1133,26 +1140,29 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) case WID_PAGE_PREVIEWBITMAP : { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh(); - if ( pDocShell ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if ( pDoc ) { - sal_uInt16 nPgNum = 0; - sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard ); - sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 ); - while( nPgNum < nPageCount ) - { - rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber ); - nPgNum++; - } - std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); - BitmapEx aBitmap; - if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap)) + ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); + if ( pDocShell ) { - SvMemoryStream aMemStream; - WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false); - uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() ); - aAny <<= aSeq; + sal_uInt16 nPgNum = 0; + sal_uInt16 nPageCount = pDoc->GetSdPageCount( PageKind::Standard ); + sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 ); + while( nPgNum < nPageCount ) + { + pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber ); + nPgNum++; + } + std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); + BitmapEx aBitmap; + if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap)) + { + SvMemoryStream aMemStream; + WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false); + uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() ); + aAny <<= aSeq; + } } } } @@ -1196,10 +1206,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND))); } @@ -1215,10 +1225,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ))); } @@ -1674,21 +1684,21 @@ void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetLeftBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetLeftBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetLeftBorder( nValue ); } } @@ -1698,21 +1708,21 @@ void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetRightBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetRightBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetRightBorder( nValue ); } } @@ -1722,21 +1732,21 @@ void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetUpperBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetUpperBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetUpperBorder( nValue ); } } @@ -1746,21 +1756,21 @@ void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetLowerBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetLowerBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetLowerBorder( nValue ); } } @@ -1801,25 +1811,25 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth ) { aSize.setWidth( nWidth ); - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetSize(aSize); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetSize(aSize); } - refreshpage( &rDoc, ePageKind ); + refreshpage( pDoc, ePageKind ); } } @@ -1830,25 +1840,25 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight ) { aSize.setHeight( nHeight ); - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetSize(aSize); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetSize(aSize); } - refreshpage( &rDoc, ePageKind ); + refreshpage( pDoc, ePageKind ); } } @@ -2379,7 +2389,7 @@ void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& pNotesPage->TRG_ClearMasterPage(); sal_uInt16 nNum = SvxFmDrawPage::mpPage->TRG_GetMasterPage().GetPageNum() + 1; - pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum)); + pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum)); pNotesPage->SetLayoutName( pSdPage->GetLayoutName() ); GetModel()->SetModified(); @@ -2476,7 +2486,7 @@ void SdDrawPage::setBackground( const Any& rValue ) if( pBack ) { - pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } else { @@ -2500,7 +2510,7 @@ void SdDrawPage::setBackground( const Any& rValue ) pProp++; } - pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBackground->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } if( aSet.Count() == 0 ) @@ -2862,7 +2872,7 @@ void SdMasterPage::setBackground( const Any& rValue ) if( pBack ) { - pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } else { @@ -2885,11 +2895,11 @@ void SdMasterPage::setBackground( const Any& rValue ) pProp++; } - pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet ); + pBackground->fillItemSet( static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()), aSet ); } // if we find the background style, copy the set to the background - SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()); SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool(); if(pSSPool) { @@ -2933,7 +2943,7 @@ void SdMasterPage::getBackground( Any& rValue ) } else { - SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()); SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool(); if(pSSPool) { @@ -3082,9 +3092,9 @@ Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage ) { Reference< uno::XInterface > xPage; - if( pPage ) + if( pPage && pPage->GetModel() ) { - SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->getSdrModelFromSdrPage().getUnoModel() ); + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() ); if( pModel ) { if( pPage->IsMasterPage() ) diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 432146681d78..c89213c5880d 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1526,10 +1526,7 @@ private: std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() ); while( iter != aAreas.end() ) { - pHandout->NbcInsertObject( - new SdrPageObj( - rModel, - (*iter++))); + pHandout->NbcInsertObject( new SdrPageObj((*iter++)) ); if( bDrawLines && (iter != aAreas.end()) ) { @@ -1549,10 +1546,7 @@ private: aPathPoly.append( aPoly ); } - SdrPathObj* pPathObj = new SdrPathObj( - rModel, - OBJ_PATHLINE, - aPathPoly); + SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly ); pPathObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_SOLID)); pPathObj->SetMergedItem(XLineColorItem(OUString(), COL_BLACK)); diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 95a4807e43c3..56a07fdb6486 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -78,15 +78,12 @@ namespace sd { * that there is no page a page is created. */ -DrawView::DrawView( - DrawDocShell* pDocSh, - OutputDevice* pOutDev, - DrawViewShell* pShell) -: ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell) - ,mpDocShell(pDocSh) - ,mpDrawViewShell(pShell) - ,mpVDev(nullptr) - ,mnPOCHSmph(0) +DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell) +: ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell) +, mpDocShell(pDocSh) +, mpDrawViewShell(pShell) +, mpVDev(nullptr) +, mnPOCHSmph(0) { SetCurrentObj(OBJ_RECT); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index bbfd4e0d3d23..f61052b4cb68 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -520,9 +520,7 @@ public: if (!pMasterPage) continue; - SdrRectObj* pObject = new SdrRectObj( - *m_rDrawViewShell.GetDoc(), // TTTT should be reference - OBJ_TEXT); + SdrRectObj* pObject = new SdrRectObj(OBJ_TEXT); pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true)); pObject->SetOutlinerParaObject(pOutliner->CreateParaObject()); pMasterPage->InsertObject(pObject); @@ -1087,9 +1085,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } // create new object - SdrGrafObj* pGraphicObj = new SdrGrafObj( - *GetDoc(), - aGraphic); + SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic); // get some necessary info and ensure it const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); @@ -2343,9 +2339,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) pOutl->QuickInsertField( *pFieldItem, ESelection() ); OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); - SdrRectObj* pRectObj = new SdrRectObj( - *GetDoc(), - OBJ_TEXT); + SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT ); pRectObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(true)); pOutl->UpdateFields(); diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index e396b8ec6ea8..1181d6c7d820 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -120,10 +120,7 @@ void DrawViewShell::ScannerEvent() if( bInsertNewObject ) { - auto pGrafObj = new SdrGrafObj( - GetView()->getSdrModelFromSdrView(), - Graphic(aScanBmp), - aRect); + auto pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect ); SdrPageView* pPV = GetView()->GetSdrPageView(); GetView()->InsertObjectAtView( pGrafObj, *pPV, SdrInsertFlags::SETDEFLAYER ); } diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index afc151b29a96..4c2e6b1c3203 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -169,10 +169,7 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq) if( bInsertNewObject ) { - pGrafObj = new SdrGrafObj( - GetView()->getSdrModelFromSdrView(), - aGraphic, - aRect); + pGrafObj = new SdrGrafObj(aGraphic, aRect); SdrPageView* pPV = mpDrawView->GetSdrPageView(); mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SdrInsertFlags::SETDEFLAYER); } diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 8b69d3616037..0b082d9e18a9 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1458,9 +1458,7 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText, pOutl->QuickInsertField( aURLItem, ESelection() ); OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); - SdrRectObj* pRectObj = new SdrRectObj( - GetView()->getSdrModelFromSdrView(), - OBJ_TEXT); + SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT); pOutl->UpdateFields(); pOutl->SetUpdateMode( true ); @@ -1536,12 +1534,8 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, if (bNewObj) try { - SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( - SdrObjFactory::MakeNewObject( - GetView()->getSdrModelFromSdrView(), - SdrInventor::FmForm, - OBJ_FM_BUTTON, - mpDrawView->GetSdrPageView()->GetPage())); + SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON, + mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) ); Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index b08896abf358..3795f9e09b4f 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -51,7 +51,7 @@ using namespace ::std; namespace sd { FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK */) -: SdrView(*pDrawDoc, nullptr), // TTTT SdDrawDocument* -> should be reference + : SdrView(pDrawDoc, nullptr), mnRefCount(0), mnPresViewShellId(SID_VIEWSHELL0), mbIsNavigatorShowingAllShapes(false) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 7bff93080e61..d0344d2ab4e5 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -104,11 +104,10 @@ using namespace com::sun::star::uno; using namespace sdr::table; namespace sd { -View::View( - SdDrawDocument& rDrawDoc, - OutputDevice* pOutDev, - ViewShell* pViewShell) -: FmFormView(rDrawDoc, pOutDev), + +View::View(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev, + ViewShell* pViewShell) + : FmFormView(&rDrawDoc, pOutDev), mrDoc(rDrawDoc), mpDocSh(rDrawDoc.GetDocSh()), mpViewSh(pViewShell), @@ -659,7 +658,7 @@ bool View::SdrBeginTextEdit( EventMultiplexerEventId::BeginTextEdit, static_cast<void*>(pObj) ); if( pOutl==nullptr && pObj ) - pOutl = SdrMakeOutliner(OutlinerMode::TextObject, pObj->getSdrModelFromSdrObject()); + pOutl = SdrMakeOutliner(OutlinerMode::TextObject, *pObj->GetModel()); // make draw&impress specific initialisations if( pOutl ) diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index cf6f72870045..c0f5f5e19413 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -797,11 +797,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, aNewSet.Put( pObj->GetMergedItemSet() ); if( bUndo ) - AddUndo( - new E3dAttributesUndoAction( - *static_cast< E3dObject* >(pPickObj), - aNewSet, - aOldSet)); + AddUndo( new E3dAttributesUndoAction( mrDoc, static_cast<E3dObject*>(pPickObj), aNewSet, aOldSet ) ); pPickObj->SetMergedItemSetAndBroadcast( aNewSet ); } @@ -999,11 +995,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) ); ::tools::Rectangle aRect( maDropPos, aSize ); - SdrOle2Obj* pObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect ); SdrPageView* pPV = GetSdrPageView(); SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER; @@ -1173,11 +1165,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) ); ::tools::Rectangle aRect( maDropPos, aSize ); - SdrOle2Obj* pObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect ); SdrPageView* pPV = GetSdrPageView(); SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER; diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index fb17fcc2df24..f98a8ab1b216 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -116,10 +116,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, } else { - pNewGrafObj = new SdrGrafObj( - getSdrModelFromSdrView(), - rGraphic, - pPickObj->GetLogicRect()); + pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() ); pNewGrafObj->SetEmptyPresObj(true); } @@ -192,10 +189,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, MapMode( MapUnit::Map100thMM ) ); } - pNewGrafObj = new SdrGrafObj( - getSdrModelFromSdrView(), - rGraphic, - ::tools::Rectangle(rPos, aSize)); + pNewGrafObj = new SdrGrafObj( rGraphic, ::tools::Rectangle( rPos, aSize ) ); SdrPage* pPage = pPV->GetPage(); Size aPageSize( pPage->GetSize() ); aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); @@ -335,9 +329,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj } - pNewMediaObj = new SdrMediaObj( - getSdrModelFromSdrView(), - aRect); + pNewMediaObj = new SdrMediaObj( aRect ); bool bIsPres = false; if( pPickObj ) @@ -537,11 +529,7 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) aRect = ::tools::Rectangle( maDropPos, aSize ); - SdrOle2Obj* pOleObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - svt::EmbeddedObjectRef(xObj, nAspect), - aName, - aRect); + SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect ); SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER; if (mpViewSh != nullptr) |