Kaydet (Commit) 2b16c138 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Jan Holesovsky

use ApplySettings instead of ImplInitSettings is called

Change-Id: I30cbfe1906d5d59db93a354ca1d1862c4b5e631a
Signed-off-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 3501d1b0
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
WindowAlign GetAlign() const; WindowAlign GetAlign() const;
bool IsHorizontal() 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 Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
......
...@@ -44,7 +44,6 @@ private: ...@@ -44,7 +44,6 @@ private:
using Window::ImplInit; using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( 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, SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize, bool bFillLayout = false ) const; const Point& rPos, const Size& rSize, bool bFillLayout = false ) const;
public: public:
...@@ -64,6 +63,8 @@ public: ...@@ -64,6 +63,8 @@ public:
virtual ~FixedText(); virtual ~FixedText();
virtual void dispose() SAL_OVERRIDE; 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 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 Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
...@@ -89,6 +90,7 @@ public: ...@@ -89,6 +90,7 @@ public:
explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 ); explicit SelectableFixedText( vcl::Window* pParent, WinBits nStyle = 0 );
virtual void LoseFocus() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE;
virtual void ApplySettings(vcl::RenderContext&) SAL_OVERRIDE;
}; };
...@@ -102,7 +104,6 @@ private: ...@@ -102,7 +104,6 @@ private:
using Window::ImplInit; using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( 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); SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false);
protected: protected:
...@@ -116,6 +117,8 @@ public: ...@@ -116,6 +117,8 @@ public:
explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ ); explicit FixedLine( vcl::Window* pParent, WinBits nStyle = WB_HORZ );
explicit FixedLine( vcl::Window* pParent, const ResId& ); 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 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 Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
...@@ -135,13 +138,14 @@ private: ...@@ -135,13 +138,14 @@ private:
using Window::ImplInit; using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings();
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize ); const Point& rPos, const Size& rSize );
public: public:
explicit FixedBitmap( vcl::Window* pParent, WinBits nStyle = 0 ); 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 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 Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
...@@ -168,7 +172,6 @@ private: ...@@ -168,7 +172,6 @@ private:
using Window::ImplInit; using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings();
protected: protected:
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
...@@ -179,6 +182,8 @@ public: ...@@ -179,6 +182,8 @@ public:
explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedImage( vcl::Window* pParent, WinBits nStyle = 0 );
explicit FixedImage( vcl::Window* pParent, const ResId& ); 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 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 Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
......
...@@ -85,6 +85,7 @@ public: ...@@ -85,6 +85,7 @@ public:
virtual ~ListBox(); virtual ~ListBox();
virtual void dispose() SAL_OVERRIDE; 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 Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
......
...@@ -425,28 +425,9 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) ...@@ -425,28 +425,9 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext)
rRenderContext.SetTextFillColor(); rRenderContext.SetTextFillColor();
} }
void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) void Control::ImplInitSettings(const bool, const bool)
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); ApplySettings(*this);
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();
}
} }
void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr, void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr,
......
...@@ -84,7 +84,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -84,7 +84,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
nStyle = ImplInitStyle( nStyle ); nStyle = ImplInitStyle( nStyle );
Control::ImplInit( pParent, nStyle, NULL ); Control::ImplInit( pParent, nStyle, NULL );
ImplInitSettings( true, true, true ); ApplySettings(*this);
} }
WinBits FixedText::ImplInitStyle( WinBits nStyle ) WinBits FixedText::ImplInitStyle( WinBits nStyle )
...@@ -104,35 +104,6 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co ...@@ -104,35 +104,6 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co
return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); 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 ) FixedText::FixedText( vcl::Window* pParent, WinBits nStyle )
: Control(WINDOW_FIXEDTEXT) : Control(WINDOW_FIXEDTEXT)
, m_nMaxWidthChars(-1) , m_nMaxWidthChars(-1)
...@@ -232,6 +203,31 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags, ...@@ -232,6 +203,31 @@ void FixedText::ImplDraw(OutputDevice* pDev, sal_uLong nDrawFlags,
bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL); 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& ) void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& )
{ {
ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel());
...@@ -240,7 +236,7 @@ void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) ...@@ -240,7 +236,7 @@ void FixedText::Paint( vcl::RenderContext& rRenderContext, const Rectangle& )
void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
sal_uLong nFlags ) sal_uLong nFlags )
{ {
ImplInitSettings( true, true, true ); ApplySettings(*pDev);
Point aPos = pDev->LogicToPixel( rPos ); Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize ); Size aSize = pDev->LogicToPixel( rSize );
...@@ -298,24 +294,24 @@ void FixedText::StateChanged( StateChangedType nType ) ...@@ -298,24 +294,24 @@ void FixedText::StateChanged( StateChangedType nType )
if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) !=
(GetStyle() & FIXEDTEXT_VIEW_STYLE) ) (GetStyle() & FIXEDTEXT_VIEW_STYLE) )
{ {
ImplInitSettings( true, false, false ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
else if ( (nType == StateChangedType::Zoom) || else if ( (nType == StateChangedType::Zoom) ||
(nType == StateChangedType::ControlFont) ) (nType == StateChangedType::ControlFont) )
{ {
ImplInitSettings( true, false, false ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlForeground ) else if ( nType == StateChangedType::ControlForeground )
{ {
ImplInitSettings( false, true, false ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlBackground ) else if ( nType == StateChangedType::ControlBackground )
{ {
ImplInitSettings( false, false, true ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -329,7 +325,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -329,7 +325,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt )
((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
{ {
ImplInitSettings( true, true, true ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -390,7 +386,7 @@ Size FixedText::GetOptimalSize() const ...@@ -390,7 +386,7 @@ Size FixedText::GetOptimalSize() const
void FixedText::FillLayoutData() const void FixedText::FillLayoutData() const
{ {
mpControlData->mpLayoutData = new vcl::ControlLayoutData(); 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) void FixedText::setMaxWidthChars(sal_Int32 nWidth)
...@@ -476,9 +472,13 @@ SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle) ...@@ -476,9 +472,13 @@ SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle)
// read-only // read-only
SetReadOnly(); SetReadOnly();
// make it transparent // make it transparent
SetPaintTransparent(true);
SetControlBackground(); SetControlBackground();
SetBackground(); }
SetPaintTransparent( true );
void SelectableFixedText::ApplySettings(vcl::RenderContext& rRenderContext)
{
rRenderContext.SetBackground();
} }
void SelectableFixedText::LoseFocus() void SelectableFixedText::LoseFocus()
...@@ -492,7 +492,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -492,7 +492,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
nStyle = ImplInitStyle( nStyle ); nStyle = ImplInitStyle( nStyle );
Control::ImplInit( pParent, nStyle, NULL ); Control::ImplInit( pParent, nStyle, NULL );
ImplInitSettings( true, true, true ); ApplySettings(*this);
} }
WinBits FixedLine::ImplInitStyle( WinBits nStyle ) WinBits FixedLine::ImplInitStyle( WinBits nStyle )
...@@ -512,35 +512,6 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co ...@@ -512,35 +512,6 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co
return _rStyle.GetGroupTextColor(); 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) void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
{ {
Size aOutSize = rRenderContext.GetOutputSizePixel(); Size aOutSize = rRenderContext.GetOutputSizePixel();
...@@ -633,12 +604,37 @@ FixedLine::FixedLine( vcl::Window* pParent, const ResId& rResId ) : ...@@ -633,12 +604,37 @@ FixedLine::FixedLine( vcl::Window* pParent, const ResId& rResId ) :
Show(); Show();
} }
void FixedLine::FillLayoutData() const void FixedLine::FillLayoutData() const
{ {
mpControlData->mpLayoutData = new vcl::ControlLayoutData(); mpControlData->mpLayoutData = new vcl::ControlLayoutData();
const_cast<FixedLine*>(this)->Invalidate(); 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&) void FixedLine::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{ {
ImplDraw(rRenderContext); ImplDraw(rRenderContext);
...@@ -676,17 +672,17 @@ void FixedLine::StateChanged( StateChangedType nType ) ...@@ -676,17 +672,17 @@ void FixedLine::StateChanged( StateChangedType nType )
(nType == StateChangedType::Style) || (nType == StateChangedType::Style) ||
(nType == StateChangedType::ControlFont) ) (nType == StateChangedType::ControlFont) )
{ {
ImplInitSettings( true, false, false ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlForeground ) else if ( nType == StateChangedType::ControlForeground )
{ {
ImplInitSettings( false, true, false ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlBackground ) else if ( nType == StateChangedType::ControlBackground )
{ {
ImplInitSettings( false, false, true ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -700,7 +696,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -700,7 +696,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt )
((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
{ {
ImplInitSettings( true, true, true ); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -714,7 +710,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -714,7 +710,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
nStyle = ImplInitStyle( nStyle ); nStyle = ImplInitStyle( nStyle );
Control::ImplInit( pParent, nStyle, NULL ); Control::ImplInit( pParent, nStyle, NULL );
ImplInitSettings(); ApplySettings(*this);
} }
WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) WinBits FixedBitmap::ImplInitStyle( WinBits nStyle )
...@@ -724,29 +720,6 @@ WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) ...@@ -724,29 +720,6 @@ WinBits FixedBitmap::ImplInitStyle( WinBits nStyle )
return 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 ) : FixedBitmap::FixedBitmap( vcl::Window* pParent, WinBits nStyle ) :
Control( WINDOW_FIXEDBITMAP ) Control( WINDOW_FIXEDBITMAP )
{ {
...@@ -771,6 +744,29 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, ...@@ -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&) void FixedBitmap::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{ {
ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel());
...@@ -823,7 +819,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) ...@@ -823,7 +819,7 @@ void FixedBitmap::StateChanged( StateChangedType nType )
} }
else if ( nType == StateChangedType::ControlBackground ) else if ( nType == StateChangedType::ControlBackground )
{ {
ImplInitSettings(); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -835,7 +831,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -835,7 +831,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{ {
ImplInitSettings(); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -852,7 +848,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -852,7 +848,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle )
nStyle = ImplInitStyle( nStyle ); nStyle = ImplInitStyle( nStyle );
mbInUserDraw = false; mbInUserDraw = false;
Control::ImplInit( pParent, nStyle, NULL ); Control::ImplInit( pParent, nStyle, NULL );
ImplInitSettings(); ApplySettings(*this);
} }
WinBits FixedImage::ImplInitStyle( WinBits nStyle ) WinBits FixedImage::ImplInitStyle( WinBits nStyle )
...@@ -862,29 +858,6 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle ) ...@@ -862,29 +858,6 @@ WinBits FixedImage::ImplInitStyle( WinBits nStyle )
return 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 ) void FixedImage::ImplLoadRes( const ResId& rResId )
{ {
Control::ImplLoadRes( rResId ); Control::ImplLoadRes( rResId );
...@@ -941,6 +914,30 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, ...@@ -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&) void FixedImage::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{ {
ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel()); ImplDraw(&rRenderContext, 0, Point(), GetOutputSizePixel());
...@@ -998,7 +995,7 @@ void FixedImage::StateChanged( StateChangedType nType ) ...@@ -998,7 +995,7 @@ void FixedImage::StateChanged( StateChangedType nType )
} }
else if ( nType == StateChangedType::ControlBackground ) else if ( nType == StateChangedType::ControlBackground )
{ {
ImplInitSettings(); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
...@@ -1010,7 +1007,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -1010,7 +1007,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{ {
ImplInitSettings(); ApplySettings(*this);
Invalidate(); Invalidate();
} }
} }
......
...@@ -105,7 +105,6 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -105,7 +105,6 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
nStyle |= WB_BORDER; nStyle |= WB_BORDER;
Control::ImplInit( pParent, nStyle, NULL ); Control::ImplInit( pParent, nStyle, NULL );
SetBackground();
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this);
...@@ -369,6 +368,11 @@ void ListBox::ToggleDropDown() ...@@ -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 ) void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{ {
mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true ); mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
......
...@@ -44,50 +44,12 @@ DockingAreaWindow::ImplData::~ImplData() ...@@ -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 ) : DockingAreaWindow::DockingAreaWindow( vcl::Window* pParent ) :
Window( WINDOW_DOCKINGAREA ) Window( WINDOW_DOCKINGAREA )
{ {
ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, NULL ); ImplInit( pParent, WB_CLIPCHILDREN|WB_3DLOOK, NULL );
mpImplData = new ImplData; mpImplData = new ImplData;
ImplInitBackground( this );
} }
DockingAreaWindow::~DockingAreaWindow() DockingAreaWindow::~DockingAreaWindow()
...@@ -107,7 +69,6 @@ void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -107,7 +69,6 @@ void DockingAreaWindow::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{ {
ImplInitBackground( this );
Invalidate(); Invalidate();
} }
} }
...@@ -149,7 +110,6 @@ void DockingAreaWindow::SetAlign( WindowAlign eNewAlign ) ...@@ -149,7 +110,6 @@ void DockingAreaWindow::SetAlign( WindowAlign eNewAlign )
if( eNewAlign != mpImplData->meAlign ) if( eNewAlign != mpImplData->meAlign )
{ {
mpImplData->meAlign = eNewAlign; mpImplData->meAlign = eNewAlign;
ImplInitBackground( this );
Invalidate(); Invalidate();
} }
} }
...@@ -159,13 +119,56 @@ WindowAlign DockingAreaWindow::GetAlign() const ...@@ -159,13 +119,56 @@ WindowAlign DockingAreaWindow::GetAlign() const
return mpImplData->meAlign; 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&) 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 EnableNativeWidget(true); // only required because the toolkit currently switches this flag off
if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
{ {
ToolbarValue aControlValue; ToolbarValue aControlValue;
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
if (GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG) if (GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG)
{ {
...@@ -256,7 +259,6 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl ...@@ -256,7 +259,6 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl
void DockingAreaWindow::Resize() void DockingAreaWindow::Resize()
{ {
ImplInitBackground( this );
ImplInvalidateMenubar( this ); ImplInvalidateMenubar( this );
if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL)) if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL))
Invalidate(); Invalidate();
......
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