Kaydet (Commit) f11a4759 authored tarafından Julien Nabet's avatar Julien Nabet

Modernize a bit vcl (part4)

by using for range loops
Remark: some iterators were used outside loops,
these have been replaced by the counterpart origin variable

Change-Id: I0b1e69811f16752b0962f5c5e662ea20064e26b4
Reviewed-on: https://gerrit.libreoffice.org/48829Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 43b19dc7
......@@ -329,13 +329,13 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion )
aRegion.GetRegionRectangles(aRectangles);
mpWindowImpl->mpSysObj->BeginSetClipRegion(aRectangles.size());
for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
for (auto const& rectangle : aRectangles)
{
mpWindowImpl->mpSysObj->UnionClipRegion(
aRectIter->Left(),
aRectIter->Top(),
aRectIter->GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
aRectIter->GetHeight()); // same for height
rectangle.Left(),
rectangle.Top(),
rectangle.GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
rectangle.GetHeight()); // same for height
}
mpWindowImpl->mpSysObj->EndSetClipRegion();
......
......@@ -226,21 +226,20 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R
}
// draw multiple toolbar backgrounds, i.e., one for each toolbar line
std::map<int, int>::const_iterator it;
for (it = ranges.begin(); it != ranges.end(); ++it)
for (auto const& range : ranges)
{
tools::Rectangle aTBRect;
if (IsHorizontal())
{
aTBRect.Left() = 0;
aTBRect.Right() = aOutSz.Width() - 1;
aTBRect.Top() = it->first;
aTBRect.Bottom() = it->first + it->second - 1;
aTBRect.Top() = range.first;
aTBRect.Bottom() = range.first + range.second - 1;
}
else
{
aTBRect.Left() = it->first;
aTBRect.Right() = it->first + it->second - 1;
aTBRect.Left() = range.first;
aTBRect.Right() = range.first + range.second - 1;
aTBRect.Top() = 0;
aTBRect.Bottom() = aOutSz.Height() - 1;
}
......
......@@ -430,9 +430,9 @@ void VclBox::setAllocation(const Size &rAllocation)
setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension);
}
for (std::vector<vcl::Window*>::iterator aI = aWindows[ePackType].begin(), aEnd = aWindows[ePackType].end(); aI != aEnd; ++aI)
for (auto const& window : aWindows[ePackType])
{
vcl::Window *pChild = *aI;
vcl::Window *pChild = window;
long nPadding = pChild->get_padding();
......@@ -546,10 +546,9 @@ Size VclButtonBox::addReqGroups(const VclButtonBox::Requisition &rReq) const
static long getMaxNonOutlier(const std::vector<long> &rG, long nAvgDimension)
{
long nMaxDimensionNonOutlier = 0;
for (std::vector<long>::const_iterator aI = rG.begin(),
aEnd = rG.end(); aI != aEnd; ++aI)
for (auto const& elem : rG)
{
long nPrimaryChildDimension = *aI;
long nPrimaryChildDimension = elem;
if (nPrimaryChildDimension < nAvgDimension * 1.5)
{
nMaxDimensionNonOutlier = std::max(nPrimaryChildDimension,
......@@ -567,10 +566,9 @@ static std::vector<long> setButtonSizes(const std::vector<long> &rG,
//set everything < 1.5 times the average to the same width, leave the
//outliers un-touched
std::vector<bool>::const_iterator aJ = rNonHomogeneous.begin();
for (std::vector<long>::const_iterator aI = rG.begin(), aEnd = rG.end();
aI != aEnd; ++aI, ++aJ)
for (auto const& elem : rG)
{
long nPrimaryChildDimension = *aI;
long nPrimaryChildDimension = elem;
bool bNonHomogeneous = *aJ;
if (!bNonHomogeneous && nPrimaryChildDimension < nAvgDimension * 1.5)
{
......@@ -580,6 +578,7 @@ static std::vector<long> setButtonSizes(const std::vector<long> &rG,
{
aVec.push_back(std::max(nPrimaryChildDimension, nMinWidth));
}
++aJ;
}
return aVec;
}
......@@ -1044,10 +1043,9 @@ array_type assembleGrid(const VclGrid &rGrid)
GridEntry &rEntry = A[rSpan.x][rSpan.y];
candidates.insert(&rEntry);
}
for (std::set<GridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end();
aI != aEnd; ++aI)
for (auto const& candidate : candidates)
{
GridEntry *pEntry = *aI;
GridEntry *pEntry = candidate;
--pEntry->nSpanWidth;
}
}
......@@ -1075,10 +1073,9 @@ array_type assembleGrid(const VclGrid &rGrid)
GridEntry &rEntry = A[rSpan.x][rSpan.y];
candidates.insert(&rEntry);
}
for (std::set<GridEntry*>::iterator aI = candidates.begin(), aEnd = candidates.end();
aI != aEnd; ++aI)
for (auto const& candidate : candidates)
{
GridEntry *pEntry = *aI;
GridEntry *pEntry = candidate;
--pEntry->nSpanHeight;
}
}
......
......@@ -1062,13 +1062,13 @@ void Window::SetWindowRegionPixel( const vcl::Region& rRegion )
mpWindowImpl->maWinRegion.GetRegionRectangles(aRectangles);
mpWindowImpl->mpFrame->BeginSetClipRegion(aRectangles.size());
for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
for (auto const& rectangle : aRectangles)
{
mpWindowImpl->mpFrame->UnionClipRegion(
aRectIter->Left(),
aRectIter->Top(),
aRectIter->GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
aRectIter->GetHeight()); // same for height
rectangle.Left(),
rectangle.Top(),
rectangle.GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
rectangle.GetHeight()); // same for height
}
mpWindowImpl->mpFrame->EndSetClipRegion();
......
......@@ -302,9 +302,11 @@ std::vector<OString> TabDialog::getAllPageUIXMLDescriptions() const
// Use the UIXMLDescription without trailing '.ui', with one trailing '/'
bool bAlreadyAdded(false);
for (auto i = aRetval.begin(); !bAlreadyAdded && i != aRetval.end(); i++)
for (auto const& elem : aRetval)
{
bAlreadyAdded = (*i == aNewName);
bAlreadyAdded = (elem == aNewName);
if (bAlreadyAdded)
break;
}
if (bAlreadyAdded)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment