Kaydet (Commit) 1802e4c9 authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Christian Lohmaier

tdf#91362: Don't override printer page autodetection

if printer settings haven't been modified

Change-Id: I68b0096ce6fa0f9e50db640a0acb3039ff7e66b5
Reviewed-on: https://gerrit.libreoffice.org/16529Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst 4025a5d0
...@@ -310,6 +310,7 @@ public: ...@@ -310,6 +310,7 @@ public:
const OUString& GetName() const { return maPrinterName; } const OUString& GetName() const { return maPrinterName; }
const OUString& GetDriverName() const { return maDriver; } const OUString& GetDriverName() const { return maDriver; }
bool IsDefPrinter() const { return mbDefPrinter; } bool IsDefPrinter() const { return mbDefPrinter; }
void SetDefPrinter(bool bDef) { mbDefPrinter = bDef; }
bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; } bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; }
bool IsValid() const { return !IsDisplayPrinter(); } bool IsValid() const { return !IsDisplayPrinter(); }
......
...@@ -281,6 +281,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) ...@@ -281,6 +281,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox )
} }
if( pKey ) if( pKey )
{ {
m_pParent->SetDataModified( true );
PPDValue* pValue = static_cast<PPDValue*>(pBox->GetSelectEntryData()); PPDValue* pValue = static_cast<PPDValue*>(pBox->GetSelectEntryData());
m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
update(); update();
...@@ -461,6 +462,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox ) ...@@ -461,6 +462,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox )
FillValueBox( pKey ); FillValueBox( pKey );
} }
} }
m_pParent->SetDataModified( true );
return 0; return 0;
} }
...@@ -504,10 +506,12 @@ int SetupPrinterDriver(::psp::PrinterInfo& rJobData) ...@@ -504,10 +506,12 @@ int SetupPrinterDriver(::psp::PrinterInfo& rJobData)
int nRet = 0; int nRet = 0;
ScopedVclPtrInstance< RTSDialog > aDialog( rJobData, nullptr ); ScopedVclPtrInstance< RTSDialog > aDialog( rJobData, nullptr );
// return 0 if cancel was pressed or if the data
// weren't modified, 1 otherwise
if( aDialog->Execute() ) if( aDialog->Execute() )
{ {
rJobData = aDialog->getSetup(); rJobData = aDialog->getSetup();
nRet = 1; nRet = aDialog->GetDataModified() ? 1 : 0;
} }
return nRet; return nRet;
......
...@@ -56,6 +56,8 @@ class RTSDialog : public TabDialog ...@@ -56,6 +56,8 @@ class RTSDialog : public TabDialog
// some resources // some resources
OUString m_aInvalidString; OUString m_aInvalidString;
bool mbDataModified;
DECL_LINK( ActivatePage, TabControl* ); DECL_LINK( ActivatePage, TabControl* );
DECL_LINK( ClickButton, Button* ); DECL_LINK( ClickButton, Button* );
...@@ -67,6 +69,9 @@ public: ...@@ -67,6 +69,9 @@ public:
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
const ::psp::PrinterInfo& getSetup() const { return m_aJobData; } const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
void SetDataModified( bool bModified ) { mbDataModified = bModified; }
bool GetDataModified() const { return mbDataModified; }
}; };
class RTSPaperPage : public TabPage class RTSPaperPage : public TabPage
......
...@@ -815,7 +815,12 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) ...@@ -815,7 +815,12 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
// reset paper size back to last configured size, not // reset paper size back to last configured size, not
// whatever happens to be the current page // 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 // call driver setup
bRet = mpImplData->mxPrinter->Setup( i_pParent ); bRet = mpImplData->mxPrinter->Setup( i_pParent );
...@@ -844,6 +849,8 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) ...@@ -844,6 +849,8 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
{ {
mpImplData->maPageCache.invalidate(); mpImplData->maPageCache.invalidate();
} }
// Settings have been modified (i.e. this printer is no longer default )
mpImplData->mxPrinter->SetDefPrinter( false );
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment