summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-03-01 15:54:32 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-07 00:28:30 +0200
commitdfefe448c41921f2f1e54d3f69b8b9e89031d055 (patch)
tree1aace31054b5740e2faffcbc5de66a791be27f7d /sd
parenteba4d5b2b76cefde90cb3d6638c736f435023a45 (diff)
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects Added need for SdrModel& in constructors of SdrModel, SdrPage, SdrView and SdrObjList. Builds, not finished. SOSAW080: removed and replaced old SdrModel Removed and replaced GetModel()/SetModel() in all using classes (SdrObject, SdrPage, SdrView), added accessors to new referenced SdrModel, adapted all accessing places. Refactored/Extended ::Clone and ::operator== for these classes to allow cloning objects to a target SdrModel. Adapted places where this is done AFAP. Added quite some comments (tagged with 'TTTT') where possible further work is needed. Builds completely, thus checking in. This does not mean that this change is done yet. SOSAW080: Adapted SdrPage/SdrModel relationship Also needed to work on copy-construction of SdrPage and hierarchy, quite some stuff removed, no copy-constructor anymore, no MigrateItemPool stuff. Builds well, test stuck, will need some cleanup/finetunung SOSAW080: Smaller corrections/includes adapted SOSAW080: Smaller corrections/includes adapted SOSAW080: Debugging/Stabilizing/MakeUnitTestWork SOSAW080: Stabilized for UnitTests, cleanups SOSAW080: Adapted GetObjGraphic to just take a const SdrObject& SOSAW080: Removed ChangeModel from classes Classes SvxTextEditSource and SvxDrawPage (including TextEditSource stuff) do not need change of SdrModel anymore. SOSAW080: Adapted some comments to make more readable SOSAW080: Corrected constructor SOSAW080: getSdrModelFromUnoModel added override marks SOSAW080: Added missing includes SOSAW080: Corrected SdrPage constructor SOSAW080: Corrected some SdrObject::Clone scenarios Especially when cloning to another SdrModel and taking the sdr::properties into account. SOSAW080: Added include for Mac-Build SOSAW080: Added Scale to DefaultProperties If a SdrModel change happens in DefaultProperties copy constructor (used from Clone()), potentially a Scale for the SfxItems has to be done. SOSAW080: Added missing include for MacBuild SOSAW080: Corrected CppunitTest_sc_anchor_test An adaption of a SdrPathObj instantiation was missing, added that. Seems as if that test is no tpart of the usual 'make' scenario, but used/executed in gerrit builds SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Free SdrObjects when SdrModel goes down In an UNO API test problem is that SvxShapes reference SdrShapes, but these are not added to a SdrPage and not 'owned' by the SvxShape. Thus these do not get deleted at all (same in master, memory leak). I extended SvxShape::Notify the case for ModelCleared to also Free the SdrObject when not owner and it's not added to a SdrPage (in that case it gets deleted with deleting the SdrModel) SOSAW080: Solve UNO API calls that move SvxShapes to other Model Due to UNO API tests I got a call to insert an xShape to a xDrawPage which was constructed in another Model, this has now to be done by Cloning the SdrObject to the new SdrModel, getting rid of the old one and getting all the UNO implementation stuff right (referemces SdrObject <-> xShape). 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078 Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c Reviewed-on: https://gerrit.libreoffice.org/52526 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/CustomAnimationEffect.hxx6
-rw-r--r--sd/inc/sdpage.hxx9
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx4
-rw-r--r--sd/source/core/annotations/Annotation.cxx4
-rw-r--r--sd/source/core/drawdoc.cxx15
-rw-r--r--sd/source/core/drawdoc3.cxx2
-rw-r--r--sd/source/core/pglink.cxx2
-rw-r--r--sd/source/core/sdpage.cxx142
-rw-r--r--sd/source/core/sdpage2.cxx174
-rw-r--r--sd/source/core/undo/undoobjects.cxx10
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx84
-rw-r--r--sd/source/filter/ppt/pptin.cxx5
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx2
-rw-r--r--sd/source/ui/app/sdmod2.cxx2
-rw-r--r--sd/source/ui/dlg/animobjs.cxx25
-rw-r--r--sd/source/ui/func/fucon3d.cxx38
-rw-r--r--sd/source/ui/func/fuconarc.cxx15
-rw-r--r--sd/source/ui/func/fuconbez.cxx5
-rw-r--r--sd/source/ui/func/fuconcs.cxx7
-rw-r--r--sd/source/ui/func/fuconrec.cxx31
-rw-r--r--sd/source/ui/func/fuconstr.cxx12
-rw-r--r--sd/source/ui/func/fuconuno.cxx5
-rw-r--r--sd/source/ui/func/fuinsert.cxx13
-rw-r--r--sd/source/ui/func/fuinsfil.cxx4
-rw-r--r--sd/source/ui/func/fumorph.cxx7
-rw-r--r--sd/source/ui/func/futext.cxx9
-rw-r--r--sd/source/ui/func/unoaprms.cxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx4
-rw-r--r--sd/source/ui/sidebar/DocumentHelper.cxx96
-rw-r--r--sd/source/ui/table/tablefunction.cxx12
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx14
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx5
-rw-r--r--sd/source/ui/unoidl/unopage.cxx248
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx10
-rw-r--r--sd/source/ui/view/drawview.cxx15
-rw-r--r--sd/source/ui/view/drviews2.cxx12
-rw-r--r--sd/source/ui/view/drviews8.cxx5
-rw-r--r--sd/source/ui/view/drviews9.cxx5
-rw-r--r--sd/source/ui/view/drviewse.cxx12
-rw-r--r--sd/source/ui/view/frmview.cxx2
-rw-r--r--sd/source/ui/view/sdview.cxx11
-rw-r--r--sd/source/ui/view/sdview3.cxx18
-rw-r--r--sd/source/ui/view/sdview4.cxx20
43 files changed, 577 insertions, 546 deletions
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx
index 6322d365b293..53e08b70c4af 100644
--- a/sd/inc/CustomAnimationEffect.hxx
+++ b/sd/inc/CustomAnimationEffect.hxx
@@ -25,17 +25,15 @@
#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 {
@@ -167,7 +165,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();
+ SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath(SdrModel& rTargetModel);
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 42af131102c0..5dedec0d3bb4 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -93,6 +93,7 @@ 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;
@@ -147,15 +148,14 @@ 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() const override;
- virtual SdrPage* Clone(SdrModel* pNewModel) const override;
+
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) 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,7 +163,6 @@ 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; }
@@ -388,6 +387,8 @@ 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 2d1025db6b61..1473358706fc 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()
+SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath(SdrModel& rTargetModel)
{
- SdrPathObj * pPathObj = new SdrPathObj( OBJ_PATHLINE );
+ SdrPathObj * pPathObj = new SdrPathObj(rTargetModel, OBJ_PATHLINE);
updateSdrPathObjFromPath( *pPathObj );
return pPathObj;
}
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index ce442b4f7402..38c6db785f46 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->GetModel() : nullptr; }
+ SdrModel* GetModel() { return (mpPage != nullptr) ? &mpPage->getSdrModelFromSdrPage() : 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->GetModel() ) );
+ m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( &mpPage->getSdrModelFromSdrPage() ) );
}
return Reference< XText >( m_TextRange.get() );
}
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index d6335e3671d3..500a88caa103 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -657,22 +657,7 @@ 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 9bc68bc98710..00a605697fa8 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -608,7 +608,6 @@ bool SdDrawDocument::InsertBookmarkAsPage(
// Assemble all link names
pPage->SetFileName(aBookmarkName);
pPage->SetBookmarkName(aName);
- pPage->SetModel(this);
}
nActualInsertPos += 2;
@@ -705,7 +704,6 @@ 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 93180e1b906b..6762dcdd9bfa 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->GetModel() );
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>( &pPage->getSdrModelFromSdrPage() );
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 ad906e23c556..eed4fa28256c 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -129,6 +129,9 @@ 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
@@ -267,7 +270,7 @@ void SdPage::EnsureMasterPageDefaultBackground()
*/
SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect )
{
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
SdrObject* pSdrObj = nullptr;
@@ -279,7 +282,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
{
case PRESOBJ_TITLE:
{
- pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TITLETEXT);
if (mbMaster)
{
@@ -290,7 +293,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_OUTLINE:
{
- pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_OUTLINETEXT);
if (mbMaster)
{
@@ -301,7 +304,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_NOTES:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
if (mbMaster)
{
@@ -312,7 +315,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_TEXT:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
}
break;
@@ -330,7 +333,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(aGraphic, aRect);
+ pSdrObj = new SdrGrafObj(getSdrModelFromSdrPage(), aGraphic, aRect);
aOutDev.Pop();
}
break;
@@ -338,7 +341,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_MEDIA:
case PRESOBJ_OBJECT:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
BitmapEx aBmpEx(BMP_PRESOBJ_OBJECT);
Graphic aGraphic( aBmpEx );
static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic);
@@ -347,7 +350,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_CHART:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarChart" );
BitmapEx aBmpEx(BMP_PRESOBJ_CHART);
Graphic aGraphic( aBmpEx );
@@ -357,7 +360,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_ORGCHART:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarOrg" );
BitmapEx aBmpEx(BMP_PRESOBJ_ORGCHART);
Graphic aGraphic( aBmpEx );
@@ -368,7 +371,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_TABLE:
case PRESOBJ_CALC:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarCalc" );
BitmapEx aBmpEx(BMP_PRESOBJ_TABLE);
Graphic aGraphic( aBmpEx );
@@ -381,7 +384,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(nullptr);
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), nullptr);
}
break;
@@ -396,13 +399,13 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
nDestPageNum -= 1;
}
- if (pModel && nDestPageNum < pModel->GetPageCount())
+ if (nDestPageNum < getSdrModelFromSdrPage().GetPageCount())
{
- pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), getSdrModelFromSdrPage().GetPage(nDestPageNum));
}
else
{
- pSdrObj = new SdrPageObj();
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage());
}
pSdrObj->SetResizeProtect(true);
@@ -414,7 +417,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_DATETIME:
case PRESOBJ_SLIDENUMBER:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
bEmptyPresObj = false;
bForceText = true;
}
@@ -437,7 +440,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if(bVertical)
static_cast<SdrTextObj*>(pSdrObj)->SetVerticalWriting(true);
- SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool());
if( bVertical )
aTempAttr.Put( makeSdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
else
@@ -479,7 +482,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*>( GetModel() )->GetInternalOutliner();
+ SdrOutliner* pOutliner = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetInternalOutliner();
OutlinerMode nOutlMode = pOutliner->GetMode();
pOutliner->Init( OutlinerMode::TextObject );
@@ -494,7 +497,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*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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 ) );
@@ -522,7 +525,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if (mbMaster)
{
- SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin(getSdrModelFromSdrPage().GetLayerAdmin());
// background objects of the master page
pSdrObj->SetLayer( rLayerAdmin.
@@ -543,7 +546,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*>(pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page));
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page));
DBG_ASSERT(pSheet, "StyleSheet for outline object not found");
if (pSheet)
pSdrObj->StartListening(*pSheet);
@@ -556,7 +559,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
eObjKind == PRESOBJ_CALC ||
eObjKind == PRESOBJ_GRAPHIC )
{
- SfxItemSet aSet( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aSet( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
aSet.Put( makeSdrTextContourFrameItem( true ) );
aSet.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
@@ -565,7 +568,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if( bUndo )
{
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
}
if( bUndo )
@@ -604,7 +607,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
aName += STR_LAYOUT_BACKGROUND;
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page);
return static_cast<SfxStyleSheet*>(pResult);
}
@@ -651,7 +654,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
break;
}
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page);
return static_cast<SfxStyleSheet*>(pResult);
}
@@ -696,7 +699,7 @@ SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
aStyleName += OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ));
}
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SfxStyleFamily::Page);
return dynamic_cast<SdStyleSheet*>(pResult);
}
@@ -718,7 +721,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
case SdrUserCallType::MoveOnly:
case SdrUserCallType::Resize:
{
- if (!pModel || pModel->isLocked())
+ if ( getSdrModelFromSdrPage().isLocked())
break;
SdrObject* pObj = const_cast<SdrObject*>(&rObj);
@@ -729,7 +732,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
{
if( pObj->GetUserCall() )
{
- ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager();
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
if( bUndo )
@@ -743,11 +746,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*>(pModel)->GetSdPageCount(mePageKind);
+ sal_uInt16 nPageCount = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPageCount(mePageKind);
for (sal_uInt16 i = 0; i < nPageCount; i++)
{
- SdPage* pLoopPage = static_cast<SdDrawDocument*>(pModel)->GetSdPage(i, mePageKind);
+ SdPage* pLoopPage = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPage(i, mePageKind);
if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
{
@@ -777,7 +780,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
{
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
SdPage* pMasterPage = this;
@@ -800,7 +803,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
pMasterPage->EnsureMasterPageDefaultBackground();
}
- if (GetModel() && static_cast<SdDrawDocument*>(GetModel())->GetDocumentType() == DocumentType::Impress)
+ if (static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocumentType() == DocumentType::Impress)
{
if( mePageKind == PageKind::Handout && bInit )
{
@@ -814,7 +817,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
if( bUndo )
{
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
}
else
{
@@ -823,7 +826,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
}
std::vector< ::tools::Rectangle > aAreas;
- CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
+ CalculateHandoutAreas( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()), pMasterPage->GetAutoLayout(), false, aAreas );
const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() );
@@ -897,7 +900,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.GetModel())->GetObjectVector();
+ const std::vector< Reference<XNode> >& objectInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetObjectVector();
for( std::vector< Reference<XNode> >::const_iterator aIter=objectInfo.begin(); aIter != objectInfo.end(); ++aIter )
{
if(bNoObjectFound)
@@ -1047,8 +1050,7 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
if( pObject )
{
- SdDrawDocument *pDoc = static_cast<SdDrawDocument*>(pModel);
-
+ SdDrawDocument* pDoc(static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()));
const bool bUndo = pDoc->IsUndoEnabled();
if( bUndo )
pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
@@ -1113,9 +1115,9 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
nDestPageNum -= 1;
}
- if(nDestPageNum < pModel->GetPageCount())
+ if(nDestPageNum < getSdrModelFromSdrPage().GetPageCount())
{
- pRefPage = pModel->GetPage(nDestPageNum);
+ pRefPage = getSdrModelFromSdrPage().GetPage(nDestPageNum);
}
if ( pRefPage )
@@ -1362,7 +1364,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.GetModel())->GetLayoutVector();
+ const std::vector< Reference<XNode> >& layoutInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetLayoutVector();
for( std::vector< Reference<XNode> >::const_iterator aIter=layoutInfo.begin(); aIter != layoutInfo.end(); ++aIter )
{
Reference<XNode> layoutNode = *aIter;
@@ -1521,10 +1523,10 @@ void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescripto
{
if( pOle2->IsEmpty() )
bFound = true;
- else if( rPage.GetModel() )
+ else
{
- SdrModel* pSdrModel = rPage.GetModel();
- ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pPersist(rPage.getSdrModelFromSdrPage().GetPersist());
+
if( pPersist )
{
uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
@@ -1598,7 +1600,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate )
const bool bSwitchLayout = eLayout != GetAutoLayout();
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
meAutoLayout = eLayout;
@@ -1647,7 +1649,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate )
if( pObj->IsEmptyPresObj() )
{
if( bUndo )
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
RemoveObject( pObj->GetOrdNum() );
@@ -1670,7 +1672,7 @@ void SdPage::NbcInsertObject(SdrObject* pObj, size_t nPos)
{
FmFormPage::NbcInsertObject(pObj, nPos);
- static_cast<SdDrawDocument*>(pModel)->InsertObject(pObj);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).InsertObject(pObj);
SdrLayerID nId = pObj->GetLayer();
if( mbMaster )
@@ -1733,8 +1735,7 @@ void SdPage::onRemoveObject( SdrObject* pObject )
{
RemovePresObj(pObject);
- if( pModel )
- static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).RemoveObject(pObject);
removeAnimations( pObject );
}
@@ -1956,7 +1957,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*>(pModel)->GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page));
+ SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page));
if (pOutlineSheet)
{
@@ -2077,12 +2078,11 @@ 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* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
- DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
- if( !pModel || !pSourceObj )
+ SdDrawDocument& rModel(static_cast< SdDrawDocument& >(rPage.getSdrModelFromSdrPage()));
+ if( !pSourceObj )
return pSourceObj;
- ::svl::IUndoManager* pUndoManager = pModel->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager = rModel.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 = pModel->GetInternalOutliner();
+ SdOutliner* pOutl = rModel.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*>( pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( rModel.GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
if (pSheet)
{
@@ -2125,7 +2125,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
}
// Remove LRSpace item
- SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
+ SfxItemSet aSet(rModel.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( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
+ pUndoManager->AddUndoAction( rModel.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 = pModel->GetInternalOutliner();
+ SdOutliner* pOutl = rModel.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(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
+ SfxItemSet aSet(rModel.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(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
+ pUndoManager->AddUndoAction(rModel.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*>(pModel)->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
- pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, true, true ) );
+ pUndoManager->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ pUndoManager->AddUndoAction( getSdrModelFromSdrPage().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*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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*>(pModel)->GetPool() );
+ SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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*>(pModel)->GetPool() );
+ SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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*>(GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
+ SfxItemPool* pPool(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDrawOutliner().GetEmptyItemSet().GetPool());
pOutl = new ::Outliner( pPool, OutlinerMode::OutlineObject );
pOutl->SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
pOutl->SetEditTextObjectPool(pPool);
- pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(GetModel()->GetStyleSheetPool()));
+ pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool()));
pOutl->EnableUndo(false);
pOutl->SetUpdateMode( false );
}
@@ -2549,7 +2549,7 @@ const OUString& SdPage::GetName() const
aCreatedPageName = SdResId(STR_PAGE);
aCreatedPageName += " ";
- if( GetModel()->GetPageNumType() == css::style::NumberingType::NUMBER_NONE )
+ if( getSdrModelFromSdrPage().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*>(GetModel())->CreatePageNumValue(nNum);
+ aCreatedPageName += static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).CreatePageNumValue(nNum);
}
}
else
@@ -2721,7 +2721,7 @@ void SdPage::SetName (const OUString& rName)
{
OUString aOldName( GetName() );
FmFormPage::SetName (rName);
- static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).UpdatePageRelativeURLs(aOldName, rName);
ActionChanged();
}
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 61fd29db97f7..3b6e42fd7b95 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 = pModel->GetMasterPageCount();
+ sal_uInt16 nMasterCount = getSdrModelFromSdrPage().GetMasterPageCount();
if( !bReverseOrder )
{
for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
{
- pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
+ pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().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*>(pModel->GetMasterPage(nMaster - 1));
+ pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().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 *>(pModel)->GetSdPage( 0, mePageKind );
+ pFoundMaster = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).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 = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
for (sal_Int16 i = -1; i < 9; i++)
{
@@ -261,7 +261,7 @@ void SdPage::EndListenOutlineText()
if (pOutlineTextObj)
{
- SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(pModel->GetStyleSheetPool());
+ SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool());
DBG_ASSERT(pSPool, "StyleSheetPool missing");
OUString aTrueLayoutName(maLayoutName);
sal_Int32 nIndex = aTrueLayoutName.indexOf( SD_LT_SEPARATOR );
@@ -282,22 +282,6 @@ void SdPage::EndListenOutlineText()
/*************************************************************************
|*
-|* Set new model
-|*
-\************************************************************************/
-
-void SdPage::SetModel(SdrModel* pNewModel)
-{
- DisconnectLink();
-
- // assign model
- FmFormPage::SetModel(pNewModel);
-
- ConnectLink();
-}
-
-/*************************************************************************
-|*
|* Is this page read-only?
|*
\************************************************************************/
@@ -315,17 +299,17 @@ bool SdPage::IsReadOnly() const
void SdPage::ConnectLink()
{
- sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
+ sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager());
if (pLinkManager && !mpPageLink && !maFileName.isEmpty() && !maBookmarkName.isEmpty() &&
mePageKind==PageKind::Standard && !IsMasterPage() &&
- static_cast<SdDrawDocument*>(pModel)->IsNewOrLoadCompleted())
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).IsNewOrLoadCompleted())
{
/**********************************************************************
* Connect
* Only standard pages are allowed to be linked
**********************************************************************/
- ::sd::DrawDocShell* pDocSh = static_cast<SdDrawDocument*>(pModel)->GetDocSh();
+ ::sd::DrawDocShell* pDocSh = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocSh();
if (!pDocSh || pDocSh->GetMedium()->GetOrigURL() != maFileName)
{
@@ -347,7 +331,7 @@ void SdPage::ConnectLink()
void SdPage::DisconnectLink()
{
- sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
+ sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager());
if (pLinkManager && mpPageLink)
{
@@ -360,57 +344,41 @@ void SdPage::DisconnectLink()
}
}
-/*************************************************************************
-|*
-|* Copy-Ctor
-|*
-\************************************************************************/
-
-SdPage::SdPage(const SdPage& rSrcPage)
-: FmFormPage(rSrcPage)
-, SdrObjUserCall()
-, mpItems(nullptr)
-, mnPageId(mnLastPageId++)
+void SdPage::lateInit(const SdPage& rSrcPage)
{
- mePageKind = rSrcPage.mePageKind;
- meAutoLayout = rSrcPage.meAutoLayout;
+ // call parent
+ FmFormPage::lateInit(rSrcPage);
- mbSelected = false;
- mnTransitionType = rSrcPage.mnTransitionType;
+ // copy local variables (former stuff from copy constructor)
+ mePageKind = rSrcPage.mePageKind;
+ meAutoLayout = rSrcPage.meAutoLayout;
+ 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;
-}
-
-void SdPage::lateInit(const SdPage& rSrcPage)
-{
- FmFormPage::lateInit(rSrcPage);
+ meCharSet = rSrcPage.meCharSet;
+ mnPaperBin = rSrcPage.mnPaperBin;
+ mpPageLink = nullptr; // is set when inserting via ConnectLink()
+ mbIsPrecious = false;
// 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));
@@ -418,31 +386,13 @@ void SdPage::lateInit(const SdPage& rSrcPage)
// header footer
setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
-}
-
-/*************************************************************************
-|*
-|* Clone
-|*
-\************************************************************************/
-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 );
+ // animations
+ rSrcPage.cloneAnimations(*this);
// fix user calls for duplicated slide
- SdrObjListIter aSourceIter( *this, SdrIterMode::DeepWithGroups );
- SdrObjListIter aTargetIter( *pNewPage, SdrIterMode::DeepWithGroups );
+ SdrObjListIter aSourceIter( rSrcPage, SdrIterMode::DeepWithGroups );
+ SdrObjListIter aTargetIter( *this, SdrIterMode::DeepWithGroups );
while( aSourceIter.IsMore() && aTargetIter.IsMore() )
{
@@ -450,10 +400,25 @@ SdrPage* SdPage::Clone(SdrModel* pNewModel) const
SdrObject* pTarget = aTargetIter.Next();
if( pSource->GetUserCall() )
- pTarget->SetUserCall( pNewPage );
+ pTarget->SetUserCall(this);
}
+}
- return 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;
}
/*************************************************************************
@@ -476,7 +441,7 @@ SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
SfxItemSet* SdPage::getOrCreateItems()
{
if( mpItems == nullptr )
- mpItems = o3tl::make_unique<SfxItemSet>( pModel->GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} );
+ mpItems = o3tl::make_unique<SfxItemSet>( getSdrModelFromSdrPage().GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} );
return mpItems.get();
}
@@ -604,40 +569,37 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn
maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
}
- if( pModel && pModel->IsUndoEnabled() )
+ if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
if( pAction )
- pModel->AddUndo( pAction );
+ getSdrModelFromSdrPage().AddUndo( pAction );
}
SetChanged();
-
- if( pModel )
- {
- pModel->SetChanged();
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
- }
+ getSdrModelFromSdrPage().SetChanged();
+ // TTTT NotifyDocumentEvent should be reference
+ NotifyDocumentEvent(
+ static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()),
+ "OnAnnotationInserted",
+ Reference<XInterface>(xAnnotation, UNO_QUERY));
}
void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
{
- if( pModel && pModel->IsUndoEnabled() )
+ if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
if( pAction )
- pModel->AddUndo( pAction );
+ getSdrModelFromSdrPage().AddUndo( pAction );
}
AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
if( iter != maAnnotations.end() )
maAnnotations.erase( iter );
- if( pModel )
- {
- pModel->SetChanged();
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
- }
+ getSdrModelFromSdrPage().SetChanged();
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( &getSdrModelFromSdrPage() ), "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 6b3a4e80876e..d8db1329af56 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -58,7 +58,10 @@ 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( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
+ mpUndoAnimation.reset(
+ new UndoAnimation( // TTTT may use ref? Or just *SdrPage?
+ static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()),
+ pPage));
}
}
}
@@ -180,7 +183,10 @@ 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->GetModel() ), pPage ) );
+ mpUndoAnimation.reset(
+ new UndoAnimation(
+ static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()),
+ pPage));
}
}
}
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index 522f2bab8fc4..985d625b04d2 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -163,62 +163,66 @@ 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();
+ // 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 )
- {
- aGrfSize.setWidth( aPagSize.Width() );
- aGrfSize.setHeight( static_cast<long>( aPagSize.Width() / fGrfWH ) );
- }
+ // 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 ) );
+ }
+ }
- // set output rectangle for graphic
- aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() );
- aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() );
+ // 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(
+ pPage->getSdrModelFromSdrPage(),
+ aGraphic,
+ ::tools::Rectangle(aPos, aGrfSize)));
+ bRet = true;
+ }
- 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 d93fa3dd8280..056b2924a6ba 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2688,8 +2688,9 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
aMediaURL = ReadSound( nRef );
if ( !aMediaURL.isEmpty() )
{
- SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
- pMediaObj->SetModel( pObj->GetModel() );
+ SdrMediaObj* pMediaObj = new SdrMediaObj(
+ pObj->getSdrModelFromSdrObject(),
+ pObj->GetSnapRect());
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 373f25149d87..c54d991ba42a 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();
+ mpPathObj = mpEffect->createSdrPathObjFromPath(rView.getSdrModelFromSdrView());
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 e9d185c58758..37a862294b29 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->GetModel() );
+ pDoc = dynamic_cast< SdDrawDocument* >( &pTextObj->getSdrModelFromSdrObject() );
if( pDoc )
pDocShell = pDoc->GetDocSh();
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index a9b324d1fd24..5ca6bab37ebd 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -777,12 +777,8 @@ 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->GetModel(), pSnapShot).GetBitmapEx() );
-
+ SdrObject* pSnapShot(pObjList->GetObj(nObject));
+ BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pSnapShot).GetBitmapEx());
::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() );
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
@@ -830,14 +826,9 @@ 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->GetModel(), pObject).GetBitmapEx() );
-
+ SdrObject* pObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj());
+ BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pObject).GetBitmapEx());
::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() );
-
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
m_FrameList.begin() + nIndex,
@@ -852,7 +843,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
}
else
{
- SdrObjGroup* pCloneGroup = new SdrObjGroup;
+ SdrObjGroup* pCloneGroup = new SdrObjGroup(rView.getSdrModelFromSdrView());
SdrObjList* pObjList = pCloneGroup->GetSubList();
for (size_t nObject= 0; nObject < nMarkCount; ++nObject)
@@ -1000,7 +991,9 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
aAnimation.SetLoopCount( nLoopCount );
}
- SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) );
+ SdrGrafObj* pGrafObj = new SdrGrafObj(
+ rView.getSdrModelFromSdrView(),
+ Graphic(aAnimation));
const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) );
pGrafObj->SetLogicRect( ::tools::Rectangle( aOrg, aMaxSizeLog ) );
@@ -1073,7 +1066,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
if(pTargetSdPage)
{
// create animation group
- SdrObjGroup* pGroup = new SdrObjGroup;
+ SdrObjGroup* pGroup = new SdrObjGroup(rView.getSdrModelFromSdrView());
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 5fe097765688..f74db13144eb 100644
--- a/sd/source/ui/func/fucon3d.cxx
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -89,6 +89,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
case SID_3D_CUBE:
{
p3DObj = new E3dCubeObj(
+ mpView->getSdrModelFromSdrView(),
mpView->Get3DDefaultAttributes(),
::basegfx::B3DPoint(-2500, -2500, -2500),
::basegfx::B3DVector(5000, 5000, 5000));
@@ -98,6 +99,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
case SID_3D_SPHERE:
{
p3DObj = new E3dSphereObj(
+ mpView->getSdrModelFromSdrView(),
mpView->Get3DDefaultAttributes(),
::basegfx::B3DPoint(0, 0, 0),
::basegfx::B3DVector(5000, 5000, 5000));
@@ -114,7 +116,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
/* this is an open object, therefore it has to be handled double-
sided by default */
@@ -141,7 +146,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
break;
}
@@ -152,7 +160,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
break;
}
@@ -178,7 +189,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
break;
}
@@ -202,7 +216,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
break;
}
@@ -226,7 +243,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
p3DObj->SetMergedItem(makeSvx3DHorizontalSegmentsItem(4));
break;
}
@@ -373,7 +393,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;
+ E3dScene* pScene = new E3dScene(*mpDoc);
// copied code from E3dView::InitScene
double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0));
@@ -387,13 +407,9 @@ 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 7d6aca665a37..6967a1495017 100644
--- a/sd/source/ui/func/fuconarc.cxx
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -91,10 +91,12 @@ void FuConstructArc::DoExecute( SfxRequest& rReq )
Activate(); // sets aObjKind
SdrCircObj* pNewCircle =
- new SdrCircObj(static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()),
- aNewRectangle,
- static_cast<long>(pPhiStart->GetValue () * 10.0),
- static_cast<long>(pPhiEnd->GetValue () * 10.0));
+ new SdrCircObj(
+ mpView->getSdrModelFromSdrView(),
+ 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);
@@ -202,8 +204,9 @@ SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const ::too
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index e7cc868d495b..cad7080afd6b 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -309,8 +309,9 @@ SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, c
// case SID_DRAW_BEZIER_NOFILL: // BASIC
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
index 6396eeb46e82..97a60a302c11 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->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
@@ -236,8 +236,9 @@ const OUString& FuConstructCustomShape::GetShapeType() const
SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const ::tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if( pObj )
{
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index 1377429ed056..d78fd866755d 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -109,7 +109,10 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
pCenterY->GetValue () - pAxisY->GetValue () / 2,
pCenterX->GetValue () + pAxisX->GetValue () / 2,
pCenterY->GetValue () + pAxisY->GetValue () / 2);
- SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle);
+ SdrCircObj *pNewCircle = new SdrCircObj(
+ mpView->getSdrModelFromSdrView(),
+ OBJ_CIRC,
+ aNewRectangle);
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR);
@@ -127,7 +130,9 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
pMouseStartY->GetValue (),
pMouseEndX->GetValue (),
pMouseEndY->GetValue ());
- SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle);
+ SdrRectObj *pNewRect = new SdrRectObj(
+ mpView->getSdrModelFromSdrView(),
+ aNewRectangle);
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewRect, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR);
@@ -477,9 +482,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->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Para));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para)));
DBG_ASSERT(pSheet, "StyleSheet missing");
if (pSheet)
@@ -496,10 +501,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, SdrModel const * pDoc)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aRetval;
- XLineEndListRef pLineEndList = pDoc->GetLineEndList();
+ XLineEndListRef pLineEndList(rModel.GetLineEndList());
if( pLineEndList.is() )
{
@@ -536,9 +541,10 @@ 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, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) );
if( !aArrow.count() )
{
::basegfx::B2DPolygon aNewArrow;
@@ -550,7 +556,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj
}
// Circles
- ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) );
if( !aCircle.count() )
{
::basegfx::B2DPolygon aNewCircle;
@@ -560,7 +566,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj
}
// Square
- ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) );
if( !aSquare.count() )
{
::basegfx::B2DPolygon aNewSquare;
@@ -764,8 +770,9 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const
// case SID_CONNECTOR_LINES_CIRCLES:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index 8f376fb3d72a..9e15f47a070a 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->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Page));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().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->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Para));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().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 935cb0c50157..8ff99fdb7e00 100644
--- a/sd/source/ui/func/fuconuno.cxx
+++ b/sd/source/ui/func/fuconuno.cxx
@@ -138,8 +138,9 @@ SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const ::
// case SID_FM_CREATE_CONTROL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 0cdd22da3807..ad22e00dc71b 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -386,7 +386,11 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
aRect = ::tools::Rectangle(aPos, aSize);
}
- SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect );
+ SdrOle2Obj* pOleObj = new SdrOle2Obj(
+ mpView->getSdrModelFromSdrView(),
+ 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
@@ -613,8 +617,11 @@ 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( aObjRef, aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ mpView->getSdrModelFromSdrView(),
+ 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 fae84526e97f..5ad65b627063 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -506,7 +506,9 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
}
else
{
- SdrRectObj* pTO = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pTO = new SdrRectObj(
+ mpView->getSdrModelFromSdrView(),
+ 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 b78c018747ed..03aa0b0ad656 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;
+ SdrObjGroup* pObjGroup = new SdrObjGroup(mpView->getSdrModelFromSdrView());
SdrObjList* pObjList = pObjGroup->GetSubList();
const size_t nCount = rPolyPolyList3D.size();
const double fStep = 1. / ( nCount + 1 );
@@ -397,7 +397,10 @@ void FuMorph::ImpInsertPolygons(
for ( size_t i = 0; i < nCount; i++, fFactor += fStep )
{
const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *rPolyPolyList3D[ i ];
- SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D);
+ SdrPathObj* pNewObj = new SdrPathObj(
+ mpView->getSdrModelFromSdrView(),
+ OBJ_POLY,
+ rPolyPoly3D);
// line color
if ( bLineColor )
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 300e17c09cc5..b6d81901f870 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->GetModel()->GetDrawOutliner(GetTextObj());
+ SdrOutliner& rOutl(mxTextObj->getSdrModelFromSdrObject().GetDrawOutliner(GetTextObj()));
bool bVertical((pOPO && pOPO->IsVertical())
|| nSlotId == SID_ATTR_CHAR_VERTICAL
|| nSlotId == SID_TEXT_FITTOSIZE_VERTICAL);
@@ -1304,10 +1304,11 @@ void FuText::DoubleClick(const MouseEvent& )
*/
SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle)
{
-
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier(),
+ nullptr);
if(pObj)
{
diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx
index 021dc5ba7a02..ab46b90ac8ee 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 = static_cast<SdDrawDocument*>(pObject->GetModel());
+ SdDrawDocument* pDoc(dynamic_cast< SdDrawDocument* >(&pObject->getSdrModelFromSdrObject()));
if( pDoc )
{
SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo( pObject );
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 67770cc27313..381b22be955f 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -128,6 +128,10 @@ 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 dc76d90a4777..b9336124f9e1 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -53,14 +53,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
break;
// Check the presence of the source document.
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
- pMasterPage->GetModel());
- if (pSourceDocument == nullptr)
- break;
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
// When the given master page already belongs to the target document
// then there is nothing more to do.
- if (pSourceDocument == &rTargetDocument)
+ if (&rSourceDocument == &rTargetDocument)
{
pNewMasterPage = pMasterPage;
break;
@@ -70,7 +67,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 = pSourceDocument->GetMasterPageCount();
+ sal_uInt16 nSourceMasterPageCount = rSourceDocument.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
@@ -81,11 +78,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
break;
// Get the slide master page.
if (pMasterPage != static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex)))
+ rSourceDocument.GetMasterPage(nIndex)))
break;
// Get the notes master page.
SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex+1));
+ rSourceDocument.GetMasterPage(nIndex+1));
if (pNotesMasterPage == nullptr)
break;
@@ -161,7 +158,7 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage)
SdDrawDocument* pDocument = nullptr;
if (pMasterPage != nullptr)
- pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ pDocument = dynamic_cast< SdDrawDocument* >(&pMasterPage->getSdrModelFromSdrPage());
// Iterate over all pages and check if it references the given master
// page.
@@ -215,10 +212,8 @@ SdPage* DocumentHelper::AddMasterPage (
pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
// Copy the necessary styles.
- SdDrawDocument* pSourceDocument
- = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument != nullptr)
- ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
+ ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage);
// Copy the precious flag.
pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
@@ -310,7 +305,7 @@ void DocumentHelper::AssignMasterPageToPageList (
::std::vector<SdPage*> aCleanedList;
for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
{
- OSL_ASSERT(*iPage!=nullptr && (*iPage)->GetModel() == &rTargetDocument);
+ OSL_ASSERT(*iPage!=nullptr && &(*iPage)->getSdrModelFromSdrPage() == &rTargetDocument);
if (*iPage != nullptr && (*iPage)->GetLayoutName() != sFullLayoutName)
{
aCleanedList.push_back(*iPage);
@@ -358,28 +353,24 @@ SdPage* DocumentHelper::AddMasterPage (
pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
// Copy the necessary styles.
- 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);
- }
+ 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);
}
return pClonedMasterPage;
@@ -406,25 +397,24 @@ void DocumentHelper::AssignMasterPageToPage (
// Leave early when the parameters are invalid.
if (pPage == nullptr || pMasterPage == nullptr)
return;
- SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
- if (pDocument == nullptr)
- return;
+
+ SdDrawDocument& rDocument(dynamic_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
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.
- pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
+ rDocument.GetDocSh()->GetUndoManager()->AddUndoAction(
new SdBackgroundObjUndoAction(
- *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
+ rDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
true);
pPage->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
- pDocument->SetMasterPage (
+ rDocument.SetMasterPage (
(pPage->GetPageNum()-1)/2,
rsBaseLayoutName,
- pDocument,
+ &rDocument,
false,
false);
}
@@ -432,10 +422,10 @@ void DocumentHelper::AssignMasterPageToPage (
{
// Find first slide that uses the master page.
SdPage* pSlide = nullptr;
- sal_uInt16 nPageCount = pDocument->GetSdPageCount(PageKind::Standard);
+ sal_uInt16 nPageCount = rDocument.GetSdPageCount(PageKind::Standard);
for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==nullptr; nPage++)
{
- SdrPage* pCandidate = pDocument->GetSdPage(nPage,PageKind::Standard);
+ SdrPage* pCandidate = rDocument.GetSdPage(nPage,PageKind::Standard);
if (pCandidate != nullptr
&& pCandidate->TRG_HasMasterPage()
&& &(pCandidate->TRG_GetMasterPage()) == pPage)
@@ -448,10 +438,10 @@ void DocumentHelper::AssignMasterPageToPage (
{
// 2. Assign the given master pages to the first slide that was
// found above that uses the master page.
- pDocument->SetMasterPage (
+ rDocument.SetMasterPage (
(pSlide->GetPageNum()-1)/2,
rsBaseLayoutName,
- pDocument,
+ &rDocument,
false,
false);
}
@@ -459,7 +449,7 @@ void DocumentHelper::AssignMasterPageToPage (
{
// 3. Replace the master page A by a copy of the given master
// page B.
- pDocument->RemoveUnnecessaryMasterPages (
+ rDocument.RemoveUnnecessaryMasterPages (
pPage);
}
}
@@ -479,11 +469,9 @@ SdPage* DocumentHelper::ProvideMasterPage (
OSL_ASSERT(pMasterPage != nullptr);
return nullptr;
}
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument == nullptr)
- return nullptr;
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
+ rSourceDocument.GetMasterPage(pMasterPage->GetPageNum()+1));
if (pNotesMasterPage == nullptr)
{
// The model is not in a valid state. Maybe a new master page
@@ -521,7 +509,7 @@ SdPage* DocumentHelper::ProvideMasterPage (
}
// Clone the master page.
- if (pMasterPage->GetModel() != &rTargetDocument)
+ if (&pMasterPage->getSdrModelFromSdrPage() != &rTargetDocument)
{
pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
if( rTargetDocument.IsUndoEnabled() )
@@ -532,7 +520,7 @@ SdPage* DocumentHelper::ProvideMasterPage (
pMasterPageInDocument = pMasterPage;
// Clone the notes master.
- if (pNotesMasterPage->GetModel() != &rTargetDocument)
+ if (&pNotesMasterPage->getSdrModelFromSdrPage() != &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 dd3e6a4f0dd3..e85d27a810fb 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -183,7 +183,11 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
aRect = ::tools::Rectangle(aPos, aSize);
}
- sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows );
+ sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj(
+ *GetDoc(), // TTTT should be reference
+ aRect,
+ nColumns,
+ nRows);
pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), true );
apply_table_style( pObj, GetDoc(), sTableStyle );
SdrPageView* pPV = mpView->GetSdrPageView();
@@ -271,7 +275,11 @@ 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 158b1603f00e..23717ea3d16b 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -202,15 +202,9 @@ bool PreviewRenderer::Initialize (
if (pPage == nullptr)
return false;
- SdrModel* pModel = pPage->GetModel();
- if (pModel == nullptr)
- return false;
-
SetupOutputSize(*pPage, rPixelSize);
-
- SdDrawDocument* pDocument
- = static_cast<SdDrawDocument*>(pPage->GetModel());
- DrawDocShell* pDocShell = pDocument->GetDocSh();
+ SdDrawDocument& rDocument(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ DrawDocShell* pDocShell = rDocument.GetDocSh();
// Create view
ProvideView (pDocShell);
@@ -260,9 +254,9 @@ bool PreviewRenderer::Initialize (
}
pPageView->SetApplicationDocumentColor(aApplicationDocumentColor);
- SdrOutliner& rOutliner(pDocument->GetDrawOutliner());
+ SdrOutliner& rOutliner(rDocument.GetDrawOutliner());
rOutliner.SetBackgroundColor(aApplicationDocumentColor);
- rOutliner.SetDefaultLanguage(pDocument->GetLanguage(EE_CHAR_LANGUAGE));
+ rOutliner.SetDefaultLanguage(rDocument.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 afe7ede9bde5..b6ee7d5d1122 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2714,6 +2714,11 @@ 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 619d84254a7d..7a34f2a80277 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -406,23 +406,20 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap
SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape );
if( pObj && ( (pObj->GetObjInventor() != SdrInventor::Default) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if( pDoc )
+ 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)
{
- // #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);
- }
+ pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true);
+ }
+ else
+ {
+ pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
}
}
return pObj;
@@ -518,9 +515,8 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap
pPresObj = SvxFmDrawPage::CreateSdrObject_( xShape );
if( pPresObj )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if( pDoc )
- pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), true );
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ pPresObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
GetPage()->InsertPresObj( pPresObj, eObjKind );
}
}
@@ -685,21 +681,21 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
if( eOri != GetPage()->GetOrientation() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
}
@@ -781,10 +777,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
@@ -801,10 +797,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
@@ -1100,39 +1096,36 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_PREVIEW :
case WID_PAGE_PREVIEWMETAFILE :
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if ( pDoc )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
+ if ( pDocShell )
{
- ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
- if ( pDocShell )
+ 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 )
{
- 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;
- }
+ 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;
}
}
}
@@ -1140,29 +1133,26 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_PREVIEWBITMAP :
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if ( pDoc )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
+ if ( pDocShell )
{
- ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
- if ( pDocShell )
+ 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 )
{
- 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;
- }
+ rDoc.SetSelected( rDoc.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;
}
}
}
@@ -1206,10 +1196,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)));
}
@@ -1225,10 +1215,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)));
}
@@ -1684,21 +1674,21 @@ void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLeftBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetLeftBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetLeftBorder( nValue );
}
}
@@ -1708,21 +1698,21 @@ void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetRightBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetRightBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetRightBorder( nValue );
}
}
@@ -1732,21 +1722,21 @@ void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetUpperBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetUpperBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetUpperBorder( nValue );
}
}
@@ -1756,21 +1746,21 @@ void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLowerBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetLowerBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetLowerBorder( nValue );
}
}
@@ -1811,25 +1801,25 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
{
aSize.setWidth( nWidth );
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- refreshpage( pDoc, ePageKind );
+ refreshpage( &rDoc, ePageKind );
}
}
@@ -1840,25 +1830,25 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
{
aSize.setHeight( nHeight );
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- refreshpage( pDoc, ePageKind );
+ refreshpage( &rDoc, ePageKind );
}
}
@@ -2389,7 +2379,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->GetModel()->GetMasterPage(nNum));
+ pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum));
pNotesPage->SetLayoutName( pSdPage->GetLayoutName() );
GetModel()->SetModified();
@@ -2486,7 +2476,7 @@ void SdDrawPage::setBackground( const Any& rValue )
if( pBack )
{
- pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
else
{
@@ -2510,7 +2500,7 @@ void SdDrawPage::setBackground( const Any& rValue )
pProp++;
}
- pBackground->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
if( aSet.Count() == 0 )
@@ -2872,7 +2862,7 @@ void SdMasterPage::setBackground( const Any& rValue )
if( pBack )
{
- pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
else
{
@@ -2895,11 +2885,11 @@ void SdMasterPage::setBackground( const Any& rValue )
pProp++;
}
- pBackground->fillItemSet( static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()), aSet );
+ pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet );
}
// if we find the background style, copy the set to the background
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
if(pSSPool)
{
@@ -2943,7 +2933,7 @@ void SdMasterPage::getBackground( Any& rValue )
}
else
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
if(pSSPool)
{
@@ -3092,9 +3082,9 @@ Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
{
Reference< uno::XInterface > xPage;
- if( pPage && pPage->GetModel() )
+ if( pPage )
{
- SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->getSdrModelFromSdrPage().getUnoModel() );
if( pModel )
{
if( pPage->IsMasterPage() )
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index c89213c5880d..432146681d78 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1526,7 +1526,10 @@ private:
std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() );
while( iter != aAreas.end() )
{
- pHandout->NbcInsertObject( new SdrPageObj((*iter++)) );
+ pHandout->NbcInsertObject(
+ new SdrPageObj(
+ rModel,
+ (*iter++)));
if( bDrawLines && (iter != aAreas.end()) )
{
@@ -1546,7 +1549,10 @@ private:
aPathPoly.append( aPoly );
}
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly );
+ SdrPathObj* pPathObj = new SdrPathObj(
+ rModel,
+ 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 56a07fdb6486..95a4807e43c3 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -78,12 +78,15 @@ 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 f61052b4cb68..bbfd4e0d3d23 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -520,7 +520,9 @@ public:
if (!pMasterPage)
continue;
- SdrRectObj* pObject = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pObject = new SdrRectObj(
+ *m_rDrawViewShell.GetDoc(), // TTTT should be reference
+ OBJ_TEXT);
pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
pObject->SetOutlinerParaObject(pOutliner->CreateParaObject());
pMasterPage->InsertObject(pObject);
@@ -1085,7 +1087,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
// create new object
- SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
+ SdrGrafObj* pGraphicObj = new SdrGrafObj(
+ *GetDoc(),
+ aGraphic);
// get some necessary info and ensure it
const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
@@ -2339,7 +2343,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
pOutl->QuickInsertField( *pFieldItem, ESelection() );
OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
- SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT );
+ SdrRectObj* pRectObj = new SdrRectObj(
+ *GetDoc(),
+ 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 1181d6c7d820..e396b8ec6ea8 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -120,7 +120,10 @@ void DrawViewShell::ScannerEvent()
if( bInsertNewObject )
{
- auto pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect );
+ auto pGrafObj = new SdrGrafObj(
+ GetView()->getSdrModelFromSdrView(),
+ 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 4c2e6b1c3203..afc151b29a96 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -169,7 +169,10 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
if( bInsertNewObject )
{
- pGrafObj = new SdrGrafObj(aGraphic, aRect);
+ pGrafObj = new SdrGrafObj(
+ GetView()->getSdrModelFromSdrView(),
+ 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 0b082d9e18a9..8b69d3616037 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1458,7 +1458,9 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
pOutl->QuickInsertField( aURLItem, ESelection() );
OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
- SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pRectObj = new SdrRectObj(
+ GetView()->getSdrModelFromSdrView(),
+ OBJ_TEXT);
pOutl->UpdateFields();
pOutl->SetUpdateMode( true );
@@ -1534,8 +1536,12 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
if (bNewObj) try
{
- SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON,
- mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
+ SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject(
+ GetView()->getSdrModelFromSdrView(),
+ SdrInventor::FmForm,
+ OBJ_FM_BUTTON,
+ mpDrawView->GetSdrPageView()->GetPage()));
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 3795f9e09b4f..b08896abf358 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),
+: SdrView(*pDrawDoc, nullptr), // TTTT SdDrawDocument* -> should be reference
mnRefCount(0),
mnPresViewShellId(SID_VIEWSHELL0),
mbIsNavigatorShowingAllShapes(false)
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d0344d2ab4e5..7bff93080e61 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -104,10 +104,11 @@ 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),
@@ -658,7 +659,7 @@ bool View::SdrBeginTextEdit(
EventMultiplexerEventId::BeginTextEdit, static_cast<void*>(pObj) );
if( pOutl==nullptr && pObj )
- pOutl = SdrMakeOutliner(OutlinerMode::TextObject, *pObj->GetModel());
+ pOutl = SdrMakeOutliner(OutlinerMode::TextObject, pObj->getSdrModelFromSdrObject());
// make draw&impress specific initialisations
if( pOutl )
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c0f5f5e19413..cf6f72870045 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -797,7 +797,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
aNewSet.Put( pObj->GetMergedItemSet() );
if( bUndo )
- AddUndo( new E3dAttributesUndoAction( mrDoc, static_cast<E3dObject*>(pPickObj), aNewSet, aOldSet ) );
+ AddUndo(
+ new E3dAttributesUndoAction(
+ *static_cast< E3dObject* >(pPickObj),
+ aNewSet,
+ aOldSet));
pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
}
@@ -995,7 +999,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
::tools::Rectangle aRect( maDropPos, aSize );
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = GetSdrPageView();
SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
@@ -1165,7 +1173,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
::tools::Rectangle aRect( maDropPos, aSize );
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ 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 f98a8ab1b216..fb17fcc2df24 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -116,7 +116,10 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
}
else
{
- pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
+ pNewGrafObj = new SdrGrafObj(
+ getSdrModelFromSdrView(),
+ rGraphic,
+ pPickObj->GetLogicRect());
pNewGrafObj->SetEmptyPresObj(true);
}
@@ -189,7 +192,10 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
MapMode( MapUnit::Map100thMM ) );
}
- pNewGrafObj = new SdrGrafObj( rGraphic, ::tools::Rectangle( rPos, aSize ) );
+ pNewGrafObj = new SdrGrafObj(
+ getSdrModelFromSdrView(),
+ rGraphic,
+ ::tools::Rectangle(rPos, aSize));
SdrPage* pPage = pPV->GetPage();
Size aPageSize( pPage->GetSize() );
aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) );
@@ -329,7 +335,9 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj
}
- pNewMediaObj = new SdrMediaObj( aRect );
+ pNewMediaObj = new SdrMediaObj(
+ getSdrModelFromSdrView(),
+ aRect);
bool bIsPres = false;
if( pPickObj )
@@ -529,7 +537,11 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void)
aRect = ::tools::Rectangle( maDropPos, aSize );
- SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
+ SdrOle2Obj* pOleObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ svt::EmbeddedObjectRef(xObj, nAspect),
+ aName,
+ aRect);
SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
if (mpViewSh != nullptr)