Kaydet (Commit) bea39901 authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Miklos Vajna

tdf#91362: Make "printer was modified" status persistent

To test:

Scenario 1:
* go to Writer -> Format -> Page
* select page format and orientation, if possible a different one than the default
  in your env.
* File -> Print -> Properties should now show those values (and not the default
  values from the printer)

Scenario 2 (aka Scenario 2 from tdf#61186)
* now go to File -> Printer settings
* change page format and orientation, if possible to yet a different one than the
  printer default and a page one
* File -> Print -> Properties should now show what was selected in Printer settings
  and not the format of the page

Change-Id: Ibc84540f428b79dbec2587c50eefe526a62751b3
Reviewed-on: https://gerrit.libreoffice.org/16716Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 0251e616)
Reviewed-on: https://gerrit.libreoffice.org/16808Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 88533219
...@@ -148,6 +148,7 @@ friend class SfxPrinterController; ...@@ -148,6 +148,7 @@ friend class SfxPrinterController;
SfxShell* pSubShell; SfxShell* pSubShell;
VclPtr<vcl::Window> pWindow; VclPtr<vcl::Window> pWindow;
bool bNoNewWindow; bool bNoNewWindow;
bool mbPrinterSettingsModified;
protected: protected:
virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE; virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE;
......
...@@ -563,6 +563,8 @@ public: ...@@ -563,6 +563,8 @@ public:
SAL_DLLPRIVATE bool getReversePrint() const; SAL_DLLPRIVATE bool getReversePrint() const;
SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup ); SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
SAL_DLLPRIVATE bool getPapersizeFromSetup() const; SAL_DLLPRIVATE bool getPapersizeFromSetup() const;
VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup );
VCL_PLUGIN_PUBLIC bool getPrinterModified() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter(); SAL_DLLPRIVATE void pushPropertiesToPrinter();
SAL_DLLPRIVATE void resetPaperToLastConfigured(); SAL_DLLPRIVATE void resetPaperToLastConfigured();
VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState ); VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState );
......
...@@ -612,6 +612,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr ...@@ -612,6 +612,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
SfxObjectShell *pObjShell = GetObjectShell(); SfxObjectShell *pObjShell = GetObjectShell();
xNewController->setValue( OUString( "JobName" ), xNewController->setValue( OUString( "JobName" ),
makeAny( OUString( pObjShell->GetTitle(0) ) ) ); makeAny( OUString( pObjShell->GetTitle(0) ) ) );
xNewController->setPrinterModified( mbPrinterSettingsModified );
} }
void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect ) void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect )
...@@ -868,6 +869,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) ...@@ -868,6 +869,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// forget new printer, it was taken over (as pPrinter) or deleted // forget new printer, it was taken over (as pPrinter) or deleted
pDlgPrinter = NULL; pDlgPrinter = NULL;
mbPrinterSettingsModified = true;
} }
else else
{ {
......
...@@ -1257,6 +1257,7 @@ SfxViewShell::SfxViewShell ...@@ -1257,6 +1257,7 @@ SfxViewShell::SfxViewShell
, pSubShell(0) , pSubShell(0)
, pWindow(0) , pWindow(0)
, bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW ) , bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW )
, mbPrinterSettingsModified(false)
{ {
if ( pViewFrame->GetParentViewFrame() ) if ( pViewFrame->GetParentViewFrame() )
......
...@@ -282,11 +282,11 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) ...@@ -282,11 +282,11 @@ 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();
} }
m_pParent->SetDataModified( true );
return 0; return 0;
} }
......
...@@ -152,6 +152,7 @@ public: ...@@ -152,6 +152,7 @@ public:
bool mbLastPage; bool mbLastPage;
bool mbReversePageOrder; bool mbReversePageOrder;
bool mbPapersizeFromSetup; bool mbPapersizeFromSetup;
bool mbPrinterModified;
view::PrintableState meJobState; view::PrintableState meJobState;
vcl::PrinterController::MultiPageSetup maMultiPage; vcl::PrinterController::MultiPageSetup maMultiPage;
...@@ -186,6 +187,7 @@ public: ...@@ -186,6 +187,7 @@ public:
mbLastPage( false ), mbLastPage( false ),
mbReversePageOrder( false ), mbReversePageOrder( false ),
mbPapersizeFromSetup( false ), mbPapersizeFromSetup( false ),
mbPrinterModified( false ),
meJobState( view::PrintableState_JOB_STARTED ), meJobState( view::PrintableState_JOB_STARTED ),
mpProgress( NULL ), mpProgress( NULL ),
mnDefaultPaperBin( -1 ), mnDefaultPaperBin( -1 ),
...@@ -817,7 +819,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) ...@@ -817,7 +819,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
// whatever happens to be the current page // whatever happens to be the current page
// (but only if the printer config has changed, otherwise // (but only if the printer config has changed, otherwise
// don't override printer page auto-detection - tdf#91362) // don't override printer page auto-detection - tdf#91362)
if (!mpImplData->mxPrinter->IsDefPrinter()) if (getPrinterModified())
{ {
resetPaperToLastConfigured(); resetPaperToLastConfigured();
} }
...@@ -849,8 +851,6 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) ...@@ -849,8 +851,6 @@ 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
{ {
...@@ -1374,6 +1374,16 @@ bool PrinterController::getPapersizeFromSetup() const ...@@ -1374,6 +1374,16 @@ bool PrinterController::getPapersizeFromSetup() const
return mpImplData->mbPapersizeFromSetup; return mpImplData->mbPapersizeFromSetup;
} }
void PrinterController::setPrinterModified( bool i_bPrinterModified )
{
mpImplData->mbPrinterModified = i_bPrinterModified;
}
bool PrinterController::getPrinterModified() const
{
return mpImplData->mbPrinterModified;
}
Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const
{ {
std::unordered_set< OUString, OUStringHash > aMergeSet; std::unordered_set< OUString, OUStringHash > aMergeSet;
......
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