summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorDaniel Silva <danielfaleirosilva@gmail.com>2018-07-22 21:05:56 -0300
committerDaniel Silva <danielfaleirosilva@gmail.com>2018-11-29 13:02:16 -0200
commita0f02b8856fce1ee0eb5f1748c7c7fc04bd568a6 (patch)
tree3c30f55549ca7ed4b47dc2a63e6d6804ce889e9a /vcl/source
parent952e4a6ffd95b49d421b6477b3f8e33a6550097f (diff)
Sets duplex (paper sides) box in print dialog
Change-Id: I223335dd9e02f8b09947a7b97ef4d718716a464b Reviewed-on: https://gerrit.libreoffice.org/57833 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/print.cxx5
-rw-r--r--vcl/source/window/printdlg.cxx29
2 files changed, 34 insertions, 0 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 7fb990a04700..a651fb6a5d99 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1511,6 +1511,11 @@ void Printer::SetDuplexMode( DuplexMode eDuplex )
}
}
+DuplexMode Printer::GetDuplexMode() const
+{
+ return maJobSetup.ImplGetConstData().GetDuplexMode();
+}
+
Paper Printer::GetPaper() const
{
return maJobSetup.ImplGetConstData().GetPaperFormat();
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 80df9a54475d..5951c8aff4c2 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -558,6 +558,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
get(mpStatusTxt, "status");
get(mpCollateBox, "collate");
get(mpCollateImage, "collateimage");
+ get(mpPaperSidesBox, "sidesbox");
get(mpReverseOrderBox, "reverseorder");
get(mpCopyCountField, "copycount");
get(mpNupOrderWin, "orderpreview");
@@ -636,6 +637,9 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
// setup dependencies
checkControlDependencies();
+ // setup paper sides box
+ setupPaperSidesBox();
+
// set initial focus to "Number of copies"
mpCopyCountField->GrabFocus();
mpCopyCountField->SetSelection( Selection(0, 0xFFFF) );
@@ -680,6 +684,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
// setup select hdl
mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
+ mpPaperSidesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupPagesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupOrientationBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupOrderBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
@@ -726,6 +731,7 @@ void PrintDialog::dispose()
mpCopyCountField.clear();
mpCollateBox.clear();
mpCollateImage.clear();
+ mpPaperSidesBox.clear();
mpReverseOrderBox.clear();
mpPagesBtn.clear();
mpBrochureBtn.clear();
@@ -751,6 +757,22 @@ void PrintDialog::dispose()
ModalDialog::dispose();
}
+void PrintDialog::setupPaperSidesBox()
+{
+ DuplexMode eDuplex = maPController->getPrinter()->GetDuplexMode();
+
+ if ( eDuplex == DuplexMode::Unknown || isPrintToFile() )
+ {
+ mpPaperSidesBox->SelectEntryPos( 0 );
+ mpPaperSidesBox->Enable( false );
+ }
+ else
+ {
+ mpPaperSidesBox->SelectEntryPos( static_cast<sal_Int32>(eDuplex) - 1 );
+ mpPaperSidesBox->Enable( true );
+ }
+}
+
void PrintDialog::setPaperSizes()
{
mpPaperSizeBox->Clear();
@@ -1789,6 +1811,13 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox&, rBox, void )
setPaperSizes();
preparePreview( true, true );
}
+
+ setupPaperSidesBox();
+ }
+ else if ( &rBox == mpPaperSidesBox )
+ {
+ DuplexMode eDuplex = static_cast<DuplexMode>(mpPaperSidesBox->GetSelectedEntryPos() + 1);
+ maPController->getPrinter()->SetDuplexMode( eDuplex );
}
else if( &rBox == mpNupOrientationBox || &rBox == mpNupOrderBox )
{