summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-01-31 11:49:59 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-01-31 15:56:25 +0100
commit8b700053cf1b91fbc728cb0b69b6efe21ab61248 (patch)
treea4e4ac2c830bc826469453d97705f44f80bfe678 /vcl
parentb843f01c5d3fbdb179cb208083938f26f28a8ed4 (diff)
Modernize a bit vcl (part5)
by using for range loops Change-Id: I52d6e6c9e1c2c321dc81d8258943a1a9a611441c Reviewed-on: https://gerrit.libreoffice.org/48987 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/window.cxx14
-rw-r--r--vcl/source/window/window2.cxx4
-rw-r--r--vcl/unx/generic/app/saldisp.cxx4
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx71
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx22
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx34
-rw-r--r--vcl/unx/generic/gdi/gcach_xpeer.cxx10
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx10
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx4
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx8
-rw-r--r--vcl/unx/generic/glyphs/glyphcache.cxx8
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx14
-rw-r--r--vcl/unx/generic/print/glyphset.cxx36
-rw-r--r--vcl/unx/generic/print/text_gfx.cxx13
-rw-r--r--vcl/unx/generic/printer/cpdmgr.cxx34
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx49
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx161
-rw-r--r--vcl/unx/gtk/gtksys.cxx14
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx148
-rw-r--r--vcl/win/gdi/gdiimpl.cxx26
-rw-r--r--vcl/win/window/salframe.cxx4
-rw-r--r--vcl/workben/vcldemo.cxx8
23 files changed, 345 insertions, 357 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index aedd405f1c04..22471ada2ff8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -387,9 +387,9 @@ void Window::dispose()
// clear mnemonic labels
std::vector<VclPtr<FixedText> > aMnemonicLabels(list_mnemonic_labels());
- for (auto aI = aMnemonicLabels.begin(); aI != aMnemonicLabels.end(); ++aI)
+ for (auto const& mnemonicLabel : aMnemonicLabels)
{
- remove_mnemonic_label(*aI);
+ remove_mnemonic_label(mnemonicLabel);
}
// hide window in order to trigger the Paint-Handling
@@ -2587,18 +2587,16 @@ void Window::EnableInput( bool bEnable, const vcl::Window* pExcludeWindow )
if( mpWindowImpl->mbFrame )
{
::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
- auto p = rList.begin();
- while( p != rList.end() )
+ for (auto const& elem : rList)
{
// Is Window in the path from this window
- if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( (*p), true ) )
+ if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( elem, true ) )
{
// Is Window not in the exclude window path or not the
// exclude window, than change the status
- if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), true ) )
- (*p)->EnableInput( bEnable );
+ if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( elem, true ) )
+ elem->EnableInput( bEnable );
}
- ++p;
}
}
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 997581a6d320..85b72726ebc2 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1669,9 +1669,9 @@ Size Window::get_preferred_size() const
{
const bool bIgnoreInHidden = pWindowImpl->m_xSizeGroup->get_ignore_hidden();
const std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
- for (auto aI = rWindows.begin(), aEnd = rWindows.end(); aI != aEnd; ++aI)
+ for (auto const& window : rWindows)
{
- const vcl::Window *pOther = *aI;
+ const vcl::Window *pOther = window;
if (pOther == this)
continue;
if (bIgnoreInHidden && !pOther->IsVisible())
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index edf8ca53246f..a8fb3c542a64 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -2307,8 +2307,8 @@ void SalDisplay::InitXinerama()
#if OSL_DEBUG_LEVEL > 1
if( m_bXinerama )
{
- for( std::vector< Rectangle >::const_iterator it = m_aXineramaScreens.begin(); it != m_aXineramaScreens.end(); ++it )
- fprintf( stderr, "Xinerama screen: %ldx%ld+%ld+%ld\n", it->GetWidth(), it->GetHeight(), it->Left(), it->Top() );
+ for (auto const& screen : m_aXineramaScreens)
+ fprintf( stderr, "Xinerama screen: %ldx%ld+%ld+%ld\n", screen.GetWidth(), screen.GetHeight(), screen.Left(), screen.Top() );
}
#endif
}
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index e0c257c45eb2..ba5bdc1d8475 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1169,14 +1169,13 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
int nFormat;
::std::list< Atom > aTypes;
convertTypeToNative( rType, selection, nFormat, aTypes );
- ::std::list< Atom >::const_iterator type_it;
Atom nSelectedType = None;
- for( type_it = aTypes.begin(); type_it != aTypes.end() && nSelectedType == None; ++type_it )
+ for (auto const& type : aTypes)
{
- for( auto const & i: rNativeTypes )
- if( i == *type_it )
+ for( auto const & nativeType: rNativeTypes )
+ if(nativeType == type)
{
- nSelectedType = *type_it;
+ nSelectedType = type;
if (nSelectedType != None)
break;
}
@@ -1900,16 +1899,15 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
{
bHandled = true;
int nCurrentTime = time( nullptr );
- std::unordered_map< Atom, IncrementalTransfer >::iterator inc_it;
// throw out aborted transfers
std::list< Atom > aTimeouts;
- for( inc_it = it->second.begin(); inc_it != it->second.end(); ++inc_it )
+ for (auto const& incrementalTransfer : it->second)
{
- if( (nCurrentTime - inc_it->second.m_nTransferStartTime) > (getSelectionTimeout()+2) )
+ if( (nCurrentTime - incrementalTransfer.second.m_nTransferStartTime) > (getSelectionTimeout()+2) )
{
- aTimeouts.push_back( inc_it->first );
+ aTimeouts.push_back( incrementalTransfer.first );
#if OSL_DEBUG_LEVEL > 1
- const IncrementalTransfer& rInc = inc_it->second;
+ const IncrementalTransfer& rInc = incrementalTransfer.second;
fprintf( stderr, "timeout on INCR transfer for window 0x%lx, property %s, type %s\n",
rInc.m_aRequestor,
OUStringToOString( getString( rInc.m_aProperty ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
@@ -1927,7 +1925,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
aTimeouts.pop_front();
}
- inc_it = it->second.find( rNotify.atom );
+ auto inc_it = it->second.find( rNotify.atom );
if( inc_it != it->second.end() )
{
IncrementalTransfer& rInc = inc_it->second;
@@ -3149,25 +3147,25 @@ void SelectionManager::startDrag(
int root_x(0), root_y(0), win_x(0), win_y(0);
unsigned int mask(0);
- std::unordered_map< ::Window, DropTargetEntry >::const_iterator it;
- it = m_aDropTargets.begin();
- while( it != m_aDropTargets.end() )
+ bool bPointerFound = false;
+ for (auto const& dropTarget : m_aDropTargets)
{
- if( XQueryPointer( m_pDisplay, it->second.m_aRootWindow,
+ if( XQueryPointer( m_pDisplay, dropTarget.second.m_aRootWindow,
&aRoot, &aParent,
&root_x, &root_y,
&win_x, &win_y,
&mask ) )
{
- aParent = it->second.m_aRootWindow;
+ aParent = dropTarget.second.m_aRootWindow;
+ aRoot = aParent;
+ bPointerFound = true;
break;
}
- ++it;
}
// don't start DnD if there is none of our windows on the same screen as
// the pointer or if no mouse button is pressed
- if( it == m_aDropTargets.end() || (mask & (Button1Mask|Button2Mask|Button3Mask)) == 0 )
+ if( !bPointerFound || (mask & (Button1Mask|Button2Mask|Button3Mask)) == 0 )
{
aGuard.clear();
if( listener.is() )
@@ -3180,7 +3178,6 @@ void SelectionManager::startDrag(
// the drag (actually this is a poor substitute for an "endDrag"
// method ).
m_aDragSourceWindow = None;
- aParent = aRoot = it->second.m_aRootWindow;
do
{
XTranslateCoordinates( m_pDisplay, aRoot, aParent, root_x, root_y, &win_x, &win_y, &aChild );
@@ -3199,7 +3196,7 @@ void SelectionManager::startDrag(
fprintf( stderr, "try to grab pointer ... " );
#endif
int nPointerGrabSuccess =
- XGrabPointer( m_pDisplay, it->second.m_aRootWindow, True,
+ XGrabPointer( m_pDisplay, aRoot, True,
DRAG_EVENT_MASK,
GrabModeAsync, GrabModeAsync,
None,
@@ -3222,7 +3219,7 @@ void SelectionManager::startDrag(
{
vcl_sal::getSalDisplay(GetGenericUnixSalData())->CaptureMouse( nullptr );
nPointerGrabSuccess =
- XGrabPointer( m_pDisplay, it->second.m_aRootWindow, True,
+ XGrabPointer( m_pDisplay, aRoot, True,
DRAG_EVENT_MASK,
GrabModeAsync, GrabModeAsync,
None,
@@ -3238,7 +3235,7 @@ void SelectionManager::startDrag(
fprintf( stderr, "try to grab keyboard ... " );
#endif
int nKeyboardGrabSuccess =
- XGrabKeyboard( m_pDisplay, it->second.m_aRootWindow, True,
+ XGrabKeyboard( m_pDisplay, aRoot, True,
GrabModeAsync, GrabModeAsync, CurrentTime );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "%d\n", nKeyboardGrabSuccess );
@@ -3274,14 +3271,12 @@ void SelectionManager::startDrag(
requestOwnership( m_nXdndSelection );
::std::list< Atom > aConversions;
- ::std::list< Atom >::const_iterator type_it;
getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection );
- int nTypes = aConversions.size();
- Atom* pTypes = static_cast<Atom*>(alloca( sizeof(Atom)*nTypes ));
- type_it = aConversions.begin();
- for( int n = 0; n < nTypes; n++, ++type_it )
- pTypes[n] = *type_it;
+ Atom* pTypes = static_cast<Atom*>(alloca( sizeof(Atom)*aConversions.size() ));
+ int nTypes = 0;
+ for (auto const& conversion : aConversions)
+ pTypes[nTypes++] = conversion;
XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes );
@@ -3463,17 +3458,15 @@ void SelectionManager::transferablesFlavorsChanged()
osl::MutexGuard aGuard(m_aMutex);
m_aDragFlavors = m_xDragSourceTransferable->getTransferDataFlavors();
- int i;
std::list< Atom > aConversions;
- std::list< Atom >::const_iterator type_it;
getNativeTypeList( m_aDragFlavors, aConversions, m_nXdndSelection );
- int nTypes = aConversions.size();
Atom* pTypes = static_cast<Atom*>(alloca( sizeof(Atom)*aConversions.size() ));
- for( i = 0, type_it = aConversions.begin(); type_it != aConversions.end(); ++type_it, i++ )
- pTypes[i] = *type_it;
+ int nTypes = 0;
+ for (auto const& conversion : aConversions)
+ pTypes[nTypes++] = conversion;
XChangeProperty( m_pDisplay, m_aWindow, m_nXdndTypeList, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes );
if( m_aCurrentDropWindow == None || m_nCurrentProtocolVersion < 0 )
@@ -3667,16 +3660,16 @@ void SelectionManager::run( void* pThis )
osl::ClearableMutexGuard aGuard(This->m_aMutex);
std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList;
- for( std::unordered_map< Atom, Selection* >::iterator it = This->m_aSelections.begin(); it != This->m_aSelections.end(); ++it )
+ for (auto const& selection : This->m_aSelections)
{
- if( it->first != This->m_nXdndSelection && ! it->second->m_bOwner )
+ if( selection.first != This->m_nXdndSelection && ! selection.second->m_bOwner )
{
- ::Window aOwner = XGetSelectionOwner( This->m_pDisplay, it->first );
- if( aOwner != it->second->m_aLastOwner )
+ ::Window aOwner = XGetSelectionOwner( This->m_pDisplay, selection.first );
+ if( aOwner != selection.second->m_aLastOwner )
{
- it->second->m_aLastOwner = aOwner;
+ selection.second->m_aLastOwner = aOwner;
std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > >
- aKeep( it->second->m_pAdaptor, it->second->m_pAdaptor->getReference() );
+ aKeep( selection.second->m_pAdaptor, selection.second->m_pAdaptor->getReference() );
aChangeList.push_back( aKeep );
}
}
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 59acfa5841b0..639dc37591ae 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -269,16 +269,15 @@ namespace
sFullMatch += OString('-');
sFullMatch += OUStringToOString(rLangTag.getCountry().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8);
- std::vector<lang_and_element>::const_iterator aEnd = elements.end();
bool alreadyclosematch = false;
bool found_fallback_englishname = false;
- for( std::vector<lang_and_element>::const_iterator aIter = elements.begin(); aIter != aEnd; ++aIter )
+ for (auto const& element : elements)
{
- const char *pLang = reinterpret_cast<const char*>(aIter->first);
+ const char *pLang = reinterpret_cast<const char*>(element.first);
if( sFullMatch == pLang)
{
// both language and country match
- candidate = aIter->second;
+ candidate = element.second;
break;
}
else if( alreadyclosematch )
@@ -290,7 +289,7 @@ namespace
else if( sLangMatch == pLang)
{
// just the language matches
- candidate = aIter->second;
+ candidate = element.second;
alreadyclosematch = true;
}
else if( found_fallback_englishname )
@@ -303,7 +302,7 @@ namespace
{
// select a fallback candidate of the first english element
// name
- candidate = aIter->second;
+ candidate = element.second;
found_fallback_englishname = true;
}
}
@@ -315,10 +314,9 @@ namespace
void FontCfgWrapper::cacheLocalizedFontNames(const FcChar8 *origfontname, const FcChar8 *bestfontname,
const std::vector< lang_and_element > &lang_and_elements)
{
- std::vector<lang_and_element>::const_iterator aEnd = lang_and_elements.end();
- for (std::vector<lang_and_element>::const_iterator aIter = lang_and_elements.begin(); aIter != aEnd; ++aIter)
+ for (auto const& element : lang_and_elements)
{
- const char *candidate = reinterpret_cast<const char*>(aIter->second);
+ const char *candidate = reinterpret_cast<const char*>(element.second);
if (rtl_str_compare(candidate, reinterpret_cast<const char*>(bestfontname)) != 0)
m_aFontNameToLocalized[OString(candidate)] = OString(reinterpret_cast<const char*>(bestfontname));
}
@@ -585,11 +583,11 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
// a collection entry, get the correct index
if( eIndexRes == FcResultMatch && nCollectionEntry != -1 )
{
- for (auto it = aFonts.begin(); it != aFonts.end(); ++it)
+ for (auto & font : aFonts)
{
- if( (*it)->m_nCollectionEntry == nCollectionEntry )
+ if( font->m_nCollectionEntry == nCollectionEntry )
{
- xUpdate = std::move(*it);
+ xUpdate = std::move(font);
break;
}
}
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 0f14242a5150..5288fead1298 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -154,8 +154,8 @@ PrintFontManager::~PrintFontManager()
{
m_aFontInstallerTimer.Stop();
deinitFontconfig();
- for( std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
- delete (*it).second;
+ for (auto const& font : m_aFonts)
+ delete font.second;
}
OString PrintFontManager::getDirectory( int nAtom ) const
@@ -195,10 +195,10 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName )
std::vector<std::unique_ptr<PrintFont>> aNewFonts = analyzeFontFile(nDirID, aName);
if (!aNewFonts.empty())
{
- for (auto it = aNewFonts.begin(); it != aNewFonts.end(); ++it)
+ for (auto & font : aNewFonts)
{
fontID nFontId = m_nNextFontID++;
- m_aFonts[nFontId] = it->release();
+ m_aFonts[nFontId] = font.release();
m_aFontFileToFontID[ aName ].insert( nFontId );
aFontIds.push_back(nFontId);
}
@@ -314,15 +314,19 @@ fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile, i
if( set_it == m_aFontFileToFontID.end() )
return nID;
- for( ::std::set< fontID >::const_iterator font_it = set_it->second.begin(); font_it != set_it->second.end() && ! nID; ++font_it )
+ for (auto const& elem : set_it->second)
{
- std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it );
+ std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find(elem);
if( it == m_aFonts.end() )
continue;
PrintFont* const pFont = (*it).second;
if (pFont->m_nDirectory == nDirID &&
pFont->m_aFontFile == rFontFile && pFont->m_nCollectionEntry == nFaceIndex)
- nID = it->first;
+ {
+ nID = it->first;
+ if (nID)
+ break;
+ }
}
return nID;
@@ -336,15 +340,15 @@ std::vector<fontID> PrintFontManager::findFontFileIDs( int nDirID, const OString
if( set_it == m_aFontFileToFontID.end() )
return aIds;
- for( ::std::set< fontID >::const_iterator font_it = set_it->second.begin(); font_it != set_it->second.end(); ++font_it )
+ for (auto const& elem : set_it->second)
{
- std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find( *font_it );
+ std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.find(elem);
if( it == m_aFonts.end() )
continue;
- PrintFont* const pFont = (*it).second;
- if (pFont->m_nDirectory == nDirID &&
- pFont->m_aFontFile == rFontFile)
- aIds.push_back(it->first);
+ PrintFont* const pFont = (*it).second;
+ if (pFont->m_nDirectory == nDirID &&
+ pFont->m_aFontFile == rFontFile)
+ aIds.push_back(it->first);
}
return aIds;
@@ -713,8 +717,8 @@ void PrintFontManager::initialize()
// gtk-fontconfig-timestamp changes to reflect new font installed and
// PrintFontManager::initialize called again
{
- for( std::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
- delete (*it).second;
+ for (auto const& font : m_aFonts)
+ delete font.second;
m_nNextFontID = 1;
m_aFonts.clear();
}
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 31195d6fe752..172fd4e45721 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -41,12 +41,12 @@ X11GlyphCache::~X11GlyphCache()
for( int i = 0; i < nMaxScreens; i++ )
{
SalDisplay::RenderEntryMap& rMap = pSalDisp->GetRenderEntries( SalX11Screen (i) );
- for( SalDisplay::RenderEntryMap::iterator it = rMap.begin(); it != rMap.end(); ++it )
+ for (auto const& elem : rMap)
{
- if( it->second.m_aPixmap )
- ::XFreePixmap( pX11Disp, it->second.m_aPixmap );
- if( it->second.m_aPicture )
- rRenderPeer.FreePicture( it->second.m_aPicture );
+ if( elem.second.m_aPixmap )
+ ::XFreePixmap( pX11Disp, elem.second.m_aPixmap );
+ if( elem.second.m_aPicture )
+ rRenderPeer.FreePicture( elem.second.m_aPicture );
}
rMap.clear();
}
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 5eed1f59232a..a9b3cfe3945f 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1010,20 +1010,20 @@ bool X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
RectangleVector aRectangles;
i_rClip.GetRegionRectangles(aRectangles);
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for (auto const& rectangle : aRectangles)
{
- const long nW(aRectIter->GetWidth());
+ const long nW(rectangle.GetWidth());
if(nW)
{
- const long nH(aRectIter->GetHeight());
+ const long nH(rectangle.GetHeight());
if(nH)
{
XRectangle aRect;
- aRect.x = static_cast<short>(aRectIter->Left());
- aRect.y = static_cast<short>(aRectIter->Top());
+ aRect.x = static_cast<short>(rectangle.Left());
+ aRect.y = static_cast<short>(rectangle.Top());
aRect.width = static_cast<unsigned short>(nW);
aRect.height = static_cast<unsigned short>(nH);
XUnionRectWithRegion(&aRect, mrParent.mpClipRegion, mrParent.mpClipRegion);
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 1ac940050077..be6f42af6eff 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -692,9 +692,9 @@ void X11SalGraphics::clipRegion(cairo_t* cr)
if (!aRectangles.empty())
{
- for (RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for (auto const& rectangle : aRectangles)
{
- cairo_rectangle(cr, aRectIter->Left(), aRectIter->Top(), aRectIter->GetWidth(), aRectIter->GetHeight());
+ cairo_rectangle(cr, rectangle.Left(), rectangle.Top(), rectangle.GetWidth(), rectangle.GetHeight());
}
cairo_clip(cr);
}
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index cde05411a659..65a9e4f14a0b 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -313,18 +313,18 @@ void FreetypeManager::AddFontFile( const OString& rNormalizedName,
void FreetypeManager::AnnounceFonts( PhysicalFontCollection* pToAdd ) const
{
- for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it )
+ for (auto const& font : maFontList)
{
- FreetypeFontInfo* pFreetypeFontInfo = it->second;
+ FreetypeFontInfo* pFreetypeFontInfo = font.second;
pFreetypeFontInfo->AnnounceFont( pToAdd );
}
}
void FreetypeManager::ClearFontList( )
{
- for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it )
+ for (auto const& font : maFontList)
{
- FreetypeFontInfo* pFreetypeFontInfo = it->second;
+ FreetypeFontInfo* pFreetypeFontInfo = font.second;
delete pFreetypeFontInfo;
}
maFontList.clear();
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index fa5bfb6a5de1..4029d4bdf7bc 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -49,9 +49,9 @@ GlyphCache::~GlyphCache()
void GlyphCache::InvalidateAllGlyphs()
{
- for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it )
+ for (auto const& font : maFontList)
{
- FreetypeFont* pFreetypeFont = it->second;
+ FreetypeFont* pFreetypeFont = font.second;
// free all pFreetypeFont related data
pFreetypeFont->GarbageCollect( mnLruIndex+0x10000000 );
delete pFreetypeFont;
@@ -63,9 +63,9 @@ void GlyphCache::InvalidateAllGlyphs()
void GlyphCache::ClearFontOptions()
{
- for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it )
+ for (auto const& font : maFontList)
{
- FreetypeFont* pFreetypeFont = it->second;
+ FreetypeFont* pFreetypeFont = font.second;
// free demand-loaded FontConfig related data
pFreetypeFont->ClearFontOptions();
}
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 617eedc46eb6..beb1781f39b8 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -430,12 +430,12 @@ void SalGenericInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
::std::vector< OUString > aPrinters;
rManager.listPrinters( aPrinters );
- for( ::std::vector< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it )
+ for (auto const& printer : aPrinters)
{
- const PrinterInfo& rInfo( rManager.getPrinterInfo( *it ) );
+ const PrinterInfo& rInfo( rManager.getPrinterInfo(printer) );
// create new entry
SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
- pInfo->maPrinterName = *it;
+ pInfo->maPrinterName = printer;
pInfo->maDriver = rInfo.m_aDriverName;
pInfo->maLocation = rInfo.m_aLocation;
pInfo->maComment = rInfo.m_aComment;
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index d53d68756aa9..3f9b12257fee 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -294,19 +294,19 @@ bool GenPspGraphics::setClipRegion( const vcl::Region& i_rClip )
i_rClip.GetRegionRectangles(aRectangles);
m_pPrinterGfx->BeginSetClipRegion();
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for (auto const& rectangle : aRectangles)
{
- const long nW(aRectIter->GetWidth());
+ const long nW(rectangle.GetWidth());
if(nW)
{
- const long nH(aRectIter->GetHeight());
+ const long nH(rectangle.GetHeight());
if(nH)
{
m_pPrinterGfx->UnionClipRegion(
- aRectIter->Left(),
- aRectIter->Top(),
+ rectangle.Left(),
+ rectangle.Top(),
nW,
nH);
}
@@ -691,11 +691,11 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti
if( aFontIds.empty() )
return false;
- for (std::vector<psp::fontID>::iterator aI = aFontIds.begin(), aEnd = aFontIds.end(); aI != aEnd; ++aI)
+ for (auto const& elem : aFontIds)
{
// prepare font data
psp::FastPrintFontInfo aInfo;
- rMgr.getFontFastInfo( *aI, aInfo );
+ rMgr.getFontFastInfo( elem, aInfo );
aInfo.m_aFamilyName = rFontName;
// inform glyph cache of new font
diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx
index 5e1ff90aa737..f90053bf9c87 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -76,23 +76,21 @@ GlyphSet::LookupGlyphID (
sal_Int32* nOutGlyphSetID
)
{
- glyph_list_t::iterator aGlyphSet;
- sal_Int32 nGlyphSetID;
+ sal_Int32 nGlyphSetID = 1;
// loop through all the font subsets
- for (aGlyphSet = maGlyphList.begin(), nGlyphSetID = 1;
- aGlyphSet != maGlyphList.end();
- ++aGlyphSet, nGlyphSetID++)
+ for (auto const& glyph : maGlyphList)
{
// check every subset if it contains the queried unicode char
- glyph_map_t::const_iterator aGlyph = (*aGlyphSet).find (nGlyph);
- if (aGlyph != (*aGlyphSet).end())
+ glyph_map_t::const_iterator aGlyph = glyph.find (nGlyph);
+ if (aGlyph != glyph.end())
{
// success: found the glyph id, return the mapped glyphid and the glyphsetid
*nOutGlyphSetID = nGlyphSetID;
- *nOutGlyphID = (*aGlyph).second;
+ *nOutGlyphID = aGlyph->second;
return true;
}
+ ++nGlyphSetID;
}
*nOutGlyphSetID = -1;
@@ -267,32 +265,32 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42
sal_uInt16 pTTGlyphMapping[256];
// loop through all the font glyph subsets
- sal_Int32 nGlyphSetID;
- glyph_list_t::iterator aGlyphSet;
- for (aGlyphSet = maGlyphList.begin(), nGlyphSetID = 1;
- aGlyphSet != maGlyphList.end();
- ++aGlyphSet, nGlyphSetID++)
+ sal_Int32 nGlyphSetID = 1;
+ for (auto const& glyph : maGlyphList)
{
- if ((*aGlyphSet).empty())
+ if (glyph.empty())
+ {
+ ++nGlyphSetID;
continue;
+ }
// loop through all the glyphs in the subset
- glyph_map_t::const_iterator aGlyph;
sal_Int32 n = 0;
- for (aGlyph = (*aGlyphSet).begin(); aGlyph != (*aGlyphSet).end(); ++aGlyph)
+ for (auto const& elem : glyph)
{
- pTTGlyphMapping [n] = (*aGlyph).first;
- pEncoding [n] = (*aGlyph).second;
+ pTTGlyphMapping [n] = elem.first;
+ pEncoding [n] = elem.second;
n++;
}
// create the current subset
OString aGlyphSetName = GetGlyphSetName(nGlyphSetID);
fprintf( pTmpFile, "%%%%BeginResource: font %s\n", aGlyphSetName.getStr() );
- CreatePSUploadableFont( pTTFont, pTmpFile, aGlyphSetName.getStr(), (*aGlyphSet).size(),
+ CreatePSUploadableFont( pTTFont, pTmpFile, aGlyphSetName.getStr(), glyph.size(),
pTTGlyphMapping, pEncoding, bAllowType42 );
fprintf( pTmpFile, "%%%%EndResource\n" );
rSuppliedFonts.push_back( aGlyphSetName );
+ ++nGlyphSetID;
}
// copy the file into the page header
diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx
index ef71ac409e2b..cf312cbcc9fe 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -66,17 +66,18 @@ void PrinterGfx::drawGlyph(const Point& rPoint,
// draw the string
// search for a glyph set matching the set font
- std::vector< GlyphSet >::iterator aIter;
- for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter)
- if ( ((*aIter).GetFontID() == mnFontID)
- && ((*aIter).IsVertical() == mbTextVertical))
+ bool bGlyphFound = false;
+ for (auto & elem : maPS3Font)
+ if ( (elem.GetFontID() == mnFontID)
+ && (elem.IsVertical() == mbTextVertical))
{
- (*aIter).DrawGlyph (*this, rPoint, aGlyphId, nDelta);
+ elem.DrawGlyph (*this, rPoint, aGlyphId, nDelta);
+ bGlyphFound = true;
break;
}
// not found ? create a new one
- if (aIter == maPS3Font.end())
+ if (!bGlyphFound)
{
maPS3Font.emplace_back(mnFontID, mbTextVertical);
maPS3Font.back().DrawGlyph (*this, rPoint, aGlyphId, nDelta);
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx
index f628dc3aa664..1e221d9547cd 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -59,7 +59,8 @@ void CPDManager::onNameAcquired (GDBusConnection *connection,
CPDManager* current = static_cast<CPDManager*>(user_data);
std::vector<std::pair<std::string, gchar*>> backends = current->getTempBackends();
- for (std::vector<std::pair<std::string, gchar*>>::iterator it = backends.begin(); it != backends.end(); ++it) {
+ for (auto const& backend : backends)
+ {
GDBusProxy *proxy;
// Get Interface for introspection
g_file_get_contents (BACKEND_INTERFACE, &contents, nullptr, nullptr);
@@ -67,12 +68,12 @@ void CPDManager::onNameAcquired (GDBusConnection *connection,
proxy = g_dbus_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_NONE,
introspection_data->interfaces[0],
- it->first.c_str(),
- it->second,
+ backend.first.c_str(),
+ backend.second,
"org.openprinting.PrintBackend",
nullptr,
nullptr);
- g_free(it->second);
+ g_free(backend.second);
g_assert (proxy != nullptr);
g_dbus_proxy_call(proxy, "ActivateBackend",
nullptr,
@@ -296,16 +297,13 @@ CPDManager::~CPDManager()
g_dbus_connection_close_sync (m_pConnection,
nullptr,
nullptr);
- std::unordered_map<std::string, GDBusProxy *>::iterator it = m_pBackends.begin();
- for(; it != m_pBackends.end(); ++it)
+ for (auto const& backend : m_pBackends)
{
- g_object_unref(it->second);
+ g_object_unref(backend.second);
}
- std::unordered_map<OUString, CPDPrinter *>::iterator dest_it =
- m_aCPDDestMap.begin();
- for(; dest_it != m_aCPDDestMap.end(); ++dest_it)
+ for (auto const& backend : m_aCPDDestMap)
{
- free(dest_it->second);
+ free(backend.second);
}
#endif
}
@@ -433,21 +431,21 @@ const PPDParser* CPDManager::createCPDParser( const OUString& rPrinter )
PPDContext& rContext = m_aDefaultContexts[ aPrinter ];
rContext.setParser( pNewParser );
setDefaultPaper( rContext );
- std::vector<PPDKey*>::iterator keyit;
- std::vector<OUString>::iterator defit;
- for (keyit = keys.begin(), defit = default_values.begin(); keyit != keys.end(); keyit++, defit++ ) {
- pKey = *keyit;
- const PPDValue* p1Value = pKey->getValue( *defit );
+ std::vector<OUString>::iterator defit = default_values.begin();
+ for (auto const& key : keys)
+ {
+ const PPDValue* p1Value = key->getValue( *defit );
if( p1Value )
{
- if( p1Value != pKey->getDefaultValue() )
+ if( p1Value != key->getDefaultValue() )
{
- rContext.setValue( pKey, p1Value, true );
+ rContext.setValue( key, p1Value, true );
SAL_INFO("vcl.unx.print", "key " << pKey->getKey() << " is set to " << *defit);
}
else
SAL_INFO("vcl.unx.print", "key " << pKey->getKey() << " is defaulted to " << *defit);
}
+ ++defit;
}
rInfo.m_pParser = pNewParser;
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 8de510de902b..e4c4a8be33cf 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -445,9 +445,9 @@ void PPDParser::initPPDFiles(PPDCache &rPPDCache)
// check installation directories
std::vector< OUString > aPathList;
psp::getPrinterPathList( aPathList, PRINTER_PPDDIR );
- for( std::vector< OUString >::const_iterator ppd_it = aPathList.begin(); ppd_it != aPathList.end(); ++ppd_it )
+ for (auto const& path : aPathList)
{
- INetURLObject aPPDDir( *ppd_it, INetProtocol::File, INetURLObject::EncodeMechanism::All );
+ INetURLObject aPPDDir( path, INetProtocol::File, INetURLObject::EncodeMechanism::All );
scanPPDDir( aPPDDir.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
}
if( rPPDCache.pAllPPDFiles->find( OUString( "SGENPRT" ) ) == rPPDCache.pAllPPDFiles->end() )
@@ -776,9 +776,9 @@ PPDParser::PPDParser( const OUString& rFile ) :
#if OSL_DEBUG_LEVEL > 1
SAL_INFO("vcl.unx.print", "acquired " << m_aKeys.size()
<< " Keys from PPD " << m_aFile << ":");
- for( PPDParser::hash_type::const_iterator it = m_aKeys.begin(); it != m_aKeys.end(); ++it )
+ for (auto const& key : m_aKeys)
{
- const PPDKey* pKey = it->second;
+ const PPDKey* pKey = key.second;
char const* pSetupType = "<unknown>";
switch( pKey->m_eSetupType )
{
@@ -815,12 +815,12 @@ PPDParser::PPDParser( const OUString& rFile ) :
}
SAL_INFO("vcl.unx.print",
"constraints: (" << m_aConstraints.size() << " found)");
- for( std::vector< PPDConstraint >::const_iterator cit = m_aConstraints.begin(); cit != m_aConstraints.end(); ++cit )
+ for (auto const& constraint : m_aConstraints)
{
- SAL_INFO("vcl.unx.print", "*\"" << cit->m_pKey1->getKey() << "\" \""
- << (cit->m_pOption1 ? cit->m_pOption1->m_aOption : "<nil>")
- << "\" *\"" << cit->m_pKey2->getKey() << "\" \""
- << (cit->m_pOption2 ? cit->m_pOption2->m_aOption : "<nil>")
+ SAL_INFO("vcl.unx.print", "*\"" << constraint.m_pKey1->getKey() << "\" \""
+ << (constraint.m_pOption1 ? constraint.m_pOption1->m_aOption : "<nil>")
+ << "\" *\"" << constraint.m_pKey2->getKey() << "\" \""
+ << (constraint.m_pOption2 ? constraint.m_pOption2->m_aOption : "<nil>")
<< "\"");
}
#endif
@@ -883,8 +883,8 @@ PPDParser::PPDParser( const OUString& rFile ) :
PPDParser::~PPDParser()
{
- for( PPDParser::hash_type::iterator it = m_aKeys.begin(); it != m_aKeys.end(); ++it )
- delete it->second;
+ for (auto const& key : m_aKeys)
+ delete key.second;
m_pTranslator.reset();
}
@@ -1815,16 +1815,16 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
return true;
const ::std::vector< PPDParser::PPDConstraint >& rConstraints( m_pParser->getConstraints() );
- for( ::std::vector< PPDParser::PPDConstraint >::const_iterator it = rConstraints.begin(); it != rConstraints.end(); ++it )
+ for (auto const& constraint : rConstraints)
{
- const PPDKey* pLeft = it->m_pKey1;
- const PPDKey* pRight = it->m_pKey2;
+ const PPDKey* pLeft = constraint.m_pKey1;
+ const PPDKey* pRight = constraint.m_pKey2;
if( ! pLeft || ! pRight || ( pKey != pLeft && pKey != pRight ) )
continue;
const PPDKey* pOtherKey = pKey == pLeft ? pRight : pLeft;
- const PPDValue* pOtherKeyOption = pKey == pLeft ? it->m_pOption2 : it->m_pOption1;
- const PPDValue* pKeyOption = pKey == pLeft ? it->m_pOption1 : it->m_pOption2;
+ const PPDValue* pOtherKeyOption = pKey == pLeft ? constraint.m_pOption2 : constraint.m_pOption1;
+ const PPDValue* pKeyOption = pKey == pLeft ? constraint.m_pOption1 : constraint.m_pOption2;
// syntax *Key1 option1 *Key2 option2
if( pKeyOption && pOtherKeyOption )
@@ -1887,15 +1887,14 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
rBytes = 0;
if( m_aCurrentValues.empty() )
return nullptr;
- hash_type::const_iterator it;
- for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it )
+ for (auto const& elem : m_aCurrentValues)
{
- OString aCopy(OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252));
+ OString aCopy(OUStringToOString(elem.first->getKey(), RTL_TEXTENCODING_MS_1252));
rBytes += aCopy.getLength();
rBytes += 1; // for ':'
- if( it->second )
+ if( elem.second )
{
- aCopy = OUStringToOString(it->second->m_aOption, RTL_TEXTENCODING_MS_1252);
+ aCopy = OUStringToOString(elem.second->m_aOption, RTL_TEXTENCODING_MS_1252);
rBytes += aCopy.getLength();
}
else
@@ -1906,15 +1905,15 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
char* pBuffer = new char[ rBytes ];
memset( pBuffer, 0, rBytes );
char* pRun = pBuffer;
- for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it )
+ for (auto const& elem : m_aCurrentValues)
{
- OString aCopy(OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252));
+ OString aCopy(OUStringToOString(elem.first->getKey(), RTL_TEXTENCODING_MS_1252));
int nBytes = aCopy.getLength();
memcpy( pRun, aCopy.getStr(), nBytes );
pRun += nBytes;
*pRun++ = ':';
- if( it->second )
- aCopy = OUStringToOString(it->second->m_aOption, RTL_TEXTENCODING_MS_1252);
+ if( elem.second )
+ aCopy = OUStringToOString(elem.second->m_aOption, RTL_TEXTENCODING_MS_1252);
else
aCopy = "*nil";
nBytes = aCopy.getLength();
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 9a6c7907cd5f..35ac2902fc37 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -131,26 +131,34 @@ PrinterInfoManager::~PrinterInfoManager()
bool PrinterInfoManager::checkPrintersChanged( bool bWait )
{
// check if files were created, deleted or modified since initialize()
- ::std::vector< WatchFile >::const_iterator it;
bool bChanged = false;
- for( it = m_aWatchFiles.begin(); it != m_aWatchFiles.end() && ! bChanged; ++it )
+ for (auto const& watchFile : m_aWatchFiles)
{
DirectoryItem aItem;
- if( DirectoryItem::get( it->m_aFilePath, aItem ) )
+ if( DirectoryItem::get( watchFile.m_aFilePath, aItem ) )
{
- if( it->m_aModified.Seconds != 0 )
+ if( watchFile.m_aModified.Seconds != 0 )
+ {
bChanged = true; // file probably has vanished
+ break;
+ }
}
else
{
FileStatus aStatus( osl_FileStatus_Mask_ModifyTime );
if( aItem.getFileStatus( aStatus ) )
+ {
bChanged = true; // unlikely but not impossible
+ break;
+ }
else
{
TimeValue aModified = aStatus.getModifyTime();
- if( aModified.Seconds != it->m_aModified.Seconds )
+ if( aModified.Seconds != watchFile.m_aModified.Seconds )
+ {
bChanged = true;
+ break;
+ }
}
}
}
@@ -204,10 +212,9 @@ void PrinterInfoManager::initialize()
std::vector< OUString > aDirList;
psp::getPrinterPathList( aDirList, nullptr );
- std::vector< OUString >::const_iterator print_dir_it;
- for( print_dir_it = aDirList.begin(); print_dir_it != aDirList.end(); ++print_dir_it )
+ for (auto const& printDir : aDirList)
{
- INetURLObject aFile( *print_dir_it, INetProtocol::File, INetURLObject::EncodeMechanism::All );
+ INetURLObject aFile( printDir, INetProtocol::File, INetURLObject::EncodeMechanism::All );
aFile.Append( PRINT_FILENAME );
Config aConfig( aFile.PathToFileName() );
if( aConfig.HasGroup( GLOBAL_DEFAULTS_GROUP ) )
@@ -272,9 +279,9 @@ void PrinterInfoManager::initialize()
setDefaultPaper( m_aGlobalDefaults.m_aContext );
// now collect all available printers
- for( print_dir_it = aDirList.begin(); print_dir_it != aDirList.end(); ++print_dir_it )
+ for (auto const& printDir : aDirList)
{
- INetURLObject aDir( *print_dir_it, INetProtocol::File, INetURLObject::EncodeMechanism::All );
+ INetURLObject aDir( printDir, INetProtocol::File, INetURLObject::EncodeMechanism::All );
INetURLObject aFile( aDir );
aFile.Append( PRINT_FILENAME );
@@ -507,10 +514,10 @@ void PrinterInfoManager::initialize()
m_pQueueInfo->getSystemQueues( m_aSystemPrintQueues );
m_pQueueInfo.reset();
}
- for( ::std::vector< SystemPrintQueue >::iterator it = m_aSystemPrintQueues.begin(); it != m_aSystemPrintQueues.end(); ++it )
+ for (auto const& printQueue : m_aSystemPrintQueues)
{
OUString aPrinterName( "<" );
- aPrinterName += it->m_aQueue;
+ aPrinterName += printQueue.m_aQueue;
aPrinterName += ">";
if( m_aPrinters.find( aPrinterName ) != m_aPrinters.end() )
@@ -518,7 +525,7 @@ void PrinterInfoManager::initialize()
continue;
OUString aCmd( m_aSystemPrintCommand );
- aCmd = aCmd.replaceAll( "(PRINTER)", it->m_aQueue );
+ aCmd = aCmd.replaceAll( "(PRINTER)", printQueue.m_aQueue );
Printer aPrinter;
@@ -526,8 +533,8 @@ void PrinterInfoManager::initialize()
aPrinter.m_aInfo = aMergeInfo;
aPrinter.m_aInfo.m_aPrinterName = aPrinterName;
aPrinter.m_aInfo.m_aCommand = aCmd;
- aPrinter.m_aInfo.m_aComment = it->m_aComment;
- aPrinter.m_aInfo.m_aLocation = it->m_aLocation;
+ aPrinter.m_aInfo.m_aComment = printQueue.m_aComment;
+ aPrinter.m_aInfo.m_aLocation = printQueue.m_aLocation;
aPrinter.m_bModified = false;
aPrinter.m_aGroup = OUStringToOString(aPrinterName, aEncoding); //provide group name in case user makes this one permanent
@@ -537,10 +544,9 @@ void PrinterInfoManager::initialize()
void PrinterInfoManager::listPrinters( ::std::vector< OUString >& rVector ) const
{
- std::unordered_map< OUString, Printer >::const_iterator it;
rVector.clear();
- for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
- rVector.push_back( it->first );
+ for (auto const& printer : m_aPrinters)
+ rVector.push_back(printer.first);
}
const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter ) const
@@ -572,11 +578,11 @@ bool PrinterInfoManager::writePrinterConfig()
std::unordered_map< OUString, int > rofiles;
std::unordered_map< OUString, Config* >::iterator file_it;
- for( ::std::vector< WatchFile >::const_iterator wit = m_aWatchFiles.begin(); wit != m_aWatchFiles.end(); ++wit )
+ for (auto const& watchFile : m_aWatchFiles)
{
- if( checkWriteability( wit->m_aFilePath ) )
+ if( checkWriteability( watchFile.m_aFilePath ) )
{
- files[ wit->m_aFilePath ] = new Config( wit->m_aFilePath );
+ files[ watchFile.m_aFilePath ] = new Config( watchFile.m_aFilePath );
break;
}
}
@@ -587,10 +593,9 @@ bool PrinterInfoManager::writePrinterConfig()
Config* pGlobal = files.begin()->second;
pGlobal->SetGroup( GLOBAL_DEFAULTS_GROUP );
- std::unordered_map< OUString, Printer >::iterator it;
- for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
+ for (auto & printer : m_aPrinters)
{
- if( ! it->second.m_bModified )
+ if( ! printer.second.m_bModified )
// printer was not changed, do nothing
continue;
@@ -599,24 +604,24 @@ bool PrinterInfoManager::writePrinterConfig()
bool bAutoQueue = false;
while( nIndex != -1 && ! bAutoQueue )
{
- OUString aToken( it->second.m_aInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
+ OUString aToken( printer.second.m_aInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
if( aToken == "autoqueue" )
bAutoQueue = true;
}
if( bAutoQueue )
continue;
- if( !it->second.m_aFile.isEmpty() )
+ if( !printer.second.m_aFile.isEmpty() )
{
// check if file is writable
- if( files.find( it->second.m_aFile ) == files.end() )
+ if( files.find( printer.second.m_aFile ) == files.end() )
{
bool bInsertToNewFile = false;
// maybe it is simply not inserted yet
- if( rofiles.find( it->second.m_aFile ) == rofiles.end() )
+ if( rofiles.find( printer.second.m_aFile ) == rofiles.end() )
{
- if( checkWriteability( it->second.m_aFile ) )
- files[ it->second.m_aFile ] = new Config( it->second.m_aFile );
+ if( checkWriteability( printer.second.m_aFile ) )
+ files[ printer.second.m_aFile ] = new Config( printer.second.m_aFile );
else
bInsertToNewFile = true;
}
@@ -625,63 +630,63 @@ bool PrinterInfoManager::writePrinterConfig()
// original file is read only, insert printer in a new writeable file
if( bInsertToNewFile )
{
- rofiles[ it->second.m_aFile ] = 1;
+ rofiles[ printer.second.m_aFile ] = 1;
// update alternate file list
// be sure m_aAlternateFiles doesn't contain the m_aFile value
- it->second.m_aAlternateFiles.erase( files.begin()->first );
- it->second.m_aAlternateFiles.insert( it->second.m_aFile );
+ printer.second.m_aAlternateFiles.erase( files.begin()->first );
+ printer.second.m_aAlternateFiles.insert( printer.second.m_aFile );
// update file
- it->second.m_aFile = files.begin()->first;
+ printer.second.m_aFile = files.begin()->first;
}
}
}
else // a new printer, write it to the first file available
- it->second.m_aFile = files.begin()->first;
+ printer.second.m_aFile = files.begin()->first;
- if( it->second.m_aGroup.isEmpty() ) // probably a new printer
- it->second.m_aGroup = OString( it->first.getStr(), it->first.getLength(), RTL_TEXTENCODING_UTF8 );
+ if( printer.second.m_aGroup.isEmpty() ) // probably a new printer
+ printer.second.m_aGroup = OString( printer.first.getStr(), printer.first.getLength(), RTL_TEXTENCODING_UTF8 );
- if( files.find( it->second.m_aFile ) != files.end() )
+ if( files.find( printer.second.m_aFile ) != files.end() )
{
- Config* pConfig = files[ it->second.m_aFile ];
- pConfig->DeleteGroup( it->second.m_aGroup ); // else some old keys may remain
- pConfig->SetGroup( it->second.m_aGroup );
+ Config* pConfig = files[ printer.second.m_aFile ];
+ pConfig->DeleteGroup( printer.second.m_aGroup ); // else some old keys may remain
+ pConfig->SetGroup( printer.second.m_aGroup );
- OStringBuffer aValue(OUStringToOString(it->second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8));
+ OStringBuffer aValue(OUStringToOString(printer.second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8));
aValue.append('/');
- aValue.append(OUStringToOString(it->first, RTL_TEXTENCODING_UTF8));
+ aValue.append(OUStringToOString(printer.first, RTL_TEXTENCODING_UTF8));
pConfig->WriteKey("Printer", aValue.makeStringAndClear());
- pConfig->WriteKey( "DefaultPrinter", it->first == m_aDefaultPrinter ? "1" : "0" );
- pConfig->WriteKey( "Location", OUStringToOString(it->second.m_aInfo.m_aLocation, RTL_TEXTENCODING_UTF8) );
- pConfig->WriteKey( "Comment", OUStringToOString(it->second.m_aInfo.m_aComment, RTL_TEXTENCODING_UTF8) );
- pConfig->WriteKey( "Command", OUStringToOString(it->second.m_aInfo.m_aCommand, RTL_TEXTENCODING_UTF8) );
- pConfig->WriteKey( "QuickCommand", OUStringToOString(it->second.m_aInfo.m_aQuickCommand, RTL_TEXTENCODING_UTF8) );
- pConfig->WriteKey( "Features", OUStringToOString(it->second.m_aInfo.m_aFeatures, RTL_TEXTENCODING_UTF8) );
- pConfig->WriteKey("Copies", OString::number(it->second.m_aInfo.m_nCopies));
- pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" );
- pConfig->WriteKey("PSLevel", OString::number(it->second.m_aInfo.m_nPSLevel));
- pConfig->WriteKey("PDFDevice", OString::number(it->second.m_aInfo.m_nPDFDevice));
- pConfig->WriteKey("ColorDevice", OString::number(it->second.m_aInfo.m_nColorDevice));
- pConfig->WriteKey("ColorDepth", OString::number(it->second.m_aInfo.m_nColorDepth));
- aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nLeftMarginAdjust));
+ pConfig->WriteKey( "DefaultPrinter", printer.first == m_aDefaultPrinter ? "1" : "0" );
+ pConfig->WriteKey( "Location", OUStringToOString(printer.second.m_aInfo.m_aLocation, RTL_TEXTENCODING_UTF8) );
+ pConfig->WriteKey( "Comment", OUStringToOString(printer.second.m_aInfo.m_aComment, RTL_TEXTENCODING_UTF8) );
+ pConfig->WriteKey( "Command", OUStringToOString(printer.second.m_aInfo.m_aCommand, RTL_TEXTENCODING_UTF8) );
+ pConfig->WriteKey( "QuickCommand", OUStringToOString(printer.second.m_aInfo.m_aQuickCommand, RTL_TEXTENCODING_UTF8) );
+ pConfig->WriteKey( "Features", OUStringToOString(printer.second.m_aInfo.m_aFeatures, RTL_TEXTENCODING_UTF8) );
+ pConfig->WriteKey("Copies", OString::number(printer.second.m_aInfo.m_nCopies));
+ pConfig->WriteKey( "Orientation", printer.second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" );
+ pConfig->WriteKey("PSLevel", OString::number(printer.second.m_aInfo.m_nPSLevel));
+ pConfig->WriteKey("PDFDevice", OString::number(printer.second.m_aInfo.m_nPDFDevice));
+ pConfig->WriteKey("ColorDevice", OString::number(printer.second.m_aInfo.m_nColorDevice));
+ pConfig->WriteKey("ColorDepth", OString::number(printer.second.m_aInfo.m_nColorDepth));
+ aValue.append(static_cast<sal_Int32>(printer.second.m_aInfo.m_nLeftMarginAdjust));
aValue.append(',');
- aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nRightMarginAdjust));
+ aValue.append(static_cast<sal_Int32>(printer.second.m_aInfo.m_nRightMarginAdjust));
aValue.append(',');
- aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nTopMarginAdjust));
+ aValue.append(static_cast<sal_Int32>(printer.second.m_aInfo.m_nTopMarginAdjust));
aValue.append(',');
- aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust));
+ aValue.append(static_cast<sal_Int32>(printer.second.m_aInfo.m_nBottomMarginAdjust));
pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear());
- if( ! it->second.m_aInfo.m_aDriverName.startsWith( "CUPS:" ) )
+ if( ! printer.second.m_aInfo.m_aDriverName.startsWith( "CUPS:" ) )
{
// write PPDContext (not for CUPS)
- for( int i = 0; i < it->second.m_aInfo.m_aContext.countValuesModified(); i++ )
+ for( int i = 0; i < printer.second.m_aInfo.m_aContext.countValuesModified(); i++ )
{
- const PPDKey* pKey = it->second.m_aInfo.m_aContext.getModifiedKey( i );
+ const PPDKey* pKey = printer.second.m_aInfo.m_aContext.getModifiedKey( i );
OStringBuffer aKey("PPD_");
aKey.append(OUStringToOString(pKey->getKey(), RTL_TEXTENCODING_ISO_8859_1));
- const PPDValue* pValue = it->second.m_aInfo.m_aContext.getValue( pKey );
+ const PPDValue* pValue = printer.second.m_aInfo.m_aContext.getValue( pKey );
if (pValue)
aValue.append(OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1));
else
@@ -693,8 +698,8 @@ bool PrinterInfoManager::writePrinterConfig()
}
// get rid of Config objects. this also writes any changes
- for( file_it = files.begin(); file_it != files.end(); ++file_it )
- delete file_it->second;
+ for (auto const& file : files)
+ delete file.second;
return true;
}
@@ -1008,15 +1013,14 @@ static void lpgetSysQueueTokenHandler(
bool bInsertAttribute = false;
OString aDescrStr( "description=" );
OString aLocStr( "location=" );
- for( std::vector< OString >::const_iterator it = i_rLines.begin();
- it != i_rLines.end(); ++it )
+ for (auto const& line : i_rLines)
{
sal_Int32 nPos = 0;
// find the begin of a new printer section
- nPos = it->indexOf( ':', 0 );
+ nPos = line.indexOf( ':', 0 );
if( nPos != -1 )
{
- OUString aSysQueue( OStringToOUString( it->copy( 0, nPos ), aEncoding ) );
+ OUString aSysQueue( OStringToOUString( line.copy( 0, nPos ), aEncoding ) );
// do not insert duplicates (e.g. lpstat tends to produce such lines)
// in case there was a "_all" section, insert only those printer explicitly
// set in the "all" attribute
@@ -1037,19 +1041,19 @@ static void lpgetSysQueueTokenHandler(
if( bInsertAttribute && ! o_rQueues.empty() )
{
// look for "description" attribute, insert as comment
- nPos = it->indexOf( aDescrStr, 0 );
+ nPos = line.indexOf( aDescrStr, 0 );
if( nPos != -1 )
{
- OString aComment( WhitespaceToSpace( it->copy(nPos+12) ) );
+ OString aComment( WhitespaceToSpace( line.copy(nPos+12) ) );
if( !aComment.isEmpty() )
o_rQueues.back().m_aComment = OStringToOUString(aComment, aEncoding);
continue;
}
// look for "location" attribute, inser as location
- nPos = it->indexOf( aLocStr, 0 );
+ nPos = line.indexOf( aLocStr, 0 );
if( nPos != -1 )
{
- OString aLoc( WhitespaceToSpace( it->copy(nPos+9) ) );
+ OString aLoc( WhitespaceToSpace( line.copy(nPos+9) ) );
if( !aLoc.isEmpty() )
o_rQueues.back().m_aLocation = OStringToOUString(aLoc, aEncoding);
continue;
@@ -1069,8 +1073,7 @@ static void standardSysQueueTokenHandler(
OString aAftToken( i_pParms->pAftToken );
/* Normal Unix print queue discovery, also used for Darwin 5 LPR printing
*/
- for( std::vector< OString >::const_iterator it = i_rLines.begin();
- it != i_rLines.end(); ++it )
+ for (auto const& line : i_rLines)
{
sal_Int32 nPos = 0;
@@ -1078,18 +1081,18 @@ static void standardSysQueueTokenHandler(
// find if there are enough tokens before the name
for( unsigned int i = 0; i < i_pParms->nForeTokenCount && nPos != -1; i++ )
{
- nPos = it->indexOf( aForeToken, nPos );
- if( nPos != -1 && it->getLength() >= nPos+aForeToken.getLength() )
+ nPos = line.indexOf( aForeToken, nPos );
+ if( nPos != -1 && line.getLength() >= nPos+aForeToken.getLength() )
nPos += aForeToken.getLength();
}
if( nPos != -1 )
{
// find if there is the token after the queue
- sal_Int32 nAftPos = it->indexOf( aAftToken, nPos );
+ sal_Int32 nAftPos = line.indexOf( aAftToken, nPos );
if( nAftPos != -1 )
{
// get the queue name between fore and aft tokens
- OUString aSysQueue( OStringToOUString( it->copy( nPos, nAftPos - nPos ), aEncoding ) );
+ OUString aSysQueue( OStringToOUString( line.copy( nPos, nAftPos - nPos ), aEncoding ) );
// do not insert duplicates (e.g. lpstat tends to produce such lines)
if( aUniqueSet.find( aSysQueue ) == aUniqueSet.end() )
{
diff --git a/vcl/unx/gtk/gtksys.cxx b/vcl/unx/gtk/gtksys.cxx
index 98411f2f039f..d99d294301a0 100644
--- a/vcl/unx/gtk/gtksys.cxx
+++ b/vcl/unx/gtk/gtksys.cxx
@@ -150,13 +150,13 @@ GdkScreen *
GtkSalSystem::getScreenMonitorFromIdx (int nIdx, gint &nMonitor)
{
GdkScreen *pScreen = nullptr;
- for (ScreenMonitors_t::const_iterator aIt(maScreenMonitors.begin()), aEnd(maScreenMonitors.end()); aIt != aEnd; ++aIt)
+ for (auto const& screenMonitor : maScreenMonitors)
{
- pScreen = aIt->first;
+ pScreen = screenMonitor.first;
if (!pScreen)
break;
- if (nIdx >= aIt->second)
- nIdx -= aIt->second;
+ if (nIdx >= screenMonitor.second)
+ nIdx -= screenMonitor.second;
else
break;
}
@@ -173,11 +173,11 @@ int
GtkSalSystem::getScreenIdxFromPtr (GdkScreen *pScreen)
{
int nIdx = 0;
- for (ScreenMonitors_t::const_iterator aIt(maScreenMonitors.begin()), aEnd(maScreenMonitors.end()); aIt != aEnd; ++aIt)
+ for (auto const& screenMonitor : maScreenMonitors)
{
- if (aIt->first == pScreen)
+ if (screenMonitor.first == pScreen)
return nIdx;
- nIdx += aIt->second;
+ nIdx += screenMonitor.second;
}
g_warning ("failed to find screen %p", pScreen);
return 0;
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 71bfcdff5d2e..7f09799c547b 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -448,12 +448,8 @@ void NWPixmapCacheList::RemoveCache( NWPixmapCache* pCache )
}
void NWPixmapCacheList::ThemeChanged( )
{
- ::std::vector< NWPixmapCache* >::iterator p = mCaches.begin();
- while( p != mCaches.end() )
- {
- (*p)->ThemeChanged();
- ++p;
- }
+ for (auto const& cache : mCaches)
+ cache->ThemeChanged();
}
/*********************************************************
@@ -905,9 +901,9 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
RectangleVector aRectangles;
aClipRegion.GetRegionRectangles(aRectangles);
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for (auto const& rectangle : aRectangles)
{
- tools::Rectangle aPaintRect = aCtrlRect.GetIntersection(*aRectIter);
+ tools::Rectangle aPaintRect = aCtrlRect.GetIntersection(rectangle);
if( aPaintRect.IsEmpty() )
continue;
aClip.push_back( aPaintRect );
@@ -1367,12 +1363,12 @@ bool GtkSalGraphics::NWPaintGTKArrow(
GtkStateType stateType(nState&ControlState::PRESSED?GTK_STATE_ACTIVE:GTK_STATE_NORMAL);
GdkRectangle clipRect;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_arrow(m_pWindow->style,gdkDrawable,stateType,GTK_SHADOW_NONE,&clipRect,
m_pWindow,"arrow",arrowType,true,
@@ -1406,12 +1402,12 @@ bool GtkSalGraphics::NWPaintGTKListHeader(
NWSetWidgetState( button, nState, stateType );
GdkRectangle clipRect;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_box(button->style,gdkDrawable,stateType,shadowType,&clipRect,
button,"button",
@@ -1451,12 +1447,12 @@ bool GtkSalGraphics::NWPaintGTKFrame(
if( nStyle == DrawFrameStyle::Out )
shadowType=GTK_SHADOW_IN;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
// Draw background first
@@ -1507,12 +1503,12 @@ bool GtkSalGraphics::NWPaintGTKWindowBackground(
const std::vector< tools::Rectangle >& rClipList )
{
GdkRectangle clipRect;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_flat_box(m_pWindow->style,gdkDrawable,GTK_STATE_NORMAL,GTK_SHADOW_NONE,&clipRect,
m_pWindow,"base",
@@ -1624,12 +1620,12 @@ bool GtkSalGraphics::NWPaintGTKButtonReal(
wi -= 2 * (focusWidth + focusPad);
hi -= 2 * (focusWidth + focusPad);
}
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it)
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
// Buttons must paint opaque since some themes have alpha-channel enabled buttons
if(button == gWidgetData[m_nXScreen].gToolbarButtonWidget)
@@ -1785,12 +1781,12 @@ bool GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable,
GTK_TOGGLE_BUTTON(gWidgetData[m_nXScreen].gRadioWidgetSibling)->active = true;
GTK_TOGGLE_BUTTON(gWidgetData[m_nXScreen].gRadioWidget)->active = isChecked;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_option( gWidgetData[m_nXScreen].gRadioWidget->style, gdkDrawable, stateType, shadowType,
&clipRect, gWidgetData[m_nXScreen].gRadioWidget, "radiobutton",
@@ -1828,12 +1824,12 @@ bool GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
NWSetWidgetState( gWidgetData[m_nXScreen].gCheckWidget, nState, stateType );
GTK_TOGGLE_BUTTON(gWidgetData[m_nXScreen].gCheckWidget)->active = isChecked;
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_check( gWidgetData[m_nXScreen].gCheckWidget->style, gdkDrawable, stateType, shadowType,
&clipRect, gWidgetData[m_nXScreen].gCheckWidget, "checkbutton",
@@ -2266,12 +2262,12 @@ bool GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable,
// Find the overall bounding rect of the buttons's drawing area,
// plus its actual draw rect excluding adornment
pixmapRect = NWGetEditBoxPixmapRect( m_nXScreen, rControlRectangle );
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
NWPaintOneEditBox( m_nXScreen, gdkDrawable, &clipRect, nType, pixmapRect, nState );
}
@@ -2584,12 +2580,12 @@ bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
arrowRect.SetPos( Point( buttonRect.Left() + static_cast<gint>((buttonRect.GetWidth() - arrowRect.GetWidth()) / 2),
buttonRect.Top() + static_cast<gint>((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) );
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
if( nPart == ControlPart::Entire )
NWPaintOneEditBox( m_nXScreen, gdkDrawable, &clipRect, nType, aEditBoxRect,
@@ -2857,12 +2853,12 @@ bool GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable,
nullptr);
}
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
if ( nPart != ControlPart::ListboxWindow )
{
@@ -2971,12 +2967,12 @@ bool GtkSalGraphics::NWPaintGTKToolbar(
if( nPart != ControlPart::Button )
{
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
// draw toolbar
if( nPart == ControlPart::DrawBackgroundHorz || nPart == ControlPart::DrawBackgroundVert )
@@ -3101,9 +3097,9 @@ bool GtkSalGraphics::NWPaintGTKMenubar(
}
}
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- lcl_rectangleToGdkRectangle(*it, clipRect);
+ lcl_rectangleToGdkRectangle(clip, clipRect);
// handle Menubar
if( nPart == ControlPart::Entire )
@@ -3125,7 +3121,7 @@ bool GtkSalGraphics::NWPaintGTKMenubar(
x, y, w, h );
// Do the conversion again, in case clipRect has been modified.
- lcl_rectangleToGdkRectangle(*it, clipRect);
+ lcl_rectangleToGdkRectangle(clip, clipRect);
gtk_paint_box( gWidgetData[m_nXScreen].gMenubarWidget->style,
gdkDrawable,
@@ -3197,12 +3193,12 @@ bool GtkSalGraphics::NWPaintGTKPopupMenu(
if ( nState & ControlState::ENABLED )
GTK_WIDGET_SET_FLAGS( gWidgetData[m_nXScreen].gMenuWidget, GTK_SENSITIVE );
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
if( nPart == ControlPart::Entire )
{
@@ -3335,12 +3331,12 @@ bool GtkSalGraphics::NWPaintGTKTooltip(
w = rControlRectangle.GetWidth();
h = rControlRectangle.GetHeight();
- for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
+ for (auto const& clip : rClipList)
{
- clipRect.x = it->Left();
- clipRect.y = it->Top();
- clipRect.width = it->GetWidth();
- clipRect.height = it->GetHeight();
+ clipRect.x = clip.Left();
+ clipRect.y = clip.Top();
+ clipRect.width = clip.GetWidth();
+ clipRect.height = clip.GetHeight();
gtk_paint_flat_box( gWidgetData[m_nXScreen].gTooltipPopup->style,
gdkDrawable,
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index b34fa84d2f62..cce4729b8742 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1228,34 +1228,34 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
RECT* pNextClipRect = reinterpret_cast<RECT*>(&(mrParent.mpClipRgnData->Buffer));
bool bFirstClipRect = true;
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for (auto const& rectangle : aRectangles)
{
- const long nW(aRectIter->GetWidth());
- const long nH(aRectIter->GetHeight());
+ const long nW(rectangle.GetWidth());
+ const long nH(rectangle.GetHeight());
if(nW && nH)
{
- const long nRight(aRectIter->Left() + nW);
- const long nBottom(aRectIter->Top() + nH);
+ const long nRight(rectangle.Left() + nW);
+ const long nBottom(rectangle.Top() + nH);
if(bFirstClipRect)
{
- pBoundRect->left = aRectIter->Left();
- pBoundRect->top = aRectIter->Top();
+ pBoundRect->left = rectangle.Left();
+ pBoundRect->top = rectangle.Top();
pBoundRect->right = nRight;
pBoundRect->bottom = nBottom;
bFirstClipRect = false;
}
else
{
- if(aRectIter->Left() < pBoundRect->left)
+ if(rectangle.Left() < pBoundRect->left)
{
- pBoundRect->left = static_cast<int>(aRectIter->Left());
+ pBoundRect->left = static_cast<int>(rectangle.Left());
}
- if(aRectIter->Top() < pBoundRect->top)
+ if(rectangle.Top() < pBoundRect->top)
{
- pBoundRect->top = static_cast<int>(aRectIter->Top());
+ pBoundRect->top = static_cast<int>(rectangle.Top());
}
if(nRight > pBoundRect->right)
@@ -1269,8 +1269,8 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
}
}
- pNextClipRect->left = static_cast<int>(aRectIter->Left());
- pNextClipRect->top = static_cast<int>(aRectIter->Top());
+ pNextClipRect->left = static_cast<int>(rectangle.Left());
+ pNextClipRect->top = static_cast<int>(rectangle.Top());
pNextClipRect->right = static_cast<int>(nRight);
pNextClipRect->bottom = static_cast<int>(nBottom);
pNextClipRect++;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 22b870bde928..a61fc5fdefe6 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -1574,8 +1574,8 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
SAL_WARN_IF( !systemChildren.empty(), "vcl", "WinSalFrame::SetParent() parent of living system child window will be destroyed!");
// reparent children before old parent is destroyed
- for( ::std::vector< WinSalFrame* >::iterator iChild = children.begin(); iChild != children.end(); ++iChild )
- ImplSetParentFrame( *iChild, hWnd, false );
+ for (auto & child : children)
+ ImplSetParentFrame( child, hWnd, false );
children.clear();
systemChildren.clear();
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 06189d2ccd67..7cf941485973 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -180,8 +180,8 @@ public:
static std::vector<tools::Rectangle> partition(const tools::Rectangle &rRect, int nX, int nY)
{
std::vector<tools::Rectangle> aRegions = partition(rRect.GetSize(), nX, nY);
- for (auto it = aRegions.begin(); it != aRegions.end(); ++it)
- it->Move(rRect.Left(), rRect.Top());
+ for (auto & region : aRegions)
+ region.Move(rRect.Left(), rRect.Top());
return aRegions;
}
@@ -1506,8 +1506,8 @@ public:
}
void Invalidate()
{
- for (size_t i = 0; i < maInvalidates.size(); ++i)
- maInvalidates[i]->Invalidate();
+ for (auto const& invalidate : maInvalidates)
+ invalidate->Invalidate();
}
};