summaryrefslogtreecommitdiff
path: root/include/toolkit
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-03-14 22:17:43 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 11:04:01 +0100
commit51e97b2ffd8f0ae0591d1880d621cba4596583b7 (patch)
tree8ae6029cf4dd89e29b81a318128ab725dbcadb4c /include/toolkit
parentbc139dde60a25a7ccb60446c7cb8475ab794bfdc (diff)
toolkit: first cut at switching to VclPtr.
Toolkit has traditionally had a very odd lifecycle relationship with VCL - start to fix that; first partial cut. Change-Id: I77e5e62ebde101d32746d12d83dae92c49970001
Diffstat (limited to 'include/toolkit')
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx3
-rw-r--r--include/toolkit/awt/vclxdevice.hxx19
-rw-r--r--include/toolkit/awt/vclxwindow.hxx8
3 files changed, 16 insertions, 14 deletions
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index 62d167ba10f1..d168ee133199 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -33,6 +33,7 @@
#include <comphelper/accessiblecomponenthelper.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
namespace vcl { class Window; }
class VCLXWindow;
@@ -83,7 +84,7 @@ public:
virtual ~VCLXAccessibleComponent();
VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
- vcl::Window* GetWindow() const;
+ VclPtr<vcl::Window> GetWindow() const;
virtual void SAL_CALL disposing() SAL_OVERRIDE;
diff --git a/include/toolkit/awt/vclxdevice.hxx b/include/toolkit/awt/vclxdevice.hxx
index 61d568911b38..751ffd8280b1 100644
--- a/include/toolkit/awt/vclxdevice.hxx
+++ b/include/toolkit/awt/vclxdevice.hxx
@@ -27,43 +27,40 @@
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/vclptr.hxx>
#include <com/sun/star/awt/XUnitConversion.hpp>
class OutputDevice;
class VirtualDevice;
-
-// class VCLXDevice
-
-
// For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later...
#define FLAGS_CREATEDWITHTOOLKIT 0x00000001
-class TOOLKIT_DLLPUBLIC VCLXDevice : public ::com::sun::star::awt::XDevice,
+/// An UNO wrapper for the VCL OutputDevice
+class TOOLKIT_DLLPUBLIC VCLXDevice :
+ public ::com::sun::star::awt::XDevice,
public ::com::sun::star::lang::XTypeProvider,
public ::com::sun::star::lang::XUnoTunnel,
public ::com::sun::star::awt::XUnitConversion,
public ::cppu::OWeakObject
{
friend class VCLXGraphics;
+ friend class VCLXVirtualDevice;
private:
- OutputDevice* mpOutputDevice;
+ VclPtr<OutputDevice> mpOutputDevice;
public:
void* pDummy;
sal_uInt32 nFlags;
-protected:
- void DestroyOutputDevice();
-
public:
VCLXDevice();
virtual ~VCLXDevice();
- void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; }
- OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+ void SetOutputDevice( VclPtr<OutputDevice> pOutDev ) { mpOutputDevice = pOutDev; }
+ VclPtr<OutputDevice> GetOutputDevice() const { return mpOutputDevice; }
void SetCreatedWithToolkit( bool bCreatedWithToolkit );
diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx
index 6306ce6717e3..dfc42aa54f99 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -128,8 +128,12 @@ public:
VCLXWindow( bool bWithDefaultProps = false );
virtual ~VCLXWindow();
- virtual void SetWindow( vcl::Window* pWindow );
- vcl::Window* GetWindow() const { return static_cast<vcl::Window*>(GetOutputDevice()); }
+ virtual void SetWindow( VclPtr<vcl::Window> pWindow );
+ template< class derived_type > VclPtr< derived_type > GetAs() const {
+ return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); }
+ template< class derived_type > VclPtr< derived_type > GetAsDynamic() const {
+ return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetOutputDevice().get() ) ); }
+ VclPtr<vcl::Window> GetWindow() const { return GetAs<vcl::Window>(); }
void suspendVclEventListening( );
void resumeVclEventListening( );