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,\
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 \
......
......@@ -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 );
......
......@@ -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&)
{
......
......@@ -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 )
......
<?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 @@
</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>
......
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