[Libreoffice-commits] core.git: Branch 'feature/vclref' - 2 commits - basctl/source canvas/source chart2/source cui/source dbaccess/source sfx2/source

Michael Meeks michael.meeks at collabora.com
Thu Mar 19 10:40:25 PDT 2015


 basctl/source/basicide/basdoc.cxx                |    3 +++
 basctl/source/basicide/basdoc.hxx                |    2 +-
 canvas/source/cairo/cairo_cairo.hxx              |    3 ++-
 canvas/source/cairo/cairo_canvasfont.cxx         |    2 +-
 canvas/source/cairo/cairo_canvashelper.cxx       |    4 ++--
 canvas/source/cairo/cairo_canvashelper.hxx       |    4 +++-
 canvas/source/cairo/cairo_canvashelper_text.cxx  |    4 ++--
 canvas/source/cairo/cairo_devicehelper.cxx       |    2 +-
 canvas/source/cairo/cairo_devicehelper.hxx       |    2 +-
 canvas/source/cairo/cairo_quartz_cairo.cxx       |    4 ++--
 canvas/source/cairo/cairo_quartz_cairo.hxx       |    2 +-
 canvas/source/cairo/cairo_win32_cairo.cxx        |    4 ++--
 canvas/source/cairo/cairo_win32_cairo.hxx        |    2 +-
 canvas/source/cairo/cairo_xlib_cairo.cxx         |    4 ++--
 canvas/source/cairo/cairo_xlib_cairo.hxx         |    2 +-
 chart2/source/controller/dialogs/DataBrowser.cxx |    4 ++--
 cui/source/inc/page.hxx                          |    2 +-
 cui/source/tabpages/page.cxx                     |    3 +--
 dbaccess/source/ui/browser/dataview.cxx          |    2 +-
 dbaccess/source/ui/inc/ConnectionLine.hxx        |    2 +-
 sfx2/source/doc/printhelper.cxx                  |    4 ++--
 21 files changed, 33 insertions(+), 28 deletions(-)

New commits:
commit 84648f990ff80946423ea3e48e6dfa85563e33e4
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Mar 19 17:21:42 2015 +0000

    Move OutputDevice members to VclPtr: dbaccess, canvas.
    
    Change-Id: Iae01ddcb6a0cde3be1bd79200e9177983be2f924

diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx
index d11bf03..2f00c5c 100644
--- a/basctl/source/basicide/basdoc.cxx
+++ b/basctl/source/basicide/basdoc.cxx
@@ -66,7 +66,10 @@ SfxPrinter* DocShell::GetPrinter( bool bCreate )
 void DocShell::SetPrinter( SfxPrinter* pPr )
 {
     if (pPr != pPrinter.get())
+    {
+        pPrinter.disposeAndClear();
         pPrinter.reset(pPr);
+    }
 }
 
 void DocShell::FillClass( SvGlobalName*, sal_uInt32*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const
diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx
index f86bff4..f8eaf6a 100644
--- a/basctl/source/basicide/basdoc.hxx
+++ b/basctl/source/basicide/basdoc.hxx
@@ -33,7 +33,7 @@ namespace basctl
 
 class DocShell: public SfxObjectShell
 {
-    boost::scoped_ptr<SfxPrinter> pPrinter;
+    ScopedVclPtr<SfxPrinter> pPrinter;
 
 protected:
     virtual void    Draw( OutputDevice *, const JobSetup & rSetup,
diff --git a/canvas/source/cairo/cairo_cairo.hxx b/canvas/source/cairo/cairo_cairo.hxx
index 10c9203..c03c09b 100644
--- a/canvas/source/cairo/cairo_cairo.hxx
+++ b/canvas/source/cairo/cairo_cairo.hxx
@@ -22,6 +22,7 @@
 
 #include <sal/config.h>
 #include <boost/shared_ptr.hpp>
+#include <vcl/vclptr.hxx>
 
 struct SystemEnvData;
 struct BitmapSystemData;
@@ -61,7 +62,7 @@ namespace cairo {
         virtual boost::shared_ptr<Surface> getSimilar( Content aContent, int width, int height ) const = 0;
 
         /// factory for VirDev on this surface
-        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
+        virtual VclPtr<VirtualDevice> createVirtualDevice() const = 0;
 
         /// Resize the surface (possibly destroying content)
         virtual void Resize( int width, int height ) = 0;
diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx
index 62bf3e2..be07a54 100644
--- a/canvas/source/cairo/cairo_canvasfont.cxx
+++ b/canvas/source/cairo/cairo_canvasfont.cxx
@@ -63,7 +63,7 @@ namespace cairocanvas
         // adjust to stretched/shrunk font
         if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
         {
-            OutputDevice* pOutDev( mpRefDevice->getOutputDevice() );
+            VclPtr<OutputDevice> pOutDev( mpRefDevice->getOutputDevice() );
 
             if( pOutDev )
             {
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 68e05fe..ecdfea3 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -83,7 +83,7 @@ namespace cairocanvas
     {
         mpSurface.reset();
         mpCairo.reset();
-        mpVirtualDevice.reset();
+        mpVirtualDevice.disposeAndClear();
         mpDevice = NULL;
         mpSurfaceProvider = NULL;
     }
@@ -105,7 +105,7 @@ namespace cairocanvas
     void CanvasHelper::setSurface( const SurfaceSharedPtr& pSurface, bool bHasAlpha )
     {
         mbHaveAlpha = bHasAlpha;
-        mpVirtualDevice.reset();
+        mpVirtualDevice.disposeAndClear();
         mpSurface = pSurface;
         mpCairo = pSurface->getCairo();
     }
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx
index f6f0099..9efbb80 100644
--- a/canvas/source/cairo/cairo_canvashelper.hxx
+++ b/canvas/source/cairo/cairo_canvashelper.hxx
@@ -28,6 +28,8 @@
 #include <basegfx/vector/b2dsize.hxx>
 #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
 
+#include <vcl/vclptr.hxx>
+#include <vcl/virdev.hxx>
 #include <boost/utility.hpp>
 
 #include "cairo_cairo.hxx"
@@ -296,7 +298,7 @@ namespace cairocanvas
 
     private:
 
-        boost::shared_ptr<VirtualDevice> mpVirtualDevice;
+        VclPtr<VirtualDevice> mpVirtualDevice;
 
         void useStates( const ::com::sun::star::rendering::ViewState& viewState,
                         const ::com::sun::star::rendering::RenderState& renderState,
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index f3c4c05..2a98ea7b 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -175,7 +175,7 @@ namespace cairocanvas
     class DeviceSettingsGuard
     {
     private:
-        OutputDevice *mpVirtualDevice;
+        VclPtr<OutputDevice> mpVirtualDevice;
         cairo_t *mpCairo;
         bool mbMappingWasEnabled;
     public:
@@ -272,7 +272,7 @@ namespace cairocanvas
             cairo_fill(mpCairo.get());
 #endif
             ::Point aOutpos;
-            if( !setupTextOutput( *mpVirtualDevice, pOwner, aOutpos, viewState, renderState, xFont ) )
+            if( !setupTextOutput( *mpVirtualDevice.get(), pOwner, aOutpos, viewState, renderState, xFont ) )
                 return uno::Reference< rendering::XCachedPrimitive >(NULL); // no output necessary
 
                 // change text direction and layout mode
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 50d79ff..3834594 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -222,7 +222,7 @@ namespace cairocanvas
 
     uno::Any DeviceHelper::getDeviceHandle() const
     {
-        return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice) );
+        return uno::makeAny( reinterpret_cast< sal_Int64 >(mpRefDevice.get()) );
     }
 
     uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/cairo/cairo_devicehelper.hxx b/canvas/source/cairo/cairo_devicehelper.hxx
index a4b7399..928fb07 100644
--- a/canvas/source/cairo/cairo_devicehelper.hxx
+++ b/canvas/source/cairo/cairo_devicehelper.hxx
@@ -119,7 +119,7 @@ namespace cairocanvas
          */
         SurfaceProvider*          mpSurfaceProvider;
 
-        OutputDevice*             mpRefDevice;
+        VclPtr<OutputDevice>      mpRefDevice;
         ::cairo::SurfaceSharedPtr mpSurface;
     };
 }
diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx
index b87b993..436ed90 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.cxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.cxx
@@ -263,12 +263,12 @@ namespace cairo
      *
      * @return The new virtual device
      **/
-    boost::shared_ptr<VirtualDevice> QuartzSurface::createVirtualDevice() const
+    VclPtr<VirtualDevice> QuartzSurface::createVirtualDevice() const
     {
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.rCGContext = getCGContext();
-        return boost::shared_ptr<VirtualDevice>(
+        return VclPtr<VirtualDevice>(
             new VirtualDevice( &aSystemGraphicsData, Size(1, 1), getDepth() ));
     }
 
diff --git a/canvas/source/cairo/cairo_quartz_cairo.hxx b/canvas/source/cairo/cairo_quartz_cairo.hxx
index cbcbf27..e3f89c4 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.hxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.hxx
@@ -55,7 +55,7 @@ namespace cairo {
         virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
         virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const;
 
-        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
+        virtual VclPtr<VirtualDevice> createVirtualDevice() const;
 
         virtual void Resize( int width, int height );
 
diff --git a/canvas/source/cairo/cairo_win32_cairo.cxx b/canvas/source/cairo/cairo_win32_cairo.cxx
index 6e1cf6f..cc60c98 100644
--- a/canvas/source/cairo/cairo_win32_cairo.cxx
+++ b/canvas/source/cairo/cairo_win32_cairo.cxx
@@ -190,13 +190,13 @@ namespace cairo
      *
      * @return The new virtual device
      **/
-    boost::shared_ptr<VirtualDevice> Win32Surface::createVirtualDevice() const
+    VclPtr<VirtualDevice> Win32Surface::createVirtualDevice() const
     {
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = cairo_win32_surface_get_dc( mpSurface.get() );
 
-        return boost::shared_ptr<VirtualDevice>(
+        return VclPtr<VirtualDevice>(
             new VirtualDevice( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>(getDepth()) ));
     }
 
diff --git a/canvas/source/cairo/cairo_win32_cairo.hxx b/canvas/source/cairo/cairo_win32_cairo.hxx
index c6f4d7e..397415e 100644
--- a/canvas/source/cairo/cairo_win32_cairo.hxx
+++ b/canvas/source/cairo/cairo_win32_cairo.hxx
@@ -43,7 +43,7 @@ namespace cairo {
         virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
         virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const;
 
-        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
+        virtual VclPtr<VirtualDevice> createVirtualDevice() const;
 
         virtual void Resize( int width, int height );
 
diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index ae9cecb..01c7790 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -270,7 +270,7 @@ namespace cairo
                                     &cairo_surface_destroy )));
     }
 
-    boost::shared_ptr<VirtualDevice> X11Surface::createVirtualDevice() const
+    VclPtr<VirtualDevice> X11Surface::createVirtualDevice() const
     {
         SystemGraphicsData aSystemGraphicsData;
 
@@ -281,7 +281,7 @@ namespace cairo
         int width = cairo_xlib_surface_get_width(mpSurface.get());
         int height = cairo_xlib_surface_get_height(mpSurface.get());
 
-        return boost::shared_ptr<VirtualDevice>(
+        return VclPtr<VirtualDevice>(
             new VirtualDevice(&aSystemGraphicsData,
                               Size(width, height),
                               std::max(getDepth(), 0)));
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index f040b9b..129f1b5 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -86,7 +86,7 @@ namespace cairo {
         virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
         virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const SAL_OVERRIDE;
 
-        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
+        virtual VclPtr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
 
         virtual void Resize( int width, int height ) SAL_OVERRIDE;
 
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index e27b0ef..4327662 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -42,7 +42,7 @@ namespace dbaui
     class ColorChanger
     {
     protected:
-        OutputDevice*   m_pDev;
+        VclPtr<OutputDevice> m_pDev;
 
     public:
         ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor )
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index dfa2695..f5bef2a 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -73,7 +73,7 @@ namespace dbaui
     /// draws a connectionline object on outputdevice
     struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void>
     {
-        OutputDevice* pDevice;
+        VclPtr<OutputDevice> pDevice;
         TConnectionLineDrawFunctor(OutputDevice* _pDevice)
         {
             pDevice = _pDevice;
commit bd53c5b1abc7ae3f638678bc612aaf7c97cc61c4
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Mar 19 17:19:43 2015 +0000

    Move OutputDevice members to VclPtr: chart2, sfx2, cui.
    
    Change-Id: If9228f8777edd4532e9a167eae23095c5e232a6c

diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index e8b8210..0eaa128 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -178,8 +178,8 @@ private:
     VclPtr< FixedImage >        m_spSymbol;
     VclPtr< SeriesHeaderEdit >  m_spSeriesName;
     VclPtr< FixedText >         m_spColorBar;
-    OutputDevice *                           m_pDevice;
-    Link                                     m_aChangeLink;
+    VclPtr< OutputDevice>       m_pDevice;
+    Link                        m_aChangeLink;
 
     void notifyChanges();
     DECL_LINK( SeriesNameChanged, void * );
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 5343eef..7a7cd73 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -139,7 +139,7 @@ private:
 
     //UUUU SvxPage_Impl*        pImpl;
     MarginPosition      m_nPos;
-    Printer*            mpDefPrinter;
+    VclPtr<Printer>     mpDefPrinter;
 
     bool                mbDelPrinter : 1;
 
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 9ce7b61..3ea038a 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -381,8 +381,7 @@ void SvxPageDescPage::dispose()
 {
     if(mbDelPrinter)
     {
-        delete mpDefPrinter;
-        mpDefPrinter = NULL;
+        mpDefPrinter.disposeAndClear();
         mbDelPrinter = false;
     }
     m_pPaperSizeBox.disposeAndClear();
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 27f2e62..1f2b1f1 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -474,7 +474,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
 {
     private:
         /// of course we must know the printer which execute the job
-        SfxPrinter* m_pPrinter;
+        VclPtr<SfxPrinter> m_pPrinter;
         /// this describes the target location for the printed temp file
         OUString m_sTargetURL;
         /// it holds the temp file alive, till the print job will finish and remove it from disk automatically if the object die
@@ -501,7 +501,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
                 SolarMutexGuard aGuard;
                 while( m_pPrinter->IsPrinting() )
                     Application::Yield();
-                m_pPrinter = NULL; // don't delete it! It's borrowed only :-)
+                m_pPrinter.clear(); // don't delete it! It's borrowed only :-)
             }
             /* } SAFE */
 


More information about the Libreoffice-commits mailing list