diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-11-22 14:39:39 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-12-20 13:53:55 +0100 |
commit | 45429e4518fb265dc817d96f41ad4238a5d09c65 (patch) | |
tree | 2210230e0f8e4a20708a5a2180182e3dc7b98814 | |
parent | 30b6545eb626a8ae91a0d3dd9f50b93efd180475 (diff) |
tdf#79077: Cleanup PapersizeFromSetup related code
Change-Id: If77c43a7eb97de0a2e23195a9539f00e452343d8
Reviewed-on: https://gerrit.libreoffice.org/45096
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r-- | include/vcl/jobdata.hxx | 2 | ||||
-rw-r--r-- | include/vcl/print.hxx | 5 | ||||
-rw-r--r-- | svtools/source/dialogs/prnsetup.cxx | 5 | ||||
-rw-r--r-- | vcl/inc/printerinfomanager.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/jobset.cxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 23 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/printer/jobdata.cxx | 1 |
9 files changed, 33 insertions, 10 deletions
diff --git a/include/vcl/jobdata.hxx b/include/vcl/jobdata.hxx index 311351894a94..65a050f80423 100644 --- a/include/vcl/jobdata.hxx +++ b/include/vcl/jobdata.hxx @@ -44,6 +44,7 @@ struct VCL_DLLPUBLIC JobData int m_nPDFDevice; // 0: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF orientation m_eOrientation; OUString m_aPrinterName; + bool m_bPapersizeFromSetup; const PPDParser* m_pParser; PPDContext m_aContext; @@ -59,6 +60,7 @@ struct VCL_DLLPUBLIC JobData m_nColorDevice( 0 ), m_nPDFDevice( 0 ), m_eOrientation( orientation::Portrait ), + m_bPapersizeFromSetup( false ), m_pParser( nullptr ) {} JobData& operator=(const psp::JobData& rRight); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index a4846becd1bb..59724e73223f 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -292,7 +292,7 @@ public: bool SetJobSetup( const JobSetup& rSetup ); const JobSetup& GetJobSetup() const { return maJobSetup; } - bool Setup( vcl::Window* pWindow, bool bPapersizeFromSetup = false ); + bool Setup( vcl::Window* pWindow ); bool SetPrinterProps( const Printer* pPrinter ); /** SetPrinterOptions is used internally only now @@ -328,6 +328,9 @@ public: sal_uInt16 GetPaperBinCount() const; OUString GetPaperBinName( sal_uInt16 nPaperBin ) const; + bool GetPrinterSettingsPreferred() const; + void SetPrinterSettingsPreferred( bool bPaperSizeFromSetup ); + const Size& GetPaperSizePixel() const { return maPaperSize; } Size GetPaperSize() const { return PixelToLogic( maPaperSize ); } const Point& GetPageOffsetPixel() const { return maPageOffset; } diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index d3a46048b2dc..d7a8b06a7900 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -293,10 +293,7 @@ IMPL_LINK_NOARG(PrinterSetupDialog, ImplPropertiesHdl, Button*, void) { if ( !mpTempPrinter ) mpTempPrinter = VclPtr<Printer>::Create( mpPrinter->GetJobSetup() ); - // 2nd argument: whether paper size and orientation from printer settings - // override document settings, iow whether matching listboxes are editable - // (this is a printer setup dialog, so they definitely should be editable) - mpTempPrinter->Setup( this, true ); + mpTempPrinter->Setup( this ); } diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx index 7691fbeebc6c..d820cfcc6057 100644 --- a/vcl/inc/printerinfomanager.hxx +++ b/vcl/inc/printerinfomanager.hxx @@ -52,11 +52,9 @@ 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() - , m_bPapersizeFromSetup(false) {} }; diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index fe7cbb2936d9..782fe81c959e 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -178,6 +178,7 @@ bool ImplJobSetup::operator==( const ImplJobSetup& rImplJobSetup ) const mePaperFormat == rImplJobSetup.mePaperFormat && mnPaperWidth == rImplJobSetup.mnPaperWidth && mnPaperHeight == rImplJobSetup.mnPaperHeight && + mbPapersizeFromSetup == rImplJobSetup.mbPapersizeFromSetup && mnDriverDataLen == rImplJobSetup.mnDriverDataLen && maValueMap == rImplJobSetup.maValueMap && memcmp( mpDriverData, rImplJobSetup.mpDriverData, mnDriverDataLen ) == 0; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 71bcf976d418..b360ebc58088 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 bPapersizeFromSetup ) +bool Printer::Setup( vcl::Window* pWindow ) { if ( IsDisplayPrinter() ) return false; @@ -1065,7 +1065,6 @@ bool Printer::Setup( vcl::Window* pWindow, bool bPapersizeFromSetup ) JobSetup aJobSetup = maJobSetup; ImplJobSetup& rData = aJobSetup.ImplGetData(); - rData.SetPapersizeFromSetup( bPapersizeFromSetup ); SalFrame* pFrame; if ( !pWindow ) pWindow = ImplGetDefaultWindow(); @@ -1280,6 +1279,26 @@ sal_uInt16 Printer::GetPaperBin() const return maJobSetup.ImplGetConstData().GetPaperBin(); } +bool Printer::GetPrinterSettingsPreferred() const +{ + return maJobSetup.ImplGetConstData().GetPapersizeFromSetup(); +} + +// dear loplugins, DO NOT REMOVE this code +// it will be used in follow-up commits +void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup) +{ + if ( maJobSetup.ImplGetConstData().GetPapersizeFromSetup() != bPaperSizeFromSetup ) + { + JobSetup aJobSetup = maJobSetup; + ImplJobSetup& rData = aJobSetup.ImplGetData(); + rData.SetPapersizeFromSetup(bPaperSizeFromSetup); + + mbNewJobSetup = true; + maJobSetup = aJobSetup; + } +} + // Map user paper format to a available printer paper formats void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest ) { diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 4a8006b2a8b6..ce4738e33746 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -813,7 +813,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) } // call driver setup - bRet = xPrinter->Setup( i_pParent, getPapersizeFromSetup() ); + bRet = xPrinter->Setup( i_pParent ); SAL_WARN_IF(xPrinter != mpImplData->mxPrinter, "vcl.gdi", "Printer changed underneath us during setup"); xPrinter = mpImplData->mxPrinter; diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 7a90bd0b0b3d..7dd74f0396fc 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -247,6 +247,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pJobSetup->SetDriverDataLen( 0 ); pJobSetup->SetDriverData( nullptr ); } + pJobSetup->SetPapersizeFromSetup( rData.m_bPapersizeFromSetup ); } // Needs a cleaner abstraction ... @@ -689,6 +690,7 @@ bool PspSalInfoPrinter::SetData( aData.m_aContext.setValue( pKey, pValue ); } } + aData.m_bPapersizeFromSetup = pJobSetup->GetPapersizeFromSetup(); m_aJobData = aData; copyJobDataToJobSetup( pJobSetup, aData ); diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index b5a6b113f9d6..31275762ac2a 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -38,6 +38,7 @@ JobData& JobData::operator=(const JobData& rRight) m_nColorDepth = rRight.m_nColorDepth; m_eOrientation = rRight.m_eOrientation; m_aPrinterName = rRight.m_aPrinterName; + m_bPapersizeFromSetup = rRight.m_bPapersizeFromSetup; m_pParser = rRight.m_pParser; m_aContext = rRight.m_aContext; m_nPSLevel = rRight.m_nPSLevel; |