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

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: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst bc34eaa0
...@@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\ ...@@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\
vcl/uiconfig/ui/editmenu \ vcl/uiconfig/ui/editmenu \
vcl/uiconfig/ui/errornocontentdialog \ vcl/uiconfig/ui/errornocontentdialog \
vcl/uiconfig/ui/errornoprinterdialog \ vcl/uiconfig/ui/errornoprinterdialog \
vcl/uiconfig/ui/moreoptionsdialog \
vcl/uiconfig/ui/printdialog \ vcl/uiconfig/ui/printdialog \
vcl/uiconfig/ui/printerdevicepage \ vcl/uiconfig/ui/printerdevicepage \
vcl/uiconfig/ui/printerpaperpage \ vcl/uiconfig/ui/printerpaperpage \
......
...@@ -35,9 +35,27 @@ ...@@ -35,9 +35,27 @@
namespace vcl 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 class PrintDialog : public ModalDialog
{ {
friend class MoreOptionsDialog;
public: public:
class PrintPreviewWindow : public vcl::Window class PrintPreviewWindow : public vcl::Window
{ {
GDIMetaFile maMtf; GDIMetaFile maMtf;
...@@ -98,6 +116,7 @@ namespace vcl ...@@ -98,6 +116,7 @@ namespace vcl
bool isPrintToFile(); bool isPrintToFile();
bool isCollate(); bool isCollate();
bool isSingleJobs() const { return mbSingleJobs; };
bool hasPreview(); bool hasPreview();
void previewForward(); void previewForward();
...@@ -109,6 +128,8 @@ namespace vcl ...@@ -109,6 +128,8 @@ namespace vcl
std::shared_ptr<PrinterController> maPController; std::shared_ptr<PrinterController> maPController;
VclPtr< MoreOptionsDialog > mpMoreOptionsDlg;
VclPtr<TabControl> mpTabCtrl; VclPtr<TabControl> mpTabCtrl;
VclPtr<VclFrame> mpPageLayoutFrame; VclPtr<VclFrame> mpPageLayoutFrame;
VclPtr<ListBox> mpPrinters; VclPtr<ListBox> mpPrinters;
...@@ -126,6 +147,7 @@ namespace vcl ...@@ -126,6 +147,7 @@ namespace vcl
VclPtr<OKButton> mpOKButton; VclPtr<OKButton> mpOKButton;
VclPtr<CancelButton> mpCancelButton; VclPtr<CancelButton> mpCancelButton;
VclPtr<HelpButton> mpHelpButton; VclPtr<HelpButton> mpHelpButton;
VclPtr<PushButton> mpMoreOptionsBtn;
VclPtr<PushButton> mpBackwardBtn; VclPtr<PushButton> mpBackwardBtn;
VclPtr<PushButton> mpForwardBtn; VclPtr<PushButton> mpForwardBtn;
...@@ -184,6 +206,7 @@ namespace vcl ...@@ -184,6 +206,7 @@ namespace vcl
Size maFirstPageSize; Size maFirstPageSize;
bool mbShowLayoutFrame; bool mbShowLayoutFrame;
bool mbSingleJobs;
DECL_LINK( ClickHdl, Button*, void ); DECL_LINK( ClickHdl, Button*, void );
DECL_LINK( SelectHdl, ListBox&, void ); DECL_LINK( SelectHdl, ListBox&, void );
......
...@@ -492,12 +492,11 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, ...@@ -492,12 +492,11 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
xController->setValue( "LocalFileName", xController->setValue( "LocalFileName",
css::uno::makeAny( aFile ) ); css::uno::makeAny( aFile ) );
} }
// FIXME: single jobs is not implemented yet. else if( aDlg->isSingleJobs() )
// else if( aDlg->isSingleJobs() ) {
// { xController->setValue( "PrintCollateAsSingleJobs",
// xController->setValue( "PrintCollateAsSingleJobs", css::uno::makeAny( true ) );
// css::uno::makeAny( true ) ); }
// }
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
......
...@@ -79,6 +79,48 @@ namespace { ...@@ -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 ) PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent )
: Window( i_pParent, 0 ) : Window( i_pParent, 0 )
, maMtf() , maMtf()
...@@ -497,11 +539,12 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -497,11 +539,12 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
, maNoCollateBmp(SV_PRINT_NOCOLLATE_BMP) , maNoCollateBmp(SV_PRINT_NOCOLLATE_BMP)
, mnCollateUIMode(0) , mnCollateUIMode(0)
, mbShowLayoutFrame( true ) , mbShowLayoutFrame( true )
, mbSingleJobs( false )
{ {
get(mpOKButton, "ok"); get(mpOKButton, "ok");
get(mpCancelButton, "cancel"); get(mpCancelButton, "cancel");
get(mpHelpButton, "help"); get(mpHelpButton, "help");
get(mpMoreOptionsBtn, "moreoptionsbtn");
get(mpTabCtrl, "tabcontrol"); get(mpTabCtrl, "tabcontrol");
get(mpPageLayoutFrame, "layoutframe"); get(mpPageLayoutFrame, "layoutframe");
get(mpForwardBtn, "forward"); get(mpForwardBtn, "forward");
...@@ -620,6 +663,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo ...@@ -620,6 +663,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpCancelButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
mpHelpButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpHelpButton->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
mpMoreOptionsBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
mpBackwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpBackwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
mpForwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl)); mpForwardBtn->SetClickHdl(LINK(this, PrintDialog, ClickHdl));
mpPreviewBox->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); mpPreviewBox->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
...@@ -667,6 +711,7 @@ void PrintDialog::dispose() ...@@ -667,6 +711,7 @@ void PrintDialog::dispose()
mpOKButton.clear(); mpOKButton.clear();
mpCancelButton.clear(); mpCancelButton.clear();
mpHelpButton.clear(); mpHelpButton.clear();
mpMoreOptionsBtn.clear();
maPController.reset(); maPController.reset();
maControlToPropertyMap.clear(); maControlToPropertyMap.clear();
maControlToNumValMap.clear(); maControlToNumValMap.clear();
...@@ -696,6 +741,7 @@ void PrintDialog::dispose() ...@@ -696,6 +741,7 @@ void PrintDialog::dispose()
mpNupOrderWin.clear(); mpNupOrderWin.clear();
mpNupOrderTxt.clear(); mpNupOrderTxt.clear();
mpBorderCB.clear(); mpBorderCB.clear();
mpMoreOptionsDlg.disposeAndClear();
ModalDialog::dispose(); ModalDialog::dispose();
} }
...@@ -1630,6 +1676,11 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void ) ...@@ -1630,6 +1676,11 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void )
{ {
updateNup(); updateNup();
} }
else if ( pButton == mpMoreOptionsBtn )
{
mpMoreOptionsDlg = VclPtr< MoreOptionsDialog >::Create( this );
mpMoreOptionsDlg->Execute();
}
else else
{ {
if( pButton == mpSetupButton ) if( pButton == mpSetupButton )
......
<?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>
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
</packing> </packing>
</child> </child>
<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="label" translatable="yes" context="printdialog|moreoptions">More Options...</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</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