From efe311f79e12853753d50ffaf73630dfc88c1c09 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 27 Jul 2009 17:10:15 +0000 Subject: #i92518# adapting new UX spec --- vcl/source/src/print.src | 184 +++++++++----------- vcl/source/window/printdlg.cxx | 371 +++++++++++++++++++++-------------------- 2 files changed, 267 insertions(+), 288 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index eb7ae8966d82..600a690ef23d 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -110,19 +110,43 @@ ModalDialog SV_DLG_PRINT Text [en-US] = "Page Layout"; Hide = TRUE; - FixedLine SV_PRINT_PRT_NUP + FixedLine SV_PRINT_PRT_NUP_LAYOUT_FL { Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 150, 10 ); - Text [en-US] = "N-Up printing"; + Text [en-US] = "Layout"; }; - FixedText SV_PRINT_PRT_NUP_ROWS_TXT + FixedText SV_PRINT_PRT_NUP_PAGES_TXT { Pos = MAP_APPFONT( 10, 20 ); Size = MAP_APPFONT( 40, 10 ); - Text [en-US] = "~Rows"; + Text [en-US] = "Pages per ~sheet"; }; - NumericField SV_PRINT_PRT_NUP_ROWS_EDT + ListBox SV_PRINT_PRT_NUP_PAGES_BOX + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 80 ); + Border = TRUE; + DropDown = TRUE; + CurPos = 0; + StringList [en-US] = + { + < "1"; 1; >; + < "2"; 2; >; + < "4"; 4; >; + < "6"; 6; >; + < "9"; 9; >; + < "16"; 16; >; + < "Custom"; 0xffff; >; + }; + }; + FixedText SV_PRINT_PRT_NUP_NUM_PAGES_TXT + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "P~ages"; + }; + NumericField SV_PRINT_PRT_NUP_COLS_EDT { Pos = MAP_APPFONT( 55, 20 ); Size = MAP_APPFONT( 40, 12 ); @@ -132,13 +156,13 @@ ModalDialog SV_DLG_PRINT Maximum = 32; Value = 1; }; - FixedText SV_PRINT_PRT_NUP_COLUMNS_TXT + FixedText SV_PRINT_PRT_NUP_TIMES_TXT { Pos = MAP_APPFONT( 10, 35 ); Size = MAP_APPFONT( 40, 10 ); - Text [en-US] = "C~olumns"; + Text [en-US] = "~by"; }; - NumericField SV_PRINT_PRT_NUP_COLUMNS_EDT + NumericField SV_PRINT_PRT_NUP_ROWS_EDT { Pos = MAP_APPFONT( 55, 35 ); Size = MAP_APPFONT( 40, 12 ); @@ -148,53 +172,13 @@ ModalDialog SV_DLG_PRINT Maximum = 32; Value = 1; }; - 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"; - }; - RadioButton SV_PRINT_PRT_NUP_PORTRAIT - { - Pos = MAP_APPFONT( 110, 20 ); - Size = MAP_APPFONT( 90, 10 ); - Text [en-US] = "Po~rtrait"; - }; - RadioButton SV_PRINT_PRT_NUP_LANDSCAPE - { - Pos = MAP_APPFONT( 110, 30 ); - Size = MAP_APPFONT( 90, 10 ); - Text [en-US] = "~Landscape"; - }; - FixedLine SV_PRINT_PRT_NUP_MARGINS_FL - { - Pos = MAP_APPFONT( 5, 80 ); - Size = MAP_APPFONT( 150, 10 ); - Text [en-US] = "Margins"; - }; - FixedText SV_PRINT_PRT_NUP_MARGINS_LEFT_TXT + FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_TXT { Pos = MAP_APPFONT( 10, 95 ); Size = MAP_APPFONT( 40, 10 ); - Text [en-US] = "~Left"; + Text [en-US] = "~Margin between pages"; }; - MetricField SV_PRINT_PRT_NUP_MARGINS_LEFT_EDT + MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT { Pos = MAP_APPFONT( 55, 95 ); Size = MAP_APPFONT( 40, 12 ); @@ -203,13 +187,13 @@ ModalDialog SV_DLG_PRINT Value = 0; Unit = FUNIT_MM; }; - FixedText SV_PRINT_PRT_NUP_MARGINS_RIGHT_TXT + FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_TXT { Pos = MAP_APPFONT( 110, 95 ); Size = MAP_APPFONT( 40, 10 ); - Text [en-US] = "~Right"; + Text [en-US] = "Ma~rgin to sheet border"; }; - MetricField SV_PRINT_PRT_NUP_MARGINS_RIGHT_EDT + MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT { Pos = MAP_APPFONT( 155, 95 ); Size = MAP_APPFONT( 40, 12 ); @@ -218,66 +202,50 @@ ModalDialog SV_DLG_PRINT Value = 0; Unit = FUNIT_MM; }; - FixedText SV_PRINT_PRT_NUP_MARGINS_TOP_TXT - { - 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, 110 ); - Size = MAP_APPFONT( 40, 12 ); - Spin = TRUE; - Border = TRUE; - Value = 0; - Unit = FUNIT_MM; - }; - FixedText SV_PRINT_PRT_NUP_MARGINS_BOTTOM_TXT + FixedText SV_PRINT_PRT_NUP_ORIENTATION_TXT { - Pos = MAP_APPFONT( 110, 110 ); - Size = MAP_APPFONT( 40, 10 ); - Text [en-US] = "~Bottom"; + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "~Orientation"; }; - MetricField SV_PRINT_PRT_NUP_MARGINS_BOTTOM_EDT + ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX { - Pos = MAP_APPFONT( 155, 110 ); - Size = MAP_APPFONT( 40, 12 ); - Spin = TRUE; + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 40 ); Border = TRUE; - Value = 0; - Unit = FUNIT_MM; - }; - - FixedText SV_PRINT_PRT_NUP_MARGINS_HSPACE_TXT - { - 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, 130 ); - Size = MAP_APPFONT( 40, 12 ); - Spin = TRUE; + DropDown = TRUE; + CurPos = 0; + StringList [en-US] = + { + < "Automatic"; SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC; >; + < "Portrait"; SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT; >; + < "Landscape"; SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE; >; + }; + }; + FixedText SV_PRINT_PRT_NUP_ORDER_TXT + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "Order"; + }; + ListBox SV_PRINT_PRT_NUP_ORDER_BOX + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 20 ); + DropDown = TRUE; Border = TRUE; - Value = 0; - Unit = FUNIT_MM; + CurPos = 0; + StringList [en-US] = + { + < "left to right, then down"; 1; >; + < "top to bottom, then right"; 2; >; + }; }; - FixedText SV_PRINT_PRT_NUP_MARGINS_VSPACE_TXT - { - Pos = MAP_APPFONT( 10, 145 ); - Size = MAP_APPFONT( 80, 10 ); - Text [en-US] = "~Vertical spacing"; - }; - MetricField SV_PRINT_PRT_NUP_MARGINS_VSPACE_EDT + CheckBox SV_PRINT_PRT_NUP_BORDER_CB { - Pos = MAP_APPFONT( 95, 145 ); - Size = MAP_APPFONT( 40, 12 ); - Spin = TRUE; - Border = TRUE; - Value = 0; - Unit = FUNIT_MM; + Pos = MAP_APPFONT( 10, 65 ); + Size = MAP_APPFONT( 150, 12 ); + Text [en-US] = "~Draw a Border around each page"; }; }; @@ -382,7 +350,7 @@ ModalDialog SV_DLG_PRINT Text [en-US] = "Options"; Hide = TRUE; - FixedLine SV_PRINT_PRT_NUP + FixedLine SV_PRINT_OPT_PRINT_FL { Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 150, 10 ); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 3022151e4425..dd618766451c 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -147,39 +147,33 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi { maMtf = i_rNewPreview; maOrigSize = i_rOrigSize; + Resize(); Invalidate(); } PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) : TabPage( i_pParent, rResId ) - , maNupLine( this, VclResId( SV_PRINT_PRT_NUP ) ) - , maNupRowsTxt( this, VclResId( SV_PRINT_PRT_NUP_ROWS_TXT ) ) + , maNupLine( this, VclResId( SV_PRINT_PRT_NUP_LAYOUT_FL ) ) + , maNupPagesTxt( this, VclResId( SV_PRINT_PRT_NUP_PAGES_TXT ) ) + , maNupPagesBox( this, VclResId( SV_PRINT_PRT_NUP_PAGES_BOX ) ) + , maNupNumPagesTxt( this, VclResId( SV_PRINT_PRT_NUP_NUM_PAGES_TXT ) ) + , maNupColEdt( this, VclResId( SV_PRINT_PRT_NUP_COLS_EDT ) ) + , maNupTimesTxt( this, VclResId( SV_PRINT_PRT_NUP_TIMES_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 ) ) - , maNupRepTxt( this, VclResId( SV_PRINT_PRT_NUP_PAGEREPEAT_TXT ) ) - , maNupRepEdt( this, VclResId( SV_PRINT_PRT_NUP_PAGEREPEAT_EDT ) ) + , maPageMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_TXT ) ) + , maPageMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT ) ) + , maSheetMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_TXT ) ) + , maSheetMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT ) ) + , maNupOrientationTxt( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_TXT ) ) + , maNupOrientationBox( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_BOX ) ) + , maNupOrderTxt( this, VclResId( SV_PRINT_PRT_NUP_ORDER_TXT ) ) + , maNupOrderBox( this, VclResId( SV_PRINT_PRT_NUP_ORDER_BOX ) ) , 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 ) ) - , maMargins( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_FL ) ) - , maLeftMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_LEFT_TXT ) ) - , maLeftMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_LEFT_EDT) ) - , maRightMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_RIGHT_TXT ) ) - , maRightMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_RIGHT_EDT ) ) - , maTopMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_TOP_TXT ) ) - , maTopMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_TOP_EDT ) ) - , maBottomMarginTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_BOTTOM_TXT ) ) - , maBottomMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_BOTTOM_EDT ) ) - , maHSpaceTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_HSPACE_TXT ) ) - , maHSpaceEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_HSPACE_EDT ) ) - , maVSpaceTxt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_VSPACE_TXT ) ) - , maVSpaceEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_VSPACE_EDT ) ) { FreeResource(); // setup field units for metric fields - const LocaleDataWrapper& rLocWrap( maLeftMarginEdt.GetLocaleDataWrapper() ); + const LocaleDataWrapper& rLocWrap( maPageMarginEdt.GetLocaleDataWrapper() ); FieldUnit eUnit = FUNIT_MM; USHORT nDigits = 0; if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) @@ -188,162 +182,105 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) nDigits = 2; } // set units - maLeftMarginEdt.SetUnit( eUnit ); - maTopMarginEdt.SetUnit( eUnit ); - maRightMarginEdt.SetUnit( eUnit ); - maBottomMarginEdt.SetUnit( eUnit ); - maHSpaceEdt.SetUnit( eUnit ); - maVSpaceEdt.SetUnit( eUnit ); + maPageMarginEdt.SetUnit( eUnit ); + maSheetMarginEdt.SetUnit( eUnit ); // set precision - maLeftMarginEdt.SetDecimalDigits( nDigits ); - maTopMarginEdt.SetDecimalDigits( nDigits ); - maRightMarginEdt.SetDecimalDigits( nDigits ); - maBottomMarginEdt.SetDecimalDigits( nDigits ); - maHSpaceEdt.SetDecimalDigits( nDigits ); - maVSpaceEdt.SetDecimalDigits( nDigits ); - - maNupLine.SMHID2( "NUpPage", "NUPline" ); - maNupRowsTxt.SMHID2( "NUpPage", "NUPRowsText" ); - 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" ); - maMargins.SMHID2( "NUpPage", "NUPMargins" ); - maLeftMarginTxt.SMHID2( "NUpPage", "NUPLeftText" ); - maLeftMarginEdt.SMHID2( "NUpPage", "NUPLeft" ); - maTopMarginTxt.SMHID2( "NUpPage", "NUPTopText" ); - maTopMarginEdt.SMHID2( "NUpPage", "NUPTop" ); - maRightMarginTxt.SMHID2( "NUpPage", "NUPRightText" ); - maRightMarginEdt.SMHID2( "NUpPage", "NUPRight" ); - maBottomMarginTxt.SMHID2( "NUpPage", "NUPBottomText" ); - maBottomMarginEdt.SMHID2( "NUpPage", "NUPBottom" ); - maHSpaceTxt.SMHID2( "NUpPage", "NUPHSpaceText" ); - maHSpaceEdt.SMHID2( "NUpPage", "NUPHSpace" ); - maVSpaceTxt.SMHID2( "NUpPage", "NUPVSpaceText" ); - maVSpaceEdt.SMHID2( "NUpPage", "NUPVSpace" ); + maPageMarginEdt.SetDecimalDigits( nDigits ); + maSheetMarginEdt.SetDecimalDigits( nDigits ); + + maNupLine.SMHID2("NUpPage", "Layout"); + maNupPagesTxt.SMHID2( "NUpPage", "PagesPerSheet" ); + maNupPagesBox.SMHID2( "NUpPage", "PagesPerSheetBox" ); + maNupNumPagesTxt.SMHID2( "NUpPage", "Columns" ); + maNupColEdt.SMHID2( "NUpPage", "ColumnsBox" ); + maNupTimesTxt.SMHID2( "NUpPage", "Rows" ); + maNupRowsEdt.SMHID2( "NUpPage", "RowsBox" ); + maPageMarginTxt.SMHID2( "NUpPage", "PageMargin" ); + maPageMarginEdt.SMHID2( "NUpPage", "PageMarginBox" ); + maSheetMarginTxt.SMHID2( "NUpPage", "SheetMargin" ); + maSheetMarginEdt.SMHID2( "NUpPage", "SheetMarginBox" ); + maNupOrientationTxt.SMHID2( "NUpPage", "Orientation" ); + maNupOrientationBox.SMHID2( "NUpPage", "OrientationBox" ); + maNupOrderTxt.SMHID2( "NUpPage", "Order" ); + maNupOrderBox.SMHID2( "NUpPage", "OrderBox" ); + maBorderCB.SMHID2( "NUpPage", "BorderBox" ); + + setupLayout(); } PrintDialog::NUpTabPage::~NUpTabPage() { } -void PrintDialog::NUpTabPage::Resize() +void PrintDialog::NUpTabPage::setupLayout() { Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); - boost::shared_ptr aPage( new vcl::RowOrColumn() ); - aPage->setParentWindow( this ); - aPage->setOuterBorder( aBorder.Width() ); - aPage->addWindow( &maNupLine ); - - boost::shared_ptr aNupIndent( new vcl::Indenter( aPage.get(), aBorder.Width() ) ); - aPage->addChild( aNupIndent ); - boost::shared_ptr aNupColumn( new vcl::RowOrColumn( aNupIndent.get() ) ); - aNupIndent->setChild( aNupColumn ); - - boost::shared_ptr aNupRow( new vcl::RowOrColumn( aNupColumn.get(), false ) ); - aNupColumn->addChild( aNupRow ); - boost::shared_ptr aNupMat( new vcl::MatrixArranger( aNupRow.get(), aBorder.Width(), aBorder.Height() ) ); - aNupRow->addChild( aNupMat ); - aNupMat->addWindow( &maNupRowsTxt, 0, 0 ); - aNupMat->addWindow( &maNupRowsEdt, 1, 0 ); - aNupMat->addWindow( &maNupColTxt, 0, 1 ); - aNupMat->addWindow( &maNupColEdt, 1, 1 ); - aNupMat->addWindow( &maNupRepTxt, 0, 2 ); - aNupMat->addWindow( &maNupRepEdt, 1, 2 ); - boost::shared_ptr aOriCol( new vcl::RowOrColumn( aNupRow.get() ) ); - aNupRow->addChild( aOriCol ); - aOriCol->addWindow( &maNupPortrait ); - aOriCol->addWindow( &maNupLandscape ); - - aNupColumn->addWindow( &maBorderCB ); - - aPage->addWindow( &maMargins ); - - boost::shared_ptr aMargIndent( new vcl::Indenter( aPage.get(), aBorder.Width() ) ); - aPage->addChild( aMargIndent ); - boost::shared_ptr aMargColumn( new vcl::RowOrColumn( aMargIndent.get(), true, 2*aBorder.Height() ) ); - aMargIndent->setChild( aMargColumn ); - - boost::shared_ptr aMargMat( new vcl::MatrixArranger( aMargIndent.get(), aBorder.Width(), aBorder.Height() ) ); - aMargColumn->addChild( aMargMat ); - aMargMat->addWindow( &maLeftMarginTxt, 0, 0 ); - aMargMat->addWindow( &maLeftMarginEdt, 1, 0 ); - aMargMat->addWindow( &maRightMarginTxt, 3, 0 ); - aMargMat->addWindow( &maRightMarginEdt, 4, 0 ); - aMargMat->addWindow( &maTopMarginTxt, 0, 1 ); - aMargMat->addWindow( &maTopMarginEdt, 1, 1 ); - aMargMat->addWindow( &maBottomMarginTxt, 3, 1 ); - aMargMat->addWindow( &maBottomMarginEdt, 4, 1 ); - - boost::shared_ptr aSpacingMat( new vcl::MatrixArranger( aPage.get(), aBorder.Width(), aBorder.Height() ) ); - aMargColumn->addChild( aSpacingMat ); - aSpacingMat->addWindow( &maHSpaceTxt, 0, 0 ); - aSpacingMat->addWindow( &maHSpaceEdt, 1, 0 ); - aSpacingMat->addWindow( &maVSpaceTxt, 0, 1 ); - aSpacingMat->addWindow( &maVSpaceEdt, 1, 1 ); - - aPage->setManagedArea( Rectangle( Point(), GetOutputSizePixel() ) ); + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + maLayout.addWindow( &maNupLine ); + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &maLayout, false ) ); + maLayout.addChild( xRow ); + xRow->addWindow( &maNupPagesTxt ); + xRow->addWindow( &maNupPagesBox ); + + boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( &maLayout ) ); + maLayout.addChild( xIndent ); + boost::shared_ptr< vcl::RowOrColumn > xCol( new vcl::RowOrColumn( xIndent.get() ) ); + xIndent->setChild( xCol ); + + xRow.reset( new vcl::RowOrColumn( xCol.get(), false ) ); + xCol->addChild( xRow ); + xRow->addWindow( &maNupNumPagesTxt ); + xRow->addWindow( &maNupColEdt ); + xRow->addWindow( &maNupTimesTxt ); + xRow->addWindow( &maNupRowsEdt ); + + xRow.reset( new vcl::RowOrColumn( xCol.get(), false ) ); + xCol->addChild( xRow ); + xRow->addWindow( &maPageMarginTxt ); + xRow->addWindow( &maPageMarginEdt ); + + xRow.reset( new vcl::RowOrColumn( xCol.get(), false ) ); + xCol->addChild( xRow ); + xRow->addWindow( &maSheetMarginTxt ); + xRow->addWindow( &maSheetMarginEdt ); + + xRow.reset( new vcl::RowOrColumn( xCol.get(), false ) ); + xCol->addChild( xRow ); + xRow->addWindow( &maNupOrientationTxt ); + xRow->addWindow( &maNupOrientationBox ); + + xRow.reset( new vcl::RowOrColumn( &maLayout, false ) ); + maLayout.addChild( xRow ); + xRow->addWindow( &maNupOrderTxt ); + xRow->addWindow( &maNupOrderBox ); + + maLayout.addWindow( &maBorderCB ); +} + +void PrintDialog::NUpTabPage::Resize() +{ + maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); } void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS ) { - maLeftMarginEdt.SetValue( maLeftMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); - maTopMarginEdt.SetValue( maTopMarginEdt.Normalize( i_rMPS.nTopMargin ), FUNIT_100TH_MM ); - maRightMarginEdt.SetValue( maRightMarginEdt.Normalize( i_rMPS.nRightMargin ), FUNIT_100TH_MM ); - maBottomMarginEdt.SetValue( maBottomMarginEdt.Normalize( i_rMPS.nBottomMargin ), FUNIT_100TH_MM ); - maHSpaceEdt.SetValue( maHSpaceEdt.Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM ); - maVSpaceEdt.SetValue( maVSpaceEdt.Normalize( i_rMPS.nVerticalSpacing ), FUNIT_100TH_MM ); + maSheetMarginEdt.SetValue( maSheetMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); + maPageMarginEdt.SetValue( maPageMarginEdt.Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM ); maBorderCB.Check( i_rMPS.bDrawBorder ); maNupRowsEdt.SetValue( i_rMPS.nRows ); maNupColEdt.SetValue( i_rMPS.nColumns ); - maNupRepEdt.SetValue( i_rMPS.nRepeat ); } void PrintDialog::NUpTabPage::readFromSettings() { - #if 0 - SettingsConfigItem* pItem = SettingsConfigItem::get(); - rtl::OUString aValue; - - aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Rows" ) ) ); - sal_Int32 nVal = aValue.toInt32(); - maNupRowsEdt.SetValue( sal_Int64( nVal > 1 ? nVal : 1) ); - - aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Columns" ) ) ); - nVal = aValue.toInt32(); - maNupColEdt.SetValue( sal_Int64(nVal > 1 ? nVal : 1) ); - - aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Portrait" ) ) ); - if( aValue.equalsIgnoreAsciiCaseAscii( "true" ) ) - maNupPortrait.Check(); - else - maNupLandscape.Check(); - #endif } void PrintDialog::NUpTabPage::storeToSettings() { - #if 0 - SettingsConfigItem* pItem = SettingsConfigItem::get(); - pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Rows" ) ), - maNupRowsEdt.GetText() ); - pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Columns" ) ), - maNupColEdt.GetText() ); - pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUp-Portrait" ) ), - rtl::OUString::createFromAscii( maNupPortrait.IsChecked() ? "true" : "false" ) ); - #endif } PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) @@ -650,13 +587,11 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrgetMultipage() ); @@ -670,8 +605,6 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrgetPageCount() > 0 ) + maFirstPageSize = maPController->getPageFile( 0, aMtf, true ); + } + return maFirstPageSize; +} + void PrintDialog::updateNup() { - int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); - int nCols = int(maNUpPage.maNupColEdt.GetValue()); - int nRepeat = int(maNUpPage.maNupRepEdt.GetValue()); + int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); + int nCols = int(maNUpPage.maNupColEdt.GetValue()); + long nPageMargin = long(maNUpPage.maPageMarginEdt.Denormalize(maNUpPage.maPageMarginEdt.GetValue( FUNIT_100TH_MM ))); + long nSheetMargin = long(maNUpPage.maSheetMarginEdt.Denormalize(maNUpPage.maSheetMarginEdt.GetValue( FUNIT_100TH_MM ))); PrinterController::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 ))); - aMPS.nTopMargin = long(maNUpPage.maTopMarginEdt.Denormalize(maNUpPage.maTopMarginEdt.GetValue( FUNIT_100TH_MM ))); - aMPS.nRightMargin = long(maNUpPage.maRightMarginEdt.Denormalize(maNUpPage.maRightMarginEdt.GetValue( FUNIT_100TH_MM ))); - aMPS.nBottomMargin = long(maNUpPage.maBottomMarginEdt.Denormalize(maNUpPage.maBottomMarginEdt.GetValue( FUNIT_100TH_MM ))); + aMPS.nRepeat = 1; + aMPS.nLeftMargin = + aMPS.nTopMargin = + aMPS.nRightMargin = + aMPS.nBottomMargin = nSheetMargin; - aMPS.nHorizontalSpacing = long(maNUpPage.maHSpaceEdt.Denormalize(maNUpPage.maHSpaceEdt.GetValue( FUNIT_100TH_MM ))); - aMPS.nVerticalSpacing = long(maNUpPage.maVSpaceEdt.Denormalize(maNUpPage.maVSpaceEdt.GetValue( FUNIT_100TH_MM ))); + aMPS.nHorizontalSpacing = + aMPS.nVerticalSpacing = nPageMargin; aMPS.bDrawBorder = maNUpPage.maBorderCB.IsChecked(); + int nOrientationMode = int(maNUpPage.maNupOrientationBox.GetEntryData( + maNUpPage.maNupOrientationBox.GetSelectEntryPos() )); + if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE ) + { + aMPS.aPaperSize = maNupLandscapeSize; + } + else if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT ) + { + aMPS.aPaperSize = maNupPortraitSize; + } + else // automatic mode + { + // get size of first real page to see if it is portrait or landscape + // we assume same page sizes for all the pages for this + Size aPageSize = getJobPageSize(); + + Size aMultiSize( aPageSize.Width() * nCols, aPageSize.Height() * nRows ); + if( aMultiSize.Width() > aMultiSize.Height() ) // fits better on landscape + aMPS.aPaperSize = maNupLandscapeSize; + else + aMPS.aPaperSize = maNupPortraitSize; + } + maPController->setMultipage( aMPS ); preparePreview( true, true ); @@ -1494,6 +1461,52 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox ) // update text fields updatePrinterText(); } + else if( pBox == &maNUpPage.maNupOrientationBox ) + { + updateNup(); + } + else if( pBox == &maNUpPage.maNupPagesBox ) + { + long nPages = long(maNUpPage.maNupPagesBox.GetEntryData(maNUpPage.maNupPagesBox.GetSelectEntryPos())); + int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); + int nCols = int(maNUpPage.maNupColEdt.GetValue()); + bool bCustom = false; + + if( nPages == 1 ) + nRows = nCols = 1; + else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 ) + { + Size aJobPageSize( getJobPageSize() ); + bool bPortrait = aJobPageSize.Width() < aJobPageSize.Height(); + if( nPages == 2 ) + { + if( bPortrait ) + nRows = 1, nCols = 2; + else + nRows = 2, nCols = 1; + } + else if( nPages == 4 ) + nRows = nCols = 2; + else if( nPages == 6 ) + { + if( bPortrait ) + nRows = 2, nCols = 3; + else + nRows = 3, nCols = 2; + } + else if( nPages == 9 ) + nRows = nCols = 3; + else if( nPages == 16 ) + nRows = nCols = 4; + } + else + bCustom = true; + + maNUpPage.maNupRowsEdt.SetValue( nRows ); + maNUpPage.maNupColEdt.SetValue( nCols ); + updateNup(); + } + return 0; } @@ -1530,7 +1543,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) maPController->getPrinter()->Setup( this ); } checkControlDependencies(); - if( pButton == &maNUpPage.maNupPortrait || pButton == &maNUpPage.maNupLandscape || pButton == &maNUpPage.maBorderCB ) + if( pButton == &maNUpPage.maBorderCB ) updateNup(); } return 0; @@ -1539,10 +1552,8 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit ) { checkControlDependencies(); - 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 + if( pEdit == &maNUpPage.maNupRowsEdt || pEdit == &maNUpPage.maNupColEdt || + pEdit == &maNUpPage.maSheetMarginEdt || pEdit == &maNUpPage.maPageMarginEdt ) { updateNup(); -- cgit