[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/generic vcl/source

Katarina Behrens Katarina.Behrens at cib.de
Mon Jul 6 16:27:27 PDT 2015


 include/sfx2/viewsh.hxx        |    1 +
 include/vcl/print.hxx          |    2 ++
 sfx2/source/view/viewprn.cxx   |    2 ++
 sfx2/source/view/viewsh.cxx    |    1 +
 vcl/generic/print/prtsetup.cxx |    2 +-
 vcl/source/gdi/print3.cxx      |   16 +++++++++++++---
 6 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 0251e61640b94094918406b33ee7b05564409feb
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jul 2 15:34:11 2015 +0200

    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/16716
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 39effbb..c6e7f4a 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -148,6 +148,7 @@ friend class SfxPrinterController;
     SfxShell*                   pSubShell;
     VclPtr<vcl::Window>         pWindow;
     bool                        bNoNewWindow;
+    bool                        mbPrinterSettingsModified;
 
 protected:
     virtual void                Activate(bool IsMDIActivate) SAL_OVERRIDE;
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e3eba8e..cc2e80d 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -563,6 +563,8 @@ public:
     SAL_DLLPRIVATE bool getReversePrint() const;
     SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
     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 resetPaperToLastConfigured();
     VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 3f238fb..13a0aed 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -612,6 +612,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
     SfxObjectShell *pObjShell = GetObjectShell();
     xNewController->setValue( OUString( "JobName"  ),
                         makeAny( OUString( pObjShell->GetTitle(0) ) ) );
+    xNewController->setPrinterModified( mbPrinterSettingsModified );
 }
 
 void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect )
@@ -868,6 +869,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
 
                     // forget new printer, it was taken over (as pPrinter) or deleted
                     pDlgPrinter = NULL;
+                    mbPrinterSettingsModified = true;
                 }
                 else
                 {
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 055d5f3..f8e0d21 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1256,6 +1256,7 @@ SfxViewShell::SfxViewShell
 ,   pSubShell(0)
 ,   pWindow(0)
 ,   bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW )
+,   mbPrinterSettingsModified(false)
 {
 
     if ( pViewFrame->GetParentViewFrame() )
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index 1d69db4..25fddc4 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -282,11 +282,11 @@ 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();
     }
+    m_pParent->SetDataModified( true );
     return 0;
 }
 
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index edbae14..be73eaa 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -152,6 +152,7 @@ public:
     bool                                                    mbLastPage;
     bool                                                    mbReversePageOrder;
     bool                                                    mbPapersizeFromSetup;
+    bool                                                    mbPrinterModified;
     view::PrintableState                                        meJobState;
 
     vcl::PrinterController::MultiPageSetup                      maMultiPage;
@@ -186,6 +187,7 @@ public:
         mbLastPage( false ),
         mbReversePageOrder( false ),
         mbPapersizeFromSetup( false ),
+        mbPrinterModified( false ),
         meJobState( view::PrintableState_JOB_STARTED ),
         mpProgress( NULL ),
         mnDefaultPaperBin( -1 ),
@@ -817,7 +819,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent )
         // whatever happens to be the current page
         // (but only if the printer config has changed, otherwise
         // don't override printer page auto-detection - tdf#91362)
-        if (!mpImplData->mxPrinter->IsDefPrinter())
+        if (getPrinterModified())
         {
             resetPaperToLastConfigured();
         }
@@ -849,8 +851,6 @@ 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
         {
@@ -1374,6 +1374,16 @@ bool PrinterController::getPapersizeFromSetup() const
     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
 {
     std::unordered_set< OUString, OUStringHash > aMergeSet;


More information about the Libreoffice-commits mailing list