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

Xisco Fauli anistenis at gmail.com
Mon May 23 06:25:00 UTC 2016


 include/sfx2/printer.hxx     |    2 +-
 sfx2/source/view/printer.cxx |   33 +++++++++++++--------------------
 2 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit dba7aaff1ac2e175f8a79caef7573d9120cf7c5c
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun May 22 17:29:23 2016 +0200

    tdf#89329: use unique_ptr for pImpl in printer
    
    Change-Id: I8adbac922b7a44ae99325a489f87762dd86397de
    Reviewed-on: https://gerrit.libreoffice.org/25316
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx
index 1e9c05b..2e5d5b4 100644
--- a/include/sfx2/printer.hxx
+++ b/include/sfx2/printer.hxx
@@ -35,7 +35,7 @@ class SFX2_DLLPUBLIC SfxPrinter : public Printer
 {
 private:
     SfxItemSet*             pOptions;
-    SfxPrinter_Impl*        pImpl;
+    std::unique_ptr< SfxPrinter_Impl >  pImpl;
     bool                    bKnown;
 
     SAL_DLLPRIVATE void operator =(SfxPrinter &) = delete;
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 566351d..7f95cf8 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -102,25 +102,21 @@ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions ) :
 
     This constructor creates a default printer.
 */
-
     pOptions( pTheOptions ),
-    bKnown(true)
-
+    pImpl( new SfxPrinter_Impl ),
+    bKnown( true )
 {
     assert(pOptions);
-    pImpl = new SfxPrinter_Impl;
 }
 
 
 SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions,
                         const JobSetup& rTheOrigJobSetup ) :
-
-    Printer         ( rTheOrigJobSetup.GetPrinterName() ),
-    pOptions        ( pTheOptions )
-
+    Printer( rTheOrigJobSetup.GetPrinterName() ),
+    pOptions( pTheOptions ),
+    pImpl( new SfxPrinter_Impl )
 {
     assert(pOptions);
-    pImpl = new SfxPrinter_Impl;
     bKnown = GetName() == rTheOrigJobSetup.GetPrinterName();
 
     if ( bKnown )
@@ -130,29 +126,26 @@ SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions,
 
 SfxPrinter::SfxPrinter( SfxItemSet* pTheOptions,
                         const OUString& rPrinterName ) :
-
-    Printer         ( rPrinterName ),
-    pOptions        ( pTheOptions ),
-    bKnown          ( GetName() == rPrinterName )
-
+    Printer( rPrinterName ),
+    pOptions( pTheOptions ),
+    pImpl( new SfxPrinter_Impl ),
+    bKnown( GetName() == rPrinterName )
 {
     assert(pOptions);
-    pImpl = new SfxPrinter_Impl;
 }
 
 
 SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) :
-
-    Printer ( rPrinter.GetName() ),
+    Printer( rPrinter.GetName() ),
     pOptions( rPrinter.GetOptions().Clone() ),
-    bKnown  ( rPrinter.IsKnown() )
+    pImpl( new SfxPrinter_Impl ),
+    bKnown( rPrinter.IsKnown() )
 {
     assert(pOptions);
     SetJobSetup( rPrinter.GetJobSetup() );
     SetPrinterProps( &rPrinter );
     SetMapMode( rPrinter.GetMapMode() );
 
-    pImpl = new SfxPrinter_Impl;
     pImpl->mbAll = rPrinter.pImpl->mbAll;
     pImpl->mbSelection = rPrinter.pImpl->mbSelection;
     pImpl->mbFromTo = rPrinter.pImpl->mbFromTo;
@@ -187,7 +180,7 @@ SfxPrinter::~SfxPrinter()
 void SfxPrinter::dispose()
 {
     delete pOptions;
-    delete pImpl;
+    pImpl.reset();
     Printer::dispose();
 }
 


More information about the Libreoffice-commits mailing list