[Libreoffice-commits] core.git: sd/inc sd/source
Caolán McNamara
caolanm at redhat.com
Thu Jun 12 06:12:30 PDT 2014
sd/inc/drawdoc.hxx | 7 +++++--
sd/source/core/drawdoc.cxx | 7 ++++++-
sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 5 ++---
3 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit b9daf7cacdcabff937d06f0f45c3daf2380bd888
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 13:59:07 2014 +0100
coverity#735840 Unchecked dynamic_cast
Change-Id: I3c772ec30360103f569b34e7c83f65b469eb5be8
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 6310fe3..f27df32 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 957f946..3a08a8d 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 e2cde15..d323817 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.
More information about the Libreoffice-commits
mailing list