diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-30 19:35:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-03 08:41:11 +0200 |
commit | d3971ec256450e6783920b46f672048b29719949 (patch) | |
tree | f4722d0e2bc321cf71b49b7573cf38640e9b28fc /basctl/source | |
parent | f50bf3c5225b49b3c6f77f882e35305e5dc5ccd3 (diff) |
new loplugin:blockblock
Change-Id: I7b68b70fa4c7234e8882f7627026959a596968fd
Reviewed-on: https://gerrit.libreoffice.org/43025
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl/source')
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 3f904c96a991..caadc73d24ff 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -1143,56 +1143,54 @@ void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& r void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not working yet { - { - MapMode aOldMap( pPrinter->GetMapMode()); - vcl::Font aOldFont( pPrinter->GetFont() ); - - MapMode aMap( MapUnit::Map100thMM ); - pPrinter->SetMapMode( aMap ); - vcl::Font aFont; - aFont.SetAlignment( ALIGN_BOTTOM ); - aFont.SetFontSize( Size( 0, 360 )); - pPrinter->SetFont( aFont ); - - Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin); - aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin); - - lcl_PrintHeader( pPrinter, rTitle ); - - Bitmap aDlg; - Size aBmpSz( pPrinter->PixelToLogic( aDlg.GetSizePixel() ) ); - double nPaperSzWidth = aPaperSz.Width(); - double nPaperSzHeight = aPaperSz.Height(); - double nBmpSzWidth = aBmpSz.Width(); - double nBmpSzHeight = aBmpSz.Height(); - double nScaleX = (nPaperSzWidth / nBmpSzWidth ); - double nScaleY = (nPaperSzHeight / nBmpSzHeight ); - - Size aOutputSz; - if( nBmpSzHeight * nScaleX <= nPaperSzHeight ) - { - aOutputSz.Width() = (long)(nBmpSzWidth * nScaleX); - aOutputSz.Height() = (long)(nBmpSzHeight * nScaleX); - } - else - { - aOutputSz.Width() = (long)(nBmpSzWidth * nScaleY); - aOutputSz.Height() = (long)(nBmpSzHeight * nScaleY); - } + MapMode aOldMap( pPrinter->GetMapMode()); + vcl::Font aOldFont( pPrinter->GetFont() ); + + MapMode aMap( MapUnit::Map100thMM ); + pPrinter->SetMapMode( aMap ); + vcl::Font aFont; + aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetFontSize( Size( 0, 360 )); + pPrinter->SetFont( aFont ); - Point aPosOffs( - (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2), - (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2)); + Size aPaperSz = pPrinter->GetOutputSize(); + aPaperSz.Width() -= (Print::nLeftMargin + Print::nRightMargin); + aPaperSz.Height() -= (Print::nTopMargin + Print::nBottomMargin); - aPosOffs.X() += Print::nLeftMargin; - aPosOffs.Y() += Print::nTopMargin; + lcl_PrintHeader( pPrinter, rTitle ); - pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg ); + Bitmap aDlg; + Size aBmpSz( pPrinter->PixelToLogic( aDlg.GetSizePixel() ) ); + double nPaperSzWidth = aPaperSz.Width(); + double nPaperSzHeight = aPaperSz.Height(); + double nBmpSzWidth = aBmpSz.Width(); + double nBmpSzHeight = aBmpSz.Height(); + double nScaleX = (nPaperSzWidth / nBmpSzWidth ); + double nScaleY = (nPaperSzHeight / nBmpSzHeight ); - pPrinter->SetMapMode( aOldMap ); - pPrinter->SetFont( aOldFont ); + Size aOutputSz; + if( nBmpSzHeight * nScaleX <= nPaperSzHeight ) + { + aOutputSz.Width() = (long)(nBmpSzWidth * nScaleX); + aOutputSz.Height() = (long)(nBmpSzHeight * nScaleX); + } + else + { + aOutputSz.Width() = (long)(nBmpSzWidth * nScaleY); + aOutputSz.Height() = (long)(nBmpSzHeight * nScaleY); } + + Point aPosOffs( + (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2), + (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2)); + + aPosOffs.X() += Print::nLeftMargin; + aPosOffs.Y() += Print::nTopMargin; + + pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg ); + + pPrinter->SetMapMode( aOldMap ); + pPrinter->SetFont( aOldFont ); } |