summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-25 12:59:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-27 17:19:26 +0100
commitc95d91ee35ca09379a8a1d415ae77716ddeadaac (patch)
tree370b0ad6832f3aca2ee0e2ef375bb6f953e5d360 /sd/source/ui
parent2d8f17565ebe867210f5769851d91b2e7b612a8f (diff)
improve subtyping when dealing with tools::WeakReference
tweak the templating to make it easier to declare a WeakReference that points to a subclass for a weak-capable class. Which lets us declare some fields with more specific types, and dump a lot of unnecessary casting. And make WeakBase be inherited from virtually, so we don't end up with weird states where two weak refernces could point to two different parts of the same object. Change-Id: I3213ea27e087038457b0761b5171c7bce96e71f3 Reviewed-on: https://gerrit.libreoffice.org/48650 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/func/futext.cxx4
-rw-r--r--sd/source/ui/inc/DrawController.hxx2
-rw-r--r--sd/source/ui/inc/futext.hxx4
-rw-r--r--sd/source/ui/view/drawview.cxx2
-rw-r--r--sd/source/ui/view/sdview.cxx8
5 files changed, 10 insertions, 10 deletions
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index b2ca0d1111b1..19c0ce638516 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -1132,7 +1132,7 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag)
}
else
{
- mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() ));
+ mpView->RestoreDefaultText( mxTextObj.get() );
}
}
}
@@ -1244,7 +1244,7 @@ void FuText::ReceiveRequest(SfxRequest& rReq)
{
// are we currently editing?
if(!bTestText)
- mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) );
+ mxTextObj.reset( mpView->GetTextEditObject() );
if (!mxTextObj.is())
{
diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx
index 7eb8d2c0fe79..d6ecc0d837f9 100644
--- a/sd/source/ui/inc/DrawController.hxx
+++ b/sd/source/ui/inc/DrawController.hxx
@@ -288,7 +288,7 @@ private:
ViewShellBase* mpBase;
::tools::Rectangle maLastVisArea;
- ::tools::WeakReference<SdrPage> mpCurrentPage;
+ ::tools::WeakReference<SdPage> mpCurrentPage;
bool mbMasterPageMode;
bool mbLayerMode;
diff --git a/sd/source/ui/inc/futext.hxx b/sd/source/ui/inc/futext.hxx
index 42c02b22d153..5b55c28eb491 100644
--- a/sd/source/ui/inc/futext.hxx
+++ b/sd/source/ui/inc/futext.hxx
@@ -54,7 +54,7 @@ public:
void SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag);
void DeleteDefaultText();
- SdrTextObj* GetTextObj() { return static_cast< SdrTextObj* >( mxTextObj.get() ); }
+ SdrTextObj* GetTextObj() { return mxTextObj.get(); }
virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override;
@@ -81,7 +81,7 @@ protected:
private:
virtual void disposing() override;
- ::tools::WeakReference<SdrObject>
+ ::tools::WeakReference<SdrTextObj>
mxTextObj;
bool bFirstObjCreated;
bool bJustEndedEdit;
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index d635b1bdf804..7620a2cec268 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -137,7 +137,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
{
SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
SdPage& rPage = *mpDrawViewShell->getCurrentPage();
- SdrTextObj* pEditObject = static_cast< SdrTextObj* >( GetTextEditObject() );
+ SdrTextObj* pEditObject = GetTextEditObject();
if (pEditObject)
{
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 92d7358b088d..be1417f82940 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -761,9 +761,9 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
{
maMasterViewFilter.End();
- ::tools::WeakReference<SdrObject> xObj( GetTextEditObject() );
+ ::tools::WeakReference<SdrTextObj> xObj( GetTextEditObject() );
- bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );
+ bool bDefaultTextRestored = RestoreDefaultText( xObj.get() );
SdrEndTextEditKind eKind = FmFormView::SdrEndTextEdit(bDontDeleteReally);
@@ -780,7 +780,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
}
else if( xObj.is() && xObj->IsEmptyPresObj() )
{
- SdrTextObj* pObj = dynamic_cast< SdrTextObj* >( xObj.get() );
+ SdrTextObj* pObj = xObj.get();
if( pObj && pObj->HasText() )
{
SdrPage* pPage = pObj->GetPage();
@@ -1194,7 +1194,7 @@ void View::OnBeginPasteOrDrop( PasteOrDropInfos* /*pInfo*/ )
void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfo )
{
/* Style Sheet handling */
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() );
+ SdrTextObj* pTextObj = GetTextEditObject();
SdrOutliner* pOutliner = GetTextEditOutliner();
if( !pOutliner || !pTextObj || !pTextObj->GetPage() )
return;