Kaydet (Commit) a0f02b88 authored tarafından Daniel Silva's avatar Daniel Silva

Sets duplex (paper sides) box in print dialog

Change-Id: I223335dd9e02f8b09947a7b97ef4d718716a464b
Reviewed-on: https://gerrit.libreoffice.org/57833
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 952e4a6f
...@@ -305,6 +305,7 @@ public: ...@@ -305,6 +305,7 @@ public:
bool SetOrientation( Orientation eOrient ); bool SetOrientation( Orientation eOrient );
Orientation GetOrientation() const; Orientation GetOrientation() const;
void SetDuplexMode( DuplexMode ); void SetDuplexMode( DuplexMode );
DuplexMode GetDuplexMode() const;
bool SetPaperBin( sal_uInt16 nPaperBin ); bool SetPaperBin( sal_uInt16 nPaperBin );
sal_uInt16 GetPaperBin() const; sal_uInt16 GetPaperBin() const;
......
...@@ -143,6 +143,7 @@ namespace vcl ...@@ -143,6 +143,7 @@ namespace vcl
VclPtr<NumericField> mpCopyCountField; VclPtr<NumericField> mpCopyCountField;
VclPtr<CheckBox> mpCollateBox; VclPtr<CheckBox> mpCollateBox;
VclPtr<FixedImage> mpCollateImage; VclPtr<FixedImage> mpCollateImage;
VclPtr<ListBox> mpPaperSidesBox;
VclPtr<CheckBox> mpReverseOrderBox; VclPtr<CheckBox> mpReverseOrderBox;
VclPtr<OKButton> mpOKButton; VclPtr<OKButton> mpOKButton;
...@@ -226,6 +227,7 @@ namespace vcl ...@@ -226,6 +227,7 @@ namespace vcl
css::beans::PropertyValue* getValueForWindow( vcl::Window* ) const; css::beans::PropertyValue* getValueForWindow( vcl::Window* ) const;
void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false ); void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false );
void setupPaperSidesBox();
void setPreviewText(); void setPreviewText();
void updatePrinterText(); void updatePrinterText();
void checkControlDependencies(); void checkControlDependencies();
......
...@@ -1511,6 +1511,11 @@ void Printer::SetDuplexMode( DuplexMode eDuplex ) ...@@ -1511,6 +1511,11 @@ void Printer::SetDuplexMode( DuplexMode eDuplex )
} }
} }
DuplexMode Printer::GetDuplexMode() const
{
return maJobSetup.ImplGetConstData().GetDuplexMode();
}
Paper Printer::GetPaper() const Paper Printer::GetPaper() const
{ {
return maJobSetup.ImplGetConstData().GetPaperFormat(); return maJobSetup.ImplGetConstData().GetPaperFormat();
......
...@@ -558,6 +558,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -558,6 +558,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
get(mpStatusTxt, "status"); get(mpStatusTxt, "status");
get(mpCollateBox, "collate"); get(mpCollateBox, "collate");
get(mpCollateImage, "collateimage"); get(mpCollateImage, "collateimage");
get(mpPaperSidesBox, "sidesbox");
get(mpReverseOrderBox, "reverseorder"); get(mpReverseOrderBox, "reverseorder");
get(mpCopyCountField, "copycount"); get(mpCopyCountField, "copycount");
get(mpNupOrderWin, "orderpreview"); get(mpNupOrderWin, "orderpreview");
...@@ -636,6 +637,9 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -636,6 +637,9 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
// setup dependencies // setup dependencies
checkControlDependencies(); checkControlDependencies();
// setup paper sides box
setupPaperSidesBox();
// set initial focus to "Number of copies" // set initial focus to "Number of copies"
mpCopyCountField->GrabFocus(); mpCopyCountField->GrabFocus();
mpCopyCountField->SetSelection( Selection(0, 0xFFFF) ); mpCopyCountField->SetSelection( Selection(0, 0xFFFF) );
...@@ -680,6 +684,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -680,6 +684,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
// setup select hdl // setup select hdl
mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpPaperSidesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupPagesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); mpNupPagesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupOrientationBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); mpNupOrientationBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
mpNupOrderBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); mpNupOrderBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
...@@ -726,6 +731,7 @@ void PrintDialog::dispose() ...@@ -726,6 +731,7 @@ void PrintDialog::dispose()
mpCopyCountField.clear(); mpCopyCountField.clear();
mpCollateBox.clear(); mpCollateBox.clear();
mpCollateImage.clear(); mpCollateImage.clear();
mpPaperSidesBox.clear();
mpReverseOrderBox.clear(); mpReverseOrderBox.clear();
mpPagesBtn.clear(); mpPagesBtn.clear();
mpBrochureBtn.clear(); mpBrochureBtn.clear();
...@@ -751,6 +757,22 @@ void PrintDialog::dispose() ...@@ -751,6 +757,22 @@ void PrintDialog::dispose()
ModalDialog::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() void PrintDialog::setPaperSizes()
{ {
mpPaperSizeBox->Clear(); mpPaperSizeBox->Clear();
...@@ -1789,6 +1811,13 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox&, rBox, void ) ...@@ -1789,6 +1811,13 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox&, rBox, void )
setPaperSizes(); setPaperSizes();
preparePreview( true, true ); 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 ) else if( &rBox == mpNupOrientationBox || &rBox == mpNupOrderBox )
{ {
......
...@@ -87,6 +87,23 @@ ...@@ -87,6 +87,23 @@
</row> </row>
</data> </data>
</object> </object>
<object class="GtkListStore" id="liststore4">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes" context="printdialog|liststore4">Print only in one side</col>
</row>
<row>
<col id="0" translatable="yes" context="printdialog|liststore4">Print in both sides (long edge)</col>
</row>
<row>
<col id="0" translatable="yes" context="printdialog|liststore4">Print in both sides (short edge)</col>
</row>
</data>
</object>
<object class="GtkDialog" id="PrintDialog"> <object class="GtkDialog" id="PrintDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
...@@ -690,6 +707,7 @@ ...@@ -690,6 +707,7 @@
<object class="GtkComboBox" id="sidesbox"> <object class="GtkComboBox" id="sidesbox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="model">liststore4</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment