diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-22 17:51:44 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-23 18:55:39 +0900 |
commit | 4f5fe008a3d5f0b5ddfa656299306cff9d57d802 (patch) | |
tree | 9bca9fd7b61d5698b200400e90efa7504bfcab84 | |
parent | loplugin:staticmethods (diff) | |
download | core-4f5fe008a3d5f0b5ddfa656299306cff9d57d802.tar.gz core-4f5fe008a3d5f0b5ddfa656299306cff9d57d802.zip |
use ApplySettings instead of ImplInitSettings is called
Change-Id: I30cbfe1906d5d59db93a354ca1d1862c4b5e631a
-rw-r--r-- | include/vcl/dockingarea.hxx | 1 | ||||
-rw-r--r-- | include/vcl/fixed.hxx | 13 | ||||
-rw-r--r-- | include/vcl/lstbox.hxx | 1 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 23 | ||||
-rw-r--r-- | vcl/source/control/fixed.cxx | 249 | ||||
-rw-r--r-- | vcl/source/control/lstbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/dockingarea.cxx | 86 |
7 files changed, 185 insertions, 194 deletions
diff --git a/include/vcl/dockingarea.hxx b/include/vcl/dockingarea.hxx index 58fcfd7d9256..a0ce2d674daa 100644 --- a/include/vcl/dockingarea.hxx +++ b/include/vcl/dockingarea.hxx @@ -43,6 +43,7 @@ public: WindowAlign GetAlign() const; bool IsHorizontal() const; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx index 15e838bdd4f7..fc455d82ef65 100644 --- a/include/vcl/fixed.hxx +++ b/include/vcl/fixed.hxx @@ -44,7 +44,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; public: @@ -64,6 +63,8 @@ public: virtual ~FixedText(); virtual void dispose() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -89,6 +90,7 @@ public: explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 ); virtual void LoseFocus() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; }; @@ -102,7 +104,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false); protected: @@ -116,6 +117,8 @@ public: explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ ); explicit FixedLine( vcl::Window* pParent, const ResId& ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -135,13 +138,14 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ); public: explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -168,7 +172,6 @@ private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); protected: SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, @@ -179,6 +182,8 @@ public: explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedImage( vcl::Window* pParent, const ResId& ); + virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE; + virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index d93167e0e1e8..8a5efc5bc853 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -85,6 +85,7 @@ public: virtual ~ListBox(); virtual void dispose() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 065ed0f686e7..ed59e5d99aad 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -425,28 +425,9 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) rRenderContext.SetTextFillColor(); } -void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) +void Control::ImplInitSettings(const bool, const bool) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (_bFont) - { - Font aFont(GetCanonicalFont(rStyleSettings)); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(*this, aFont); - } - - if (_bForeground || _bFont) - { - Color aColor; - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = GetCanonicalTextColor(rStyleSettings); - SetTextColor(aColor); - SetTextFillColor(); - } + ApplySettings(*this); } void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr, diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 4588596286ed..55b8b0c6a6a8 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -84,7 +84,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedText::ImplInitStyle( WinBits nStyle ) @@ -104,35 +104,6 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); } -void FixedText::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - FixedText::FixedText( vcl::Window* pParent, WinBits nStyle ) : Control(WINDOW_FIXEDTEXT) , m_nMaxWidthChars(-1) @@ -232,6 +203,31 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL); } +void FixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -240,7 +236,7 @@ void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - ImplInitSettings( true, true, true ); + ApplySettings(*pDev); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -298,24 +294,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } } else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -329,7 +325,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -390,7 +386,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); - ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); + const_cast<FixedText*>(this)->Invalidate(); } void FixedText::setMaxWidthChars(sal_Int32 nWidth) @@ -476,9 +472,13 @@ SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle) // read-only SetReadOnly(); // make it transparent + SetPaintTransparent(true); SetControlBackground(); - SetBackground(); - SetPaintTransparent( true ); +} + +void SelectableFixedText::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); } void SelectableFixedText::LoseFocus() @@ -492,7 +492,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); } WinBits FixedLine::ImplInitStyle( WinBits nStyle ) @@ -512,35 +512,6 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co return _rStyle.GetGroupTextColor(); } -void FixedLine::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) -{ - Control::ImplInitSettings( bFont, bForeground ); - - if ( bBackground ) - { - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } - } -} - void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) { Size aOutSize = rRenderContext.GetOutputSizePixel(); @@ -633,12 +604,37 @@ FixedLine::FixedLine( vcl::Window* pParent, const ResId& rResId ) : Show(); } -void FixedLine::FillLayoutData() const +void FixedLine::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<FixedLine*>(this)->Invalidate(); } +void FixedLine::ApplySettings(vcl::RenderContext& rRenderContext) +{ + Control::ApplySettings(rRenderContext); + + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedLine::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(rRenderContext); @@ -676,17 +672,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == StateChangedType::Style) || (nType == StateChangedType::ControlFont) ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } } @@ -700,7 +696,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ImplInitSettings( true, true, true ); + ApplySettings(*this); Invalidate(); } } @@ -714,7 +710,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) @@ -724,29 +720,6 @@ WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedBitmap::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } -} - FixedBitmap::FixedBitmap( vcl::Window* pParent, WinBits nStyle ) : Control( WINDOW_FIXEDBITMAP ) { @@ -771,6 +744,29 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, } } +void FixedBitmap::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + void FixedBitmap::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -823,7 +819,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -835,7 +831,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -852,7 +848,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) nStyle = ImplInitStyle( nStyle ); mbInUserDraw = false; Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings(); + ApplySettings(*this); } WinBits FixedImage::ImplInitStyle( WinBits nStyle ) @@ -862,29 +858,6 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle ) return nStyle; } -void FixedImage::ImplInitSettings() -{ - vcl::Window* pParent = GetParent(); - if ( pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( true ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( true ); - SetBackground(); - } - else - { - EnableChildTransparentMode( false ); - SetParentClipMode( 0 ); - SetPaintTransparent( false ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else if ( pParent ) - SetBackground( pParent->GetBackground() ); - } -} - void FixedImage::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); @@ -941,6 +914,30 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, } } +void FixedImage::ApplySettings(vcl::RenderContext& rRenderContext) +{ + vcl::Window* pParent = GetParent(); + if (pParent && pParent->IsChildTransparentModeEnabled() && !IsControlBackground()) + { + EnableChildTransparentMode(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + SetPaintTransparent(true); + rRenderContext.SetBackground(); + } + else + { + EnableChildTransparentMode(false); + SetParentClipMode(0); + SetPaintTransparent(false); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else if (pParent) + rRenderContext.SetBackground(pParent->GetBackground()); + } +} + + void FixedImage::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); @@ -998,7 +995,7 @@ void FixedImage::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } @@ -1010,7 +1007,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitSettings(); + ApplySettings(*this); Invalidate(); } } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 4fbc24e5495d..60683d3f30af 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -105,7 +105,6 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) nStyle |= WB_BORDER; Control::ImplInit( pParent, nStyle, NULL ); - SetBackground(); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this); @@ -369,6 +368,11 @@ void ListBox::ToggleDropDown() } } +void ListBox::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); +} + void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true ); diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 793ae09430fd..25519f9bb46f 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -44,50 +44,12 @@ DockingAreaWindow::ImplData::~ImplData() { } -static void ImplInitBackground( DockingAreaWindow* pThis ) -{ - const StyleSettings rSetting = Application::GetSettings().GetStyleSettings(); - const BitmapEx& rPersonaBitmap = pThis->GetAlign() == WINDOWALIGN_TOP ? rSetting.GetPersonaHeader() :rSetting.GetPersonaFooter(); - if ( !rPersonaBitmap.IsEmpty() &&( pThis->GetAlign() == WINDOWALIGN_TOP|| pThis->GetAlign()==WINDOWALIGN_BOTTOM ) ) - { - Wallpaper aWallpaper( rPersonaBitmap ); - if(pThis->GetAlign()==WINDOWALIGN_TOP ) - aWallpaper.SetStyle( WALLPAPER_TOPRIGHT ); - else - aWallpaper.SetStyle( WALLPAPER_BOTTOMRIGHT ); - aWallpaper.SetColor( rSetting.GetWorkspaceColor() ); - - // we need to shift the bitmap vertically so that it spans over the - // menubar conveniently - long nMenubarHeight = 0; - SystemWindow *pSysWin = pThis->GetSystemWindow(); - if ( pSysWin && pSysWin->GetMenuBar() ) - { - vcl::Window *pMenubarWin = pSysWin->GetMenuBar()->GetWindow(); - if ( pMenubarWin ) - nMenubarHeight = pMenubarWin->GetOutputHeightPixel(); - } - aWallpaper.SetRect( Rectangle( Point( 0, -nMenubarHeight ), Size( pThis->GetOutputWidthPixel(), pThis->GetOutputHeightPixel() + nMenubarHeight ) ) ); - - pThis->SetBackground( aWallpaper ); - } - else if( !pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) - { - Wallpaper aWallpaper; - aWallpaper.SetStyle( WALLPAPER_APPLICATIONGRADIENT ); - pThis->SetBackground( aWallpaper ); - } - else - pThis->SetBackground( Wallpaper( pThis->GetSettings().GetStyleSettings().GetFaceColor() ) ); -} - DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) : Window( WINDOW_DOCKINGAREA ) { ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, NULL ); mpImplData = new ImplData; - ImplInitBackground( this ); } DockingAreaWindow::~DockingAreaWindow() @@ -107,7 +69,6 @@ void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ImplInitBackground( this ); Invalidate(); } } @@ -149,7 +110,6 @@ void DockingAreaWindow::SetAlign( WindowAlign eNewAlign ) if( eNewAlign != mpImplData->meAlign ) { mpImplData->meAlign = eNewAlign; - ImplInitBackground( this ); Invalidate(); } } @@ -159,13 +119,56 @@ WindowAlign DockingAreaWindow::GetAlign() const return mpImplData->meAlign; } +void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); + const BitmapEx& rPersonaBitmap = (GetAlign() == WINDOWALIGN_TOP) ? rSetting.GetPersonaHeader() : rSetting.GetPersonaFooter(); + + if (!rPersonaBitmap.IsEmpty() && (GetAlign() == WINDOWALIGN_TOP || GetAlign()==WINDOWALIGN_BOTTOM)) + { + Wallpaper aWallpaper(rPersonaBitmap); + if (GetAlign() == WINDOWALIGN_TOP) + aWallpaper.SetStyle(WALLPAPER_TOPRIGHT); + else + aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); + aWallpaper.SetColor(rSetting.GetWorkspaceColor()); + + // we need to shift the bitmap vertically so that it spans over the + // menubar conveniently + long nMenubarHeight = 0; + SystemWindow* pSysWin = GetSystemWindow(); + if (pSysWin && pSysWin->GetMenuBar()) + { + vcl::Window* pMenubarWin = pSysWin->GetMenuBar()->GetWindow(); + if (pMenubarWin) + nMenubarHeight = pMenubarWin->GetOutputHeightPixel(); + } + aWallpaper.SetRect(Rectangle(Point(0, -nMenubarHeight), + Size(rRenderContext.GetOutputWidthPixel(), + rRenderContext.GetOutputHeightPixel() + nMenubarHeight))); + + rRenderContext.SetBackground(aWallpaper); + } + else if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) + { + Wallpaper aWallpaper; + aWallpaper.SetStyle(WALLPAPER_APPLICATIONGRADIENT); + rRenderContext.SetBackground(aWallpaper); + } + else + rRenderContext.SetBackground(Wallpaper(rSetting.GetFaceColor())); + +} + void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { + + const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); + EnableNativeWidget(true); // only required because the toolkit currently switches this flag off if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) { ToolbarValue aControlValue; - const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings(); if (GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG) { @@ -256,7 +259,6 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl void DockingAreaWindow::Resize() { - ImplInitBackground( this ); ImplInvalidateMenubar( this ); if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) Invalidate(); |