[Libreoffice-commits] core.git: toolkit/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 24 18:23:31 UTC 2021


 toolkit/source/awt/stylesettings.cxx |  539 ++++++++++++++++-------------------
 toolkit/source/awt/stylesettings.hxx |   19 -
 2 files changed, 273 insertions(+), 285 deletions(-)

New commits:
commit 60e81b7ac33272a12e54c3d12dab8960ca8b071e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 23 20:02:14 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 24 20:22:53 2021 +0200

    remove pimpl from WindowStyleSettings
    
    Change-Id: If230f9f166365c83d478cab6149f95efad7b15f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120954
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 6d6419090c38..359e59077049 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -24,7 +24,6 @@
 
 #include <com/sun/star/lang/DisposedException.hpp>
 
-#include <comphelper/interfacecontainer2.hxx>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <vcl/event.hxx>
@@ -35,8 +34,6 @@
 
 namespace toolkit
 {
-
-
     using ::com::sun::star::uno::Reference;
     using ::com::sun::star::uno::RuntimeException;
     using ::com::sun::star::lang::DisposedException;
@@ -45,24 +42,7 @@ namespace toolkit
     using ::com::sun::star::awt::XStyleChangeListener;
 
 
-    //= WindowStyleSettings_Data
-
-    struct WindowStyleSettings_Data
-    {
-        VCLXWindow*                         pOwningWindow;
-        ::comphelper::OInterfaceContainerHelper2   aStyleChangeListeners;
-
-        WindowStyleSettings_Data( ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
-            : pOwningWindow( &i_rOwningWindow )
-            ,aStyleChangeListeners( i_rListenerMutex )
-        {
-        }
-
-        DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
-    };
-
-
-    IMPL_LINK( WindowStyleSettings_Data, OnWindowEvent, VclWindowEvent&, rEvent, void )
+    IMPL_LINK( WindowStyleSettings, OnWindowEvent, VclWindowEvent&, rEvent, void )
     {
         if ( rEvent.GetId() != VclEventId::WindowDataChanged )
             return;
@@ -84,9 +64,9 @@ namespace toolkit
     class StyleMethodGuard
     {
     public:
-        explicit StyleMethodGuard( WindowStyleSettings_Data const & i_rData )
+        explicit StyleMethodGuard( VCLXWindow* pOwningWindow )
         {
-            if ( i_rData.pOwningWindow == nullptr )
+            if ( pOwningWindow == nullptr )
                 throw DisposedException();
         }
 
@@ -100,12 +80,13 @@ namespace toolkit
 
 
     WindowStyleSettings::WindowStyleSettings(::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
-        :m_pData( new WindowStyleSettings_Data(i_rListenerMutex, i_rOwningWindow ) )
+        : pOwningWindow( &i_rOwningWindow )
+        ,aStyleChangeListeners( i_rListenerMutex )
     {
         VclPtr<vcl::Window> pWindow = i_rOwningWindow.GetWindow();
         if ( !pWindow )
             throw RuntimeException();
-        pWindow->AddEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
+        pWindow->AddEventListener( LINK( this, WindowStyleSettings, OnWindowEvent ) );
     }
 
 
@@ -116,289 +97,285 @@ namespace toolkit
 
     void WindowStyleSettings::dispose()
     {
-        StyleMethodGuard aGuard( *m_pData );
+        StyleMethodGuard aGuard( pOwningWindow );
 
-        VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
+        VclPtr<vcl::Window> pWindow = pOwningWindow->GetWindow();
         OSL_ENSURE( pWindow, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
         if ( pWindow )
-            pWindow->RemoveEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
+            pWindow->RemoveEventListener( LINK( this, WindowStyleSettings, OnWindowEvent ) );
 
         EventObject aEvent( *this );
-        m_pData->aStyleChangeListeners.disposeAndClear( aEvent );
+        aStyleChangeListeners.disposeAndClear( aEvent );
 
-        m_pData->pOwningWindow = nullptr;
+        pOwningWindow = nullptr;
     }
 
 
-    namespace
+    sal_Int32 WindowStyleSettings::ImplGetStyleColor( Color const & (StyleSettings::*i_pGetter)() const )
     {
-        sal_Int32 lcl_getStyleColor( WindowStyleSettings_Data const & i_rData, Color const & (StyleSettings::*i_pGetter)() const )
-        {
-            const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
-            const AllSettings aAllSettings = pWindow->GetSettings();
-            const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
-            return sal_Int32((aStyleSettings.*i_pGetter)());
-        }
-
-        void lcl_setStyleColor( WindowStyleSettings_Data const & i_rData, void (StyleSettings::*i_pSetter)( Color const & ), sal_Int32 i_nColor )
-        {
-            VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
-            AllSettings aAllSettings = pWindow->GetSettings();
-            StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
-            (aStyleSettings.*i_pSetter)( Color(ColorTransparency, i_nColor) );
-            aAllSettings.SetStyleSettings( aStyleSettings );
-            pWindow->SetSettings( aAllSettings );
-        }
+        const VclPtr<vcl::Window>& pWindow = pOwningWindow->GetWindow();
+        const AllSettings aAllSettings = pWindow->GetSettings();
+        const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
+        return sal_Int32((aStyleSettings.*i_pGetter)());
+    }
 
-        FontDescriptor lcl_getStyleFont( WindowStyleSettings_Data const & i_rData, vcl::Font const & (StyleSettings::*i_pGetter)() const )
-        {
-            const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
-            const AllSettings aAllSettings = pWindow->GetSettings();
-            const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
-            return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
-        }
+    void WindowStyleSettings::ImplSetStyleColor( void (StyleSettings::*i_pSetter)( Color const & ), sal_Int32 i_nColor )
+    {
+        VclPtr<vcl::Window> pWindow = pOwningWindow->GetWindow();
+        AllSettings aAllSettings = pWindow->GetSettings();
+        StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+        (aStyleSettings.*i_pSetter)( Color(ColorTransparency, i_nColor) );
+        aAllSettings.SetStyleSettings( aStyleSettings );
+        pWindow->SetSettings( aAllSettings );
+    }
 
-        void lcl_setStyleFont( WindowStyleSettings_Data const & i_rData, void (StyleSettings::*i_pSetter)( vcl::Font const &),
-            vcl::Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont )
-        {
-            VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
-            AllSettings aAllSettings = pWindow->GetSettings();
-            StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
-            const vcl::Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() );
-            (aStyleSettings.*i_pSetter)( aNewFont );
-            aAllSettings.SetStyleSettings( aStyleSettings );
-            pWindow->SetSettings( aAllSettings );
-        }
+    FontDescriptor WindowStyleSettings::ImplGetStyleFont( vcl::Font const & (StyleSettings::*i_pGetter)() const )
+    {
+        const VclPtr<vcl::Window>& pWindow = pOwningWindow->GetWindow();
+        const AllSettings aAllSettings = pWindow->GetSettings();
+        const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
+        return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
     }
 
+    void WindowStyleSettings::ImplSetStyleFont( void (StyleSettings::*i_pSetter)( vcl::Font const &),
+        vcl::Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont )
+    {
+        VclPtr<vcl::Window> pWindow = pOwningWindow->GetWindow();
+        AllSettings aAllSettings = pWindow->GetSettings();
+        StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+        const vcl::Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() );
+        (aStyleSettings.*i_pSetter)( aNewFont );
+        aAllSettings.SetStyleSettings( aStyleSettings );
+        pWindow->SetSettings( aAllSettings );
+    }
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveBorderColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveBorderColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetActiveBorderColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveBorderColor, _activebordercolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetActiveBorderColor, _activebordercolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetActiveColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveColor, _activecolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetActiveColor, _activecolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTabColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTabColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetActiveTabColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTabColor, _activetabcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetActiveTabColor, _activetabcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetActiveTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTextColor, _activetextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetActiveTextColor, _activetextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonRolloverTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonRolloverTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetButtonRolloverTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonRolloverTextColor, _buttonrollovertextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetButtonRolloverTextColor, _buttonrollovertextcolor );
         // Also need to set ActionButtonRolloverTextColor as this setting can't be
         // set through the UNO interface otherwise.
         // Previously this setting was used to set colors for both scenarios,
         // but action button setting was added to differentiate the buttons from
         // "normal" buttons in some themes.
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActionButtonRolloverTextColor, _buttonrollovertextcolor );
+        ImplSetStyleColor( &StyleSettings::SetActionButtonRolloverTextColor, _buttonrollovertextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetButtonTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonTextColor, _buttontextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetButtonTextColor, _buttontextcolor );
         // Also need to set ActionButtonTextColor and DefaultActionButtonTextColor
         // as this two settings can't be set through the UNO interface otherwise.
         // Previously this setting was used to set colors for all three scenarios,
         // but action button setting was added to differentiate the buttons from
         // "normal" buttons in some themes.
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetActionButtonTextColor, _buttontextcolor );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDefaultActionButtonTextColor, _buttontextcolor );
+        ImplSetStyleColor( &StyleSettings::SetActionButtonTextColor, _buttontextcolor );
+        ImplSetStyleColor( &StyleSettings::SetDefaultActionButtonTextColor, _buttontextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getCheckedColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetCheckedColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetCheckedColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetCheckedColor, _checkedcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetCheckedColor, _checkedcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDarkShadowColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDarkShadowColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDarkShadowColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDarkShadowColor, _darkshadowcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDarkShadowColor, _darkshadowcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveBorderColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveBorderColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDeactiveBorderColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveBorderColor, _deactivebordercolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDeactiveBorderColor, _deactivebordercolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDeactiveColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveColor, _deactivecolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDeactiveColor, _deactivecolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDeactiveTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveTextColor, _deactivetextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDeactiveTextColor, _deactivetextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDialogColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogColor, _dialogcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDialogColor, _dialogcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDialogTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogTextColor, _dialogtextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDialogTextColor, _dialogtextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getDisableColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetDisableColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetDisableColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetDisableColor, _disablecolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetDisableColor, _disablecolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetFaceColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetFaceColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetFaceColor, _facecolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetFaceColor, _facecolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceGradientColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
+        StyleMethodGuard aGuard( pOwningWindow );
+        const VclPtr<vcl::Window>& pWindow = pOwningWindow->GetWindow();
         const AllSettings aAllSettings = pWindow->GetSettings();
         const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
         return sal_Int32(aStyleSettings.GetFaceGradientColor());
@@ -407,288 +384,288 @@ namespace toolkit
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetFieldColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldColor, _fieldcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetFieldColor, _fieldcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldRolloverTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldRolloverTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetFieldRolloverTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldRolloverTextColor, _fieldrollovertextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetFieldRolloverTextColor, _fieldrollovertextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetFieldTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldTextColor, _fieldtextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetFieldTextColor, _fieldtextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getGroupTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetGroupTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetGroupTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetGroupTextColor, _grouptextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetGroupTextColor, _grouptextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetHelpColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpColor, _helpcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetHelpColor, _helpcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetHelpTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpTextColor, _helptextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetHelpTextColor, _helptextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetHighlightColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightColor, _highlightcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetHighlightColor, _highlightcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetHighlightTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightTextColor, _highlighttextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetHighlightTextColor, _highlighttextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getInactiveTabColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetInactiveTabColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetInactiveTabColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetInactiveTabColor, _inactivetabcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetInactiveTabColor, _inactivetabcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getLabelTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetLabelTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetLabelTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetLabelTextColor, _labeltextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetLabelTextColor, _labeltextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getLightColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetLightColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetLightColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetLightColor, _lightcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetLightColor, _lightcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuBarColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarColor, _menubarcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuBarColor, _menubarcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuBarTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarTextColor, _menubartextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuBarTextColor, _menubartextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBorderColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBorderColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuBorderColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBorderColor, _menubordercolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuBorderColor, _menubordercolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuColor, _menucolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuColor, _menucolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuHighlightColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightColor, _menuhighlightcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuHighlightColor, _menuhighlightcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuHighlightTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightTextColor, _menuhighlighttextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuHighlightTextColor, _menuhighlighttextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMenuTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuTextColor, _menutextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMenuTextColor, _menutextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getMonoColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetMonoColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetMonoColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetMonoColor, _monocolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetMonoColor, _monocolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getRadioCheckTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetRadioCheckTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetRadioCheckTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetRadioCheckTextColor, _radiochecktextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetRadioCheckTextColor, _radiochecktextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getSeparatorColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
+        StyleMethodGuard aGuard( pOwningWindow );
+        const VclPtr<vcl::Window>& pWindow = pOwningWindow->GetWindow();
         const AllSettings aAllSettings = pWindow->GetSettings();
         const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
         return sal_Int32(aStyleSettings.GetSeparatorColor());
@@ -697,64 +674,64 @@ namespace toolkit
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getShadowColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetShadowColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetShadowColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetShadowColor, _shadowcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetShadowColor, _shadowcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetWindowColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowColor, _windowcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetWindowColor, _windowcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowTextColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowTextColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetWindowTextColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowTextColor, _windowtextcolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetWindowTextColor, _windowtextcolor );
     }
 
 
     ::sal_Int32 SAL_CALL WindowStyleSettings::getWorkspaceColor()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleColor( *m_pData, &StyleSettings::GetWorkspaceColor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleColor( &StyleSettings::GetWorkspaceColor );
     }
 
 
     void SAL_CALL WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleColor( *m_pData, &StyleSettings::SetWorkspaceColor, _workspacecolor );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleColor( &StyleSettings::SetWorkspaceColor, _workspacecolor );
     }
 
 
     sal_Bool SAL_CALL WindowStyleSettings::getHighContrastMode()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
