[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/vcl vcl/generic vcl/inc vcl/source

Katarina Behrens Katarina.Behrens at cib.de
Wed Jul 8 03:08:08 PDT 2015


 include/vcl/print.hxx              |    2 +-
 include/vcl/printerinfomanager.hxx |    1 +
 vcl/generic/print/genprnpsp.cxx    |    1 +
 vcl/generic/print/prtsetup.cxx     |    8 ++++++++
 vcl/inc/jobset.h                   |    1 +
 vcl/source/gdi/jobset.cxx          |    2 ++
 vcl/source/gdi/print.cxx           |    6 ++++--
 vcl/source/gdi/print3.cxx          |    2 +-
 8 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 6779b46796c93cbb4293a400f57c29e8ae85811b
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Jul 7 12:08:33 2015 +0200

    Related tdf#91362: disable paper size & orientation selection
    
    Unless 'Use only papersize from printer prefs' is toggled on,
    whatever the user sets here doesn't have any effect on the actual
    printing (page settings from the document are used instead). It is
    misleading to have the user believe otherwise.
    
    It was really challenging to have this one toggle get all the way
    down through several layers of abstraction, though ...
    
    Change-Id: If240084ca23b3946a92882a6ee47dbc161b3b86c
    Reviewed-on: https://gerrit.libreoffice.org/16822
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 35c6109..d0ec6a1 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -320,7 +320,7 @@ public:
     bool                        SetJobSetup( const JobSetup& rSetup );
     const JobSetup&             GetJobSetup() const { return maJobSetup; }
 
-    bool                        Setup( vcl::Window* pWindow = NULL );
+    bool                        Setup( vcl::Window* pWindow = NULL, bool bPapersizeFromSetup = false );
     bool                        SetPrinterProps( const Printer* pPrinter );
 
     // SetPrinterOptions is used internally only now
diff --git a/include/vcl/printerinfomanager.hxx b/include/vcl/printerinfomanager.hxx
index ec5c587..52245c4 100644
--- a/include/vcl/printerinfomanager.hxx
+++ b/include/vcl/printerinfomanager.hxx
@@ -50,6 +50,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;
+    bool                 m_bPapersizeFromSetup;
 
     PrinterInfo() :
             JobData()
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 425b717..6f4a907 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -560,6 +560,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup )
         SetData( ~0, pJobSetup );
         JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
     }
+    aInfo.m_bPapersizeFromSetup = pJobSetup->mbPapersizeFromSetup;
 
     if (SetupPrinterDriver(aInfo))
     {
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index 41fd69c..8a5fd70 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -256,6 +256,14 @@ void RTSPaperPage::update()
         m_pSlotText->Enable( false );
         m_pSlotBox->Enable( false );
     }
+
+    // disable those, unless user wants to use papersize from printer prefs
+    // as they have no influence on what's going to be printed anyway
+    if (!m_pParent->m_aJobData.m_bPapersizeFromSetup)
+    {
+        m_pPaperBox->Enable( false );
+        m_pOrientBox->Enable( false );
+    }
 }
 
 IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h
index 9ce9c5c..f0bf8a5 100644
--- a/vcl/inc/jobset.h
+++ b/vcl/inc/jobset.h
@@ -43,6 +43,7 @@ struct ImplJobSetup
     long            mnPaperHeight;      // paper height (100th mm)
     sal_uIntPtr         mnDriverDataLen;    // length of system specific data
     sal_uInt8*          mpDriverData;       // system specific data (will be streamed a byte block)
+    bool            mbPapersizeFromSetup;
     std::unordered_map< OUString, OUString, OUStringHash >         maValueMap;
 
                     ImplJobSetup();
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 623d7be..ab6d0cd 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -61,6 +61,7 @@ ImplJobSetup::ImplJobSetup()
     mnPaperHeight       = 0;
     mnDriverDataLen     = 0;
     mpDriverData        = NULL;
+    mbPapersizeFromSetup = false;
 }
 
 ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
@@ -83,6 +84,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
     }
     else
         mpDriverData = NULL;
+    mbPapersizeFromSetup = rJobSetup.mbPapersizeFromSetup;
     maValueMap          = rJobSetup.maValueMap;
 }
 
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index b920cea..c01d6a3 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1133,7 +1133,7 @@ bool Printer::SetJobSetup( const JobSetup& rSetup )
     return false;
 }
 
-bool Printer::Setup( vcl::Window* pWindow )
+bool Printer::Setup( vcl::Window* pWindow, bool bPapersizeFromSetup )
 {
     if ( IsDisplayPrinter() )
         return false;
@@ -1142,6 +1142,8 @@ bool Printer::Setup( vcl::Window* pWindow )
         return false;
 
     JobSetup aJobSetup = maJobSetup;
+    ImplJobSetup* pData = aJobSetup.ImplGetData();
+    pData->mbPapersizeFromSetup = bPapersizeFromSetup;
     SalFrame* pFrame;
     if ( !pWindow )
         pWindow = ImplGetDefaultWindow();
@@ -1153,7 +1155,7 @@ bool Printer::Setup( vcl::Window* pWindow )
     ImplSVData* pSVData = ImplGetSVData();
     pSVData->maAppData.mnModalMode++;
     nImplSysDialog++;
-    bool bSetup = mpInfoPrinter->Setup( pFrame, aJobSetup.ImplGetData() );
+    bool bSetup = mpInfoPrinter->Setup( pFrame, pData );
     pSVData->maAppData.mnModalMode--;
     nImplSysDialog--;
     if ( bSetup )
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 6bfa81a..1d4fe04 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -825,7 +825,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
         }
 
         // call driver setup
-        bRet = mpImplData->mxPrinter->Setup( i_pParent );
+        bRet = mpImplData->mxPrinter->Setup( i_pParent, getPapersizeFromSetup() );
         Size aNewPaperSize(mpImplData->mxPrinter->GetPaperSize());
         if (bRet)
         {


More information about the Libreoffice-commits mailing list