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 bb58c09..ee96c23 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*, SotClipboardFormatId*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const
diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx
index 5b6210d..65bfb89 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_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 6157ea67..7a918f4 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 b67904d..ed6f702 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 <vcl/cairo.hxx>
@@ -269,7 +271,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 9e7ba2e..684b61a 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -209,7 +209,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 81f7181..eafc506 100644
--- a/canvas/source/cairo/cairo_devicehelper.hxx
+++ b/canvas/source/cairo/cairo_devicehelper.hxx
@@ -116,7 +116,7 @@ namespace cairocanvas
         */
        SurfaceProvider*          mpSurfaceProvider;

        OutputDevice*             mpRefDevice;
        VclPtr<OutputDevice>      mpRefDevice;
        ::cairo::SurfaceSharedPtr mpSurface;
    };
}
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 0e8f397..7c85660 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;
diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
index c8cc23e..13983a8 100644
--- a/include/vcl/cairo.hxx
+++ b/include/vcl/cairo.hxx
@@ -22,6 +22,7 @@

#include <sal/config.h>
#include <boost/shared_ptr.hpp>
#include <vcl/vclptr.hxx>

typedef struct _cairo_surface cairo_surface_t;
typedef struct _cairo cairo_t;
@@ -49,7 +50,7 @@ namespace cairo {
        virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, 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), only possible for X11 typically
        /// so on failure caller must create a new surface instead
diff --git a/vcl/quartz/cairo_quartz_cairo.cxx b/vcl/quartz/cairo_quartz_cairo.cxx
index b3a0554..cec50a2 100644
--- a/vcl/quartz/cairo_quartz_cairo.cxx
+++ b/vcl/quartz/cairo_quartz_cairo.cxx
@@ -244,12 +244,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/vcl/quartz/cairo_quartz_cairo.hxx b/vcl/quartz/cairo_quartz_cairo.hxx
index a3f94d2..9c31c42 100644
--- a/vcl/quartz/cairo_quartz_cairo.hxx
+++ b/vcl/quartz/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 flush() const;

diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index bf58b95..99944d1 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -257,7 +257,7 @@ namespace cairo
                                    &cairo_surface_destroy )));
    }

    boost::shared_ptr<VirtualDevice> X11Surface::createVirtualDevice() const
    VclPtr<VirtualDevice> X11Surface::createVirtualDevice() const
    {
        SystemGraphicsData aSystemGraphicsData;

@@ -268,7 +268,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/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
index 166ebaf..5be944f 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
@@ -87,7 +87,7 @@ namespace cairo {
        virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
        virtual SurfaceSharedPtr getSimilar(int cairo_content_type, int width, int height) const SAL_OVERRIDE;

        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
        virtual VclPtr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;

        virtual bool Resize( int width, int height ) SAL_OVERRIDE;

diff --git a/vcl/win/source/gdi/cairo_win32_cairo.cxx b/vcl/win/source/gdi/cairo_win32_cairo.cxx
index 9cf81c7..3571067 100644
--- a/vcl/win/source/gdi/cairo_win32_cairo.cxx
+++ b/vcl/win/source/gdi/cairo_win32_cairo.cxx
@@ -170,13 +170,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/vcl/win/source/gdi/cairo_win32_cairo.hxx b/vcl/win/source/gdi/cairo_win32_cairo.hxx
index dd1be37..5dee0ea 100644
--- a/vcl/win/source/gdi/cairo_win32_cairo.hxx
+++ b/vcl/win/source/gdi/cairo_win32_cairo.hxx
@@ -43,7 +43,7 @@ namespace cairo {
        virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
        virtual SurfaceSharedPtr getSimilar( int aContent, int width, int height ) const;

        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
        virtual VclPtr<VirtualDevice> createVirtualDevice() const;

        virtual void flush() const;