diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-10 13:07:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-10 15:44:58 +0000 |
commit | b6d6dab920a9e14a6fe9c61446da64ab62dcbfdf (patch) | |
tree | 0b80eb631d6869ad1c3c06857909c08c9f5d3480 /sd | |
parent | 441523b0df8983fb34409a5f4e25dde571be1af7 (diff) |
V668 no sense in testing the result of new against null
Change-Id: I1cff71d15f4d1b5ee47cc734b3fc2168d7f99201
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx | 17 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod1.cxx | 89 | ||||
-rw-r--r-- | sd/source/ui/dlg/TemplateScanner.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 38 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 2 |
5 files changed, 62 insertions, 93 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index fffc50cec5fe..16208b1eb870 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -112,17 +112,16 @@ void AccessibleDrawDocumentView::Init (void) // Create the children manager. mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this); - if (mpChildrenManager != NULL) + + rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape()); + if (xPage.is()) { - rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape()); - if (xPage.is()) - { - xPage->Init(); - mpChildrenManager->AddAccessibleShape (xPage.get()); - mpChildrenManager->Update (); - } - mpChildrenManager->UpdateSelection (); + xPage->Init(); + mpChildrenManager->AddAccessibleShape (xPage.get()); + mpChildrenManager->Update (); } + + mpChildrenManager->UpdateSelection (); } void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType, diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index dad7b14889c4..8df6940b7d76 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -266,47 +266,45 @@ bool SdModule::OutlineToImpress(SfxRequest& rRequest) ::sd::DrawDocShell* pDocSh; xDocShell = pDocSh = new ::sd::DrawDocShell( SFX_CREATE_MODE_STANDARD, false); - if(pDocSh) + + pDocSh->DoInitNew(NULL); + SdDrawDocument* pDoc = pDocSh->GetDoc(); + if(pDoc) { - pDocSh->DoInitNew(NULL); - SdDrawDocument* pDoc = pDocSh->GetDoc(); - if(pDoc) - { - pDoc->CreateFirstPages(); - pDoc->StopWorkStartupDelay(); - } + pDoc->CreateFirstPages(); + pDoc->StopWorkStartupDelay(); + } - SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, false); - SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); + SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, false); + SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); - ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); + ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); - if (pViewSh && pDoc) - { - // AutoLayouts have to be finished - pDoc->StopWorkStartupDelay(); + if (pViewSh && pDoc) + { + // AutoLayouts have to be finished + pDoc->StopWorkStartupDelay(); - SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); + SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); - // When the view frame has not been just created we have - // to switch synchronously to the outline view. - // (Otherwise the request will be ignored anyway.) - ::sd::ViewShellBase* pBase - = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell()); - if (pBase != NULL) - { - ::boost::shared_ptr<FrameworkHelper> pHelper ( - FrameworkHelper::Instance(*pBase)); - pHelper->RequestView( - FrameworkHelper::msOutlineViewURL, - FrameworkHelper::msCenterPaneURL); - - pHelper->RunOnResourceActivation( - FrameworkHelper::CreateResourceId( - FrameworkHelper::msOutlineViewURL, - FrameworkHelper::msCenterPaneURL), - OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes)); - } + // When the view frame has not been just created we have + // to switch synchronously to the outline view. + // (Otherwise the request will be ignored anyway.) + ::sd::ViewShellBase* pBase + = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell()); + if (pBase != NULL) + { + ::boost::shared_ptr<FrameworkHelper> pHelper ( + FrameworkHelper::Instance(*pBase)); + pHelper->RequestView( + FrameworkHelper::msOutlineViewURL, + FrameworkHelper::msCenterPaneURL); + + pHelper->RunOnResourceActivation( + FrameworkHelper::CreateResourceId( + FrameworkHelper::msOutlineViewURL, + FrameworkHelper::msCenterPaneURL), + OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes)); } } } @@ -724,21 +722,18 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< SfxObjectShellLock xDocShell; ::sd::DrawDocShell* pNewDocSh; xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,false,eDocType); - if(pNewDocSh) + pNewDocSh->DoInitNew(NULL); + SdDrawDocument* pDoc = pNewDocSh->GetDoc(); + if (pDoc) { - pNewDocSh->DoInitNew(NULL); - SdDrawDocument* pDoc = pNewDocSh->GetDoc(); - if(pDoc) - { - pDoc->CreateFirstPages(); - pDoc->StopWorkStartupDelay(); - } - - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); - OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); - pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; + pDoc->CreateFirstPages(); + pDoc->StopWorkStartupDelay(); } + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); + OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); + pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; + return pFrame; } diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index 617f6401c813..3e43b1923ccd 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -373,12 +373,9 @@ TemplateScanner::State TemplateScanner::ScanFolder (void) // Scan the folder and insert it into the list of template // folders. mpTemplateDirectory = new TemplateDir (sTitle, sTargetDir); - if (mpTemplateDirectory != NULL) - { - mpTemplateDirectory->EnableSorting(mbEntrySortingEnabled); - // Continue with scanning all entries in the folder. - eNextState = INITIALIZE_ENTRY_SCAN; - } + mpTemplateDirectory->EnableSorting(mbEntrySortingEnabled); + // Continue with scanning all entries in the folder. + eNextState = INITIALIZE_ENTRY_SCAN; } } else diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index cd9043858ba5..af598c28204d 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -909,24 +909,13 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark) // Jump to the page. This is done by using the API because this // takes care of all the little things to be done. Especially // writing the view data to the frame view (see bug #107803#). - sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( *pDrViewSh, *pDrViewSh->GetView()); - if (pUnoDrawView != NULL) - { - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPage> xDrawPage ( - pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); - pUnoDrawView->setCurrentPage (xDrawPage); - } - else - { - // As a fall back switch to the page via the core. - DBG_ASSERT (pUnoDrawView!=NULL, - "SdDrawDocShell::GotoBookmark: can't switch page via API"); - pDrViewSh->SwitchPage(nSdPgNum); - } + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage> xDrawPage ( + pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); + pUnoDrawView->setCurrentPage (xDrawPage); delete pUnoDrawView; if (pObj) @@ -1002,24 +991,13 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark) // Jump to the page. This is done by using the API because this // takes care of all the little things to be done. Especially // writing the view data to the frame view (see bug #107803#). - sal_uInt16 nSdPgNum = (nPgNum - 1) / 2; SdUnoDrawView* pUnoDrawView = new SdUnoDrawView ( *pDrViewSh, *pDrViewSh->GetView()); - if (pUnoDrawView != NULL) - { - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPage> xDrawPage ( - pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); - pUnoDrawView->setCurrentPage (xDrawPage); - } - else - { - // As a fall back switch to the page via the core. - DBG_ASSERT (pUnoDrawView!=NULL, - "SdDrawDocShell::GotoBookmark: can't switch page via API"); - pDrViewSh->SwitchPage(nSdPgNum); - } + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage> xDrawPage ( + pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY); + pUnoDrawView->setCurrentPage (xDrawPage); delete pUnoDrawView; if (pObj) diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 5ad3d45d80f3..77ae2631a11d 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -993,7 +993,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pImageMap ) pObj->AppendUserData( new SdIMapInfo( *pImageMap ) ); - if ( pObj && pObj->IsChart() ) + if (pObj->IsChart()) { bool bDisableDataTableDialog = false; svt::EmbeddedObjectRef::TryRunningState( xObj ); |