summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2015-06-24 17:31:32 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-06-25 09:47:10 +0000
commit07602e5a8b869be1c45158cf71d6015d17a5f797 (patch)
tree6ae64677f6709452baeef2725a7288c0dd3aa95f
parentb28a63728ac081b3cc94c76d0bac4a573087ca5e (diff)
tdf#91362: Don't override printer page autodetection
if printer settings haven't been modified Change-Id: I68b0096ce6fa0f9e50db640a0acb3039ff7e66b5 Reviewed-on: https://gerrit.libreoffice.org/16454 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--include/vcl/print.hxx1
-rw-r--r--vcl/generic/print/prtsetup.cxx6
-rw-r--r--vcl/generic/print/prtsetup.hxx5
-rw-r--r--vcl/source/gdi/print3.cxx9
4 files changed, 19 insertions, 2 deletions
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index b2d31ddabbd8..e3eba8e7f5ae 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -310,6 +310,7 @@ public:
const OUString& GetName() const { return maPrinterName; }
const OUString& GetDriverName() const { return maDriver; }
bool IsDefPrinter() const { return mbDefPrinter; }
+ void SetDefPrinter(bool bDef) { mbDefPrinter = bDef; }
bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; }
bool IsValid() const { return !IsDisplayPrinter(); }
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index e024f08fd13e..b3d0766af342 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -281,6 +281,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
}
if( pKey )
{
+ m_pParent->SetDataModified( true );
PPDValue* pValue = static_cast<PPDValue*>(pBox->GetSelectEntryData());
m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
update();
@@ -461,6 +462,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox )
FillValueBox( pKey );
}
}
+ m_pParent->SetDataModified( true );
return 0;
}
@@ -504,10 +506,12 @@ int SetupPrinterDriver(::psp::PrinterInfo& rJobData)
int nRet = 0;
ScopedVclPtrInstance< RTSDialog > aDialog( rJobData, nullptr );
+ // return 0 if cancel was pressed or if the data
+ // weren't modified, 1 otherwise
if( aDialog->Execute() )
{
rJobData = aDialog->getSetup();
- nRet = 1;
+ nRet = aDialog->GetDataModified() ? 1 : 0;
}
return nRet;
diff --git a/vcl/generic/print/prtsetup.hxx b/vcl/generic/print/prtsetup.hxx
index 240d78e1fb17..766237e5e25c 100644
--- a/vcl/generic/print/prtsetup.hxx
+++ b/vcl/generic/print/prtsetup.hxx
@@ -56,6 +56,8 @@ class RTSDialog : public TabDialog
// some resources
OUString m_aInvalidString;
+ bool mbDataModified;
+
DECL_LINK( ActivatePage, TabControl* );
DECL_LINK( ClickButton, Button* );
@@ -67,6 +69,9 @@ public:
virtual void dispose() SAL_OVERRIDE;
const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
+
+ void SetDataModified( bool bModified ) { mbDataModified = bModified; }
+ bool GetDataModified() const { return mbDataModified; }
};
class RTSPaperPage : public TabPage
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index afec12ce7935..edbae14c0dc9 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -815,7 +815,12 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
// reset paper size back to last configured size, not
// whatever happens to be the current page
- resetPaperToLastConfigured();
+ // (but only if the printer config has changed, otherwise
+ // don't override printer page auto-detection - tdf#91362)
+ if (!mpImplData->mxPrinter->IsDefPrinter())
+ {
+ resetPaperToLastConfigured();
+ }
// call driver setup
bRet = mpImplData->mxPrinter->Setup( i_pParent );
@@ -844,6 +849,8 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
{
mpImplData->maPageCache.invalidate();
}
+ // Settings have been modified (i.e. this printer is no longer default )
+ mpImplData->mxPrinter->SetDefPrinter( false );
}
else
{