diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-17 22:56:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-18 11:22:49 +0900 |
commit | b4bbb5e5d7b31caad2fbcc00382ad27df3c81001 (patch) | |
tree | 8ac345712ff92a9b33a7d54651ed27ad88f1ec67 /svx | |
parent | 2ca7795a6a723c701f295323fcc3f6c52ad37976 (diff) |
refactor how font, fg. and bg. are applied in widgets/controls
- Move vcl::RenderContext to outdev.
- Change some methods on vcl::Window to accept RenderContext
as parameter.
- Add ApplySettings to vcl::Window - This method is called before
painting. Refactor existing classes that use InitSettings to
have ApplySettings or mark the classes to be refactored later.
- Add RenderSettings for adding defered settings to rendering.
This is similar to ApplySettings but for more ad-hoc calls.
Change-Id: I4ea58461f3b6b08ccfa3e0ddd1a4a3e04f8c4f45
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 52 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 10 |
2 files changed, 30 insertions, 32 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 40874b41fbcb..326f6fbf5c3c 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -729,52 +729,50 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet { vcl::Window* pWindows[] = { m_pPainter, m_pWindow }; - if ( ( _eInitWhat & InitWritingMode ) != 0 ) + if ((_eInitWhat & InitWritingMode) != 0) { - for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) + for (size_t i = 0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i) { - if ( pWindows[i] ) - pWindows[i]->EnableRTL( rParent.IsRTLEnabled() ); + if (pWindows[i]) + pWindows[i]->EnableRTL(rParent.IsRTLEnabled()); } } - if ( ( _eInitWhat & InitFontFacet ) != 0 ) + if ((_eInitWhat & InitFontFacet) != 0) { - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i = 0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i) { - if ( !pWindows[i] ) + if (!pWindows[i]) continue; - pWindows[i]->SetZoom( rParent.GetZoom() ); + pWindows[i]->SetZoom(rParent.GetZoom()); const StyleSettings& rStyleSettings = pWindows[i]->GetSettings().GetStyleSettings(); vcl::Font aFont = rStyleSettings.GetFieldFont(); - aFont.SetTransparent( isTransparent() ); + aFont.SetTransparent(isTransparent()); - if ( rParent.IsControlFont() ) + if (rParent.IsControlFont()) { - pWindows[i]->SetControlFont( rParent.GetControlFont() ); - aFont.Merge( rParent.GetControlFont() ); + pWindows[i]->SetControlFont(rParent.GetControlFont()); + aFont.Merge(rParent.GetControlFont()); } else pWindows[i]->SetControlFont(); - pWindows[i]->SetZoomedPointFont( aFont ); + pWindows[i]->SetZoomedPointFont(*pWindows[i], aFont); // FIXME RenderContext } } - if ( ( ( _eInitWhat & InitFontFacet ) != 0 ) - || ( ( _eInitWhat & InitForeground ) != 0 ) - ) + if (((_eInitWhat & InitFontFacet) != 0) || ((_eInitWhat & InitForeground) != 0)) { - Color aTextColor( rParent.IsControlForeground() ? rParent.GetControlForeground() : rParent.GetTextColor() ); + Color aTextColor(rParent.IsControlForeground() ? rParent.GetControlForeground() : rParent.GetTextColor()); bool bTextLineColor = rParent.IsTextLineColor(); - Color aTextLineColor( rParent.GetTextLineColor() ); + Color aTextLineColor(rParent.GetTextLineColor()); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i) { - if ( pWindows[i] ) + if (pWindows[i]) { pWindows[i]->SetTextColor(aTextColor); if (rParent.IsControlForeground()) @@ -788,16 +786,16 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet } } - if ( ( _eInitWhat & InitBackground ) != 0 ) + if ((_eInitWhat & InitBackground) != 0) { if (rParent.IsControlBackground()) { - Color aColor( rParent.GetControlBackground()); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + Color aColor(rParent.GetControlBackground()); + for (size_t i=0; i < sizeof(pWindows) / sizeof(pWindows[0]); ++i) { - if ( pWindows[i] ) + if (pWindows[i]) { - if ( isTransparent() ) + if (isTransparent()) pWindows[i]->SetBackground(); else { @@ -812,7 +810,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet { if (m_pPainter) { - if ( isTransparent() ) + if (isTransparent()) m_pPainter->SetBackground(); else m_pPainter->SetBackground(rParent.GetBackground()); @@ -821,7 +819,7 @@ void DbCellControl::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet if (m_pWindow) { - if ( isTransparent() ) + if (isTransparent()) m_pWindow->SetBackground(rParent.GetBackground()); else m_pWindow->SetFillColor(rParent.GetFillColor()); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 25e44b38e1b4..df26ebbc65f6 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -729,9 +729,9 @@ void DbGridControl::NavigationBar::Paint(vcl::RenderContext& rRenderContext, con Point(aAbsolutePos.X() + aAbsoluteSize.Width() + 1, aAbsolutePos.Y() + aAbsoluteSize.Height())); } -void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) +void DbGridControl::NavigationBar::StateChanged(StateChangedType nType) { - Control::StateChanged( nType ); + Control::StateChanged(nType); vcl::Window* pWindows[] = { @@ -751,7 +751,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) case StateChangedType::Mirroring: { bool bIsRTLEnabled = IsRTLEnabled(); - for ( size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i ) + for (size_t i=0; i < (sizeof (pWindows) / sizeof(pWindows[0])); ++i) pWindows[i]->EnableRTL( bIsRTLEnabled ); } break; @@ -768,10 +768,10 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { pWindows[i]->SetZoom(aZoom); - pWindows[i]->SetZoomedPointFont(aFont); + pWindows[i]->SetZoomedPointFont(*pWindows[i], aFont); } - SetZoomedPointFont( aFont ); + SetZoomedPointFont(*this, aFont); // rearrange the controls m_nDefaultWidth = ArrangeControls(); |