summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2015-06-24 17:31:32 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-06-27 01:03:44 +0000
commit1802e4c903a0597c9cb5c2ef752fe68486e197b1 (patch)
tree916dcc4c4d3d1b6d28d33b1fa9622765fcf40273
parent4025a5d0cbc14c8fbe8dffcd1ac2f302186e6d5e (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/16529 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-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 9f381b4f152d..81f865626aea 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 738d00de721a..e4355f04ffc6 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 67b6cd2216b8..1be4927c6f99 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 e29d1cc72b19..8ccde00e0b61 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
{