diff options
-rw-r--r-- | vcl/inc/vcl/print.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/vcl/prndlg.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/svids.hrc | 2 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 59 | ||||
-rw-r--r-- | vcl/source/src/print.src | 54 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 14 |
6 files changed, 83 insertions, 51 deletions
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 6d63d7a6ab23..8b5d711d129f 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -451,6 +451,7 @@ public: // all metrics in 100th mm int nRows; int nColumns; + int nRepeat; Size aPaperSize; long nLeftMargin; long nTopMargin; @@ -461,7 +462,7 @@ public: bool bDrawBorder; MultiPageSetup() - : nRows( 1 ), nColumns( 1 ), aPaperSize( 21000, 29700 ) + : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 ) , nLeftMargin( 0 ), nTopMargin( 0 ) , nRightMargin( 0 ), nBottomMargin( 0 ) , nHorizontalSpacing( 500 ), nVerticalSpacing( 500 ) diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index 384dcd2451e3..4d1ead6018e2 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -86,6 +86,8 @@ namespace vcl NumericField maNupRowsEdt; FixedText maNupColTxt; NumericField maNupColEdt; + FixedText maNupRepTxt; + NumericField maNupRepEdt; CheckBox maBorderCB; RadioButton maNupPortrait; RadioButton maNupLandscape; diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 4c512d056153..0edbd5661335 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -110,6 +110,8 @@ #define SV_PRINT_PRT_NUP_MARGINS_VSPACE_TXT 19 #define SV_PRINT_PRT_NUP_MARGINS_VSPACE_EDT 20 #define SV_PRINT_PRT_NUP_BORDER_CB 21 +#define SV_PRINT_PRT_NUP_PAGEREPEAT_TXT 22 +#define SV_PRINT_PRT_NUP_PAGEREPEAT_EDT 23 #define SV_PRINT_TAB_JOB 2 #define SV_PRINT_PRINTERS 1 diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index e873b1cc068d..00fda02135a3 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -513,35 +513,38 @@ Size PrinterListener::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_r o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); int nDocPages = getPageCount(); - for( int nPage = i_nFilteredPage * nSubPages, nSubP = 0; - nPage < (i_nFilteredPage+1)*nSubPages && nPage < nDocPages; - nPage++, nSubP++ ) + for( int nSubPage = 0; nSubPage < nSubPages; nSubPage++ ) { - GDIMetaFile aPageFile; - Size aPageSize = getPageFile( nPage, aPageFile ); - if( aPageSize.Width() && aPageSize.Height() ) + // map current sub page to real page + int nPage = (i_nFilteredPage * nSubPages + nSubPage) / rMPS.nRepeat; + if( nPage < nDocPages ) { - // scale the metafile down to a sub page size - double fScaleX = double(aSubPageSize.Width())/double(aPageSize.Width()); - double fScaleY = double(aSubPageSize.Height())/double(aPageSize.Height()); - double fScale = std::min( fScaleX, fScaleY ); - aPageFile.Scale( fScale, fScale ); - aPageFile.WindStart(); - - // move the subpage so it is centered in its "cell" - long nOffX = (aSubPageSize.Width() - long(double(aPageSize.Width()) * fScale)) / 2; - long nOffY = (aSubPageSize.Height() - long(double(aPageSize.Height()) * fScale)) / 2; - long nX = rMPS.nLeftMargin + nOffX + nAdvX * (nSubP % rMPS.nColumns); - long nY = rMPS.nTopMargin + nOffY + nAdvY * (nSubP / rMPS.nColumns); - aPageFile.Move( nX, nY ); - aPageFile.WindStart(); - // calculate border rectangle - Rectangle aSubPageRect( Point( nX, nY ), - Size( long(double(aPageSize.Width())*fScale), - long(double(aPageSize.Height())*fScale) ) ); - - // append subpage to page - appendSubPage( o_rMtf, aSubPageRect, aPageFile, rMPS.bDrawBorder ); + GDIMetaFile aPageFile; + Size aPageSize = getPageFile( nPage, aPageFile ); + if( aPageSize.Width() && aPageSize.Height() ) + { + // scale the metafile down to a sub page size + double fScaleX = double(aSubPageSize.Width())/double(aPageSize.Width()); + double fScaleY = double(aSubPageSize.Height())/double(aPageSize.Height()); + double fScale = std::min( fScaleX, fScaleY ); + aPageFile.Scale( fScale, fScale ); + aPageFile.WindStart(); + + // move the subpage so it is centered in its "cell" + long nOffX = (aSubPageSize.Width() - long(double(aPageSize.Width()) * fScale)) / 2; + long nOffY = (aSubPageSize.Height() - long(double(aPageSize.Height()) * fScale)) / 2; + long nX = rMPS.nLeftMargin + nOffX + nAdvX * (nSubPage % rMPS.nColumns); + long nY = rMPS.nTopMargin + nOffY + nAdvY * (nSubPage / rMPS.nColumns); + aPageFile.Move( nX, nY ); + aPageFile.WindStart(); + // calculate border rectangle + Rectangle aSubPageRect( Point( nX, nY ), + Size( long(double(aPageSize.Width())*fScale), + long(double(aPageSize.Height())*fScale) ) ); + + // append subpage to page + appendSubPage( o_rMtf, aSubPageRect, aPageFile, rMPS.bDrawBorder ); + } } } o_rMtf.WindStart(); @@ -554,7 +557,7 @@ int PrinterListener::getFilteredPageCount() int nDiv = mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns; if( nDiv < 1 ) nDiv = 1; - return (getPageCount() + (nDiv-1)) / nDiv; + return (getPageCount() * mpImplData->maMultiPage.nRepeat + (nDiv-1)) / nDiv; } void PrinterListener::printFilteredPage( int i_nPage ) diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 148af441b8ec..d629ba7c04d2 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -38,18 +38,18 @@ ModalDialog SV_DLG_PRINT Moveable = TRUE; SVLook = TRUE; - Size = MAP_APPFONT( 350, 205 ); + Size = MAP_APPFONT( 350, 215 ); OKButton SV_PRINT_OK { DefButton = TRUE; - Pos = MAP_APPFONT( 240, 185 ); + Pos = MAP_APPFONT( 240, 195 ); Size = MAP_APPFONT( 50, 15 ); Text [en-US] = "~Print"; }; CancelButton SV_PRINT_CANCEL { - Pos = MAP_APPFONT( 295, 185 ); + Pos = MAP_APPFONT( 295, 195 ); Size = MAP_APPFONT( 50, 15 ); }; @@ -87,12 +87,12 @@ ModalDialog SV_DLG_PRINT TabControl SV_PRINT_TABCTRL { Pos = MAP_APPFONT( 140, 5 ); - Size = MAP_APPFONT( 205, 165 ); + Size = MAP_APPFONT( 205, 175 ); // DropDown = TRUE; }; FixedLine SV_PRINT_BUTTONLINE { - Pos = MAP_APPFONT( 0, 175 ); + Pos = MAP_APPFONT( 0, 185 ); Size = MAP_APPFONT( 350, 8 ); }; String SV_PRINT_NOPAGES @@ -160,9 +160,25 @@ ModalDialog SV_DLG_PRINT Maximum = 32; Value = 1; }; - CheckBox SV_PRINT_PRT_NUP_BORDER_CB + FixedText SV_PRINT_PRT_NUP_PAGEREPEAT_TXT { Pos = MAP_APPFONT( 10, 50 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "~Repeat"; + }; + NumericField SV_PRINT_PRT_NUP_PAGEREPEAT_EDT + { + Pos = MAP_APPFONT( 55, 50 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 32; + Value = 1; + }; + CheckBox SV_PRINT_PRT_NUP_BORDER_CB + { + Pos = MAP_APPFONT( 10, 65 ); Size = MAP_APPFONT( 150, 12 ); Text [en-US] = "~Draw a Border around each page"; }; @@ -180,19 +196,19 @@ ModalDialog SV_DLG_PRINT }; FixedLine SV_PRINT_PRT_NUP_MARGINS_FL { - Pos = MAP_APPFONT( 5, 65 ); + Pos = MAP_APPFONT( 5, 80 ); Size = MAP_APPFONT( 150, 10 ); Text [en-US] = "Margins"; }; FixedText SV_PRINT_PRT_NUP_MARGINS_LEFT_TXT { - Pos = MAP_APPFONT( 10, 80 ); + Pos = MAP_APPFONT( 10, 95 ); Size = MAP_APPFONT( 40, 10 ); Text [en-US] = "~Left"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_LEFT_EDT { - Pos = MAP_APPFONT( 55, 80 ); + Pos = MAP_APPFONT( 55, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; @@ -201,13 +217,13 @@ ModalDialog SV_DLG_PRINT }; FixedText SV_PRINT_PRT_NUP_MARGINS_RIGHT_TXT { - Pos = MAP_APPFONT( 110, 80 ); + Pos = MAP_APPFONT( 110, 95 ); Size = MAP_APPFONT( 40, 10 ); Text [en-US] = "~Right"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_RIGHT_EDT { - Pos = MAP_APPFONT( 155, 80 ); + Pos = MAP_APPFONT( 155, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; @@ -216,13 +232,13 @@ ModalDialog SV_DLG_PRINT }; FixedText SV_PRINT_PRT_NUP_MARGINS_TOP_TXT { - Pos = MAP_APPFONT( 10, 95 ); + Pos = MAP_APPFONT( 10, 110 ); Size = MAP_APPFONT( 40, 10 ); Text [en-US] = "~Top"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_TOP_EDT { - Pos = MAP_APPFONT( 55, 95 ); + Pos = MAP_APPFONT( 55, 110 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; @@ -231,13 +247,13 @@ ModalDialog SV_DLG_PRINT }; FixedText SV_PRINT_PRT_NUP_MARGINS_BOTTOM_TXT { - Pos = MAP_APPFONT( 110, 95 ); + Pos = MAP_APPFONT( 110, 110 ); Size = MAP_APPFONT( 40, 10 ); Text [en-US] = "~Bottom"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_BOTTOM_EDT { - Pos = MAP_APPFONT( 155, 95 ); + Pos = MAP_APPFONT( 155, 110 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; @@ -247,13 +263,13 @@ ModalDialog SV_DLG_PRINT FixedText SV_PRINT_PRT_NUP_MARGINS_HSPACE_TXT { - Pos = MAP_APPFONT( 10, 115 ); + Pos = MAP_APPFONT( 10, 130 ); Size = MAP_APPFONT( 80, 10 ); Text [en-US] = "~Horizontal spacing"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_HSPACE_EDT { - Pos = MAP_APPFONT( 95, 115 ); + Pos = MAP_APPFONT( 95, 130 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; @@ -262,13 +278,13 @@ ModalDialog SV_DLG_PRINT }; FixedText SV_PRINT_PRT_NUP_MARGINS_VSPACE_TXT { - Pos = MAP_APPFONT( 10, 130 ); + Pos = MAP_APPFONT( 10, 145 ); Size = MAP_APPFONT( 80, 10 ); Text [en-US] = "~Vertical spacing"; }; MetricField SV_PRINT_PRT_NUP_MARGINS_VSPACE_EDT { - Pos = MAP_APPFONT( 95, 130 ); + Pos = MAP_APPFONT( 95, 145 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 121278bf21df..6d9772f8b5f2 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -117,6 +117,8 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) , 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 ) ) + , maNupRepTxt( this, VclResId( SV_PRINT_PRT_NUP_PAGEREPEAT_TXT ) ) + , maNupRepEdt( this, VclResId( SV_PRINT_PRT_NUP_PAGEREPEAT_EDT ) ) , maBorderCB( this, VclResId( SV_PRINT_PRT_NUP_BORDER_CB ) ) , maNupPortrait( this, VclResId( SV_PRINT_PRT_NUP_PORTRAIT ) ) , maNupLandscape( this, VclResId( SV_PRINT_PRT_NUP_LANDSCAPE ) ) @@ -166,6 +168,8 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) maNupRowsEdt.SMHID2( "NUpPage", "NUPRows" ); maNupColTxt.SMHID2( "NUpPage", "NUPColumnsText" ); maNupColEdt.SMHID2( "NUpPage", "NUPColumns" ); + maNupRepTxt.SMHID2( "NUpPage", "NUPRepeatText" ); + maNupRepEdt.SMHID2( "NUpPage", "NUPRepeat" ); maNupPortrait.SMHID2( "NUpPage", "NUPPortrait" ); maNupLandscape.SMHID2( "NUpPage", "NUPLandscape" ); maBorderCB.SMHID2( "NUpPage", "NUPBorder" ); @@ -199,6 +203,7 @@ void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterListener maBorderCB.Check( i_rMPS.bDrawBorder ); maNupRowsEdt.SetValue( i_rMPS.nRows ); maNupColEdt.SetValue( i_rMPS.nColumns ); + maNupRepEdt.SetValue( i_rMPS.nRepeat ); } void PrintDialog::NUpTabPage::readFromSettings() @@ -434,6 +439,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList maJobPage.maCopyCountField.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maNUpPage.maNupRowsEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maNUpPage.maNupColEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maNUpPage.maNupRepEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maNUpPage.maLeftMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maNUpPage.maTopMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); maNUpPage.maRightMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); @@ -1163,12 +1169,14 @@ void PrintDialog::preparePreview( bool i_bNewPage ) void PrintDialog::updateNup() { - int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); - int nCols = int(maNUpPage.maNupColEdt.GetValue()); + int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); + int nCols = int(maNUpPage.maNupColEdt.GetValue()); + int nRepeat = int(maNUpPage.maNupRepEdt.GetValue()); PrinterListener::MultiPageSetup aMPS; aMPS.nRows = nRows; aMPS.nColumns = nCols; + aMPS.nRepeat = nRepeat; aMPS.aPaperSize = maNUpPage.maNupPortrait.IsChecked() ? maNupPortraitSize : maNupLandscapeSize; aMPS.nLeftMargin = long(maNUpPage.maLeftMarginEdt.Denormalize(maNUpPage.maLeftMarginEdt.GetValue( FUNIT_100TH_MM ))); @@ -1231,7 +1239,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit ) { checkControlDependencies(); - if( pEdit == &maNUpPage.maNupRowsEdt || pEdit == &maNUpPage.maNupColEdt || + if( pEdit == &maNUpPage.maNupRowsEdt || pEdit == &maNUpPage.maNupColEdt || pEdit == &maNUpPage.maNupRepEdt || pEdit == &maNUpPage.maLeftMarginEdt || pEdit == &maNUpPage.maTopMarginEdt || pEdit == &maNUpPage.maRightMarginEdt || pEdit == &maNUpPage.maBottomMarginEdt || pEdit == &maNUpPage.maHSpaceEdt || pEdit == &maNUpPage.maVSpaceEdt |