diff options
-rw-r--r-- | vcl/inc/vcl/print.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/vcl/prndlg.hxx | 11 | ||||
-rw-r--r-- | vcl/inc/vcl/svids.hrc | 7 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 14 | ||||
-rw-r--r-- | vcl/source/src/print.src | 79 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 45 |
6 files changed, 142 insertions, 15 deletions
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 8ea864f3b6a5..727c08545cf4 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -493,6 +493,7 @@ public: void SAL_DLLPRIVATE setOptionChangeHdl( const Link& ); void SAL_DLLPRIVATE createProgressDialog(); void SAL_DLLPRIVATE setPrintSelection( const rtl::OUString& ); + void SAL_DLLPRIVATE setMultipage( int nRows, int nColumns, const Size& rPaperSize ); }; } diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index 8bd4ab56141c..c44bda8a2711 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -78,6 +78,13 @@ namespace vcl FixedText maLocText; FixedText maComment; FixedText maCommentText; + FixedLine maNupLine; + FixedText maNupRowsTxt; + NumericField maNupRowsEdt; + FixedText maNupColTxt; + NumericField maNupColEdt; + RadioButton maNupPortrait; + RadioButton maNupLandscape; PrinterTabPage( Window*, const ResId& ); virtual ~PrinterTabPage(); @@ -134,6 +141,10 @@ namespace vcl std::multimap< rtl::OUString, Window* > maPropertyToWindowMap; std::map< Window*, sal_Int32 > maControlToNumValMap; + Size maNupPortraitSize; + Size maNupLandscapeSize; + + void updateNup(); void preparePreview(); void setPreviewText( sal_Int32 ); void updatePrinterText(); diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index b2ceb89ec4cf..1c5f5d598faf 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -94,6 +94,13 @@ #define SV_PRINT_PRT_COMMENT_TXT 9 #define SV_PRINT_PRT_TOFILE 10 #define SV_PRINT_PRT_SETUP 11 +#define SV_PRINT_PRT_NUP 12 +#define SV_PRINT_PRT_NUP_ROWS_TXT 13 +#define SV_PRINT_PRT_NUP_ROWS_EDT 14 +#define SV_PRINT_PRT_NUP_COLUMNS_TXT 15 +#define SV_PRINT_PRT_NUP_COLUMNS_EDT 16 +#define SV_PRINT_PRT_NUP_PORTRAIT 17 +#define SV_PRINT_PRT_NUP_LANDSCAPE 18 #define SV_DLG_PRINT_PROGRESS 2048 #define SV_PRINT_PROGRESS_CANCEL 1 diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 5356c74327ed..bf7c02dc775e 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -324,7 +324,6 @@ bool Printer::StartJob( const XubString& i_rJobName, boost::shared_ptr<vcl::Prin int nPages = i_pListener->getFilteredPageCount(); for( int nPage = 0; nPage < nPages; nPage++ ) { - // remember MultiSelection is 1 based (due to user input) i_pListener->printFilteredPage( nPage ); } EndJob(); @@ -440,6 +439,7 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rRect, GDIMet o_rMtf.AddAction( new MetaRectAction( i_rRect ) ); // clip to page rect + // FIXME: clipping does not seem to work reliably with this o_rMtf.AddAction( new MetaISectRectClipRegionAction( i_rRect ) ); // append the subpage @@ -582,6 +582,11 @@ void PrinterListener::printFilteredPage( int i_nPage ) mpImplData->mpPrinter->EnableOutput( TRUE ); + // in N-Up printing set the correct page size + // FIXME: setting paper landscape/portrait does not work here reliably ? + if( mpImplData->mnMultiPageRows != 1 || mpImplData->mnMultiPageColumns != 1 ) + mpImplData->mpPrinter->SetPaperSizeUser( mpImplData->maMultiPageSize ); + // actually print the page mpImplData->mpPrinter->StartPage(); @@ -784,3 +789,10 @@ void PrinterListener::createProgressDialog() mpImplData->mpProgress->Show(); } } + +void PrinterListener::setMultipage( int i_nRows, int i_nColumns, const Size& rPaperSize ) +{ + mpImplData->mnMultiPageRows = i_nRows; + mpImplData->mnMultiPageColumns = i_nColumns; + mpImplData->maMultiPageSize = rPaperSize; +}
\ No newline at end of file diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 26454e35ec3d..04d9c1e02b5e 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -45,6 +45,7 @@ ModalDialog SV_DLG_PRINT DefButton = TRUE; Pos = MAP_APPFONT( 240, 175 ); Size = MAP_APPFONT( 50, 15 ); + Text [en-US] = "~Print"; }; CancelButton SV_PRINT_CANCEL { @@ -76,7 +77,7 @@ ModalDialog SV_DLG_PRINT TabControl SV_PRINT_TABCTRL { Pos = MAP_APPFONT( 140, 5 ); - Size = MAP_APPFONT( 205, 155 ); + Size = MAP_APPFONT( 205, 160 ); }; FixedLine SV_PRINT_BUTTONLINE { @@ -149,6 +150,56 @@ ModalDialog SV_DLG_PRINT Pos = MAP_APPFONT( 50, 66 ); Size = MAP_APPFONT( 200, 10 ); }; + FixedLine SV_PRINT_PRT_NUP + { + Pos = MAP_APPFONT( 5, 80 ); + Size = MAP_APPFONT( 150, 10 ); + Text [en-US] = "N-Up printing"; + }; + FixedText SV_PRINT_PRT_NUP_ROWS_TXT + { + Pos = MAP_APPFONT( 10, 95 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "~Rows"; + }; + NumericField SV_PRINT_PRT_NUP_ROWS_EDT + { + Pos = MAP_APPFONT( 55, 95 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 32; + Value = 1; + }; + FixedText SV_PRINT_PRT_NUP_COLUMNS_TXT + { + Pos = MAP_APPFONT( 10, 110 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "C~olumns"; + }; + NumericField SV_PRINT_PRT_NUP_COLUMNS_EDT + { + Pos = MAP_APPFONT( 55, 110 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 32; + Value = 1; + }; + RadioButton SV_PRINT_PRT_NUP_PORTRAIT + { + Pos = MAP_APPFONT( 10, 125 ); + Size = MAP_APPFONT( 90, 10 ); + Text [en-US] = "Po~rtrait"; + }; + RadioButton SV_PRINT_PRT_NUP_LANDSCAPE + { + Pos = MAP_APPFONT( 10, 135 ); + Size = MAP_APPFONT( 90, 10 ); + Text [en-US] = "~Landscape"; + }; }; TabPage SV_PRINT_TAB_JOB @@ -164,58 +215,58 @@ ModalDialog SV_DLG_PRINT }; CheckBox SV_PRINT_PRT_TOFILE { - Pos = MAP_APPFONT( 15, 20 ); + Pos = MAP_APPFONT( 10, 20 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "Print to file"; }; FixedLine SV_PRINT_RANGE { - Pos = MAP_APPFONT( 5, 30 ); + Pos = MAP_APPFONT( 5, 35 ); Size = MAP_APPFONT( 150, 10 ); Text [en-US] = "Print range"; }; RadioButton SV_PRINT_ALL { - Pos = MAP_APPFONT( 10, 40 ); + Pos = MAP_APPFONT( 10, 45 ); Size = MAP_APPFONT( 145, 15 ); Text [en-US] = "All pages"; Check = TRUE; }; RadioButton SV_PRINT_PAGERANGE { - Pos = MAP_APPFONT( 10, 55 ); + Pos = MAP_APPFONT( 10, 60 ); Size = MAP_APPFONT( 60, 15 ); Text [en-US] = "Pages"; }; Edit SV_PRINT_PAGERANGE_EDIT { - Pos = MAP_APPFONT( 70, 55 ); - Size = MAP_APPFONT( 80, 15 ); + Pos = MAP_APPFONT( 70, 60 ); + Size = MAP_APPFONT( 80, 12 ); Border = TRUE; }; RadioButton SV_PRINT_SELECTION { - Pos = MAP_APPFONT( 10, 70 ); + Pos = MAP_APPFONT( 10, 75 ); Size = MAP_APPFONT( 145, 15 ); Text [en-US] = "Selection"; }; FixedLine SV_PRINT_COPIES { - Pos = MAP_APPFONT( 5, 90 ); + Pos = MAP_APPFONT( 5, 95 ); Size = MAP_APPFONT( 150, 10 ); Text [en-US] = "Copies"; }; FixedText SV_PRINT_COPYCOUNT { - Pos = MAP_APPFONT( 10, 100 ); + Pos = MAP_APPFONT( 10, 105 ); Size = MAP_APPFONT( 80, 10 ); Text [en-US] = "Number of copies"; }; NumericField SV_PRINT_COPYCOUNT_FIELD { - Pos = MAP_APPFONT( 90, 100 ); - Size = MAP_APPFONT( 40, 10 ); + Pos = MAP_APPFONT( 90, 105 ); + Size = MAP_APPFONT( 40, 12 ); Border = TRUE; Spin = TRUE; Minimum = 1; @@ -224,12 +275,12 @@ ModalDialog SV_DLG_PRINT }; FixedImage SV_PRINT_COLLATE_IMAGE { - Pos = MAP_APPFONT( 10, 120 ); + Pos = MAP_APPFONT( 10, 125 ); Size = MAP_PIXEL( 80, 30 ); }; CheckBox SV_PRINT_COLLATE { - Pos = MAP_APPFONT( 80, 120 ); + Pos = MAP_APPFONT( 80, 125 ); Size = MAP_APPFONT( 70, 10 ); Text [en-US] = "Collate"; }; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index eb1a0b2e0a2c..bc6e22d2283a 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -91,6 +91,13 @@ PrintDialog::PrinterTabPage::PrinterTabPage( Window* i_pParent, const ResId& rRe , maLocText( this, VclResId( SV_PRINT_PRT_LOCATION_TXT ) ) , maComment( this, VclResId( SV_PRINT_PRT_COMMENT ) ) , maCommentText( this, VclResId( SV_PRINT_PRT_COMMENT_TXT ) ) + , maNupLine( this, VclResId( SV_PRINT_PRT_NUP ) ) + , maNupRowsTxt( this, VclResId( SV_PRINT_PRT_NUP_ROWS_TXT ) ) + , maNupRowsEdt( this, VclResId( SV_PRINT_PRT_NUP_ROWS_EDT ) ) + , maNupColTxt( this, VclResId( SV_PRINT_PRT_NUP_COLUMNS_TXT ) ) + , maNupColEdt( this, VclResId( SV_PRINT_PRT_NUP_COLUMNS_EDT ) ) + , maNupPortrait( this, VclResId( SV_PRINT_PRT_NUP_PORTRAIT ) ) + , maNupLandscape( this, VclResId( SV_PRINT_PRT_NUP_LANDSCAPE ) ) { FreeResource(); } @@ -198,16 +205,36 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList } maJobPage.maPagesEdit.SetText( aBuf.makeStringAndClear() ); + // setup sizes for N-Up + Size aNupSize( maPListener->getPrinter()->PixelToLogic( + maPListener->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + if( maPListener->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE ) + { + maNupLandscapeSize = aNupSize; + maNupPortraitSize = Size( aNupSize.Height(), aNupSize.Width() ); + maPrinterPage.maNupLandscape.Check(); + } + else + { + maNupPortraitSize = aNupSize; + maNupLandscapeSize = Size( aNupSize.Height(), aNupSize.Width() ); + maPrinterPage.maNupPortrait.Check(); + } + // setup click handler on the various buttons maJobPage.maCollateBox.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maJobPage.maAllButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maJobPage.maSelectionButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maJobPage.maPagesButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); maPrinterPage.maSetupButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maPrinterPage.maNupPortrait.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maPrinterPage.maNupLandscape.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); // setup modify hdl maJobPage.maCopyCountField.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maJobPage.maPagesEdit.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maPrinterPage.maNupRowsEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maPrinterPage.maNupColEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); // setup optional UI options set by application setupOptionalUI(); @@ -712,6 +739,18 @@ void PrintDialog::preparePreview() maPreviewWindow.setPreview( aMtf ); } +void PrintDialog::updateNup() +{ + int nRows = maPrinterPage.maNupRowsEdt.GetValue(); + int nCols = maPrinterPage.maNupColEdt.GetValue(); + + maPListener->setMultipage( nRows, nCols, + maPrinterPage.maNupPortrait.IsChecked() + ? maNupPortraitSize : maNupLandscapeSize ); + + preparePreview(); +} + IMPL_LINK( PrintDialog, ScrollHdl, ScrollBar*, pScrBar ) { if( pScrBar == &maPageScrollbar ) @@ -772,6 +811,8 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) preparePreview(); } + if( pButton == &maPrinterPage.maNupPortrait || pButton == &maPrinterPage.maNupLandscape ) + updateNup(); return 0; } @@ -783,6 +824,10 @@ IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit ) maPListener->setPrintSelection( maJobPage.maPagesEdit.GetText() ); preparePreview(); } + else if( pEdit == &maPrinterPage.maNupRowsEdt || pEdit == &maPrinterPage.maNupColEdt ) + { + updateNup(); + } return 0; } |