summaryrefslogtreecommitdiff
path: root/sd/source/core
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-30 09:54:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-30 11:48:59 +0100
commit1f0b7e5dc4299ff0c4c52fc69fa97b99d9e9e076 (patch)
treedb8f35c8e54a40cb32a8ff5115247cad6fe00d36 /sd/source/core
parent502f059b1ff8dcd305d31b01a665c9d4255013cd (diff)
coverity#704728 Unchecked dynamic_cast
Change-Id: I2db2d6ffdca1775f21969b523ede56b3fb3fd682
Diffstat (limited to 'sd/source/core')
-rw-r--r--sd/source/core/drawdoc.cxx7
-rw-r--r--sd/source/core/drawdoc2.cxx18
-rw-r--r--sd/source/core/drawdoc3.cxx4
3 files changed, 17 insertions, 12 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 63d51585aff9..2245654020af 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -498,12 +498,17 @@ SdrModel* SdDrawDocument::AllocModel() const
return pNewModel;
}
+SdPage* SdDrawDocument::AllocSdPage(bool bMasterPage)
+{
+ return new SdPage(*this, bMasterPage);
+}
+
// This method creates a new page (SdPage) and returns a pointer to said page.
// The drawing engine uses this method to create pages (whose types it does
// not know, as they are _derivatives_ of SdrPage) when loading.
SdrPage* SdDrawDocument::AllocPage(bool bMasterPage)
{
- return new SdPage(*this, bMasterPage);
+ return AllocSdPage(bMasterPage);
}
// When the model has changed
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 3d3b8e9c57f2..a592640fba0d 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -476,7 +476,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM );
// Insert handout page
- SdPage* pHandoutPage = dynamic_cast< SdPage* >( AllocPage(false) );
+ SdPage* pHandoutPage = AllocSdPage(false);
SdPage* pRefPage = NULL;
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
InsertPage(pHandoutPage, 0);
// Insert master page and register this with the handout page
- SdPage* pHandoutMPage = (SdPage*) AllocPage(true);
+ SdPage* pHandoutMPage = AllocSdPage(true);
pHandoutMPage->SetSize( pHandoutPage->GetSize() );
pHandoutMPage->SetPageKind(PK_HANDOUT);
pHandoutMPage->SetBorder( pHandoutPage->GetLftBorder(),
@@ -520,7 +520,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
if (nPageCount == 0)
{
- pPage = dynamic_cast< SdPage* >( AllocPage(false) );
+ pPage = AllocSdPage(false);
if( pRefPage )
{
@@ -574,7 +574,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
}
// Insert master page, then register this with the page
- SdPage* pMPage = (SdPage*) AllocPage(true);
+ SdPage* pMPage = AllocSdPage(true);
pMPage->SetSize( pPage->GetSize() );
pMPage->SetBorder( pPage->GetLftBorder(),
pPage->GetUppBorder(),
@@ -586,7 +586,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
pMPage->SetLayoutName( pPage->GetLayoutName() );
// Insert notes page
- SdPage* pNotesPage = (SdPage*) AllocPage(false);
+ SdPage* pNotesPage = AllocSdPage(false);
if( pRefDocument )
pRefPage = pRefDocument->GetSdPage( 0, PK_NOTES );
@@ -616,7 +616,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument* pRefDocument /* = 0 */ )
pNotesPage->SetLayoutName( pPage->GetLayoutName() );
// Insert master page, then register this with the notes page
- SdPage* pNotesMPage = (SdPage*) AllocPage(true);
+ SdPage* pNotesMPage = AllocSdPage(true);
pNotesMPage->SetSize( pNotesPage->GetSize() );
pNotesMPage->SetPageKind(PK_NOTES);
pNotesMPage->SetBorder( pNotesPage->GetLftBorder(),
@@ -1154,7 +1154,7 @@ void SdDrawDocument::CheckMasterPages()
if( nFound == nMaxPages )
pRefNotesPage = NULL;
- SdPage* pNewNotesPage = static_cast<SdPage*>(AllocPage(true));
+ SdPage* pNewNotesPage = AllocSdPage(true);
pNewNotesPage->SetPageKind(PK_NOTES);
if( pRefNotesPage )
{
@@ -1225,7 +1225,7 @@ sal_uInt16 SdDrawDocument::CreatePage (
}
// Create new standard page and set it up
- pStandardPage = (SdPage*) AllocPage(false);
+ pStandardPage = AllocSdPage(false);
// Set the size here since else the presobj autolayout
// will be wrong.
@@ -1255,7 +1255,7 @@ sal_uInt16 SdDrawDocument::CreatePage (
pStandardPage->SetTime( pPreviousStandardPage->GetTime() );
// Create new notes page and set it up
- pNotesPage = (SdPage*) AllocPage(false);
+ pNotesPage = AllocSdPage(false);
pNotesPage->SetPageKind(PK_NOTES);
// Use master page of current page
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 5621826c5c63..bc2af1cffc63 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1807,7 +1807,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if( bUndo )
BegUndo();
- pMaster = (SdPage*) AllocPage(true);
+ pMaster = AllocSdPage(true);
pMaster->SetSize(pSelectedPage->GetSize());
pMaster->SetBorder(pSelectedPage->GetLftBorder(),
pSelectedPage->GetUppBorder(),
@@ -1822,7 +1822,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
pMaster->SetAutoLayout(AUTOLAYOUT_NONE, true, true);
- pNotesMaster = (SdPage*) AllocPage(true);
+ pNotesMaster = AllocSdPage(true);
pNotesMaster->SetPageKind(PK_NOTES);
pNotesMaster->SetSize(pNotes->GetSize());
pNotesMaster->SetBorder(pNotes->GetLftBorder(),