fdo#39440 sd: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I14107ca24aa98f4111f542c3999866eb1a93a72b
This commit is contained in:
committed by
Julien Nabet
parent
17fc7aa3b8
commit
fb7c188842
@@ -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;
|
||||
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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(),
|
||||
|
@@ -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() );
|
||||
|
||||
|
@@ -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())
|
||||
|
@@ -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:
|
||||
|
@@ -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() );
|
||||
}
|
||||
|
@@ -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 );
|
||||
|
@@ -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));
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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:
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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() ) )
|
||||
{
|
||||
|
@@ -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)'#' );
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user