diff options
author | Daniel Silva <danielfaleirosilva@gmail.com> | 2018-06-21 10:20:54 -0300 |
---|---|---|
committer | Daniel Silva <danielfaleirosilva@gmail.com> | 2018-11-29 13:02:16 -0200 |
commit | 1a2ebd24e5daaefa209dea7f4b1889a8295b5794 (patch) | |
tree | ea4b55e8e4dc5947740f4d061c891d74ccb88ca3 /vcl | |
parent | bc34eaa0a87ff89b07581551991ac83d69f64d63 (diff) |
Adds More options dialog with single jobs checkbox in print dialog
Change-Id: I5f88e48edb5dfd966bcafca7866ee2a982a7f020
Reviewed-on: https://gerrit.libreoffice.org/56236
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/UIConfig_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/inc/printdlg.hxx | 23 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 11 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 53 | ||||
-rw-r--r-- | vcl/uiconfig/ui/moreoptionsdialog.ui | 88 | ||||
-rw-r--r-- | vcl/uiconfig/ui/printdialog.ui | 2 |
6 files changed, 170 insertions, 8 deletions
diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk index 8238c717a279..8a385dedddd8 100644 --- a/vcl/UIConfig_vcl.mk +++ b/vcl/UIConfig_vcl.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\ vcl/uiconfig/ui/editmenu \ vcl/uiconfig/ui/errornocontentdialog \ vcl/uiconfig/ui/errornoprinterdialog \ + vcl/uiconfig/ui/moreoptionsdialog \ vcl/uiconfig/ui/printdialog \ vcl/uiconfig/ui/printerdevicepage \ vcl/uiconfig/ui/printerpaperpage \ diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 468ea03a11ac..8ea63dfd4986 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -35,9 +35,27 @@ namespace vcl { + class MoreOptionsDialog : public ModalDialog + { + VclPtr<PrintDialog> mpParent; + VclPtr<OKButton> mpOKButton; + VclPtr<CancelButton> mpCancelButton; + VclPtr<CheckBox> mpSingleJobsBox; + + DECL_LINK( ClickHdl, Button*, void ); + + public: + + MoreOptionsDialog( VclPtr<PrintDialog> i_pParent ); + virtual ~MoreOptionsDialog() override; + virtual void dispose() override; + }; + class PrintDialog : public ModalDialog { + friend class MoreOptionsDialog; public: + class PrintPreviewWindow : public vcl::Window { GDIMetaFile maMtf; @@ -98,6 +116,7 @@ namespace vcl bool isPrintToFile(); bool isCollate(); + bool isSingleJobs() const { return mbSingleJobs; }; bool hasPreview(); void previewForward(); @@ -109,6 +128,8 @@ namespace vcl std::shared_ptr<PrinterController> maPController; + VclPtr< MoreOptionsDialog > mpMoreOptionsDlg; + VclPtr<TabControl> mpTabCtrl; VclPtr<VclFrame> mpPageLayoutFrame; VclPtr<ListBox> mpPrinters; @@ -126,6 +147,7 @@ namespace vcl VclPtr<OKButton> mpOKButton; VclPtr<CancelButton> mpCancelButton; VclPtr<HelpButton> mpHelpButton; + VclPtr<PushButton> mpMoreOptionsBtn; VclPtr<PushButton> mpBackwardBtn; VclPtr<PushButton> mpForwardBtn; @@ -184,6 +206,7 @@ namespace vcl Size maFirstPageSize; bool mbShowLayoutFrame; + bool mbSingleJobs; DECL_LINK( ClickHdl, Button*, void ); DECL_LINK( SelectHdl, ListBox&, void ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index ac58a5c21fda..e698ab9ee251 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -492,12 +492,11 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, xController->setValue( "LocalFileName", css::uno::makeAny( aFile ) ); } - // FIXME: single jobs is not implemented yet. - // else if( aDlg->isSingleJobs() ) - // { - // xController->setValue( "PrintCollateAsSingleJobs", - // css::uno::makeAny( true ) ); - // } + else if( aDlg->isSingleJobs() ) + { + xController->setValue( "PrintCollateAsSingleJobs", + css::uno::makeAny( true ) ); + } } catch (const std::bad_alloc&) { diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 9ace0dd8ef7a..d410e62d1261 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -79,6 +79,48 @@ namespace { } } +MoreOptionsDialog::MoreOptionsDialog( VclPtr<PrintDialog> i_pParent ) + : ModalDialog(i_pParent, "MoreOptionsDialog", "vcl/ui/moreoptionsdialog.ui") + , mpParent( i_pParent ) +{ + get(mpOKButton, "ok"); + get(mpCancelButton, "cancel"); + get(mpSingleJobsBox, "singlejobs"); + + mpSingleJobsBox->Check( mpParent->isSingleJobs() ); + + mpOKButton->SetClickHdl( LINK( this, MoreOptionsDialog, ClickHdl ) ); + mpCancelButton->SetClickHdl( LINK( this, MoreOptionsDialog, ClickHdl ) ); +} + +MoreOptionsDialog::~MoreOptionsDialog() +{ + disposeOnce(); +} + +void MoreOptionsDialog::dispose() +{ + mpOKButton.clear(); + mpCancelButton.clear(); + mpSingleJobsBox.clear(); + mpParent.clear(); + ModalDialog::dispose(); +} + +IMPL_LINK ( MoreOptionsDialog, ClickHdl, Button*, pButton, void ) +{ + if ( pButton == mpOKButton ) + { + mpParent->mbSingleJobs = mpSingleJobsBox->IsChecked(); + EndDialog( RET_OK ); + } + else if ( pButton == mpCancelButton ) + { + EndDialog( RET_CANCEL ); + } +} + + PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent ) : Window( i_pParent, 0 ) , maMtf() @@ -497,11 +539,12 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo , maNoCollateBmp(SV_PRINT_NOCOLLATE_BMP) , mnCollateUIMode(0) , mbShowLayoutFrame( true ) +, mbSingleJobs( false ) { - get(mpOKButton, "ok"); get(mpCancelButton, "cancel"); get(mpHelpButton, "help"); + get(mpMoreOptionsBtn, "moreoptionsbtn"); get(mpTabCtrl, "tabcontrol"); get(mpPageLayoutFrame, "layoutframe"); get(mpForwardBtn, "forward"); @@ -620,6 +663,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpHelpButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + mpMoreOptionsBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); mpBackwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpForwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpPreviewBox->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); @@ -667,6 +711,7 @@ void PrintDialog::dispose() mpOKButton.clear(); mpCancelButton.clear(); mpHelpButton.clear(); + mpMoreOptionsBtn.clear(); maPController.reset(); maControlToPropertyMap.clear(); maControlToNumValMap.clear(); @@ -696,6 +741,7 @@ void PrintDialog::dispose() mpNupOrderWin.clear(); mpNupOrderTxt.clear(); mpBorderCB.clear(); + mpMoreOptionsDlg.disposeAndClear(); ModalDialog::dispose(); } @@ -1630,6 +1676,11 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void ) { updateNup(); } + else if ( pButton == mpMoreOptionsBtn ) + { + mpMoreOptionsDlg = VclPtr< MoreOptionsDialog >::Create( this ); + mpMoreOptionsDlg->Execute(); + } else { if( pButton == mpSetupButton ) diff --git a/vcl/uiconfig/ui/moreoptionsdialog.ui b/vcl/uiconfig/ui/moreoptionsdialog.ui new file mode 100644 index 000000000000..7fb615d60417 --- /dev/null +++ b/vcl/uiconfig/ui/moreoptionsdialog.ui @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.4 --> +<interface domain="vcl"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkDialog" id="MoreOptionsDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes" context="moreoptionsdialog|moreprintingoptions">More Printing Options</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="box"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="buttonbox"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label" context="moreoptionsdialog|ok">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label" context="moreoptionsdialog|cancel">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="singlejobs"> + <property name="label" translatable="yes" context="moreoptionsdialog|singlejobs">Create single print jobs for collated output</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <child> + <placeholder/> + </child> + </object> +</interface> diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui index 0251d367f106..0073dbf1e5f4 100644 --- a/vcl/uiconfig/ui/printdialog.ui +++ b/vcl/uiconfig/ui/printdialog.ui @@ -116,7 +116,7 @@ </packing> </child> <child> - <object class="GtkButton" id="moreoptions"> + <object class="GtkButton" id="moreoptionsbtn"> <property name="label" translatable="yes" context="printdialog|moreoptions">More Options...</property> <property name="visible">True</property> <property name="can_focus">True</property> |