diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 00:16:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 01:41:27 +0200 |
commit | 750a6bddf16a2e85555ae3859bf5facfd8cff955 (patch) | |
tree | 2cb0e2444b3e6187970c47855e16d943fbec57dc /vcl/source/gdi/print3.cxx | |
parent | ce47b1a9c68a27fc37594148f6be2661f27120ea (diff) |
loplugin:flatten in vcl/gdi
Change-Id: Ief1736264e62acfac3a9a83c54dc564c03d6fba9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100034
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi/print3.cxx')
-rw-r--r-- | vcl/source/gdi/print3.cxx | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index cbf486713330..1d0e31c69f77 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -833,67 +833,67 @@ void PrinterController::setupPrinter( weld::Window* i_pParent ) // Important to hold printer alive while doing setup etc. VclPtr< Printer > xPrinter = mpImplData->mxPrinter; - if( xPrinter ) - { - xPrinter->Push(); - xPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); + if( !xPrinter ) + return; - // get current data - Size aPaperSize(xPrinter->GetPaperSize()); - Orientation eOrientation = xPrinter->GetOrientation(); - sal_uInt16 nPaperBin = xPrinter->GetPaperBin(); + xPrinter->Push(); + xPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); - // reset paper size back to last configured size, not - // whatever happens to be the current page - // (but only if the printer config has changed, otherwise - // don't override printer page auto-detection - tdf#91362) - if (getPrinterModified() || getPapersizeFromSetup()) - { - resetPaperToLastConfigured(); - } + // get current data + Size aPaperSize(xPrinter->GetPaperSize()); + Orientation eOrientation = xPrinter->GetOrientation(); + sal_uInt16 nPaperBin = xPrinter->GetPaperBin(); - // call driver setup - bRet = xPrinter->Setup( i_pParent, PrinterSetupMode::SingleJob ); - SAL_WARN_IF(xPrinter != mpImplData->mxPrinter, "vcl.gdi", - "Printer changed underneath us during setup"); - xPrinter = mpImplData->mxPrinter; + // reset paper size back to last configured size, not + // whatever happens to be the current page + // (but only if the printer config has changed, otherwise + // don't override printer page auto-detection - tdf#91362) + if (getPrinterModified() || getPapersizeFromSetup()) + { + resetPaperToLastConfigured(); + } - Size aNewPaperSize(xPrinter->GetPaperSize()); - if (bRet) - { - bool bInvalidateCache = false; - setPapersizeFromSetup(xPrinter->GetPrinterSettingsPreferred()); + // call driver setup + bRet = xPrinter->Setup( i_pParent, PrinterSetupMode::SingleJob ); + SAL_WARN_IF(xPrinter != mpImplData->mxPrinter, "vcl.gdi", + "Printer changed underneath us during setup"); + xPrinter = mpImplData->mxPrinter; - // was papersize overridden ? if so we need to take action if we're - // configured to use the driver papersize - if (aNewPaperSize != mpImplData->maDefaultPageSize) - { - mpImplData->maDefaultPageSize = aNewPaperSize; - bInvalidateCache = getPapersizeFromSetup(); - } + Size aNewPaperSize(xPrinter->GetPaperSize()); + if (bRet) + { + bool bInvalidateCache = false; + setPapersizeFromSetup(xPrinter->GetPrinterSettingsPreferred()); - // was bin overridden ? if so we need to take action - sal_uInt16 nNewPaperBin = xPrinter->GetPaperBin(); - if (nNewPaperBin != nPaperBin) - { - mpImplData->mnFixedPaperBin = nNewPaperBin; - bInvalidateCache = true; - } + // was papersize overridden ? if so we need to take action if we're + // configured to use the driver papersize + if (aNewPaperSize != mpImplData->maDefaultPageSize) + { + mpImplData->maDefaultPageSize = aNewPaperSize; + bInvalidateCache = getPapersizeFromSetup(); + } - if (bInvalidateCache) - { - mpImplData->maPageCache.invalidate(); - } + // was bin overridden ? if so we need to take action + sal_uInt16 nNewPaperBin = xPrinter->GetPaperBin(); + if (nNewPaperBin != nPaperBin) + { + mpImplData->mnFixedPaperBin = nNewPaperBin; + bInvalidateCache = true; } - else + + if (bInvalidateCache) { - //restore to whatever it was before we entered this method - xPrinter->SetOrientation( eOrientation ); - if (aPaperSize != aNewPaperSize) - xPrinter->SetPaperSizeUser(aPaperSize); + mpImplData->maPageCache.invalidate(); } - xPrinter->Pop(); } + else + { + //restore to whatever it was before we entered this method + xPrinter->SetOrientation( eOrientation ); + if (aPaperSize != aNewPaperSize) + xPrinter->SetPaperSizeUser(aPaperSize); + } + xPrinter->Pop(); } PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const css::uno::Sequence< css::beans::PropertyValue >& i_rProps ) @@ -1075,20 +1075,20 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const tools::Rectangle& i_rClipR o_rMtf.AddAction( new MetaPopAction() ); // draw a border - if( i_bDrawBorder ) - { - // save gstate - o_rMtf.AddAction( new MetaPushAction( PushFlags::LINECOLOR | PushFlags::FILLCOLOR | PushFlags::CLIPREGION | PushFlags::MAPMODE ) ); - o_rMtf.AddAction( new MetaMapModeAction( MapMode( MapUnit::Map100thMM ) ) ); + if( !i_bDrawBorder ) + return; - tools::Rectangle aBorderRect( i_rClipRect ); - o_rMtf.AddAction( new MetaLineColorAction( COL_BLACK, true ) ); - o_rMtf.AddAction( new MetaFillColorAction( COL_TRANSPARENT, false ) ); - o_rMtf.AddAction( new MetaRectAction( aBorderRect ) ); + // save gstate + o_rMtf.AddAction( new MetaPushAction( PushFlags::LINECOLOR | PushFlags::FILLCOLOR | PushFlags::CLIPREGION | PushFlags::MAPMODE ) ); + o_rMtf.AddAction( new MetaMapModeAction( MapMode( MapUnit::Map100thMM ) ) ); - // restore gstate - o_rMtf.AddAction( new MetaPopAction() ); - } + tools::Rectangle aBorderRect( i_rClipRect ); + o_rMtf.AddAction( new MetaLineColorAction( COL_BLACK, true ) ); + o_rMtf.AddAction( new MetaFillColorAction( COL_TRANSPARENT, false ) ); + o_rMtf.AddAction( new MetaRectAction( aBorderRect ) ); + + // restore gstate + o_rMtf.AddAction( new MetaPopAction() ); } PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) |