summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/print
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/unx/generic/print
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/unx/generic/print')
-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
4 files changed, 34 insertions, 35 deletions
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);