[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 19:08:24 UTC 2018


 vcl/UIConfig_vcl.mk                  |    1 
 vcl/inc/printdlg.hxx                 |   23 +++++++++
 vcl/source/gdi/print3.cxx            |   11 +---
 vcl/source/window/printdlg.cxx       |   53 ++++++++++++++++++++-
 vcl/uiconfig/ui/moreoptionsdialog.ui |   88 +++++++++++++++++++++++++++++++++++
 vcl/uiconfig/ui/printdialog.ui       |    2 
 6 files changed, 170 insertions(+), 8 deletions(-)

New commits:
commit 4bfb749c06884c5506c48668a46e95c7bb18006c
Author:     Daniel Silva <danielfaleirosilva at gmail.com>
AuthorDate: Thu Jun 21 10:20:54 2018 -0300
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Jul 26 21:07:58 2018 +0200

    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 at cib.de>

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 5264fa506034..0be16fcd8413 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 599965f479f5..69dc05d9a949 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -491,12 +491,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 97c3bca84689..c10dd7bed22f 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -77,6 +77,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()
@@ -495,11 +537,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");
@@ -619,6 +662,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 ) );
@@ -666,6 +710,7 @@ void PrintDialog::dispose()
     mpOKButton.clear();
     mpCancelButton.clear();
     mpHelpButton.clear();
+    mpMoreOptionsBtn.clear();
     maPController.reset();
     maControlToPropertyMap.clear();
     maControlToNumValMap.clear();
@@ -695,6 +740,7 @@ void PrintDialog::dispose()
     mpNupOrderWin.clear();
     mpNupOrderTxt.clear();
     mpBorderCB.clear();
+    mpMoreOptionsDlg.disposeAndClear();
     ModalDialog::dispose();
 }
 
@@ -1629,6 +1675,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>


More information about the Libreoffice-commits mailing list