[Libreoffice-commits] core.git: 3 commits - sd/source sfx2/source svtools/source

David Tardon dtardon at redhat.com
Thu Jan 28 04:20:20 PST 2016


 sd/source/ui/docshell/docshel4.cxx  |    6 +++---
 sfx2/source/view/viewprn.cxx        |    7 ++++---
 svtools/source/dialogs/prnsetup.cxx |    5 +++++
 3 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit db87ae54f755023975ef24da0a0fc51656f238e8
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jan 27 14:52:23 2016 +0100

    we have had RTTI for a looong time
    
    Change-Id: Id5b07e6898cfc5b54c3094a10b1f6f91f3ade07d

diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 6b9ce0b..e341578 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -187,10 +187,10 @@ void DrawDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter)
             return;
     }
 
-    //  if 0 != dynamic_cast< SfxPrinter *>( (mpPrinter ))
+    SfxPrinter* const pSfxPrinter = dynamic_cast<SfxPrinter*>(pNewPrinter);
+    if (pSfxPrinter)
     {
-        // Since we do not have RTTI we use a hard cast (...)
-        SetPrinter(static_cast<SfxPrinter*>(pNewPrinter));
+        SetPrinter(pSfxPrinter);
 
         // container owns printer
         mbOwnPrinter = false;
commit 7e8f24c569abda227a6d7c3a27a0c394f6517e92
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jan 27 15:31:19 2016 +0100

    use unique_ptr to manage memory
    
    Change-Id: I2f22dfc6c9ddbaf07145ca553fdb53c12cd94dcb

diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 0424489..33f0bfe 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <memory>
+
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/view/XRenderable.hpp>
 
@@ -817,12 +819,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
 
                 // execute PrinterSetupDialog
                 VclPtrInstance<PrinterSetupDialog> pPrintSetupDlg( GetWindow() );
-                SfxDialogExecutor_Impl* pExecutor = nullptr;
+                std::unique_ptr<SfxDialogExecutor_Impl> pExecutor;
 
                 if (pImp->m_bHasPrintOptions && HasPrintOptionsPage())
                 {
                     // additional controls for dialog
-                    pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg );
+                    pExecutor.reset( new SfxDialogExecutor_Impl( this, pPrintSetupDlg ) );
                     if ( bPrintOnHelp )
                         pExecutor->DisableHelp();
                     pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() );
@@ -844,7 +846,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                 }
 
                 pPrintSetupDlg.disposeAndClear();
-                delete pExecutor;
 
                 // no recording of PrinterSetup except printer name (is printer dependent)
                 rReq.Ignore();
commit 4bc37b7e804fbfe17f8f516487d16ea23a0b246e
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Jan 26 11:40:58 2016 +0100

    Related: rhbz#1168756 save chosen printer also in print settings dlg
    
    Change-Id: Ie750d36f804189828a24c99c6b4507d57322c541

diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index ef75158..7a3cbf3 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -20,6 +20,7 @@
 #include <svtools/prnsetup.hxx>
 #include <svtools/svtools.hrc>
 #include <svtools/svtresid.hxx>
+#include <vcl/configsettings.hxx>
 #include <vcl/print.hxx>
 
 
@@ -370,6 +371,10 @@ short PrinterSetupDialog::Execute()
     {
         if ( mpTempPrinter )
             mpPrinter->SetPrinterProps( mpTempPrinter );
+
+        vcl::SettingsConfigItem* const pItem = vcl::SettingsConfigItem::get();
+        pItem->setValue("PrintDialog", "LastPrinter", mpPrinter->GetName());
+        pItem->Commit();
     }
 
     maStatusTimer.Stop();


More information about the Libreoffice-commits mailing list