summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-02-24 10:45:45 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-02-24 11:46:24 +0100
commit8f2d6e80608b7f8cc931e6d7e7280c043fc92ae8 (patch)
treec971155c14f681821432be2ca727920dc5ef1b1c
parentImplement OOXML password hashing algorithm, tdf#104250 prep (diff)
downloadcore-8f2d6e80608b7f8cc931e6d7e7280c043fc92ae8.tar.gz
core-8f2d6e80608b7f8cc931e6d7e7280c043fc92ae8.zip
Modernize a bit accessibility and basctl
by using for range loops + compare end iterator with "!=" instead of "<" Change-Id: I615a8ca417a58fde4976bb6d8d9112dc5d993a88 Reviewed-on: https://gerrit.libreoffice.org/50277 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx5
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx5
-rw-r--r--basctl/source/basicide/basicbox.cxx7
-rw-r--r--basctl/source/basicide/baside2b.cxx36
-rw-r--r--basctl/source/basicide/basides1.cxx20
-rw-r--r--basctl/source/basicide/basides3.cxx6
-rw-r--r--basctl/source/basicide/basidesh.cxx72
-rw-r--r--basctl/source/basicide/basobj3.cxx13
-rw-r--r--basctl/source/basicide/bastype3.cxx9
-rw-r--r--basctl/source/basicide/breakpoint.cxx4
-rw-r--r--basctl/source/basicide/layout.cxx6
-rw-r--r--basctl/source/basicide/localizationmgr.cxx4
-rw-r--r--basctl/source/basicide/macrodlg.cxx4
-rw-r--r--basctl/source/basicide/moduldl2.cxx7
-rw-r--r--basctl/source/basicide/scriptdocument.cxx30
-rw-r--r--basctl/source/dlged/dlged.cxx4
-rw-r--r--basctl/source/dlged/dlgedobj.cxx49
17 files changed, 121 insertions, 160 deletions
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 47c8f9ecd3a5..bd5c81129a1c 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -171,12 +171,11 @@ namespace accessibility
else
{
// NULL means Clear()
- MAP_ENTRY::iterator mi = m_mapEntry.begin();
- for ( ; mi != m_mapEntry.end() ; ++mi)
+ for (auto const& entry : m_mapEntry)
{
uno::Any aNewValue;
uno::Any aOldValue;
- aOldValue <<= mi->second;
+ aOldValue <<= entry.second;
NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
}
m_mapEntry.clear();
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 50b472d66371..5183af524492 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -2340,11 +2340,10 @@ void Document::handleSelectionChangeNotification()
void Document::disposeParagraphs()
{
- for (Paragraphs::iterator aIt(m_xParagraphs->begin());
- aIt != m_xParagraphs->end(); ++aIt)
+ for (auto const& paragraph : *m_xParagraphs)
{
css::uno::Reference< css::lang::XComponent > xComponent(
- aIt->getParagraph().get(), css::uno::UNO_QUERY);
+ paragraph.getParagraph().get(), css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index 01238926670f..dd5eb2f36fdf 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -203,12 +203,9 @@ void LibBox::FillBox()
InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- InsertEntries( *doc, LIBRARY_LOCATION_DOCUMENT );
+ InsertEntries(doc, LIBRARY_LOCATION_DOCUMENT);
}
SetUpdateMode(true);
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 3f81bde3bb5a..f25e60c91a23 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -600,12 +600,11 @@ void EditorWindow::HandleAutoCorrect()
HighlightPortion& r = aPortions.back();
if( static_cast<size_t>(nIndex) != aPortions.size()-1 )
{//cursor is not standing at the end of the line
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- if( i->nEnd == nIndex )
+ if( portion.nEnd == nIndex )
{
- r = *i;
+ r = portion;
break;
}
}
@@ -673,12 +672,11 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
HighlightPortion& r = aPortions.back();
if( static_cast<size_t>(nIndex) != aPortions.size()-1 )
{//cursor is not standing at the end of the line
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- if( i->nEnd == nIndex )
+ if( portion.nEnd == nIndex )
{
- r = *i;
+ r = portion;
break;
}
}
@@ -794,18 +792,17 @@ bool EditorWindow::GetProcedureName(OUString const & rLine, OUString& rProcType,
bool bFoundType = false;
bool bFoundName = false;
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- OUString sTokStr = rLine.copy(i->nBegin, i->nEnd - i->nBegin);
+ OUString sTokStr = rLine.copy(portion.nBegin, portion.nEnd - portion.nBegin);
- if( i->tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub")
+ if( portion.tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub")
|| sTokStr.equalsIgnoreAsciiCase("function")) )
{
rProcType = sTokStr;
bFoundType = true;
}
- if( i->tokenType == TokenType::Identifier && bFoundType )
+ if( portion.tokenType == TokenType::Identifier && bFoundType )
{
rProcName = sTokStr;
bFoundName = true;
@@ -1166,11 +1163,10 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( aLine, aPortions );
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
+ for (auto const& portion : aPortions)
{
- Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(i->tokenType);
- pEditEngine->SetAttrib(TextAttribFontColor(aColor), nLine, i->nBegin, i->nEnd);
+ Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(portion.tokenType);
+ pEditEngine->SetAttrib(TextAttribFontColor(aColor), nLine, portion.nBegin, portion.nEnd);
}
pEditEngine->SetModified(bWasModified);
@@ -1261,11 +1257,9 @@ IMPL_LINK_NOARG(EditorWindow, SyntaxTimerHdl, Timer *, void)
//pEditEngine->SetUpdateMode(false);
bHighlighting = true;
- for ( std::set<sal_uInt16>::const_iterator it = aSyntaxLineTable.begin();
- it != aSyntaxLineTable.end(); ++it )
+ for (auto const& syntaxLine : aSyntaxLineTable)
{
- sal_uInt16 nLine = *it;
- DoSyntaxHighlight( nLine );
+ DoSyntaxHighlight(syntaxLine);
}
// #i45572#
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 32969aaf594a..22afa37f5d2a 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -94,18 +94,18 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL)
{
sal_uInt16 nActModWindows = 0;
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if (pWin->HasActiveEditor())
nActModWindows++;
}
if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && ScopedVclPtrInstance<QueryBox>(pCurWin, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, IDEResId(RID_STR_SEARCHALLMODULES))->Execute() == RET_YES ) )
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
nFound += pWin->StartSearchAndReplace(rSearchItem);
}
}
@@ -413,9 +413,9 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_STOREALLMODULESOURCES:
case SID_BASICIDE_UPDATEALLMODULESOURCES:
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin))
{
if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES )
@@ -1154,9 +1154,9 @@ VclPtr<BaseWindow> Shell::FindWindow(
ItemType eType, bool bFindSuspended
)
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* const pWin = it->second;
+ BaseWindow* const pWin = window.second;
if (pWin->Is(rDocument, rLibName, rName, eType, bFindSuspended))
return pWin;
}
@@ -1296,9 +1296,9 @@ void Shell::Deactivate( bool bMDI )
// test CanClose to also test during deactivating the BasicIDE whether
// the sourcecode is too large in one of the modules...
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() )
{
if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index 9ba2a6db36bb..ea892bfe873c 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -120,9 +120,9 @@ VclPtr<DialogWindow> Shell::FindDlgWin (
sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
- if ( it->second == pWin )
- return it->first;
+ for (auto const& window : aWindowTable)
+ if ( window.second == pWin )
+ return window.first;
return 0;
}
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index ad39f4c84b70..e4791604572b 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -231,10 +231,10 @@ Shell::~Shell()
aVScrollBar.disposeAndClear();
aHScrollBar.disposeAndClear();
- for (WindowTable::iterator it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto & window : aWindowTable)
{
// no store; does already happen when the BasicManagers are destroyed
- it->second.disposeAndClear();
+ window.second.disposeAndClear();
}
// no store; does already happen when the BasicManagers are destroyed
@@ -300,9 +300,9 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
std::vector<VclPtr<BaseWindow> > aDeleteVec;
// remove all windows which belong to this document
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( pWin->IsDocument( _rDocument ) )
{
if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) )
@@ -345,9 +345,9 @@ void Shell::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
void Shell::onDocumentModeChanged( const ScriptDocument& _rDocument )
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( pWin->IsDocument( _rDocument ) && _rDocument.isDocument() )
pWin->SetReadOnly( _rDocument.isReadOnly() );
}
@@ -355,9 +355,9 @@ void Shell::onDocumentModeChanged( const ScriptDocument& _rDocument )
void Shell::StoreAllWindowData( bool bPersistent )
{
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
DBG_ASSERT( pWin, "PrepareClose: NULL-Pointer in Table?" );
if ( !pWin->IsSuspended() )
pWin->StoreData();
@@ -394,15 +394,16 @@ bool Shell::PrepareClose( bool bUI )
else
{
bool bCanClose = true;
- for (WindowTableIt it = aWindowTable.begin(); bCanClose && (it != aWindowTable.end()); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( !pWin->CanClose() )
{
if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
SetCurWindow( pWin, true );
bCanClose = false;
+ break;
}
}
@@ -535,9 +536,9 @@ void Shell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
m_pCurLocalizationMgr->handleBasicStarted();
}
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( nHintId == SfxHintId::BasicStart )
pWin->BasicStarted();
else
@@ -553,9 +554,9 @@ void Shell::CheckWindows()
{
bool bSetCurWindow = false;
std::vector<VclPtr<BaseWindow> > aDeleteVec;
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
aDeleteVec.emplace_back(pWin );
}
@@ -575,9 +576,9 @@ void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLib
{
bool bChangeCurWindow = pCurWin;
std::vector<VclPtr<BaseWindow> > aDeleteVec;
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
aDeleteVec.emplace_back(pWin );
}
@@ -600,9 +601,9 @@ void Shell::UpdateWindows()
if ( !m_aCurLibName.isEmpty() )
{
std::vector<VclPtr<BaseWindow> > aDeleteVec;
- for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if ( !pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName )
{
if ( pWin == pCurWin )
@@ -615,9 +616,9 @@ void Shell::UpdateWindows()
aDeleteVec.emplace_back(pWin );
}
}
- for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for (auto const& elem : aDeleteVec)
{
- RemoveWindow( *it, false, false );
+ RemoveWindow( elem, false, false );
}
}
@@ -628,15 +629,12 @@ void Shell::UpdateWindows()
// show all windows that are to be shown
ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- StartListening(*doc->getBasicManager(), DuplicateHandling::Prevent /* log on only once */);
+ StartListening(*doc.getBasicManager(), DuplicateHandling::Prevent /* log on only once */);
// libraries
- Sequence< OUString > aLibNames( doc->getLibraryNames() );
+ Sequence< OUString > aLibNames( doc.getLibraryNames() );
sal_Int32 nLibCount = aLibNames.getLength();
const OUString* pLibNames = aLibNames.getConstArray();
@@ -644,11 +642,11 @@ void Shell::UpdateWindows()
{
OUString aLibName = pLibNames[ i ];
- if ( m_aCurLibName.isEmpty() || ( *doc == m_aCurDocument && aLibName == m_aCurLibName ) )
+ if ( m_aCurLibName.isEmpty() || ( doc == m_aCurDocument && aLibName == m_aCurLibName ) )
{
// check, if library is password protected and not verified
bool bProtected = false;
- Reference< script::XLibraryContainer > xModLibContainer( doc->getLibraryContainer( E_SCRIPTS ) );
+ Reference< script::XLibraryContainer > xModLibContainer( doc.getLibraryContainer( E_SCRIPTS ) );
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
{
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
@@ -662,27 +660,27 @@ void Shell::UpdateWindows()
{
LibInfo::Item const* pLibInfoItem = nullptr;
if (ExtraData* pData = GetExtraData())
- pLibInfoItem = pData->GetLibInfo().GetInfo(*doc, aLibName);
+ pLibInfoItem = pData->GetLibInfo().GetInfo(doc, aLibName);
// modules
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
{
- StarBASIC* pLib = doc->getBasicManager()->GetLib( aLibName );
+ StarBASIC* pLib = doc.getBasicManager()->GetLib( aLibName );
if ( pLib )
StartListening(pLib->GetBroadcaster(), DuplicateHandling::Prevent /* log on only once */);
try
{
- Sequence< OUString > aModNames( doc->getObjectNames( E_SCRIPTS, aLibName ) );
+ Sequence< OUString > aModNames( doc.getObjectNames( E_SCRIPTS, aLibName ) );
sal_Int32 nModCount = aModNames.getLength();
const OUString* pModNames = aModNames.getConstArray();
for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
{
OUString aModName = pModNames[ j ];
- VclPtr<ModulWindow> pWin = FindBasWin( *doc, aLibName, aModName );
+ VclPtr<ModulWindow> pWin = FindBasWin( doc, aLibName, aModName );
if ( !pWin )
- pWin = CreateBasWin( *doc, aLibName, aModName );
+ pWin = CreateBasWin( doc, aLibName, aModName );
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
pLibInfoItem->GetCurrentType() == TYPE_MODULE )
{
@@ -697,12 +695,12 @@ void Shell::UpdateWindows()
}
// dialogs
- Reference< script::XLibraryContainer > xDlgLibContainer( doc->getLibraryContainer( E_DIALOGS ) );
+ Reference< script::XLibraryContainer > xDlgLibContainer( doc.getLibraryContainer( E_DIALOGS ) );
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
{
try
{
- Sequence< OUString > aDlgNames = doc->getObjectNames( E_DIALOGS, aLibName );
+ Sequence< OUString > aDlgNames = doc.getObjectNames( E_DIALOGS, aLibName );
sal_Int32 nDlgCount = aDlgNames.getLength();
const OUString* pDlgNames = aDlgNames.getConstArray();
@@ -711,9 +709,9 @@ void Shell::UpdateWindows()
OUString aDlgName = pDlgNames[ j ];
// this find only looks for non-suspended windows;
// suspended windows are handled in CreateDlgWin
- VclPtr<DialogWindow> pWin = FindDlgWin( *doc, aLibName, aDlgName );
+ VclPtr<DialogWindow> pWin = FindDlgWin( doc, aLibName, aDlgName );
if ( !pWin )
- pWin = CreateDlgWin( *doc, aLibName, aDlgName );
+ pWin = CreateDlgWin( doc, aLibName, aDlgName );
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
pLibInfoItem->GetCurrentType() == TYPE_DIALOG )
{
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 77b0e8829f1d..8f3c0d562782 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -217,17 +217,14 @@ StarBASIC* FindBasic( const SbxVariable* pVar )
BasicManager* FindBasicManager( StarBASIC const * pLib )
{
ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- BasicManager* pBasicMgr = doc->getBasicManager();
+ BasicManager* pBasicMgr = doc.getBasicManager();
OSL_ENSURE( pBasicMgr, "basctl::FindBasicManager: no basic manager for the document!" );
if ( !pBasicMgr )
continue;
- Sequence< OUString > aLibNames( doc->getLibraryNames() );
+ Sequence< OUString > aLibNames( doc.getLibraryNames() );
sal_Int32 nLibCount = aLibNames.getLength();
const OUString* pLibNames = aLibNames.getConstArray();
@@ -278,9 +275,9 @@ void StopBasic()
if (Shell* pShell = GetShell())
{
Shell::WindowTable& rWindows = pShell->GetWindowTable();
- for (Shell::WindowTableIt it = rWindows.begin(); it != rWindows.end(); ++it )
+ for (auto const& window : rWindows)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
// call BasicStopped manually because the Stop-Notify
// might not get through otherwise
pWin->BasicStopped();
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 7a4b14fd1ed3..7d6df0153b6c 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -150,13 +150,10 @@ void TreeListBox::ScanAllEntries()
ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- if ( doc->isAlive() )
- ScanEntry( *doc, LIBRARY_LOCATION_DOCUMENT );
+ if ( doc.isAlive() )
+ ScanEntry(doc, LIBRARY_LOCATION_DOCUMENT);
}
}
diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx
index 5fd549760bbb..abb47b1f1afa 100644
--- a/basctl/source/basicide/breakpoint.cxx
+++ b/basctl/source/basicide/breakpoint.cxx
@@ -55,7 +55,7 @@ void BreakPointList::transfer(BreakPointList & rList)
void BreakPointList::InsertSorted(BreakPoint* pNewBrk)
{
- for ( std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
+ for ( std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i != maBreakPoints.end(); ++i )
{
if ( pNewBrk->nLine <= (*i)->nLine )
{
@@ -131,7 +131,7 @@ void BreakPointList::ResetHitCount()
BreakPoint* BreakPointList::remove(BreakPoint* ptr)
{
- for ( std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
+ for ( std::vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i != maBreakPoints.end(); ++i )
{
if ( ptr == *i )
{
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index ae19f7695d4d..54195c564898 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -175,10 +175,10 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) :
void Layout::SplittedSide::dispose()
{
aSplitter.disposeAndClear();
- for (auto i = vItems.begin(); i != vItems.end(); ++i)
+ for (auto & item : vItems)
{
- i->pSplit.disposeAndClear();
- i->pWin.clear();
+ item.pSplit.disposeAndClear();
+ item.pWin.clear();
}
}
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index 528c3afafdab..2ef3c968ed34 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -777,9 +777,9 @@ void LocalizationMgr::handleBasicStopped()
DialogWindow* FindDialogWindowForEditor( DlgEditor const * pEditor )
{
Shell::WindowTable const& aWindowTable = GetShell()->GetWindowTable();
- for (Shell::WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it )
+ for (auto const& window : aWindowTable)
{
- BaseWindow* pWin = it->second;
+ BaseWindow* pWin = window.second;
if (!pWin->IsSuspended())
if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin))
{
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index fda0bd567051..69c2e4ec4b90 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -519,8 +519,8 @@ IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox, void )
}
m_pMacroBox->SetUpdateMode(false);
- for ( map< sal_uInt16, SbMethod* >::iterator it = aMacros.begin(); it != aMacros.end(); ++it )
- m_pMacroBox->InsertEntry( (*it).second->GetName() );
+ for (auto const& macro : aMacros)
+ m_pMacroBox->InsertEntry( macro.second->GetName() );
m_pMacroBox->SetUpdateMode(true);
if ( m_pMacroBox->GetEntryCount() )
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index d2fcf703cc2f..40da9f29f536 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1392,12 +1392,9 @@ void LibPage::FillListBox()
InsertListBoxEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- InsertListBoxEntry( *doc, LIBRARY_LOCATION_DOCUMENT );
+ InsertListBoxEntry( doc, LIBRARY_LOCATION_DOCUMENT );
}
}
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index 5dde5c181cdb..593ebdd3e9c9 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -134,12 +134,9 @@ namespace basctl
{
try
{
- for ( docs::Controllers::const_iterator controller = _rDocument.aControllers.begin();
- controller != _rDocument.aControllers.end();
- ++controller
- )
+ for (auto const& controller : _rDocument.aControllers)
{
- Reference< XFrame > xFrame( (*controller)->getFrame(), UNO_SET_THROW );
+ Reference< XFrame > xFrame( controller->getFrame(), UNO_SET_THROW );
Reference< XWindow2 > xContainer( xFrame->getContainerWindow(), UNO_QUERY_THROW );
if ( xContainer->isVisible() )
return true;
@@ -1058,17 +1055,14 @@ namespace basctl
docs::Documents aDocuments;
lcl_getAllModels_throw( aDocuments, false );
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- const BasicManager* pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( doc->xModel );
+ const BasicManager* pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( doc.xModel );
if ( ( pDocBasicManager != SfxApplication::GetBasicManager() )
&& ( pDocBasicManager == _pManager )
)
{
- return ScriptDocument( doc->xModel );
+ return ScriptDocument( doc.xModel );
}
}
@@ -1086,12 +1080,9 @@ namespace basctl
docs::Documents aDocuments;
lcl_getAllModels_throw( aDocuments, false );
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
- const ScriptDocument aCheck = ScriptDocument( doc->xModel );
+ const ScriptDocument aCheck = ScriptDocument( doc.xModel );
if ( _rUrlOrCaption == aCheck.getTitle()
|| _rUrlOrCaption == aCheck.m_pImpl->getURL()
)
@@ -1138,13 +1129,10 @@ namespace basctl
docs::Documents aDocuments;
lcl_getAllModels_throw( aDocuments, true /* exclude invisible */ );
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
+ for (auto const& doc : aDocuments)
{
// exclude documents without script/library containers
- ScriptDocument aDoc( doc->xModel );
+ ScriptDocument aDoc( doc.xModel );
if ( !aDoc.isValid() )
continue;
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index dc01d9abde64..0e36883665c0 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -386,9 +386,9 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
}
// create controls and insert them into drawing page
- for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt )
+ for (auto const& indexToName : aIndexToNameMap)
{
- Any aCtrl = xNameAcc->getByName( aIt->second );
+ Any aCtrl = xNameAcc->getByName( indexToName.second );
Reference< css::awt::XControlModel > xCtrlModel;
aCtrl >>= xCtrlModel;
DlgEdObj* pCtrlObj = new DlgEdObj();
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 6eecc246a849..96e03bd0690a 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -530,10 +530,9 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
{
// stop listening with all children
std::vector<DlgEdObj*> aChildList = pForm->GetChildren();
- std::vector<DlgEdObj*>::iterator aIter;
- for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter )
+ for (auto const& child : aChildList)
{
- (*aIter)->EndListening( false );
+ child->EndListening( false );
}
Reference< container::XNameAccess > xNameAcc( pForm->GetUnoControlModel() , UNO_QUERY );
@@ -613,9 +612,9 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
}
// start listening with all children
- for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter )
+ for (auto const& child : aChildList)
{
- (*aIter)->StartListening();
+ child->StartListening();
}
}
}
@@ -1318,7 +1317,6 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
bool bAdjustedPageSize = rEditor.AdjustPageSize();
SetRectFromProps();
std::vector<DlgEdObj*> const& aChildList = GetChildren();
- std::vector<DlgEdObj*>::const_iterator aIter;
if ( bAdjustedPageSize )
{
@@ -1328,9 +1326,9 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
nPageHeightIn = aPageSize.Height();
if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
{
- for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter )
+ for (auto const& child : aChildList)
{
- Reference< beans::XPropertySet > xPSet( (*aIter)->GetUnoControlModel(), UNO_QUERY );
+ Reference< beans::XPropertySet > xPSet( child->GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
@@ -1371,8 +1369,8 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
}
}
- for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter )
- (*aIter)->SetRectFromProps();
+ for (auto const& child : aChildList)
+ child->SetRectFromProps();
}
void DlgEdForm::UpdateStep()
@@ -1394,10 +1392,9 @@ void DlgEdForm::UpdateStep()
void DlgEdForm::UpdateTabIndices()
{
// stop listening with all children
- std::vector<DlgEdObj*>::iterator aIter;
- for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
+ for (auto const& child : pChildren)
{
- (*aIter)->EndListening( false );
+ child->EndListening( false );
}
Reference< css::container::XNameAccess > xNameAcc( GetUnoControlModel() , UNO_QUERY );
@@ -1429,9 +1426,9 @@ void DlgEdForm::UpdateTabIndices()
// set new tab indices
sal_Int16 nNewTabIndex = 0;
- for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt )
+ for (auto const& indexToName : aIndexToNameMap)
{
- Any aCtrl = xNameAcc->getByName( aIt->second );
+ Any aCtrl = xNameAcc->getByName( indexToName.second );
Reference< beans::XPropertySet > xPSet;
aCtrl >>= xPSet;
if ( xPSet.is() )
@@ -1445,9 +1442,9 @@ void DlgEdForm::UpdateTabIndices()
}
// start listening with all children
- for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
+ for (auto const& child : pChildren)
{
- (*aIter)->StartListening();
+ child->StartListening();
}
}
@@ -1551,12 +1548,11 @@ void DlgEdForm::NbcMove( const Size& rSize )
StartListening();
// set geometry properties of all children
- std::vector<DlgEdObj*>::iterator aIter;
- for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
+ for (auto const& child : pChildren)
{
- (*aIter)->EndListening(false);
- (*aIter)->SetPropsFromRect();
- (*aIter)->StartListening();
+ child->EndListening(false);
+ child->SetPropsFromRect();
+ child->StartListening();
}
// dialog model changed
@@ -1573,12 +1569,11 @@ void DlgEdForm::NbcResize(const Point& rRef, const Fraction& xFract, const Fract
StartListening();
// set geometry properties of all children
- std::vector<DlgEdObj*>::iterator aIter;
- for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
+ for (auto const& child : pChildren)
{
- (*aIter)->EndListening(false);
- (*aIter)->SetPropsFromRect();
- (*aIter)->StartListening();
+ child->EndListening(false);
+ child->SetPropsFromRect();
+ child->StartListening();
}
// dialog model changed