summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-02-03 14:36:42 +1100
committerCaolán McNamara <caolanm@redhat.com>2014-02-05 13:41:13 +0000
commit6a6a51ed0546de2d6e198b0d7486d347b2fb345b (patch)
treeafef8de55b96c2252fed38cdfc0d853515fdfe45
parenta10f9277b51f55050782dcd4fc1bc8d9af05cbe2 (diff)
fdo#74424 Start to decouple Window class from OutputDevice
We want to start to decouple Window from OutputDevice. This is because a Window should *use* an OutputDevice, a Window is *not* an OutputDevice. In order to start to decouple the two classes, the strategy will be: 1. This patch adds in a new private member pOutputDevice as well as an accessor. When the Window is initialized, pOutputDevice is set to a downcasted instance of this (because we are still inheriting Window from OutputDevice). 2. We will start to go through all the functions in Window that rely on OutputDevice and use the getter function to use the OutputDevice private member. 3. Any subclasses of Window will then need to have the same procedure done on them. 4. Once this is done, we need to work out the best way of initializing mpOutputDevice, then we can remove OutputDevice as the parent class of Window (and all Window subclasses). Change-Id: I39886c77070befb1542c8f22346111cde1c360b1 Reviewed-on: https://gerrit.libreoffice.org/7786 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/window.hxx7
-rw-r--r--vcl/source/window/window.cxx5
2 files changed, 12 insertions, 0 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 2fcdf0c732e5..bf6bf2467e59 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -362,6 +362,10 @@ private:
//
WindowImpl* mpWindowImpl;
+ // This is a first attempt to start to remove the dependency of Window on
+ // OutputDevice
+ OutputDevice* mpOutputDevice;
+
SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType );
#ifdef DBG_UTIL
@@ -578,6 +582,9 @@ public:
Window( Window* pParent, const ResId& rResId );
virtual ~Window();
+ OutputDevice const* GetOutDev() const { return mpOutputDevice; };
+ OutputDevice* GetOutDev() { return mpOutputDevice; };
+
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b881d1e63de4..7654e2ef9af6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -731,6 +731,11 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
{
DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" );
+ // We will eventually being removing the inheritance of OutputDevice from Window.
+ // It will be replaced with a composition relationship. A Window will use an OutputDevice,
+ // it will not *be* an OutputDevice
+ mpOutputDevice = (OutputDevice*)this;
+
ImplSVData* pSVData = ImplGetSVData();
Window* pRealParent = pParent;