summaryrefslogtreecommitdiff
path: root/sd
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
parent502f059b1ff8dcd305d31b01a665c9d4255013cd (diff)
coverity#704728 Unchecked dynamic_cast
Change-Id: I2db2d6ffdca1775f21969b523ede56b3fb3fd682
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/drawdoc.hxx2
-rw-r--r--sd/source/core/drawdoc.cxx7
-rw-r--r--sd/source/core/drawdoc2.cxx18
-rw-r--r--sd/source/core/drawdoc3.cxx4
-rw-r--r--sd/source/ui/dlg/animobjs.cxx2
-rw-r--r--sd/source/ui/func/fuexpand.cxx4
-rw-r--r--sd/source/ui/func/fusumry.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx10
-rw-r--r--sd/source/ui/view/outlview.cxx4
9 files changed, 30 insertions, 25 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index bf59fc060e35..da589b87f33f 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -201,7 +201,6 @@ private:
com::sun::star::xml::dom::XNode> > maPresObjectInfo;
bool mbUseEmbedFonts;
-
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel() SAL_OVERRIDE;
@@ -215,6 +214,7 @@ public:
virtual SdrModel* AllocModel() const SAL_OVERRIDE;
virtual SdrPage* AllocPage(bool bMasterPage) SAL_OVERRIDE;
+ SdPage* AllocSdPage(bool bMasterPage);
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 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(),
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 00303482441d..1989f83b277a 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -173,7 +173,7 @@ AnimationWindow::AnimationWindow( SfxBindings* pInBindings,
// create new document with page
pMyDoc = new SdDrawDocument(DOCUMENT_TYPE_IMPRESS, NULL);
- SdPage* pPage = (SdPage*) pMyDoc->AllocPage(false);
+ SdPage* pPage = pMyDoc->AllocSdPage(false);
pMyDoc->InsertPage(pPage);
pControllerItem = new AnimationControllerItem( SID_ANIMATOR_STATE, this, pBindings );
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index 2467e1a42e5c..5626cb4533ed 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -134,7 +134,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
if ( nDepth == 0 )
{
// page with title & structuring!
- SdPage* pPage = (SdPage*) mpDoc->AllocPage(false);
+ SdPage* pPage = mpDoc->AllocSdPage(false);
pPage->SetSize(pActualPage->GetSize() );
pPage->SetBorder(pActualPage->GetLftBorder(),
pActualPage->GetUppBorder(),
@@ -156,7 +156,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
// notes-page
- SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(false);
+ SdPage* pNotesPage = mpDoc->AllocSdPage(false);
pNotesPage->SetSize(pActualNotesPage->GetSize());
pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
pActualNotesPage->GetUppBorder(),
diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
index a5ae8c0d8b5f..0c5731acef74 100644
--- a/sd/source/ui/func/fusumry.cxx
+++ b/sd/source/ui/func/fusumry.cxx
@@ -117,7 +117,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
// page with title & structuring!
- pSummaryPage = (SdPage*) mpDoc->AllocPage(false);
+ pSummaryPage = mpDoc->AllocSdPage(false);
pSummaryPage->SetSize(pActualPage->GetSize() );
pSummaryPage->SetBorder(pActualPage->GetLftBorder(),
pActualPage->GetUppBorder(),
@@ -137,7 +137,7 @@ void FuSummaryPage::DoExecute( SfxRequest& )
pSummaryPage->setHeaderFooterSettings(pActualPage->getHeaderFooterSettings());
// notes-page
- SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(false);
+ SdPage* pNotesPage = mpDoc->AllocSdPage(false);
pNotesPage->SetSize(pActualNotesPage->GetSize());
pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
pActualNotesPage->GetUppBorder(),
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index ce57995e718c..d56b857b68f5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -452,7 +452,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
if( 0 == nPageCount )
{
// this is only used for clipboard where we only have one page
- pStandardPage = (SdPage*) mpDoc->AllocPage(false);
+ pStandardPage = mpDoc->AllocSdPage(false);
Size aDefSize(21000, 29700); // A4-Hochformat
pStandardPage->SetSize( aDefSize );
@@ -485,7 +485,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
if( bDuplicate )
pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
else
- pStandardPage = (SdPage*) mpDoc->AllocPage(false);
+ pStandardPage = mpDoc->AllocSdPage(false);
pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
@@ -520,7 +520,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
if( bDuplicate )
pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
else
- pNotesPage = (SdPage*) mpDoc->AllocPage(false);
+ pNotesPage = mpDoc->AllocSdPage(false);
pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(),
@@ -2723,7 +2723,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIn
SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES);
// create and instert new draw masterpage
- SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(true);
+ SdPage* pMPage = mpModel->mpDoc->AllocSdPage(true);
pMPage->SetSize( pPage->GetSize() );
pMPage->SetBorder( pPage->GetLftBorder(),
pPage->GetUppBorder(),
@@ -2740,7 +2740,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIn
xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() );
// create and instert new notes masterpage
- SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(true);
+ SdPage* pMNotesPage = mpModel->mpDoc->AllocSdPage(true);
pMNotesPage->SetSize( pRefNotesPage->GetSize() );
pMNotesPage->SetPageKind(PK_NOTES);
pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 4436bdd07003..b6b4d4153260 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -441,7 +441,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara )
// this page is exemplary
SdPage* pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_STANDARD);
- SdPage* pPage = (SdPage*)mrDoc.AllocPage(false);
+ SdPage* pPage = mrDoc.AllocSdPage(false);
pPage->SetLayoutName(pExample->GetLayoutName());
@@ -478,7 +478,7 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara )
|* now the notes page
\*********************************************************************/
pExample = (SdPage*)mrDoc.GetSdPage((sal_uInt16)nExample, PK_NOTES);
- SdPage* pNotesPage = (SdPage*)mrDoc.AllocPage(false);
+ SdPage* pNotesPage = mrDoc.AllocSdPage(false);
pNotesPage->SetLayoutName(pExample->GetLayoutName());