summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-07-27 00:43:34 +0200
committerMichael Stahl <mstahl@redhat.com>2013-07-27 00:45:21 +0200
commit3a46d91f8de420f38dd763028e91229c846dff52 (patch)
treef34ae4072fdd9ff6f06dbd4bac49072ff81f5c60 /svx
parent197010643e7e1b8c973013efa9034ffc9bdb56c0 (diff)
SfxStyleSheetBasePool: remove internal iterator
The clients always start with First() anyway so they might as well use external iterators, which makes calling First() in certain situations just so the internal iterator is invalidated unnecessary. Change-Id: I0948576c20410136448e8b85311c21a257469bc7
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/srchdlg.cxx13
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx27
2 files changed, 20 insertions, 20 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 11d235e57870..63b3a9b45f31 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -894,16 +894,16 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern )
m_pSearchTmplLB->Clear();
m_pReplaceTmplLB->Clear();
SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool();
- pStylePool->SetSearchMask( pSearchItem->GetFamily(),
+ SfxStyleSheetIterator iter(pStylePool, pSearchItem->GetFamily(),
SFXSTYLEBIT_ALL );
- SfxStyleSheetBase* pBase = pStylePool->First();
+ SfxStyleSheetBase* pBase = iter.First();
while ( pBase )
{
if ( pBase->IsUsed() )
m_pSearchTmplLB->InsertEntry( pBase->GetName() );
m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
- pBase = pStylePool->Next();
+ pBase = iter.Next();
}
m_pSearchTmplLB->SelectEntry( pSearchItem->GetSearchString() );
m_pReplaceTmplLB->SelectEntry( pSearchItem->GetReplaceString() );
@@ -1564,17 +1564,18 @@ void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
String aOldRepl( m_pReplaceTmplLB->GetSelectEntry() );
m_pSearchTmplLB->Clear();
m_pReplaceTmplLB->Clear();
- rPool.SetSearchMask( pSearchItem->GetFamily(), SFXSTYLEBIT_ALL );
m_pSearchTmplLB->SetUpdateMode( sal_False );
m_pReplaceTmplLB->SetUpdateMode( sal_False );
- SfxStyleSheetBase* pBase = rPool.First();
+ SfxStyleSheetIterator iter(&rPool,
+ pSearchItem->GetFamily(), SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase* pBase = iter.First();
while ( pBase )
{
if ( pBase->IsUsed() )
m_pSearchTmplLB->InsertEntry( pBase->GetName() );
m_pReplaceTmplLB->InsertEntry( pBase->GetName() );
- pBase = rPool.Next();
+ pBase = iter.Next();
}
m_pSearchTmplLB->SetUpdateMode( sal_True );
m_pReplaceTmplLB->SetUpdateMode( sal_True );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 779753c45b5f..aa5a5910c39f 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -420,11 +420,11 @@ void SvxStyleBox_Impl::Select()
if ( pPool )
{
- pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
- pStyle = pPool->First();
+ pStyle = iter.First();
while ( pStyle && OUString( pStyle->GetName() ) != aSearchEntry )
- pStyle = pPool->Next();
+ pStyle = iter.Next();
}
if ( !pStyle )
@@ -569,11 +569,11 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
if ( pPool )
{
- pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetIterator iter(pPool, eStyleFamily, SFXSTYLEBIT_ALL);
- pStyle = pPool->First();
+ pStyle = iter.First();
while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
- pStyle = pPool->Next();
+ pStyle = iter.Next();
}
if ( !pStyle )
@@ -1942,17 +1942,16 @@ void SvxStyleToolBoxControl::FillStyleBox()
if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
{
const SfxStyleFamily eFamily = GetActFamily();
- sal_uInt16 nCount = pStyleSheetPool->Count();
SfxStyleSheetBase* pStyle = NULL;
bool bDoFill = false;
- pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
+ SfxStyleSheetIterator iter(pStyleSheetPool, eFamily, SFXSTYLEBIT_USED);
// Check whether fill is necessary
- pStyle = pStyleSheetPool->First();
+ pStyle = iter.First();
//!!! TODO: This condition isn't right any longer, because we always show some default entries
//!!! so the list doesn't show the count
- if ( nCount != pBox->GetEntryCount() )
+ if (iter.Count() != pBox->GetEntryCount())
{
bDoFill = true;
}
@@ -1962,7 +1961,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
while ( pStyle && !bDoFill )
{
bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() );
- pStyle = pStyleSheetPool->Next();
+ pStyle = iter.Next();
i++;
}
}
@@ -1976,7 +1975,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
sal_uInt16 _i;
sal_uInt32 nCnt = pImpl->aDefaultStyles.size();
- pStyle = pStyleSheetPool->First();
+ pStyle = iter.First();
if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
{
@@ -1997,7 +1996,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
if( bInsert )
pBox->InsertEntry( aName );
- pStyle = pStyleSheetPool->Next();
+ pStyle = iter.Next();
}
}
else
@@ -2005,7 +2004,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
while ( pStyle )
{
pBox->InsertEntry( pStyle->GetName() );
- pStyle = pStyleSheetPool->Next();
+ pStyle = iter.Next();
}
}
}