+        StyleMethodGuard aGuard( pOwningWindow );
+        const VclPtr<vcl::Window>& pWindow = pOwningWindow->GetWindow();
         const AllSettings aAllSettings = pWindow->GetSettings();
         const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
         return aStyleSettings.GetHighContrastMode();
@@ -763,8 +740,8 @@ namespace toolkit
 
     void SAL_CALL WindowStyleSettings::setHighContrastMode( sal_Bool _highcontrastmode )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
+        StyleMethodGuard aGuard( pOwningWindow );
+        VclPtr<vcl::Window> pWindow = pOwningWindow->GetWindow();
         AllSettings aAllSettings = pWindow->GetSettings();
         StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
         aStyleSettings.SetHighContrastMode( _highcontrastmode );
@@ -775,171 +752,171 @@ namespace toolkit
 
     FontDescriptor SAL_CALL WindowStyleSettings::getApplicationFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetAppFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetAppFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setApplicationFont( const FontDescriptor& _applicationfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetAppFont, &StyleSettings::GetAppFont, _applicationfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetAppFont, &StyleSettings::GetAppFont, _applicationfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getHelpFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetHelpFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetHelpFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setHelpFont( const FontDescriptor& _helpfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetHelpFont, &StyleSettings::GetHelpFont, _helpfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetHelpFont, &StyleSettings::GetHelpFont, _helpfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getTitleFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetTitleFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetTitleFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setTitleFont( const FontDescriptor& _titlefont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetTitleFont, &StyleSettings::GetTitleFont, _titlefont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetTitleFont, &StyleSettings::GetTitleFont, _titlefont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getFloatTitleFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetFloatTitleFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetFloatTitleFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFloatTitleFont( const FontDescriptor& _floattitlefont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetFloatTitleFont, &StyleSettings::GetFloatTitleFont, _floattitlefont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetFloatTitleFont, &StyleSettings::GetFloatTitleFont, _floattitlefont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getMenuFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetMenuFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetMenuFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setMenuFont( const FontDescriptor& _menufont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetMenuFont, &StyleSettings::GetMenuFont, _menufont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetMenuFont, &StyleSettings::GetMenuFont, _menufont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getToolFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetToolFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetToolFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setToolFont( const FontDescriptor& _toolfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetToolFont, &StyleSettings::GetToolFont, _toolfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetToolFont, &StyleSettings::GetToolFont, _toolfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getGroupFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetGroupFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetGroupFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setGroupFont( const FontDescriptor& _groupfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetGroupFont, &StyleSettings::GetGroupFont, _groupfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetGroupFont, &StyleSettings::GetGroupFont, _groupfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getLabelFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetLabelFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetLabelFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setLabelFont( const FontDescriptor& _labelfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetLabelFont, &StyleSettings::GetLabelFont, _labelfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetLabelFont, &StyleSettings::GetLabelFont, _labelfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getRadioCheckFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetRadioCheckFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetRadioCheckFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setRadioCheckFont( const FontDescriptor& _radiocheckfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetRadioCheckFont, &StyleSettings::GetRadioCheckFont, _radiocheckfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetRadioCheckFont, &StyleSettings::GetRadioCheckFont, _radiocheckfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getPushButtonFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetPushButtonFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetPushButtonFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setPushButtonFont( const FontDescriptor& _pushbuttonfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetPushButtonFont, &StyleSettings::GetPushButtonFont, _pushbuttonfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetPushButtonFont, &StyleSettings::GetPushButtonFont, _pushbuttonfont );
     }
 
 
     FontDescriptor SAL_CALL WindowStyleSettings::getFieldFont()
     {
-        StyleMethodGuard aGuard( *m_pData );
-        return lcl_getStyleFont( *m_pData, &StyleSettings::GetFieldFont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        return ImplGetStyleFont( &StyleSettings::GetFieldFont );
     }
 
 
     void SAL_CALL WindowStyleSettings::setFieldFont( const FontDescriptor& _fieldfont )
     {
-        StyleMethodGuard aGuard( *m_pData );
-        lcl_setStyleFont( *m_pData, &StyleSettings::SetFieldFont, &StyleSettings::GetFieldFont, _fieldfont );
+        StyleMethodGuard aGuard( pOwningWindow );
+        ImplSetStyleFont( &StyleSettings::SetFieldFont, &StyleSettings::GetFieldFont, _fieldfont );
     }
 
 
     void SAL_CALL WindowStyleSettings::addStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener )
     {
-        StyleMethodGuard aGuard( *m_pData );
+        StyleMethodGuard aGuard( pOwningWindow );
         if ( i_rListener.is() )
-            m_pData->aStyleChangeListeners.addInterface( i_rListener );
+            aStyleChangeListeners.addInterface( i_rListener );
     }
 
 
     void SAL_CALL WindowStyleSettings::removeStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener )
     {
-        StyleMethodGuard aGuard( *m_pData );
+        StyleMethodGuard aGuard( pOwningWindow );
         if ( i_rListener.is() )
-            m_pData->aStyleChangeListeners.removeInterface( i_rListener );
+            aStyleChangeListeners.removeInterface( i_rListener );
     }
 
 
diff --git a/toolkit/source/awt/stylesettings.hxx b/toolkit/source/awt/stylesettings.hxx
index 0bc28cd1dad4..560e30866194 100644
--- a/toolkit/source/awt/stylesettings.hxx
+++ b/toolkit/source/awt/stylesettings.hxx
@@ -22,7 +22,9 @@
 
 #include <com/sun/star/awt/XStyleSettings.hpp>
 
+#include <comphelper/interfacecontainer2.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <tools/link.hxx>
 
 #include <memory>
 
@@ -30,9 +32,11 @@ namespace osl
 {
     class Mutex;
 }
-
+class Color;
 class VCLXWindow;
-
+class VclWindowEvent;
+class StyleSettings;
+namespace vcl { class Font; }
 
 namespace toolkit
 {
@@ -40,7 +44,6 @@ namespace toolkit
 
     //= WindowStyleSettings
 
-    struct WindowStyleSettings_Data;
     typedef ::cppu::WeakImplHelper <   css::awt::XStyleSettings
                                     >   WindowStyleSettings_Base;
     class WindowStyleSettings : public WindowStyleSettings_Base
@@ -160,7 +163,15 @@ namespace toolkit
         virtual void SAL_CALL removeStyleChangeListener( const css::uno::Reference< css::awt::XStyleChangeListener >& Listener ) override;
 
     private:
-        std::unique_ptr< WindowStyleSettings_Data > m_pData;
+        void ImplSetStyleFont( void (StyleSettings::*i_pSetter)( vcl::Font const &),
+            vcl::Font const & (StyleSettings::*i_pGetter)() const, const css::awt::FontDescriptor& i_rFont );
+        void ImplSetStyleColor( void (StyleSettings::*i_pSetter)( Color const & ), sal_Int32 i_nColor );
+        sal_Int32 ImplGetStyleColor( Color const & (StyleSettings::*i_pGetter)() const );
+        css::awt::FontDescriptor ImplGetStyleFont( vcl::Font const & (StyleSettings::*i_pGetter)() const );
+        DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
+
+        VCLXWindow*                                pOwningWindow;
+        ::comphelper::OInterfaceContainerHelper2   aStyleChangeListeners;
     };
 
 


More information about the Libreoffice-commits mailing list