diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-12 13:59:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-12 14:12:03 +0100 |
commit | b9daf7cacdcabff937d06f0f45c3daf2380bd888 (patch) | |
tree | b108dafcb002ddc7f033ff46dcf08fbebe88bd6a /sd | |
parent | 7b832d545acb91cc343d26e8bf26e6a844040183 (diff) |
coverity#735840 Unchecked dynamic_cast
Change-Id: I3c772ec30360103f569b34e7c83f65b469eb5be8
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/drawdoc.hxx | 7 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 5 |
3 files changed, 13 insertions, 6 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 6310fe3c4a42..f27df329d66f 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -212,9 +212,12 @@ public: SdDrawDocument(DocumentType eType, SfxObjectShell* pDocSh); virtual ~SdDrawDocument(); - virtual SdrModel* AllocModel() const SAL_OVERRIDE; - virtual SdrPage* AllocPage(bool bMasterPage) SAL_OVERRIDE; + SdDrawDocument* AllocSdDrawDocument() const; + virtual SdrModel* AllocModel() const SAL_OVERRIDE; //forwards to AllocSdDrawDocument + SdPage* AllocSdPage(bool bMasterPage); + virtual SdrPage* AllocPage(bool bMasterPage) SAL_OVERRIDE; //forwards to AllocSdPage + virtual bool IsReadOnly() const SAL_OVERRIDE; virtual void SetChanged(bool bFlag = true) SAL_OVERRIDE; diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 957f946cbec5..3a08a8de83b3 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -434,10 +434,15 @@ SdDrawDocument::~SdDrawDocument() mpCharClass = NULL; } +SdrModel* SdDrawDocument::AllocModel() const +{ + return AllocSdDrawDocument(); +} + // This method creates a new document (SdDrawDocument) and returns a pointer to // said document. The drawing engine uses this method to put the document (or // parts of it) into the clipboard/DragServer. -SdrModel* SdDrawDocument::AllocModel() const +SdDrawDocument* SdDrawDocument::AllocSdDrawDocument() const { SdDrawDocument* pNewModel = NULL; diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index e2cde15a31bc..d32381782631 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -467,7 +467,7 @@ void Clipboard::CreateSlideTransferable ( SD_MOD()->pTransferClip = pTransferable; pDocument->CreatingDataObj (pTransferable); - pTransferable->SetWorkDocument( dynamic_cast<SdDrawDocument*>(pDocument->AllocModel()) ); + pTransferable->SetWorkDocument(pDocument->AllocSdDrawDocument()); pDocument->CreatingDataObj (NULL); TransferableObjectDescriptor aObjDesc; pTransferable->GetWorkDocument()->GetDocSh() @@ -573,8 +573,7 @@ void Clipboard::CreateSlideTransferable ( new TransferableData( pSlideSorterViewShell, aRepresentatives)); - pTransferable->SetWorkDocument( dynamic_cast<SdDrawDocument*>( - pTreeListBoxTransferable->GetSourceDoc()->AllocModel())); + pTransferable->SetWorkDocument(pTreeListBoxTransferable->GetSourceDoc()->AllocSdDrawDocument()); // pTransferable->SetView(&mrSlideSorter.GetView()); // Set page bookmark list. |