diff options
Diffstat (limited to 'basctl')
-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 ); } |