[Libreoffice-commits] core.git: include/vcl vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Wed Feb 5 05:41:39 PST 2014


 include/vcl/window.hxx       |    7 +++++++
 vcl/source/window/window.cxx |    5 +++++
 2 files changed, 12 insertions(+)

New commits:
commit 6a6a51ed0546de2d6e198b0d7486d347b2fb345b
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Feb 3 14:36:42 2014 +1100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 2fcdf0c..bf6bf24 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 b881d1e..7654e2e 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;
 


More information about the Libreoffice-commits mailing list