[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/uiconfig vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Fri Dec 22 08:23:59 UTC 2017


 include/vcl/print.hxx               |    3 ++-
 include/vcl/prntypes.hxx            |    6 ++++++
 vcl/inc/jobset.h                    |    6 ++++++
 vcl/inc/printerinfomanager.hxx      |    2 ++
 vcl/source/gdi/jobset.cxx           |    6 ++++++
 vcl/source/gdi/print.cxx            |    5 ++++-
 vcl/source/gdi/print3.cxx           |    4 ++--
 vcl/uiconfig/ui/printerpaperpage.ui |    5 ++---
 vcl/unx/generic/print/genprnpsp.cxx |    1 +
 vcl/unx/generic/print/prtsetup.cxx  |   29 +++++++++++++++++++++--------
 vcl/unx/generic/print/prtsetup.hxx  |    1 +
 11 files changed, 53 insertions(+), 15 deletions(-)

New commits:
commit 2113282cf957943d08999e7c7071a76734cf2c00
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Dec 21 23:09:33 2017 +0100

    tdf#79077: Mildly improved user experience
    
    Change-Id: I3cf63d06c3c238ed936a8dd0287cfbe02e8e39be
    Reviewed-on: https://gerrit.libreoffice.org/46936
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 59724e73223f..eb81145ca440 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -292,7 +292,8 @@ public:
     bool                        SetJobSetup( const JobSetup& rSetup );
     const JobSetup&             GetJobSetup() const { return maJobSetup; }
 
-    bool                        Setup( vcl::Window* pWindow );
+    bool                        Setup( vcl::Window* pWindow,
+                                       PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal );
     bool                        SetPrinterProps( const Printer* pPrinter );
 
     /** SetPrinterOptions is used internally only now
diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx
index 88920604a961..747f43190fcb 100644
--- a/include/vcl/prntypes.hxx
+++ b/include/vcl/prntypes.hxx
@@ -83,6 +83,12 @@ enum class PrinterCapType
     UsePullModel       = 12,
 };
 
+enum class PrinterSetupMode
+{
+    SingleJob = 0,
+    DocumentGlobal = 1
+};
+
 #endif // INCLUDED_VCL_PRNTYPES_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h
index 5ff4c38e9a24..af9fec49084f 100644
--- a/vcl/inc/jobset.h
+++ b/vcl/inc/jobset.h
@@ -44,6 +44,9 @@ private:
     sal_uInt32      mnDriverDataLen;    //< length of system specific data
     sal_uInt8*      mpDriverData;       //< system specific data (will be streamed a byte block)
     bool            mbPapersizeFromSetup;
+    // setup mode
+    PrinterSetupMode meSetupMode;
+    // TODO: orig paper size
     std::unordered_map< OUString, OUString > maValueMap;
 
 public:
@@ -89,6 +92,9 @@ public:
     bool             GetPapersizeFromSetup() const { return mbPapersizeFromSetup; }
     void             SetPapersizeFromSetup(bool bPapersizeFromSetup);
 
+    PrinterSetupMode GetPrinterSetupMode() const { return meSetupMode; }
+    void             SetPrinterSetupMode(PrinterSetupMode eMode);
+
     const std::unordered_map< OUString, OUString >& GetValueMap() const
                     { return maValueMap; }
     void            SetValueMap(const OUString& rKey, const OUString& rValue);
diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx
index d820cfcc6057..0cb01f155075 100644
--- a/vcl/inc/printerinfomanager.hxx
+++ b/vcl/inc/printerinfomanager.hxx
@@ -27,6 +27,7 @@
 
 #include <vcl/dllapi.h>
 #include <vcl/jobdata.hxx>
+#include <vcl/prntypes.hxx>
 #include <osl/file.hxx>
 #include "unx/helper.hxx"
 
@@ -52,6 +53,7 @@ struct PrinterInfo : JobData
     // a list of special features separated by ',' not used by psprint
     // but assigned from the outside (currently for "fax","pdf=","autoqueue","external_dialog")
     OUString             m_aFeatures;
+    PrinterSetupMode     meSetupMode;
 
     PrinterInfo()
         : JobData()
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 782fe81c959e..d126a8b16f9a 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -60,6 +60,7 @@ ImplJobSetup::ImplJobSetup()
     mnDriverDataLen     = 0;
     mpDriverData        = nullptr;
     mbPapersizeFromSetup = false;
+    meSetupMode         = PrinterSetupMode::DocumentGlobal;
 }
 
 ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
@@ -150,6 +151,11 @@ void ImplJobSetup::SetPapersizeFromSetup(bool bPapersizeFromSetup)
     mbPapersizeFromSetup = bPapersizeFromSetup;
 }
 
+void ImplJobSetup::SetPrinterSetupMode(PrinterSetupMode eMode)
+{
+    meSetupMode = eMode;
+}
+
 void ImplJobSetup::SetValueMap( const OUString& rKey, const OUString& rValue )
 {
     maValueMap [ rKey ] = rValue;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index b360ebc58088..db9eafd1546d 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1055,7 +1055,7 @@ bool Printer::SetJobSetup( const JobSetup& rSetup )
     return false;
 }
 
-bool Printer::Setup( vcl::Window* pWindow )
+bool Printer::Setup( vcl::Window* pWindow, PrinterSetupMode eMode )
 {
     if ( IsDisplayPrinter() )
         return false;
@@ -1065,6 +1065,9 @@ bool Printer::Setup( vcl::Window* pWindow )
 
     JobSetup aJobSetup = maJobSetup;
     ImplJobSetup& rData = aJobSetup.ImplGetData();
+    rData.SetPrinterSetupMode( eMode );
+    // TODO: orig page size
+
     SalFrame* pFrame;
     if ( !pWindow )
         pWindow = ImplGetDefaultWindow();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index ce4738e33746..43485921e7b0 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -807,13 +807,13 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
         // whatever happens to be the current page
         // (but only if the printer config has changed, otherwise
         // don't override printer page auto-detection - tdf#91362)
-        if (getPrinterModified())
+        if (getPrinterModified() || getPapersizeFromSetup())
         {
             resetPaperToLastConfigured();
         }
 
         // call driver setup
-        bRet = xPrinter->Setup( i_pParent );
+        bRet = xPrinter->Setup( i_pParent, PrinterSetupMode::SingleJob );
         SAL_WARN_IF(xPrinter != mpImplData->mxPrinter, "vcl.gdi",
                     "Printer changed underneath us during setup");
         xPrinter = mpImplData->mxPrinter;
diff --git a/vcl/uiconfig/ui/printerpaperpage.ui b/vcl/uiconfig/ui/printerpaperpage.ui
index c8d834a1e1e5..42c956a0a74c 100644
--- a/vcl/uiconfig/ui/printerpaperpage.ui
+++ b/vcl/uiconfig/ui/printerpaperpage.ui
@@ -26,10 +26,10 @@
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="label4">
+      <object class="GtkLabel" id="orientft">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="printerpaperpage|label4">_Orientation:</property>
+        <property name="label" translatable="yes" context="printerpaperpage|orientft">_Orientation:</property>
         <property name="use_underline">True</property>
         <property name="xalign">1</property>
       </object>
@@ -111,7 +111,6 @@
     <child>
       <object class="GtkCheckButton" id="papersizefromsetup">
         <property name="label" translatable="yes" context="printerpaperpage|papersizefromsetup">Use only paper size from printer preferences</property>
-        <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="receives_default">False</property>
         <property name="draw_indicator">True</property>
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 7dd74f0396fc..63013b1188b4 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -554,6 +554,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup )
         JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aInfo );
     }
     aInfo.m_bPapersizeFromSetup = pJobSetup->GetPapersizeFromSetup();
+    aInfo.meSetupMode = pJobSetup->GetPrinterSetupMode();
 
     if (SetupPrinterDriver(aInfo))
     {
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index dc667fbc9825..49489099158e 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -130,6 +130,10 @@ IMPL_LINK( RTSDialog, ClickButton, Button*, pButton, void )
             // orientation
             m_aJobData.m_eOrientation = m_pPaperPage->getOrientation() == 0 ?
                 orientation::Portrait : orientation::Landscape;
+            // assume use of paper size from printer setup if the user
+            // got here via File > Printer Settings ...
+            m_aJobData.m_bPapersizeFromSetup =
+                ( m_aJobData.meSetupMode == PrinterSetupMode::DocumentGlobal );
         }
         if( m_pDevicePage )
         {
@@ -155,6 +159,7 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
     get(m_pCbFromSetup, "papersizefromsetup");
     get(m_pPaperText, "paperft");
     get(m_pPaperBox, "paperlb");
+    get(m_pOrientText, "orientft");
     get(m_pOrientBox, "orientlb");
     get(m_pDuplexText, "duplexft");
     get(m_pDuplexBox, "duplexlb");
@@ -191,9 +196,10 @@ RTSPaperPage::~RTSPaperPage()
 void RTSPaperPage::dispose()
 {
     m_pParent.clear();
-    m_pPaperText.clear();
     m_pCbFromSetup.clear();
+    m_pPaperText.clear();
     m_pPaperBox.clear();
+    m_pOrientText.clear();
     m_pOrientBox.clear();
     m_pDuplexText.clear();
     m_pDuplexBox.clear();
@@ -246,14 +252,21 @@ void RTSPaperPage::update()
         m_pSlotBox->Enable( false );
     }
 
-    if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
-        m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup );
-    // disable those, unless user wants to use papersize from printer prefs
-    // as they have no influence on what's going to be printed anyway
-    else
+    if ( m_pParent->m_aJobData.meSetupMode == PrinterSetupMode::SingleJob )
     {
-        m_pPaperBox->Enable( false );
-        m_pOrientBox->Enable( false );
+        m_pCbFromSetup->Show();
+
+        if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
+            m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup );
+        // disable those, unless user wants to use papersize from printer prefs
+        // as they have no influence on what's going to be printed anyway
+        else
+        {
+            m_pPaperText->Enable( false );
+            m_pPaperBox->Enable( false );
+            m_pOrientText->Enable( false );
+            m_pOrientBox->Enable( false );
+        }
     }
 }
 
diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx
index 924d4c54b27f..3d6ae8d792d6 100644
--- a/vcl/unx/generic/print/prtsetup.hxx
+++ b/vcl/unx/generic/print/prtsetup.hxx
@@ -83,6 +83,7 @@ class RTSPaperPage : public TabPage
     VclPtr<FixedText>          m_pPaperText;
     VclPtr<ListBox>            m_pPaperBox;
 
+    VclPtr<FixedText>          m_pOrientText;
     VclPtr<ListBox>            m_pOrientBox;
 
     VclPtr<FixedText>          m_pDuplexText;


More information about the Libreoffice-commits mailing list