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

Katarina Behrens Katarina.Behrens at cib.de
Fri Jul 10 02:26:35 PDT 2015


 include/vcl/print.hxx              |    2 +-
 include/vcl/printerinfomanager.hxx |    1 +
 vcl/generic/print/genprnpsp.cxx    |    1 +
 vcl/generic/print/prtsetup.cxx     |    9 +++++++++
 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, 20 insertions(+), 4 deletions(-)

New commits:
commit 2a1fe443a8343642292444be19cbd10700e7e01c
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/16812
    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 cc2e80d..ce9dbba 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 faaddc9..b64206f 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 25fddc4..0a7ab60 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 )
@@ -286,6 +294,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
         m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
         update();
     }
+
     m_pParent->SetDataModified( true );
     return 0;
 }
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 2570800..17fb9c7 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 439dbd4..2a686ca 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 be73eaa..a8acbe8 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