Kaydet (Commit) b129ee50 authored tarafından Michael Meeks's avatar Michael Meeks

Move OutputDevice members to VclPtr: dbaccess, canvas.

Change-Id: Iae01ddcb6a0cde3be1bd79200e9177983be2f924
üst 23d833dd
...@@ -66,7 +66,10 @@ SfxPrinter* DocShell::GetPrinter( bool bCreate ) ...@@ -66,7 +66,10 @@ SfxPrinter* DocShell::GetPrinter( bool bCreate )
void DocShell::SetPrinter( SfxPrinter* pPr ) void DocShell::SetPrinter( SfxPrinter* pPr )
{ {
if (pPr != pPrinter.get()) if (pPr != pPrinter.get())
{
pPrinter.disposeAndClear();
pPrinter.reset(pPr); pPrinter.reset(pPr);
}
} }
void DocShell::FillClass( SvGlobalName*, SotClipboardFormatId*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const void DocShell::FillClass( SvGlobalName*, SotClipboardFormatId*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const
......
...@@ -33,7 +33,7 @@ namespace basctl ...@@ -33,7 +33,7 @@ namespace basctl
class DocShell: public SfxObjectShell class DocShell: public SfxObjectShell
{ {
boost::scoped_ptr<SfxPrinter> pPrinter; ScopedVclPtr<SfxPrinter> pPrinter;
protected: protected:
virtual void Draw( OutputDevice *, const JobSetup & rSetup, virtual void Draw( OutputDevice *, const JobSetup & rSetup,
......
...@@ -63,7 +63,7 @@ namespace cairocanvas ...@@ -63,7 +63,7 @@ namespace cairocanvas
// adjust to stretched/shrunk font // adjust to stretched/shrunk font
if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) ) if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) )
{ {
OutputDevice* pOutDev( mpRefDevice->getOutputDevice() ); VclPtr<OutputDevice> pOutDev( mpRefDevice->getOutputDevice() );
if( pOutDev ) if( pOutDev )
{ {
......
...@@ -83,7 +83,7 @@ namespace cairocanvas ...@@ -83,7 +83,7 @@ namespace cairocanvas
{ {
mpSurface.reset(); mpSurface.reset();
mpCairo.reset(); mpCairo.reset();
mpVirtualDevice.reset(); mpVirtualDevice.disposeAndClear();
mpDevice = NULL; mpDevice = NULL;
mpSurfaceProvider = NULL; mpSurfaceProvider = NULL;
} }
...@@ -105,7 +105,7 @@ namespace cairocanvas ...@@ -105,7 +105,7 @@ namespace cairocanvas
void CanvasHelper::setSurface( const SurfaceSharedPtr& pSurface, bool bHasAlpha ) void CanvasHelper::setSurface( const SurfaceSharedPtr& pSurface, bool bHasAlpha )
{ {
mbHaveAlpha = bHasAlpha; mbHaveAlpha = bHasAlpha;
mpVirtualDevice.reset(); mpVirtualDevice.disposeAndClear();
mpSurface = pSurface; mpSurface = pSurface;
mpCairo = pSurface->getCairo(); mpCairo = pSurface->getCairo();
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <basegfx/vector/b2dsize.hxx> #include <basegfx/vector/b2dsize.hxx>
#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp> #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
#include <vcl/vclptr.hxx>
#include <vcl/virdev.hxx>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <vcl/cairo.hxx> #include <vcl/cairo.hxx>
...@@ -269,7 +271,7 @@ namespace cairocanvas ...@@ -269,7 +271,7 @@ namespace cairocanvas
private: private:
boost::shared_ptr<VirtualDevice> mpVirtualDevice; VclPtr<VirtualDevice> mpVirtualDevice;
void useStates( const ::com::sun::star::rendering::ViewState& viewState, void useStates( const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::rendering::RenderState& renderState,
......
...@@ -175,7 +175,7 @@ namespace cairocanvas ...@@ -175,7 +175,7 @@ namespace cairocanvas
class DeviceSettingsGuard class DeviceSettingsGuard
{ {
private: private:
OutputDevice *mpVirtualDevice; VclPtr<OutputDevice> mpVirtualDevice;
cairo_t *mpCairo; cairo_t *mpCairo;
bool mbMappingWasEnabled; bool mbMappingWasEnabled;
public: public:
...@@ -272,7 +272,7 @@ namespace cairocanvas ...@@ -272,7 +272,7 @@ namespace cairocanvas
cairo_fill(mpCairo.get()); cairo_fill(mpCairo.get());
#endif #endif
::Point aOutpos; ::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 return uno::Reference< rendering::XCachedPrimitive >(NULL); // no output necessary
// change text direction and layout mode // change text direction and layout mode
......
...@@ -209,7 +209,7 @@ namespace cairocanvas ...@@ -209,7 +209,7 @@ namespace cairocanvas
uno::Any DeviceHelper::getDeviceHandle() const 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 uno::Any DeviceHelper::getSurfaceHandle() const
......
...@@ -116,7 +116,7 @@ namespace cairocanvas ...@@ -116,7 +116,7 @@ namespace cairocanvas
*/ */
SurfaceProvider* mpSurfaceProvider; SurfaceProvider* mpSurfaceProvider;
OutputDevice* mpRefDevice; VclPtr<OutputDevice> mpRefDevice;
::cairo::SurfaceSharedPtr mpSurface; ::cairo::SurfaceSharedPtr mpSurface;
}; };
} }
......
...@@ -42,7 +42,7 @@ namespace dbaui ...@@ -42,7 +42,7 @@ namespace dbaui
class ColorChanger class ColorChanger
{ {
protected: protected:
OutputDevice* m_pDev; VclPtr<OutputDevice> m_pDev;
public: public:
ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor ) ColorChanger( OutputDevice* _pDev, const ::Color& _rNewLineColor, const ::Color& _rNewFillColor )
......
...@@ -73,7 +73,7 @@ namespace dbaui ...@@ -73,7 +73,7 @@ namespace dbaui
/// draws a connectionline object on outputdevice /// draws a connectionline object on outputdevice
struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void> struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void>
{ {
OutputDevice* pDevice; VclPtr<OutputDevice> pDevice;
TConnectionLineDrawFunctor(OutputDevice* _pDevice) TConnectionLineDrawFunctor(OutputDevice* _pDevice)
{ {
pDevice = _pDevice; pDevice = _pDevice;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <sal/config.h> #include <sal/config.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <vcl/vclptr.hxx>
typedef struct _cairo_surface cairo_surface_t; typedef struct _cairo_surface cairo_surface_t;
typedef struct _cairo cairo_t; typedef struct _cairo cairo_t;
...@@ -49,7 +50,7 @@ namespace cairo { ...@@ -49,7 +50,7 @@ namespace cairo {
virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, int width, int height) const = 0; virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, int width, int height) const = 0;
/// factory for VirDev on this surface /// 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 /// Resize the surface (possibly destroying content), only possible for X11 typically
/// so on failure caller must create a new surface instead /// so on failure caller must create a new surface instead
......
...@@ -244,12 +244,12 @@ namespace cairo ...@@ -244,12 +244,12 @@ namespace cairo
* *
* @return The new virtual device * @return The new virtual device
**/ **/
boost::shared_ptr<VirtualDevice> QuartzSurface::createVirtualDevice() const VclPtr<VirtualDevice> QuartzSurface::createVirtualDevice() const
{ {
SystemGraphicsData aSystemGraphicsData; SystemGraphicsData aSystemGraphicsData;
aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
aSystemGraphicsData.rCGContext = getCGContext(); aSystemGraphicsData.rCGContext = getCGContext();
return boost::shared_ptr<VirtualDevice>( return VclPtr<VirtualDevice>(
new VirtualDevice( &aSystemGraphicsData, Size(1, 1), getDepth() )); new VirtualDevice( &aSystemGraphicsData, Size(1, 1), getDepth() ));
} }
......
...@@ -55,7 +55,7 @@ namespace cairo { ...@@ -55,7 +55,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; } virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const; 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; virtual void flush() const;
......
...@@ -257,7 +257,7 @@ namespace cairo ...@@ -257,7 +257,7 @@ namespace cairo
&cairo_surface_destroy ))); &cairo_surface_destroy )));
} }
boost::shared_ptr<VirtualDevice> X11Surface::createVirtualDevice() const VclPtr<VirtualDevice> X11Surface::createVirtualDevice() const
{ {
SystemGraphicsData aSystemGraphicsData; SystemGraphicsData aSystemGraphicsData;
...@@ -268,7 +268,7 @@ namespace cairo ...@@ -268,7 +268,7 @@ namespace cairo
int width = cairo_xlib_surface_get_width(mpSurface.get()); int width = cairo_xlib_surface_get_width(mpSurface.get());
int height = cairo_xlib_surface_get_height(mpSurface.get()); int height = cairo_xlib_surface_get_height(mpSurface.get());
return boost::shared_ptr<VirtualDevice>( return VclPtr<VirtualDevice>(
new VirtualDevice(&aSystemGraphicsData, new VirtualDevice(&aSystemGraphicsData,
Size(width, height), Size(width, height),
std::max(getDepth(), 0))); std::max(getDepth(), 0)));
......
...@@ -87,7 +87,7 @@ namespace cairo { ...@@ -87,7 +87,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; } virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
virtual SurfaceSharedPtr getSimilar(int cairo_content_type, int width, int height) const SAL_OVERRIDE; 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; virtual bool Resize( int width, int height ) SAL_OVERRIDE;
......
...@@ -170,13 +170,13 @@ namespace cairo ...@@ -170,13 +170,13 @@ namespace cairo
* *
* @return The new virtual device * @return The new virtual device
**/ **/
boost::shared_ptr<VirtualDevice> Win32Surface::createVirtualDevice() const VclPtr<VirtualDevice> Win32Surface::createVirtualDevice() const
{ {
SystemGraphicsData aSystemGraphicsData; SystemGraphicsData aSystemGraphicsData;
aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
aSystemGraphicsData.hDC = cairo_win32_surface_get_dc( mpSurface.get() ); 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()) )); new VirtualDevice( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>(getDepth()) ));
} }
......
...@@ -43,7 +43,7 @@ namespace cairo { ...@@ -43,7 +43,7 @@ namespace cairo {
virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; } virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; }
virtual SurfaceSharedPtr getSimilar( int aContent, int width, int height ) const; 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; virtual void flush() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment