Kaydet (Commit) 6a6a51ed authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Caolán McNamara

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/7786Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a10f9277
...@@ -362,6 +362,10 @@ private: ...@@ -362,6 +362,10 @@ private:
// //
WindowImpl* mpWindowImpl; 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 ); SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType );
#ifdef DBG_UTIL #ifdef DBG_UTIL
...@@ -578,6 +582,9 @@ public: ...@@ -578,6 +582,9 @@ public:
Window( Window* pParent, const ResId& rResId ); Window( Window* pParent, const ResId& rResId );
virtual ~Window(); virtual ~Window();
OutputDevice const* GetOutDev() const { return mpOutputDevice; };
OutputDevice* GetOutDev() { return mpOutputDevice; };
virtual void MouseMove( const MouseEvent& rMEvt ); virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt ); virtual void MouseButtonUp( const MouseEvent& rMEvt );
......
...@@ -731,6 +731,11 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste ...@@ -731,6 +731,11 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
{ {
DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" ); 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(); ImplSVData* pSVData = ImplGetSVData();
Window* pRealParent = pParent; Window* pRealParent = pParent;
......
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