sd/source/filter/html/htmlex.cxx | 6 ++---- sd/source/filter/ppt/pptin.cxx | 9 +++++---- sd/source/ui/animations/CustomAnimationList.cxx | 9 +++------ sd/source/ui/dlg/custsdlg.cxx | 6 ++---- sd/source/ui/dlg/dlgassim.cxx | 3 +-- sd/source/ui/dlg/sdtreelb.cxx | 5 ++--- sd/source/ui/func/fuinsfil.cxx | 3 +-- sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx | 6 ++---- sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 3 +-- sd/source/ui/unoidl/unolayer.cxx | 3 +-- sd/source/ui/unoidl/unopback.cxx | 3 +-- sd/source/ui/view/drviews2.cxx | 3 +-- sd/source/ui/view/drviewsa.cxx | 3 +-- sd/source/ui/view/drviewsf.cxx | 2 +- sd/source/ui/view/frmview.cxx | 6 ++---- sd/source/ui/view/outlview.cxx | 6 ++---- sd/source/ui/view/sdview.cxx | 3 +-- sd/source/ui/view/sdview2.cxx | 3 ++- sd/source/ui/view/sdview3.cxx | 4 ++-- 19 files changed, 33 insertions(+), 53 deletions(-)
New commits: commit fb7c18884223f08818b44a9953b55c69a029c71c Author: Michael Weghorn <m.wegh...@posteo.de> Date: Sat Dec 20 21:45:16 2014 +0100 fdo#39440 sd: reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I14107ca24aa98f4111f542c3999866eb1a93a72b diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 66544a2..23a3ce3 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -1035,12 +1035,11 @@ bool HtmlExport::CreateImagesForPresPages( bool bThumbnail) SdrTextObj* HtmlExport::GetLayoutTextObject(SdrPage* pPage) { const size_t nObjectCount = pPage->GetObjCount(); - SdrObject* pObject = NULL; SdrTextObj* pResult = NULL; for (size_t nObject = 0; nObject < nObjectCount; ++nObject) { - pObject = pPage->GetObj(nObject); + SdrObject* pObject = pPage->GetObj(nObject); if (pObject->GetObjInventor() == SdrInventor && pObject->GetObjIdentifier() == OBJ_OUTLINETEXT) { @@ -1326,13 +1325,12 @@ void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutl sal_Int32 nCount = pOutliner->GetParagraphCount(); - Paragraph* pParagraph = NULL; sal_Int16 nCurrentDepth = -1; for (sal_Int32 nIndex = 0; nIndex < nCount; nIndex++) { - pParagraph = pOutliner->GetParagraph(nIndex); + Paragraph* pParagraph = pOutliner->GetParagraph(nIndex); if(pParagraph == NULL) continue; diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 70a8ba0..b01e1b6 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -872,8 +872,6 @@ bool ImplSdPPTImport::Import() { for ( sal_uInt16 nPage = 0; nPage < nPageAnz; nPage++ ) { - bool bNewAnimationsUsed = false; - mePresChange = PRESCHANGE_SEMIAUTO; SetPageNum( nPage, PPT_SLIDEPAGE ); SdPage* pPage = static_cast<SdPage*>(MakeBlancPage( false )); @@ -896,6 +894,8 @@ bool ImplSdPPTImport::Import() DffRecordHeader aPageHd; if ( SeekToAktPage( &aPageHd ) ) { + bool bNewAnimationsUsed = false; + aPageHd.SeekToContent( rStCtrl ); while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) ) { @@ -2527,12 +2527,13 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi pObj, PRESOBJ_PAGE ); } - bool bInhabitanceChecked = false; - bool bAnimationInfoFound = false; DffRecordHeader aMasterShapeHd; if ( maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) ) { + bool bInhabitanceChecked = false; + bool bAnimationInfoFound = false; + DffRecordHeader& rHdClientData = *maShapeRecords.Current(); while( true ) { diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index e62b84b..c29cd2e 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -541,9 +541,6 @@ void CustomAnimationList::update() long nLastVis = -1; long nFirstSelOld = -1; long nLastSelOld = -1; - bool bMoved = false; - bool bMovedUp = false; - bool bMovedDown = false; if( mpMainSequence.get() ) { @@ -650,9 +647,9 @@ void CustomAnimationList::update() } // Scroll to a selected entry, depending on where the selection moved. - bMoved = nFirstSelNew != nFirstSelOld; - bMovedUp = nFirstSelNew < nFirstSelOld; - bMovedDown = nFirstSelNew > nFirstSelOld; + const bool bMoved = nFirstSelNew != nFirstSelOld; + const bool bMovedUp = nFirstSelNew < nFirstSelOld; + const bool bMovedDown = nFirstSelNew > nFirstSelOld; if( bMoved && nLastSelOld < nFirstVis && nLastSelNew < nFirstVis ) { diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index b5b9d93..94e0e87 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -295,13 +295,12 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( vcl::Window* pWindow, m_pLbCustomPages->set_width_request(m_pLbPages->approximate_char_width() * 16); m_pLbPages->SetDropDownLineCount(10); - SdPage* pPage; // fill Listbox with page names of Docs for( long nPage = 0L; nPage < rDoc.GetSdPageCount( PK_STANDARD ); nPage++ ) { - pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD ); + SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD ); OUString aStr( pPage->GetName() ); m_pLbPages->InsertEntry( aStr ); } @@ -438,12 +437,11 @@ void SdDefineCustomShowDlg::CheckCustomShow() // set new page pointer if( bDifferent ) { - SdPage* pPage = NULL; for( pEntry = m_pLbCustomPages->First(); pEntry != NULL; pEntry = m_pLbCustomPages->Next( pEntry ) ) { - pPage = (SdPage*) pEntry->GetUserData(); + SdPage* pPage = (SdPage*) pEntry->GetUserData(); rpCustomShow->PagesVector().push_back( pPage ); } bModified = true; diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx index 7802b96..5eaab01 100644 --- a/sd/source/ui/dlg/dlgassim.cxx +++ b/sd/source/ui/dlg/dlgassim.cxx @@ -149,11 +149,10 @@ void SdPageListControl::Fill( SdDrawDocument* pDoc ) sal_Int32 nCount = pOutliner->GetParagraphCount(); - Paragraph* pPara = NULL; for (sal_Int32 nPara = 0; nPara < nCount; nPara++) { - pPara = pOutliner->GetParagraph(nPara); + Paragraph* pPara = pOutliner->GetParagraph(nPara); if(pPara && pOutliner->GetDepth( nPara ) == 0 ) { OUString aParaText = pOutliner->GetText(pPara); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 5f9741f..bcea730 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -456,11 +456,11 @@ bool SdPageObjsTLB::SelectEntry( const OUString& rName ) */ bool SdPageObjsTLB::HasSelectedChildren( const OUString& rName ) { - bool bFound = false; bool bChildren = false; if( !rName.isEmpty() ) { + bool bFound = false; SvTreeListEntry* pEntry = NULL; OUString aTmp; @@ -896,7 +896,6 @@ void SdPageObjsTLB::RequestingChildren( SvTreeListEntry* pFileEntry ) if( GetBookmarkDoc() ) { SdrObject* pObj = NULL; - SdPage* pPage = NULL; SvTreeListEntry* pPageEntry = NULL; Image aImgPage = Image( BitmapEx( SdResId( BMP_PAGE ) ) ); @@ -911,7 +910,7 @@ void SdPageObjsTLB::RequestingChildren( SvTreeListEntry* pFileEntry ) while( nPage < nMaxPages ) { - pPage = static_cast<SdPage*>( mpBookmarkDoc->GetPage( nPage ) ); + SdPage* pPage = static_cast<SdPage*>( mpBookmarkDoc->GetPage( nPage ) ); if( pPage->GetPageKind() == PK_STANDARD ) { pPageEntry = InsertEntry( pPage->GetName(), diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 5fa1a0a..ff71ff2 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -107,7 +107,6 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) Reference< XFilterManager > xFilterManager( xFilePicker, UNO_QUERY ); OUString aOwnCont; OUString aOtherCont; - const SfxFilter* pFilter = NULL; aFileDialog.SetTitle( SD_RESSTR(STR_DLG_INSERT_PAGES_FROM_FILE) ); @@ -135,7 +134,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) xFilterManager->setCurrentFilter( aAllSpec ); // set default-filter (<All>) // Get main filter - pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont ); + const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont ); if( pFilter ) xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() ); diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index 00d0f8d..34924a6 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -121,13 +121,12 @@ void CurrentMasterPagesSelector::LateInit (void) void CurrentMasterPagesSelector::Fill (ItemList& rItemList) { sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD); - SdPage* pMasterPage; // Remember the names of the master pages that have been inserted to // avoid double insertion. ::std::set<OUString> aMasterPageNames; for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++) { - pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD); + SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD); if (pMasterPage == NULL) continue; @@ -168,13 +167,12 @@ void CurrentMasterPagesSelector::UpdateSelection (void) // Iterate over all pages and for the selected ones put the name of // their master page into a set. sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD); - SdPage* pPage; ::std::set<OUString> aNames; sal_uInt16 nIndex; bool bLoop (true); for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++) { - pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD); + SdPage* pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD); if (pPage != NULL && pPage->IsSelected()) { if ( ! pPage->TRG_HasMasterPage()) diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 455c800..12a027d 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -1248,12 +1248,11 @@ namespace { SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet) { SlideExclusionState eState (UNDEFINED); - bool bState; // Get toggle state of the selected pages. while (rPageSet.HasMoreElements() && eState!=MIXED) { - bState = rPageSet.GetNextElement()->GetPage()->IsExcluded(); + const bool bState = rPageSet.GetNextElement()->GetPage()->IsExcluded(); switch (eState) { case UNDEFINED: diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index 9ce0982..59d6d2c 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -655,11 +655,10 @@ uno::Sequence< OUString > SAL_CALL SdLayerManager::getElementNames() uno::Sequence< OUString > aSeq( nLayerCount ); OUString* pStrings = aSeq.getArray(); - SdrLayer* pLayer; for( sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++ ) { - pLayer = rLayerAdmin.GetLayer( nLayer ); + SdrLayer* pLayer = rLayerAdmin.GetLayer( nLayer ); if( pLayer ) *pStrings++ = SdLayer::convertToExternalName( pLayer->GetName() ); } diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 42b295d..f11a333 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -110,13 +110,12 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( mpPropSet->AreThereOwnUsrAnys() ) { - uno::Any* pAny; PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap().getPropertyEntries(); PropertyEntryVector_t::const_iterator aIt = aProperties.begin(); while( aIt != aProperties.end() ) { - pAny = mpPropSet->GetUsrAnyForID( aIt->nWID ); + uno::Any* pAny = mpPropSet->GetUsrAnyForID( aIt->nWID ); if( pAny ) { OUString aPropertyName( aIt->sName ); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 00d1b0d..5b4517e 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -240,14 +240,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_OUTLINE_TEXT_AUTOFIT: { ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager(); - SdrObject* pObj = NULL; const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); if( rMarkList.GetMarkCount() == 1 ) { pUndoManager->EnterListAction("", ""); mpDrawView->BegUndo(); - pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); bool bSet = static_cast<const SdrTextFitToSizeTypeItem*>(pObj->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE))->GetValue() != SDRTEXTFIT_NONE; mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index fe57ddc..eb4a084 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -160,12 +160,11 @@ DrawViewShell::~DrawViewShell() DisposeFunctions(); - SdPage* pPage; sal_uInt16 aPageCnt = GetDoc()->GetSdPageCount(mePageKind); for (sal_uInt16 i = 0; i < aPageCnt; i++) { - pPage = GetDoc()->GetSdPage(i, mePageKind); + SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); if (pPage == mpActualPage) { diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 1fe47f9..665e830 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -601,10 +601,10 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } if ( nCount == 1 ) { - bool bBullets = false; const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel); if ( pNumFmt ) { + bool bBullets = false; switch(pNumFmt->GetNumberingType()) { case SVX_NUM_CHAR_SPECIAL: diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 8ce1f57..11573da 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -77,16 +77,14 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * { // document is loaded, is there a FrameView? sal_uLong nSdViewShellCount = 0; - ViewShellBase* pBase = NULL; - SfxViewShell* pSfxViewSh = NULL; SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(pDocShell); while (pSfxViewFrame) { // Count the FrameViews and remember the type of the main // view shell. - pSfxViewSh = pSfxViewFrame->GetViewShell(); - pBase = PTR_CAST(ViewShellBase, pSfxViewSh ); + SfxViewShell* pSfxViewSh = pSfxViewFrame->GetViewShell(); + ViewShellBase* pBase = PTR_CAST(ViewShellBase, pSfxViewSh ); if (pBase != NULL) { diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index bdf5a6f..c7e1508 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -955,12 +955,11 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) SdrTextObj* OutlineView::GetTitleTextObject(SdrPage* pPage) { const size_t nObjectCount = pPage->GetObjCount(); - SdrObject* pObject = NULL; SdrTextObj* pResult = NULL; for (size_t nObject = 0; nObject < nObjectCount; ++nObject) { - pObject = pPage->GetObj(nObject); + SdrObject* pObject = pPage->GetObj(nObject); if (pObject->GetObjInventor() == SdrInventor && pObject->GetObjIdentifier() == OBJ_TITLETEXT) { @@ -977,12 +976,11 @@ SdrTextObj* OutlineView::GetTitleTextObject(SdrPage* pPage) SdrTextObj* OutlineView::GetOutlineTextObject(SdrPage* pPage) { const size_t nObjectCount = pPage->GetObjCount(); - SdrObject* pObject = NULL; SdrTextObj* pResult = NULL; for (size_t nObject = 0; nObject < nObjectCount; ++nObject) { - pObject = pPage->GetObj(nObject); + SdrObject* pObject = pPage->GetObj(nObject); if (pObject->GetObjInventor() == SdrInventor && pObject->GetObjIdentifier() == OBJ_OUTLINETEXT) { diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index bf3ec43..7716320 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -556,7 +556,6 @@ bool View::IsPresObjSelected(bool bOnPage, bool bOnMasterPage, bool bCheckPresOb SdrMark* pMark; SdPage* pPage; - SdrObject* pObj; bool bSelected = false; bool bMasterPage = false; @@ -566,7 +565,7 @@ bool View::IsPresObjSelected(bool bOnPage, bool bOnMasterPage, bool bCheckPresOb --nMark; // Backwards through mark list pMark = pMarkList->GetMark(nMark); - pObj = pMark->GetMarkedSdrObj(); + SdrObject* pObj = pMark->GetMarkedSdrObj(); if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) ) { diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 59ca186..bfd682d 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -738,10 +738,11 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTar // insert as clip action => jump OUString aBookmark( aINetBookmark.GetURL() ); SdAnimationInfo* pInfo = mrDoc.GetAnimationInfo( pPickObj ); - bool bCreated = false; if( !aBookmark.isEmpty() ) { + bool bCreated = false; + presentation::ClickAction eClickAction = presentation::ClickAction_DOCUMENT; sal_Int32 nIndex = aBookmark.indexOf( (sal_Unicode)'#' ); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index e029afa..5ad3d45 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -663,8 +663,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) ) { - bool bChanged = false; - DrawDocShellRef xShell = new DrawDocShell(SFX_CREATE_MODE_INTERNAL); xShell->DoInitNew(0); @@ -683,6 +681,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } else { + bool bChanged = false; + if( bReturn ) { if( pModel->GetSdPage( 0, PK_STANDARD )->GetObjCount() == 1 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits