diff options
72 files changed, 1039 insertions, 619 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 351bc13da347..95b6a95d455a 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1242,7 +1242,7 @@ void EditorWindow::ImplSetFont() Size aFontSize(0, officecfg::Office::Common::Font::SourceViewFont::FontHeight::get()); vcl::Font aFont(sFontName, aFontSize); aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor()); - SetPointFont(aFont); + SetPointFont(*this, aFont); // FIXME RenderContext aFont = GetFont(); rModulWindow.GetBreakPointWindow().SetFont(aFont); diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 6ccdcabaf59d..0c6c64a8dbeb 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1342,12 +1342,13 @@ void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt ) void DialogWindow::InitSettings(bool bFont, bool bForeground, bool bBackground) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index faeb2d7302b6..b43338f693b0 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -106,7 +106,7 @@ void SvxHlmarkTreeLBox::Paint(vcl::RenderContext& rRenderContext, const Rectangl } else { - rRenderContext.Erase(); + Erase(rRenderContext); Rectangle aDrawRect(Point( 0, 0 ), GetSizePixel()); diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 44284fbb8f0b..c3dc8ef4a089 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -164,13 +164,14 @@ namespace } void OTablePreviewWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + //FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) @@ -1234,12 +1235,13 @@ void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt ) void OAppDetailPageHelper::ImplInitSettings() { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); - m_aTBPreview->SetPointFont( aFont ); + SetPointFont(*this, aFont); + m_aTBPreview->SetPointFont(*m_aTBPreview, aFont); SetTextColor( rStyleSettings.GetFieldTextColor() ); SetTextFillColor(); @@ -1324,13 +1326,14 @@ void OPreviewWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OPreviewWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index c547945aee5b..bd4ba2f048c0 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -391,13 +391,14 @@ void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OTasksWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) @@ -581,13 +582,14 @@ void OApplicationDetailView::dispose() void OApplicationDetailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx index 37df4725692a..05f9a06fc459 100644 --- a/dbaccess/source/ui/app/AppSwapWindow.cxx +++ b/dbaccess/source/ui/app/AppSwapWindow.cxx @@ -77,13 +77,14 @@ void OApplicationSwapWindow::Resize() void OApplicationSwapWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( bFont ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index 71317b01a82b..1a28fb789703 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -134,6 +134,7 @@ void OTitleWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OTitleWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext AllSettings aAllSettings = GetSettings(); StyleSettings aStyle = aAllSettings.GetStyleSettings(); aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor()); @@ -146,7 +147,7 @@ void OTitleWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( bForeground || bFont ) diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx index 8947c9e21c40..4c56fa87ba3f 100644 --- a/dbaccess/source/ui/app/AppView.cxx +++ b/dbaccess/source/ui/app/AppView.cxx @@ -150,13 +150,14 @@ void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OAppBorderWindow::ImplInitSettings() { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( true ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( true ) @@ -548,13 +549,14 @@ void OApplicationView::_disposing( const ::com::sun::star::lang::EventObject& /* void OApplicationView::ImplInitSettings() { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if( true ) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if( true ) diff --git a/dbaccess/source/ui/control/VertSplitView.cxx b/dbaccess/source/ui/control/VertSplitView.cxx index 5644fbbaf4bf..469536b9af6f 100644 --- a/dbaccess/source/ui/control/VertSplitView.cxx +++ b/dbaccess/source/ui/control/VertSplitView.cxx @@ -67,6 +67,7 @@ IMPL_LINK( OSplitterView, SplitHdl, Splitter*, /*pSplit*/ ) void OSplitterView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if ( bFont ) @@ -74,7 +75,7 @@ void OSplitterView::ImplInitSettings( bool bFont, bool bForeground, bool bBackgr vcl::Font aFont = rStyleSettings.GetAppFont(); if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); // Set/*Zoomed*/PointFont( aFont ); } diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 16879ed1b1d9..e444861d5b77 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -1464,6 +1464,7 @@ void OJoinTableView::StateChanged( StateChangedType nType ) { Window::StateChanged( nType ); + // FIXME RenderContext if ( nType == StateChangedType::Zoom ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -1471,7 +1472,7 @@ void OJoinTableView::StateChanged( StateChangedType nType ) vcl::Font aFont = rStyleSettings.GetGroupFont(); if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + SetZoomedPointFont(*this, aFont); OTableWindowMap::iterator aIter = m_aTableMap.begin(); OTableWindowMap::iterator aEnd = m_aTableMap.end(); diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index fefb91da63ee..971ff21bf21f 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -560,6 +560,8 @@ void OTableWindow::StateChanged( StateChangedType nType ) { Window::StateChanged( nType ); + // FIXME RenderContext + if ( nType == StateChangedType::Zoom ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -567,7 +569,7 @@ void OTableWindow::StateChanged( StateChangedType nType ) vcl::Font aFont = rStyleSettings.GetGroupFont(); if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + SetZoomedPointFont(*this, aFont); m_aTitle->SetZoom(GetZoom()); m_pListBox->SetZoom(GetZoom()); diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx index 2cb3efea4629..8adf24f934d2 100644 --- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -182,7 +182,7 @@ void OTableWindowTitle::StateChanged( StateChangedType nType ) vcl::Font aFont = rStyleSettings.GetGroupFont(); if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + SetZoomedPointFont(*this, aFont); Resize(); } diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index 9b5598f11a9b..90e012ff5d93 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -119,12 +119,14 @@ void OTableBorderWindow::ImplInitSettings( bool bFont, bool bForeground, bool bB { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + // FIXME RenderContext + if ( bFont ) { vcl::Font aFont = rStyleSettings.GetAppFont(); if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); } if ( bFont || bForeground ) diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx index bcf9e572fb05..04c251cc8cf7 100644 --- a/include/sfx2/thumbnailview.hxx +++ b/include/sfx2/thumbnailview.hxx @@ -295,6 +295,9 @@ protected: SFX2_DLLPRIVATE void ImplInit(); SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + SFX2_DLLPRIVATE void ImplInitScrollBar(); SFX2_DLLPRIVATE void ImplDeleteItems(); SFX2_DLLPRIVATE void ImplDraw(); diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx index 8293eb00aa98..af4859f2da50 100644 --- a/include/sfx2/titledockwin.hxx +++ b/include/sfx2/titledockwin.hxx @@ -27,14 +27,8 @@ #include <vcl/vclptr.hxx> #include <tools/svborder.hxx> - namespace sfx2 { - - - - //= TitledDockingWindow - class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow { public: @@ -92,18 +86,19 @@ namespace sfx2 protected: // Window overridables - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& i_rArea ) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void StateChanged( StateChangedType i_nType ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent ) SAL_OVERRIDE; virtual void SetText( const OUString& i_rText ) SAL_OVERRIDE; // DockingWindow overridables - void EndDocking( const Rectangle& rRect, bool bFloatMode ) SAL_OVERRIDE; + void EndDocking(const Rectangle& rRect, bool bFloatMode) SAL_OVERRIDE; // own overridables virtual void onLayoutDone(); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; protected: /** internal version of ResetToolBox */ diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx index 7e5751028d75..9aa1cdba9edb 100644 --- a/include/svtools/calendar.hxx +++ b/include/svtools/calendar.hxx @@ -228,6 +228,9 @@ private: using Window::ImplInit; SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle ); SVT_DLLPRIVATE void ImplInitSettings(); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext); + SVT_DLLPRIVATE void ImplGetWeekFont( vcl::Font& rFont ) const; SVT_DLLPRIVATE void ImplFormat(); using Window::ImplHitTest; diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx index cd99e317c9f0..9feeaa2500da 100644 --- a/include/svtools/headbar.hxx +++ b/include/svtools/headbar.hxx @@ -281,6 +281,8 @@ private: SVT_DLLPRIVATE void ImplDrag( const Point& rPos ); SVT_DLLPRIVATE void ImplEndDrag( bool bCancel ); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + public: HeaderBar( vcl::Window* pParent, WinBits nWinBits = WB_STDHEADERBAR ); virtual ~HeaderBar(); diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 537aa3bbde2f..b9510694ca33 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -690,6 +690,8 @@ private: SVT_DLLPRIVATE void ImplDrawExtra(vcl::RenderContext& rRenderContext, bool bPaint = false); SVT_DLLPRIVATE void ImplUpdate( bool bMustCalc = false ); + virtual void ApplySettings(vcl::RenderContext& rRenderContext); + using Window::ImplHitTest; SVT_DLLPRIVATE bool ImplHitTest( const Point& rPosition, RulerSelection* pHitTest, diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 5babd96909d1..90d8eae36b60 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -621,6 +621,9 @@ protected: virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; void InitSettings(bool bFont, bool bForeground, bool bBackground); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + bool IsCellFocusEnabled() const; bool SetCurrentTabPos( sal_uInt16 _nNewPos ); sal_uInt16 GetCurrentTabPos() const; diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 0497bdd237ce..8c2cd2aa5106 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -247,6 +247,9 @@ private: using Window::ImplInit; SVT_DLLPRIVATE void ImplInit(); SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + SVT_DLLPRIVATE void ImplInitScrollBar(); SVT_DLLPRIVATE void ImplDeleteItems(); SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext& rRenderContext, ValueSetItem* pItem, Rectangle aRect); diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx index 7c3c9e69c9cc..e526e31a44cc 100644 --- a/include/vcl/ctrl.hxx +++ b/include/vcl/ctrl.hxx @@ -101,6 +101,8 @@ protected: void ImplInitSettings( const bool _bFont, const bool _bForeground ); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + public: SAL_DLLPRIVATE void ImplClearLayoutData() const; /** draws a frame around the give rectangle, onto the given device diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx index a543ce510b34..8a9e2d5ae372 100644 --- a/include/vcl/edit.hxx +++ b/include/vcl/edit.hxx @@ -155,10 +155,10 @@ protected: virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - protected: +protected: + Edit(WindowType nType); virtual void FillLayoutData() const SAL_OVERRIDE; - Edit( WindowType nType ); - + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; public: // public because needed in button.cxx SAL_DLLPRIVATE bool ImplUseNativeBorder( WinBits nStyle ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 3d1b0dbaa9a2..3655e44b08d8 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -111,12 +111,10 @@ struct SalTwoRect; #define SAL_LAYOUT_FOR_FALLBACK (1<<13) #define SAL_LAYOUT_DRAW_BULLET (1<<14) -namespace com { -namespace sun { -namespace star { -namespace rendering { +namespace com { namespace sun { namespace star { namespace rendering { class XCanvas; }}}} + namespace basegfx { class B2DHomMatrix; class B2DPolygon; @@ -125,10 +123,7 @@ namespace basegfx { typedef B2IVector B2ISize; } -namespace com { -namespace sun { -namespace star { -namespace awt { +namespace com { namespace sun { namespace star { namespace awt { class XGraphics; } } } } @@ -254,6 +249,12 @@ extern const sal_uLong nVCLBLut[ 6 ]; extern const sal_uLong nVCLDitherLut[ 256 ]; extern const sal_uLong nVCLLut[ 256 ]; +class OutputDevice; + +namespace vcl { + typedef OutputDevice RenderContext; +} + class VCL_DLLPUBLIC OutputDevice { friend class Printer; @@ -1999,7 +2000,6 @@ public: const Point& rPt, const Size& rSz, const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL ); ///@} - }; #endif // INCLUDED_VCL_OUTDEV_HXX diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx index 1e9c2effc80e..06255171ffd3 100644 --- a/include/vcl/outdevstate.hxx +++ b/include/vcl/outdevstate.hxx @@ -98,6 +98,7 @@ inline ComplexTextLayoutMode& operator&= (ComplexTextLayoutMode& lhs, ComplexTex class OutDevState { public: + OutDevState(); ~OutDevState(); MapMode* mpMapMode; diff --git a/include/vcl/rendersettings.hxx b/include/vcl/rendersettings.hxx new file mode 100644 index 000000000000..f6df7215441d --- /dev/null +++ b/include/vcl/rendersettings.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_RENDERSETTINGS_HXX +#define INCLUDED_VCL_RENDERSETTINGS_HXX + +#include <vcl/window.hxx> +#include <vcl/outdev.hxx> +#include <vcl/outdevstate.hxx> + +namespace vcl +{ + +class VCL_DLLPUBLIC RenderSettings +{ + OutDevState maOutDevState; + std::unique_ptr<Wallpaper> mpBackground; + +public: + RenderSettings() + {} + + virtual ~RenderSettings() + {} + + inline void SetLineColor(const Color& rColor); + inline void SetFillColor(const Color& rColor); + inline void SetBackground(const Wallpaper& rBackground); + inline void SetFont(const vcl::Font& rNewFont); + + void PushAndApply(vcl::RenderContext& rRenderContext); + void Apply(vcl::RenderContext& rRenderContext); +}; + +} + +#endif // INCLUDED_VCL_RENDERSETTINGS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx index 270ef4eac89f..85a94cd44c36 100644 --- a/include/vcl/status.hxx +++ b/include/vcl/status.hxx @@ -110,6 +110,9 @@ private: SAL_DLLPRIVATE Rectangle ImplGetItemRectPos( sal_uInt16 nPos ) const; SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisiblePos() const; +protected: + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + public: StatusBar( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER | WB_RIGHT ); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 8b94b6b81aac..98e73e0e2b6d 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -283,7 +283,11 @@ public: SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } protected: - void SetCurItemId(sal_uInt16 nSet) { mnCurItemId = nSet; } + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + void SetCurItemId(sal_uInt16 nSet) + { + mnCurItemId = nSet; + } public: ToolBox( vcl::Window* pParent, WinBits nStyle = 0 ); diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index 12d03e14f512..d7eb4807b1c6 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -56,6 +56,7 @@ protected: ExtTextView* GetTextView() const; ScrollBar* GetVScrollBar() const; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; public: VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index ae4b4e33c19c..3f857f227965 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -69,31 +69,17 @@ class SalFrame; class MenuFloatingWindow; class VCLXWindow; -namespace com { -namespace sun { -namespace star { +namespace com { namespace sun { namespace star { namespace accessibility { class XAccessible; -}}}} - -namespace com { -namespace sun { -namespace star { +} namespace beans { struct PropertyValue; -}}}} - -namespace com { -namespace sun { -namespace star { +} namespace rendering { class XCanvas; class XSpriteCanvas; -}}}} - -namespace com { -namespace sun { -namespace star { +} namespace awt { class XWindowPeer; class XWindow; @@ -102,27 +88,24 @@ namespace uno { class Any; class XInterface; } -namespace datatransfer { -namespace clipboard { +namespace datatransfer { namespace clipboard { class XClipboard; } - namespace dnd { class XDragGestureRecognizer; class XDragSource; class XDropTarget; -} } } } } +}}}}} namespace vcl { struct ControlLayoutData; + class RenderSettings; } namespace svt { class PopupWindowControllerImpl; } template<class T> class VclPtr; - - enum class TrackingEventFlags { NONE = 0x0000, @@ -133,6 +116,7 @@ enum class TrackingEventFlags End = 0x1000, DontCallHdl = 0x8000, }; + namespace o3tl { template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x9107> {}; @@ -393,8 +377,6 @@ struct WindowResHeader namespace vcl { -typedef OutputDevice RenderContext; - class VCL_DLLPUBLIC RenderTools { public: @@ -598,8 +580,8 @@ private: SAL_DLLPRIVATE void ImplInitResolutionSettings(); - SAL_DLLPRIVATE void ImplPointToLogic( vcl::Font& rFont ) const; - SAL_DLLPRIVATE void ImplLogicToPoint( vcl::Font& rFont ) const; + SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const; + SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const; SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion ); SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip(); @@ -711,8 +693,16 @@ protected: virtual void ClipToPaintRegion( Rectangle& rDstRect ) SAL_OVERRIDE; virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE; - virtual void DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper ) SAL_OVERRIDE; + virtual void DrawGradientWallpaper(long nX, long nY, long nWidth, long nHeight, + const Wallpaper& rWallpaper) SAL_OVERRIDE + { + OutputDevice::DrawGradientWallpaper(nX, nY, nWidth, nHeight, rWallpaper); + } + + virtual void DrawGradientWallpaper(vcl::RenderContext& rRenderContext, long nX, long nY, + long nWidth, long nHeight, const Wallpaper& rWallpaper); + virtual void ApplySettings(vcl::RenderContext& rRenderContext); public: bool HasMirroredGraphics() const SAL_OVERRIDE; @@ -735,8 +725,17 @@ public: virtual void PrePaint(vcl::RenderContext& rRenderContext); virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect); virtual void PostPaint(vcl::RenderContext& rRenderContext); - virtual void Erase() SAL_OVERRIDE; - virtual void Erase( const Rectangle& rRect ) SAL_OVERRIDE { ::OutputDevice::Erase( rRect ); } + virtual void Erase(vcl::RenderContext& rRenderContext); + + virtual void Erase() SAL_OVERRIDE + { + OutputDevice::Erase(); + } + + virtual void Erase(const Rectangle& rRect) SAL_OVERRIDE + { + OutputDevice::Erase(rRect); + } virtual void Draw( ::OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ); virtual void Move(); @@ -835,24 +834,29 @@ public: void UpdateSettings( const AllSettings& rSettings, bool bChild = false ); void NotifyAllChildren( DataChangedEvent& rDCEvt ); - void SetPointFont( const vcl::Font& rFont ); - vcl::Font GetPointFont() const; - void SetZoomedPointFont( const vcl::Font& rFont ); + void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont); + vcl::Font GetPointFont(vcl::RenderContext& rRenderContext) const; + void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont); long GetDrawPixel( ::OutputDevice* pDev, long nPixels ) const; vcl::Font GetDrawPixelFont( ::OutputDevice* pDev ) const; - void SetControlFont(); - void SetControlFont( const vcl::Font& rFont ); - vcl::Font GetControlFont() const; - bool IsControlFont() const; - void SetControlForeground(); - void SetControlForeground( const Color& rColor ); - Color GetControlForeground() const; - bool IsControlForeground() const; - void SetControlBackground(); - void SetControlBackground( const Color& rColor ); - Color GetControlBackground() const; - bool IsControlBackground() const; + void SetControlFont(); + void SetControlFont( const vcl::Font& rFont ); + vcl::Font GetControlFont() const; + bool IsControlFont() const; + void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont); + + void SetControlForeground(); + void SetControlForeground(const Color& rColor); + Color GetControlForeground() const; + bool IsControlForeground() const; + void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor); + + void SetControlBackground(); + void SetControlBackground( const Color& rColor ); + Color GetControlBackground() const; + bool IsControlBackground() const; + void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor); void SetParentClipMode( sal_uInt16 nMode = 0 ); sal_uInt16 GetParentClipMode() const; @@ -890,6 +894,8 @@ public: const vcl::Window* pExcludeWindow = NULL ); bool IsInputEnabled() const; + vcl::RenderSettings& GetRenderSettings(); + /** Override <code>EnableInput</code>. This can be necessary due to other people using EnableInput for whole window hierarchies. diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index a801a97f9d16..004b5384501d 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -152,9 +152,9 @@ public: const OUString& GetHiddenTitle() const { return aHiddenTitle; } /** Applies the navigator settings to the listbox. */ - void ApplySettings(); + void ApplyNavigatorSettings(); /** Stores the current listbox state in the navigator settings. */ - void StoreSettings() const; + void StoreNavigatorSettings() const; static bool IsInDrag() { return bIsInDrag; } }; diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 3b583113706b..e6f607a97767 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -425,7 +425,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl) void ScContentTree::MouseButtonDown( const MouseEvent& rMEvt ) { SvTreeListBox::MouseButtonDown( rMEvt ); - StoreSettings(); + StoreNavigatorSettings(); } void ScContentTree::KeyInput( const KeyEvent& rKEvt ) @@ -531,13 +531,13 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt ) { if(aCode.GetCode() == KEY_F5 ) { - StoreSettings(); + StoreNavigatorSettings(); SvTreeListBox::KeyInput(rKEvt); } else { SvTreeListBox::KeyInput(rKEvt); - StoreSettings(); + StoreNavigatorSettings(); } } } @@ -739,7 +739,7 @@ void ScContentTree::ObjectFresh( sal_uInt16 nType, SvTreeListEntry* pEntry ) ClearType( nType ); GetDrawNames( nType/*, nId*/ ); if( !pEntry ) - ApplySettings(); + ApplyNavigatorSettings(); SetUpdateMode(true); if( pEntry ) { @@ -808,7 +808,7 @@ void ScContentTree::Refresh( sal_uInt16 nType ) if ( !nType || nType == SC_CONTENT_AREALINK ) GetLinkNames(); - ApplySettings(); + ApplyNavigatorSettings(); SetUpdateMode(true); } @@ -1622,7 +1622,7 @@ void ScContentTree::SelectDoc(const OUString& rName) // rName wie im Menue/ } } -void ScContentTree::ApplySettings() +void ScContentTree::ApplyNavigatorSettings() { const ScNavigatorSettings* pSettings = ScNavigatorDlg::GetNavigatorSettings(); if( pSettings ) @@ -1657,7 +1657,7 @@ void ScContentTree::ApplySettings() } } -void ScContentTree::StoreSettings() const +void ScContentTree::StoreNavigatorSettings() const { ScNavigatorSettings* pSettings = ScNavigatorDlg::GetNavigatorSettings(); if( pSettings ) diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index d5a14b223886..ba6f706a76fd 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -187,34 +187,36 @@ void ThumbnailView::ImplDeleteItems() mpStartSelRange = mFilteredItemList.end(); } +void ThumbnailView::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + ApplyControlFont(*this, rStyleSettings.GetAppFont()); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); + rRenderContext.SetTextFillColor(); + Color aColor = rStyleSettings.GetFieldColor(); + rRenderContext.SetBackground(aColor); +} + void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { - vcl::Font aFont; - aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, rStyleSettings.GetAppFont()); } - if ( bForeground || bFont ) + if (bForeground || bFont) { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } - if ( bBackground ) + if (bBackground) { Color aColor = rStyleSettings.GetFieldColor(); - SetBackground( aColor ); + SetBackground(aColor); } delete mpItemAttrs; diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 8b579dfa6eb5..91623bfe6105 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -140,31 +140,22 @@ namespace sfx2 onLayoutDone(); } + void TitledDockingWindow::ApplySettings(vcl::RenderContext& rRenderContext) + { + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + // Font + ApplyControlFont(rRenderContext, rStyleSettings.GetAppFont()); + + // Color + ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); + rRenderContext.SetTextFillColor(); + } void TitledDockingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea) { const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - // Setup defaults - { - // Font - vcl::Font aFont = rStyleSettings.GetAppFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(aFont); - - // Color. - Color aColor; - - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - - rRenderContext.SetTextColor(aColor); - rRenderContext.SetTextFillColor(); - } - if (m_bLayoutPending) impl_layout(); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 65906f0ab762..e42749eba4f9 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -224,12 +224,14 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) { const StyleSettings aSettings( GetSettings().GetStyleSettings() ); + // FIXME RenderContext + ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); SetBackground( aSettings.GetWindowColor() ); // edit fields in other Applications use this font instead of // the application font thus we use this one too - SetPointFont( aSettings.GetFieldFont() /*aSettings.GetAppFont()*/ ); + SetPointFont(*this, aSettings.GetFieldFont() /*aSettings.GetAppFont()*/); EditEngine *pEditEngine = GetEditEngine(); SfxItemPool *pEditEngineItemPool = GetEditEngineItemPool(); diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index e3dfa380cd21..74f2f25c4ac7 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -257,36 +257,18 @@ void BrowserDataWin::LeaveUpdateLock() } } - -void InitSettings_Impl( vcl::Window *pWin, - bool bFont, bool bForeground, bool bBackground ) +void InitSettings_Impl(vcl::Window* pWin, bool bFont, bool bForeground, bool bBackground) { - const StyleSettings& rStyleSettings = - pWin->GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); - if ( bFont ) - { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - if ( pWin->IsControlFont() ) - aFont.Merge( pWin->GetControlFont() ); - pWin->SetZoomedPointFont( aFont ); - } + if (bFont) + pWin->ApplyControlFont(*pWin, rStyleSettings.GetFieldFont()); - if ( bFont || bForeground ) - { - Color aTextColor = rStyleSettings.GetWindowTextColor(); - if ( pWin->IsControlForeground() ) - aTextColor = pWin->GetControlForeground(); - pWin->SetTextColor( aTextColor ); - } + if (bFont || bForeground) + pWin->ApplyControlForeground(*pWin, rStyleSettings.GetWindowTextColor()); - if ( bBackground ) - { - if( pWin->IsControlBackground() ) - pWin->SetBackground( pWin->GetControlBackground() ); - else - pWin->SetBackground( rStyleSettings.GetWindowColor() ); - } + if (bBackground) + pWin->ApplyControlBackground(*pWin, rStyleSettings.GetWindowColor()); } @@ -306,9 +288,9 @@ void BrowserDataWin::DataChanged( const DataChangedEvent& rDCEvt ) { if( !bOwnDataChangedHdl ) { - InitSettings_Impl( this, true, true, true ); + InitSettings_Impl(this, true, true, true); Invalidate(); - InitSettings_Impl( GetParent(), true, true, true ); + InitSettings_Impl(GetParent(), true, true, true); GetParent()->Invalidate(); GetParent()->Resize(); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 31424b38570b..0c07e7c7d665 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -818,40 +818,21 @@ namespace svt } } - void EditBrowseBox::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (bFont) { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - if (IsControlFont()) - { - GetDataWindow().SetControlFont(GetControlFont()); - aFont.Merge(GetControlFont()); - } - else - GetDataWindow().SetControlFont(); - - GetDataWindow().SetZoomedPointFont(aFont); + GetDataWindow().ApplyControlFont(GetDataWindow(), rStyleSettings.GetFieldFont()); } - if ( bFont || bForeground ) + if (bFont || bForeground) { - Color aTextColor = rStyleSettings.GetFieldTextColor(); - if (IsControlForeground()) - { - aTextColor = GetControlForeground(); - GetDataWindow().SetControlForeground(aTextColor); - } - else - GetDataWindow().SetControlForeground(); - - GetDataWindow().SetTextColor( aTextColor ); + GetDataWindow().ApplyControlForeground(GetDataWindow(), rStyleSettings.GetFieldTextColor()); } - if ( bBackground ) + if (bBackground) // FIXME: Outside of Paint Hierarchy { if (GetDataWindow().IsControlBackground()) { @@ -862,8 +843,8 @@ namespace svt else { GetDataWindow().SetControlBackground(); - GetDataWindow().SetBackground( rStyleSettings.GetFieldColor() ); - GetDataWindow().SetFillColor( rStyleSettings.GetFieldColor() ); + GetDataWindow().SetBackground(rStyleSettings.GetFieldColor()); + GetDataWindow().SetFillColor(rStyleSettings.GetFieldColor()); } } } diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 0db2da34085e..64dbe4d3bf50 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2483,20 +2483,20 @@ void SvxIconChoiceCtrl_Impl::SetDefaultTextSize() long nDY = nGridDY; nDY -= aImageSize.Height(); nDY -= VER_DIST_BMP_STRING; - nDY -= 2*TBOFFS_BOUND; - if( nDY <= 0 ) + nDY -= 2 * TBOFFS_BOUND; + if (nDY <= 0) nDY = 2; long nDX = nGridDX; - nDX -= 2*LROFFS_BOUND; + nDX -= 2 * LROFFS_BOUND; nDX -= 2; - if( nDX <= 0 ) + if (nDX <= 0) nDX = 2; long nHeight = pView->GetTextHeight(); - if( nDY < nHeight ) + if (nDY < nHeight) nDY = nHeight; - aDefaultTextSize = Size( nDX, nDY ); + aDefaultTextSize = Size(nDX, nDY); } @@ -2535,7 +2535,7 @@ void SvxIconChoiceCtrl_Impl::Scroll( long nDeltaX, long nDeltaY, bool bScrollBar const Size& SvxIconChoiceCtrl_Impl::GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType eItem ) const { - if( eItem == IcnViewFieldTypeText ) + if (eItem == IcnViewFieldTypeText) return aDefaultTextSize; return aImageSize; } @@ -3153,14 +3153,15 @@ IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPo bAlreadyInCallback( false ), bGrabFocus( false ) { - vcl::Font aFont( pParent->GetPointFont() ); + // FIXME: Outside of Paint Hierarchy + vcl::Font aFont(pParent->GetPointFont(*this)); aFont.SetTransparent( false ); - SetControlFont( aFont ); - SetControlBackground( aFont.GetFillColor() ); - SetControlForeground( aFont.GetColor() ); - SetPosPixel( rPos ); - SetSizePixel( CalcAdjustedSize(rSize) ); - SetText( rData ); + SetControlFont(aFont); + SetControlBackground(aFont.GetFillColor()); + SetControlForeground(aFont.GetColor()); + SetPosPixel(rPos); + SetSizePixel(CalcAdjustedSize(rSize)); + SetText(rData); SaveValue(); aAccReturn.InsertItem( IMPICNVIEW_ACC_RETURN, vcl::KeyCode(KEY_RETURN) ); diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index fe721c4f939f..56fff117da27 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -221,23 +221,24 @@ void SvtIconChoiceCtrl::LoseFocus() Control::LoseFocus(); } -void SvtIconChoiceCtrl::SetFont( const vcl::Font& rFont ) +void SvtIconChoiceCtrl::SetFont(const vcl::Font& rFont) { - if( rFont != GetFont() ) + if (rFont != GetFont()) { - Control::SetFont( rFont ); + Control::SetFont(rFont); _pImp->FontModified(); } } -void SvtIconChoiceCtrl::SetPointFont( const vcl::Font& rFont ) +void SvtIconChoiceCtrl::SetPointFont(const vcl::Font& rFont) { - if( rFont != GetPointFont() ) + if (rFont != GetPointFont(*this)) //FIXME { - Control::SetPointFont( rFont ); + Control::SetPointFont(*this, rFont); //FIXME _pImp->FontModified(); } } + SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( const Point& rPixPos, bool bHit ) const { Point aPos( rPixPos ); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index aba60a71bf5d..b6d18de66122 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -3779,30 +3779,48 @@ void SvTreeListBox::StateChanged( StateChangedType eType ) ImplInitStyle(); } +void SvTreeListBox::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + vcl::Font aFont; + aFont = rStyleSettings.GetFieldFont(); + aFont.SetColor(rStyleSettings.GetWindowTextColor()); + SetPointFont(rRenderContext, aFont); + AdjustEntryHeightAndRecalc(aFont); + + rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); + rRenderContext.SetTextFillColor(); + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); + + // always try to re-create default-SvLBoxButtonData + if (pCheckButtonData && pCheckButtonData->HasDefaultImages()) + pCheckButtonData->SetDefaultImages(this); +} + void SvTreeListBox::InitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if( bFont ) + if (bFont) { vcl::Font aFont; aFont = rStyleSettings.GetFieldFont(); - aFont.SetColor( rStyleSettings.GetWindowTextColor() ); - SetPointFont( aFont ); - AdjustEntryHeightAndRecalc( aFont ); + aFont.SetColor(rStyleSettings.GetWindowTextColor()); + SetPointFont(*this, aFont); + AdjustEntryHeightAndRecalc(aFont); } - if( bForeground || bFont ) + if (bForeground || bFont) { - SetTextColor( rStyleSettings.GetFieldTextColor() ); + SetTextColor(rStyleSettings.GetFieldTextColor()); SetTextFillColor(); } - if( bBackground ) - SetBackground( rStyleSettings.GetFieldColor() ); + if (bBackground) + SetBackground(rStyleSettings.GetFieldColor()); // always try to re-create default-SvLBoxButtonData if( pCheckButtonData && pCheckButtonData->HasDefaultImages() ) - pCheckButtonData->SetDefaultImages( this ); + pCheckButtonData->SetDefaultImages(this); } bool SvTreeListBox::IsCellFocusEnabled() const diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 24f5e6af169f..ffd68d62ff7f 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -213,13 +213,22 @@ void Calendar::ImplInit( WinBits nWinStyle ) ImplInitSettings(); } +void Calendar::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + maSelColor = rStyleSettings.GetHighlightTextColor(); + SetPointFont(rRenderContext, rStyleSettings.GetToolFont()); + rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); + rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); +} + void Calendar::ImplInitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); maSelColor = rStyleSettings.GetHighlightTextColor(); - SetPointFont( rStyleSettings.GetToolFont() ); - SetTextColor( rStyleSettings.GetFieldTextColor() ); - SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); + SetPointFont(*this, rStyleSettings.GetToolFont()); + SetTextColor(rStyleSettings.GetFieldTextColor()); + SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); } Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) : diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 6d4be8b36188..f34884213e71 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -121,40 +121,33 @@ void HeaderBar::dispose() Window::dispose(); } -void HeaderBar::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) +void HeaderBar::ApplySettings(vcl::RenderContext& rRenderContext) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) - { - vcl::Font aFont; - aFont = rStyleSettings.GetToolFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } + ApplyControlFont(rRenderContext, rStyleSettings.GetToolFont()); - if ( bForeground || bFont ) + ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); + SetTextFillColor(); + + ApplyControlBackground(rRenderContext, rStyleSettings.GetFaceColor()); +} + +void HeaderBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if (bFont) + ApplyControlFont(*this, rStyleSettings.GetToolFont()); + + if (bForeground || bFont) { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } - if ( bBackground ) - { - Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else - aColor = rStyleSettings.GetFaceColor(); - SetBackground( aColor ); - } + if (bBackground) + ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); } long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 35d5be2ca6aa..b6ff5aaf9ae4 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -1045,58 +1045,64 @@ static int adjustSize(int nOrig) return ( (3*nOrig) / 8) * 2 + 1; } -void Ruler::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) +void Ruler::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font aFont = rStyleSettings.GetToolFont(); + // make the font a bit smaller than default + Size aSize(adjustSize(aFont.GetSize().Width()), adjustSize(aFont.GetSize().Height())); + aFont.SetSize(aSize); + + ApplyControlFont(rRenderContext, aFont); + + ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor()); + SetTextFillColor(); + + Color aColor; + svtools::ColorConfig aColorConfig; + aColor = Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor); + ApplyControlBackground(rRenderContext, aColor); +} + +void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { - vcl::Font aFont; - aFont = rStyleSettings.GetToolFont(); - + vcl::Font aFont = rStyleSettings.GetToolFont(); // make the font a bit smaller than default Size aSize(adjustSize(aFont.GetSize().Width()), adjustSize(aFont.GetSize().Height())); aFont.SetSize(aSize); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, aFont); } - if ( bForeground || bFont ) + if (bForeground || bFont) { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetDarkShadowColor(); - SetTextColor( aColor ); + ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor()); SetTextFillColor(); } - if ( bBackground ) + if (bBackground) { Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else - { - svtools::ColorConfig aColorConfig; - aColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ); - } - SetBackground( aColor ); + svtools::ColorConfig aColorConfig; + aColor = Color(aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor); + ApplyControlBackground(*this, aColor); } maVirDev->SetSettings( GetSettings() ); maVirDev->SetBackground( GetBackground() ); vcl::Font aFont = GetFont(); - if ( mnWinStyle & WB_VERT ) - aFont.SetOrientation( 900 ); + if (mnWinStyle & WB_VERT) + aFont.SetOrientation(900); - maVirDev->SetFont( aFont ); - maVirDev->SetTextColor( GetTextColor() ); - maVirDev->SetTextFillColor( GetTextFillColor() ); + maVirDev->SetFont(aFont); + maVirDev->SetTextColor(GetTextColor()); + maVirDev->SetTextFillColor(GetTextFillColor()); } void Ruler::ImplCalc() diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 0b8ca9eaf132..291786f43ca8 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -625,36 +625,31 @@ ImplTabBarItem* TabBar::next() void TabBar::ImplInitSettings( bool bFont, bool bBackground ) { + // FIXME RenderContext + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { vcl::Font aToolFont; aToolFont = rStyleSettings.GetToolFont(); - if ( IsControlFont() ) - aToolFont.Merge( GetControlFont() ); aToolFont.SetWeight( WEIGHT_BOLD ); - SetZoomedPointFont( aToolFont ); + ApplyControlFont(*this, aToolFont); // Adapt font size if window too small? - while ( GetTextHeight() > (GetOutputSizePixel().Height()-1) ) + while (GetTextHeight() > (GetOutputSizePixel().Height() - 1)) { vcl::Font aFont = GetFont(); - if ( aFont.GetHeight() <= 6 ) + if (aFont.GetHeight() <= 6) break; - aFont.SetHeight( aFont.GetHeight()-1 ); - SetFont( aFont ); + aFont.SetHeight(aFont.GetHeight() - 1); + SetFont(aFont); } } - if ( bBackground ) + if (bBackground) { - Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else - aColor = rStyleSettings.GetFaceColor(); - SetBackground( aColor ); + ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); } } @@ -2173,7 +2168,7 @@ bool TabBar::StartEditMode(sal_uInt16 nPageId) } mpImpl->mpEdit->SetText(GetPageText(mnEditId)); mpImpl->mpEdit->setPosSizePixel(nX, aRect.Top() + mnOffY + 1, nWidth, aRect.GetHeight() - 3); - vcl::Font aFont = GetPointFont(); + vcl::Font aFont = GetPointFont(*this); // FIXME RenderContext Color aForegroundColor; Color aBackgroundColor; diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index ab7da47123be..bb9d1a3325ee 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -567,9 +567,10 @@ void ToolbarMenu::initWindow() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetPointFont( rStyleSettings.GetMenuFont() ); - SetBackground( Wallpaper( GetControlBackground() ) ); - SetTextColor( rStyleSettings.GetMenuTextColor() ); + // FIXME RenderContext + SetPointFont(*this, rStyleSettings.GetMenuFont()); + SetBackground(Wallpaper(GetControlBackground())); + SetTextColor(rStyleSettings.GetMenuTextColor()); SetTextFillColor(); SetLineColor(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index b2c84dde2f39..a3398c9d9689 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -161,42 +161,48 @@ void ValueSet::ImplDeleteItems() mItemList.clear(); } -void ValueSet::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) +void ValueSet::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + ApplyControlFont(rRenderContext, rStyleSettings.GetAppFont()); + ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); + SetTextFillColor(); + Color aColor; + if (GetStyle() & WB_MENUSTYLEVALUESET) + aColor = rStyleSettings.GetMenuColor(); + else if (IsEnabled() && (GetStyle() & WB_FLATVALUESET)) + aColor = rStyleSettings.GetWindowColor(); + else + aColor = rStyleSettings.GetFaceColor(); + ApplyControlBackground(rRenderContext, aColor); +} + +void ValueSet::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { - vcl::Font aFont; - aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, rStyleSettings.GetAppFont()); } - if ( bForeground || bFont ) + if (bForeground || bFont) { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } - if ( bBackground ) + if (bBackground) { Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else if ( GetStyle() & WB_MENUSTYLEVALUESET ) + if (GetStyle() & WB_MENUSTYLEVALUESET) aColor = rStyleSettings.GetMenuColor(); - else if ( IsEnabled() && (GetStyle() & WB_FLATVALUESET) ) + else if (IsEnabled() && (GetStyle() & WB_FLATVALUESET)) aColor = rStyleSettings.GetWindowColor(); else aColor = rStyleSettings.GetFaceColor(); - SetBackground( aColor ); + ApplyControlBackground(*this, aColor); } } diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 4b986a635aa5..0ce9851ea5e7 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -246,6 +246,13 @@ namespace svt (void)i_rMouseEvent; } + void ToolPanelDrawer::ApplySettings(vcl::RenderContext& rRenderContext) + { + const StyleSettings& rStyleSettings(rRenderContext.GetSettings().GetStyleSettings()); + ApplyControlFont(rRenderContext, rStyleSettings.GetAppFont()); + ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); + rRenderContext.SetTextFillColor(); + } void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent ) { @@ -265,22 +272,9 @@ namespace svt case DataChangedEventType::FONTSUBSTITUTION: { const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); - - // Font. - vcl::Font aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - - // Color. - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); + ApplyControlFont(*this, rStyleSettings.GetAppFont()); + ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); SetTextFillColor(); - Invalidate(); } break; diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index 6fd17cf2a448..403b296c9957 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -64,7 +64,7 @@ namespace svt return m_bExpanded; } - void Paint(vcl::RenderContext& rRenderContext); + void Paint(vcl::RenderContext& rRenderContext); protected: // Window overridables @@ -77,6 +77,8 @@ namespace svt virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( bool i_bCreate ) SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + private: Rectangle impl_calcTextBoundingBox() const; Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const; 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(); diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 7ee871dcee93..3b7f4046d8dd 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -135,9 +135,11 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag m_nFadeRate( 100 ), m_aFadeTimer( ) { + //FIXME RenderContext + // Get the font and configure it vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetToolFont(); - SetZoomedPointFont(aFont); + SetZoomedPointFont(*this, aFont); // Create the line control m_pLine = VclPtr<SwDashedLine>::Create(GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor); diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 12fe31cac62c..012f34ba5f81 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -485,6 +485,8 @@ void TextViewOutWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& void SwSrcEditWindow::CreateTextEngine() { + // FIXME RenderContext + const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor(); pOutWin = VclPtr<TextViewOutWin>::Create(this, 0); pOutWin->SetBackground(Wallpaper(rCol)); @@ -514,7 +516,7 @@ void SwSrcEditWindow::CreateTextEngine() vcl::Font aFont; aFont.SetTransparent( false ); aFont.SetFillColor( rCol ); - SetPointFont( aFont ); + SetPointFont(*this, aFont); aFont = GetFont(); aFont.SetFillColor( rCol ); pOutWin->SetFont( aFont ); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a174b0dc2c40..7c99bed96ec3 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -241,6 +241,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/outdev/textline \ vcl/source/outdev/pixel \ vcl/source/outdev/rect \ + vcl/source/outdev/rendersettings \ vcl/source/outdev/line \ vcl/source/outdev/polyline \ vcl/source/outdev/hatch \ diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index da69ac82f425..f019b699932e 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -359,8 +359,6 @@ public: void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; } bool IsReadOnly() const { return mbReadOnly; } - using Control::ImplInitSettings; - void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); sal_uInt16 ImplGetTextStyle() const; /// pb: #106948# explicit mirroring for calc @@ -371,6 +369,10 @@ public: void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } void EnableQuickSelection( const bool& b ); + using Control::ImplInitSettings; + void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + protected: // ISearchableStringList virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const SAL_OVERRIDE; @@ -602,6 +604,11 @@ public: void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } virtual void ShowFocus(const Rectangle& rRect) SAL_OVERRIDE; + + using Control::ImplInitSettings; + void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; + }; class ImplBtn : public PushButton diff --git a/vcl/inc/window.h b/vcl/inc/window.h index a2066d4bf5b0..d73f3e10a3bc 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -36,14 +36,19 @@ #include <vcl/idle.hxx> #include <vcl/vclevent.hxx> #include <vcl/vclptr.hxx> +#include <vcl/rendersettings.hxx> #include <vector> struct SalPaintEvent; struct ImplDelData; struct ImplAccessibleInfos; +namespace vcl { + class Window; + struct ControlLayoutData; +} + class FixedText; -namespace vcl { class Window; } class VclSizeGroup; class VirtualDevice; class PhysicalFontCollection; @@ -54,23 +59,16 @@ class SalObject; enum class MouseEventModifiers; enum class MouseNotifyEvent; -namespace com { -namespace sun { -namespace star { +namespace com { namespace sun { namespace star { + namespace accessibility { class XAccessible; -}}}} +} -namespace com { -namespace sun { -namespace star { namespace rendering { class XCanvas; -}}}} +} -namespace com { -namespace sun { -namespace star { namespace awt { class XWindowPeer; class XWindow; @@ -79,8 +77,7 @@ namespace uno { class Any; class XInterface; } -namespace datatransfer { -namespace clipboard { +namespace datatransfer { namespace clipboard { class XClipboard; } @@ -89,11 +86,7 @@ namespace dnd { class XDragGestureRecognizer; class XDragSource; class XDropTarget; -} } } } } - -namespace vcl { - struct ControlLayoutData; -} +}}}}} bool ImplWindowFrameProc( vcl::Window* pInst, SalFrame* pFrame, sal_uInt16 nEvent, const void* pEvent ); @@ -377,6 +370,8 @@ public: mbSecondary:1, mbNonHomogeneous:1; + vcl::RenderSettings maRenderSettings; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; }; diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 7c4867310f06..f9d02fc01e43 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -250,8 +250,9 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal // EnableAlwaysOnTop(); EnableSaveBackground(); + // FIXME RenderContext const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetPointFont( rStyleSettings.GetHelpFont() ); + SetPointFont(*this, rStyleSettings.GetHelpFont()); SetTextColor( rStyleSettings.GetHelpTextColor() ); SetTextAlign( ALIGN_TOP ); if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) ) diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index e74dc8fe6821..04c94554d14c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -418,6 +418,18 @@ const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) cons return _rStyle.GetLabelTextColor(); } +void Control::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font rFont(GetCanonicalFont(rStyleSettings)); + ApplyControlFont(rRenderContext, rFont); + + ApplyControlForeground(rRenderContext, GetCanonicalTextColor(rStyleSettings)); + + rRenderContext.SetTextFillColor(); +} + void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -427,7 +439,7 @@ void Control::ImplInitSettings( const bool _bFont, const bool _bForeground ) Font aFont(GetCanonicalFont(rStyleSettings)); if (IsControlFont()) aFont.Merge(GetControlFont()); - SetZoomedPointFont( aFont ); + SetZoomedPointFont(*this, aFont); } if (_bForeground || _bFont) @@ -460,9 +472,9 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec Font Control::GetUnzoomedControlPointFont() const { - Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); + Font aFont(GetCanonicalFont(GetSettings().GetStyleSettings())); + if (IsControlFont()) + aFont.Merge(GetControlFont()); return aFont; } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 227c7fe63cb4..9449e49f9c2c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -394,44 +394,70 @@ void Edit::ImplModified() Modify(); } -void Edit::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) +void Edit::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font aFont = rStyleSettings.GetFieldFont(); + ApplyControlFont(rRenderContext, aFont); + + ImplClearLayoutData(); + + Color aTextColor = rStyleSettings.GetFieldTextColor(); + ApplyControlForeground(rRenderContext, aTextColor); + + if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) + { + // Transparent background + rRenderContext.SetBackground(); + rRenderContext.SetFillColor(); + } + else if (IsControlBackground()) + { + rRenderContext.SetBackground(GetControlBackground()); + rRenderContext.SetFillColor(GetControlBackground()); + } + else + { + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); + rRenderContext.SetFillColor(rStyleSettings.GetFieldColor()); + } +} + +void Edit::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { vcl::Font aFont = rStyleSettings.GetFieldFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + ApplyControlFont(*this, aFont); ImplClearLayoutData(); } - if ( bFont || bForeground ) + if (bFont || bForeground) { Color aTextColor = rStyleSettings.GetFieldTextColor(); - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); + ApplyControlForeground(*this, aTextColor); } - if ( bBackground ) + if (bBackground) { - if ( ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent() ) + if (ImplUseNativeBorder(GetStyle()) || IsPaintTransparent()) { // Transparent background SetBackground(); SetFillColor(); } - else if ( IsControlBackground() ) + else if (IsControlBackground()) { - SetBackground( GetControlBackground() ); - SetFillColor( GetControlBackground() ); + SetBackground(GetControlBackground()); + SetFillColor(GetControlBackground()); } else { - SetBackground( rStyleSettings.GetFieldColor() ); - SetFillColor( rStyleSettings.GetFieldColor() ); + SetBackground(rStyleSettings.GetFieldColor()); + SetFillColor(rStyleSettings.GetFieldColor()); } } } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 296e923671ca..40bba26acc1c 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -47,35 +47,6 @@ using namespace ::com::sun::star; -void ImplInitFieldSettings( vcl::Window* pWin, bool bFont, bool bForeground, bool bBackground ) -{ - const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); - - if ( bFont ) - { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - if ( pWin->IsControlFont() ) - aFont.Merge( pWin->GetControlFont() ); - pWin->SetZoomedPointFont( aFont ); - } - - if ( bFont || bForeground ) - { - Color aTextColor = rStyleSettings.GetFieldTextColor(); - if ( pWin->IsControlForeground() ) - aTextColor = pWin->GetControlForeground(); - pWin->SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if( pWin->IsControlBackground() ) - pWin->SetBackground( pWin->GetControlBackground() ); - else - pWin->SetBackground( rStyleSettings.GetFieldColor() ); - } -} - void ImplInitDropDownButton( PushButton* pButton ) { if ( pButton->GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN ) @@ -546,9 +517,53 @@ void ImplListBoxWindow::dispose() Control::dispose(); } -void ImplListBoxWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) +void ImplListBoxWindow::ApplySettings(vcl::RenderContext& rRenderContext) { - ImplInitFieldSettings( this, bFont, bForeground, bBackground ); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font aFont = rStyleSettings.GetFieldFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(rRenderContext, aFont); + + Color aTextColor = rStyleSettings.GetFieldTextColor(); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + rRenderContext.SetTextColor(aTextColor); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); +} + +void ImplListBoxWindow::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if (bFont) + { + vcl::Font aFont = rStyleSettings.GetFieldFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(*this, aFont); + } + + if (bFont || bForeground) + { + Color aTextColor = rStyleSettings.GetFieldTextColor(); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + SetTextColor( aTextColor ); + } + + if (bBackground) + { + if (IsControlBackground()) + SetBackground(GetControlBackground()); + else + SetBackground(rStyleSettings.GetFieldColor()); + } } void ImplListBoxWindow::ImplCalcMetrics() @@ -2770,6 +2785,55 @@ void ImplWin::ImplDraw( bool bLayout ) } } +void ImplWin::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + vcl::Font aFont = rStyleSettings.GetFieldFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(rRenderContext, aFont); + + Color aTextColor = rStyleSettings.GetFieldTextColor(); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + rRenderContext.SetTextColor(aTextColor); + + if (IsControlBackground()) + rRenderContext.SetBackground(GetControlBackground()); + else + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); +} + +void ImplWin::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if (bFont) + { + vcl::Font aFont = rStyleSettings.GetFieldFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(*this, aFont); + } + + if (bFont || bForeground) + { + Color aTextColor = rStyleSettings.GetFieldTextColor(); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + SetTextColor( aTextColor ); + } + + if (bBackground) + { + if (IsControlBackground()) + SetBackground(GetControlBackground()); + else + SetBackground(rStyleSettings.GetFieldColor()); + } +} + void ImplWin::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) { ImplDraw(); diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 2c3566b89ade..9f582144e0c0 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -551,7 +551,7 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( mpImplWin ) { mpImplWin->SetSettings( GetSettings() ); // If not yet set... - ImplInitFieldSettings( mpImplWin, true, true, true ); + mpImplWin->ImplInitSettings(true, true, true); mpBtn->SetSettings( GetSettings() ); ImplInitDropDownButton( mpBtn ); diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index c34fc22baeb4..66ae92933be6 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -976,7 +976,55 @@ WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle ) return nStyle; } -void VclMultiLineEdit::ImplInitSettings( bool /*bFont*/, bool /*bForeground*/, bool bBackground ) +void VclMultiLineEdit::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + // The Font has to be adjusted, as the TextEngine does not take care of + // TextColor/Background + + Color aTextColor = rStyleSettings.GetFieldTextColor(); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + + if (!IsEnabled()) + aTextColor = rStyleSettings.GetDisableColor(); + + vcl::Font aFont = rStyleSettings.GetFieldFont(); + aFont.SetTransparent(IsPaintTransparent()); + ApplyControlFont(rRenderContext, aFont); + + vcl::Font theFont = rRenderContext.GetFont(); + theFont.SetColor(aTextColor); + if (IsPaintTransparent()) + theFont.SetFillColor(Color(COL_TRANSPARENT)); + else + theFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor()); + + pImpVclMEdit->GetTextWindow()->SetFont(theFont); + pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(theFont); + pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor); + + if (IsPaintTransparent()) + { + pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true); + pImpVclMEdit->GetTextWindow()->SetBackground(); + pImpVclMEdit->GetTextWindow()->SetControlBackground(); + rRenderContext.SetBackground(); + SetControlBackground(); + } + else + { + if (IsControlBackground()) + pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground()); + else + pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor()); + // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars + rRenderContext.SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground()); + } +} + +void VclMultiLineEdit::ImplInitSettings(bool /*bFont*/, bool /*bForeground*/, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -984,31 +1032,30 @@ void VclMultiLineEdit::ImplInitSettings( bool /*bFont*/, bool /*bForeground*/, b // TextColor/Background Color aTextColor = rStyleSettings.GetFieldTextColor(); - if ( IsControlForeground() ) + if (IsControlForeground()) aTextColor = GetControlForeground(); - if ( !IsEnabled() ) + if (!IsEnabled()) aTextColor = rStyleSettings.GetDisableColor(); vcl::Font aFont = rStyleSettings.GetFieldFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - aFont.SetTransparent( IsPaintTransparent() ); - SetZoomedPointFont( aFont ); + aFont.SetTransparent(IsPaintTransparent()); + ApplyControlFont(*this, aFont); + vcl::Font TheFont = GetFont(); - TheFont.SetColor( aTextColor ); - if( IsPaintTransparent() ) - TheFont.SetFillColor( Color( COL_TRANSPARENT ) ); + TheFont.SetColor(aTextColor); + if (IsPaintTransparent()) + TheFont.SetFillColor(Color(COL_TRANSPARENT)); else - TheFont.SetFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() ); - pImpVclMEdit->GetTextWindow()->SetFont( TheFont ); - pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont( TheFont ); - pImpVclMEdit->GetTextWindow()->SetTextColor( aTextColor ); + TheFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor()); + pImpVclMEdit->GetTextWindow()->SetFont(TheFont); + pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont); + pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor); - if ( bBackground ) + if (bBackground) { - if( IsPaintTransparent() ) + if (IsPaintTransparent()) { - pImpVclMEdit->GetTextWindow()->SetPaintTransparent( true ); + pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true); pImpVclMEdit->GetTextWindow()->SetBackground(); pImpVclMEdit->GetTextWindow()->SetControlBackground(); SetBackground(); @@ -1016,12 +1063,12 @@ void VclMultiLineEdit::ImplInitSettings( bool /*bFont*/, bool /*bForeground*/, b } else { - if( IsControlBackground() ) - pImpVclMEdit->GetTextWindow()->SetBackground( GetControlBackground() ); + if (IsControlBackground()) + pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground()); else - pImpVclMEdit->GetTextWindow()->SetBackground( rStyleSettings.GetFieldColor() ); + pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor()); // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars - SetBackground( pImpVclMEdit->GetTextWindow()->GetBackground() ); + SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground()); } } } diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index bc6bd4a8b6c9..155efed74888 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -39,6 +39,11 @@ #include "salgdi.hxx" #include "sallayout.hxx" +OutDevState::OutDevState() : + mnFlags(PushFlags::NONE) +{ +} + OutDevState::~OutDevState() { if ( mnFlags & PushFlags::LINECOLOR ) diff --git a/vcl/source/outdev/rendersettings.cxx b/vcl/source/outdev/rendersettings.cxx new file mode 100644 index 000000000000..fd2524d8858a --- /dev/null +++ b/vcl/source/outdev/rendersettings.cxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <vcl/rendersettings.hxx> + +namespace vcl +{ + +void RenderSettings::SetLineColor(const Color& rColor) +{ + maOutDevState.mpLineColor = new Color(rColor); + maOutDevState.mnFlags |= PushFlags::LINECOLOR; +} + +void RenderSettings::SetFillColor(const Color& rColor) +{ + maOutDevState.mpFillColor = new Color(rColor); + maOutDevState.mnFlags |= PushFlags::FILLCOLOR; +} + +void RenderSettings::SetFont(const vcl::Font& rNewFont) +{ + maOutDevState.mpFont = new vcl::Font(rNewFont); + maOutDevState.mnFlags |= PushFlags::FONT; +} + +void RenderSettings::SetBackground(const Wallpaper& rBackground) +{ + mpBackground.reset(new Wallpaper(rBackground)); +} + +void RenderSettings::PushAndApply(vcl::RenderContext& rRenderContext) +{ + rRenderContext.Push(maOutDevState.mnFlags); + Apply(rRenderContext); +} + +void RenderSettings::Apply(vcl::RenderContext& rRenderContext) +{ + if (maOutDevState.mnFlags & PushFlags::LINECOLOR) + rRenderContext.SetLineColor(*maOutDevState.mpLineColor); + if (maOutDevState.mnFlags & PushFlags::FILLCOLOR) + rRenderContext.SetFillColor(*maOutDevState.mpFillColor); + if (maOutDevState.mnFlags & PushFlags::FONT) + rRenderContext.SetFont(*maOutDevState.mpFont); + if (mpBackground) + rRenderContext.SetBackground(Wallpaper(*mpBackground.get())); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 06a28c0bccbc..d68c2e1e9aa8 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -175,7 +175,7 @@ Rectangle ImplBorderWindowView::GetMenuRect() const return Rectangle(); } -void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData ) +void ImplBorderWindowView::ImplInitTitle(ImplBorderFrameData* pData) { ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; @@ -188,22 +188,23 @@ void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData ) else { const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings(); - if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF ) + if (pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF) pData->mnTitleHeight = rStyleSettings.GetTearOffTitleHeight(); else { - if ( pData->mnTitleType == BORDERWINDOW_TITLE_SMALL ) + if (pData->mnTitleType == BORDERWINDOW_TITLE_SMALL) { - pBorderWindow->SetPointFont( rStyleSettings.GetFloatTitleFont() ); + pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetFloatTitleFont() ); pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight(); } else // pData->mnTitleType == BORDERWINDOW_TITLE_NORMAL { - pBorderWindow->SetPointFont( rStyleSettings.GetTitleFont() ); + // FIXME RenderContext + pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetTitleFont()); pData->mnTitleHeight = rStyleSettings.GetTitleHeight(); } long nTextHeight = pBorderWindow->GetTextHeight(); - if ( nTextHeight > pData->mnTitleHeight ) + if (nTextHeight > pData->mnTitleHeight) pData->mnTitleHeight = nTextHeight; } } @@ -1426,8 +1427,8 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh pData->mnBottomBorder += pData->mnBorderSize; pData->mnNoTitleTop = pData->mnTopBorder; - ImplInitTitle( &maFrameData ); - if ( pData->mnTitleHeight ) + ImplInitTitle(&maFrameData); + if (pData->mnTitleHeight) { // to improve symbol display force a minum title height if( pData->mnTitleHeight < MIN_CAPTION_HEIGHT ) diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 786c84bbad31..793ae09430fd 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -178,7 +178,7 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl const bool isFooter = GetAlign() == WINDOWALIGN_BOTTOM && !rSetting.GetPersonaFooter().IsEmpty(); if ((GetAlign() == WINDOWALIGN_TOP && !rSetting.GetPersonaHeader().IsEmpty() ) || isFooter) - rRenderContext.Erase(); + Erase(rRenderContext); else if (!ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB) { // draw a single toolbar background covering the whole docking area diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 407e0c86ff36..a98948144421 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -610,7 +610,7 @@ void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); if (!Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() ) - rRenderContext.Erase(); + Erase(rRenderContext); else { Rectangle aBgRegion(Point(), rRenderContext.GetOutputSizePixel()); @@ -886,7 +886,7 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight(this); if (!rStyleSettings.GetPersonaHeader().IsEmpty()) - rRenderContext.Erase(); + Erase(rRenderContext); else { Point aPt; diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx index b7680e5abb8a..2e8df7a104f8 100644 --- a/vcl/source/window/menuwindow.cxx +++ b/vcl/source/window/menuwindow.cxx @@ -30,8 +30,9 @@ void MenuWindow::ImplInitMenuWindow(vcl::Window* pWin, bool bFont, bool bMenuBar { const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings(); - if ( bFont ) - pWin->SetPointFont( rStyleSettings.GetMenuFont() ); + // FIXME RenderContext + if (bFont) + pWin->SetPointFont(*pWin, rStyleSettings.GetMenuFont()); if( bMenuBar ) { const BitmapEx& rPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index f888d116868d..07851b21ff4f 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -147,6 +147,8 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) // copy the underlying content to be able to handle trasparency pDevice->DrawOutDev(m_aPaintRect.TopLeft(), m_aPaintRect.GetSize(), m_aPaintRect.TopLeft(), m_aPaintRect.GetSize(), *m_pWindow); + m_pWindow->ApplySettings(*pDevice.get()); + // paint to the VirtualDevice first m_pWindow->Paint(*pDevice.get(), m_aPaintRect); @@ -1384,37 +1386,37 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / SetParent( pRealParent ); } -void Window::Erase() +void Window::Erase(vcl::RenderContext& rRenderContext) { - if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) + if (!IsDeviceOutputNecessary() || ImplIsRecordLayout()) return; bool bNativeOK = false; ControlPart aCtrlPart = ImplGetWindowImpl()->mnNativeBackground; - if( aCtrlPart != 0 && ! IsControlBackground() ) + if (aCtrlPart != 0 && ! IsControlBackground()) { - Rectangle aCtrlRegion( Point(), GetOutputSizePixel() ); - ControlState nState = ControlState::NONE; + Rectangle aCtrlRegion(Point(), rRenderContext.GetOutputSizePixel()); + ControlState nState = ControlState::NONE; - if( IsEnabled() ) + if (IsEnabled()) nState |= ControlState::ENABLED; - bNativeOK = DrawNativeControl( CTRL_WINDOW_BACKGROUND, aCtrlPart, aCtrlRegion, - nState, ImplControlValue(), OUString() ); + bNativeOK = rRenderContext.DrawNativeControl(CTRL_WINDOW_BACKGROUND, aCtrlPart, aCtrlRegion, + nState, ImplControlValue(), OUString()); } - if ( mbBackground && ! bNativeOK ) + if (mbBackground && !bNativeOK) { RasterOp eRasterOp = GetRasterOp(); - if ( eRasterOp != ROP_OVERPAINT ) - SetRasterOp( ROP_OVERPAINT ); - DrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground ); - if ( eRasterOp != ROP_OVERPAINT ) - SetRasterOp( eRasterOp ); + if (eRasterOp != ROP_OVERPAINT) + SetRasterOp(ROP_OVERPAINT); + rRenderContext.DrawWallpaper(0, 0, mnOutWidth, mnOutHeight, maBackground); + if (eRasterOp != ROP_OVERPAINT) + rRenderContext.SetRasterOp(eRasterOp); } - if( mpAlphaVDev ) + if (mpAlphaVDev) mpAlphaVDev->Erase(); } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index b778e0811d19..2b13051b3a37 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -176,7 +176,7 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, // replacement is active rRenderContext.Push(); Font aFont(rRenderContext.GetSettings().GetStyleSettings().GetLabelFont()); - SetZoomedPointFont(aFont); + SetZoomedPointFont(rRenderContext, aFont); Rectangle aTextRect(aOffset + Point(2, 2), Size(maPreviewSize.Width() - 4, maPreviewSize.Height() - 4)); rRenderContext.DrawText(aTextRect, maReplacementString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index bfbe30b5f29a..a997130af601 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -173,29 +173,64 @@ void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI) mbAdjustHiDPI = bAdjustHiDPI; } -void StatusBar::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) +void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext) +{ + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + vcl::Font aFont = rStyleSettings.GetToolFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(rRenderContext, aFont); + + Color aColor; + if (IsControlForeground()) + aColor = GetControlForeground(); + else if (GetStyle() & WB_3DLOOK) + aColor = rStyleSettings.GetButtonTextColor(); + else + aColor = rStyleSettings.GetWindowTextColor(); + + rRenderContext.SetTextColor(aColor); + rRenderContext.SetTextFillColor(); + + if (IsControlBackground()) + aColor = GetControlBackground(); + else if (GetStyle() & WB_3DLOOK) + aColor = rStyleSettings.GetFaceColor(); + else + aColor = rStyleSettings.GetWindowColor(); + rRenderContext.SetBackground(aColor); + + // NWF background + if (!IsControlBackground() && + rRenderContext.IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_WINDOW)) + { + ImplGetWindowImpl()->mnNativeBackground = PART_BACKGROUND_WINDOW; + EnableChildTransparentMode(true); + } +} + +void StatusBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { vcl::Font aFont = rStyleSettings.GetToolFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(*this, aFont); } - if ( bForeground || bFont ) + if (bForeground || bFont) { Color aColor; - if ( IsControlForeground() ) + if (IsControlForeground()) aColor = GetControlForeground(); else if ( GetStyle() & WB_3DLOOK ) aColor = rStyleSettings.GetButtonTextColor(); else aColor = rStyleSettings.GetWindowTextColor(); - SetTextColor( aColor ); + SetTextColor(aColor); SetTextFillColor(); mpImplData->mpVirDev->SetFont( GetFont() ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 4fc1750bed63..00370ff74cdd 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1420,52 +1420,107 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) ImplGetWindowImpl()->mnStyle &= ~WB_DIALOGCONTROL; } - ImplInitSettings( true, true, true ); + ImplInitSettings(true, true, true); } -void ToolBox::ImplInitSettings( bool bFont, - bool bForeground, bool bBackground ) +void ToolBox::ApplySettings(vcl::RenderContext& rRenderContext) +{ + mpData->mbNativeButtons = rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_BUTTON); + + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + + // Font + vcl::Font aFont = rStyleSettings.GetToolFont(); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(rRenderContext, aFont); + + // ControlForeground + Color aColor; + if (IsControlForeground()) + aColor = GetControlForeground(); + else if (Window::GetStyle() & WB_3DLOOK) + aColor = rStyleSettings.GetButtonTextColor(); + else + aColor = rStyleSettings.GetWindowTextColor(); + rRenderContext.SetTextColor(aColor); + rRenderContext.SetTextFillColor(); + + if (IsControlBackground()) + { + aColor = GetControlBackground(); + SetBackground( aColor ); + SetPaintTransparent(false); + SetParentClipMode( 0 ); + } + else + { + if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL) + || (GetAlign() == WINDOWALIGN_TOP && !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty()) + || (GetAlign() == WINDOWALIGN_BOTTOM && !Application::GetSettings().GetStyleSettings().GetPersonaFooter().IsEmpty())) + { + rRenderContext.SetBackground(); + rRenderContext.SetTextColor(rStyleSettings.GetMenuBarTextColor()); + SetPaintTransparent(true); + SetParentClipMode(PARENTCLIPMODE_NOCLIP); + mpData->maDisplayBackground = Wallpaper(rStyleSettings.GetFaceColor()); + } + else + { + if (Window::GetStyle() & WB_3DLOOK) + aColor = rStyleSettings.GetFaceColor(); + else + aColor = rStyleSettings.GetWindowColor(); + + rRenderContext.SetBackground(aColor); + SetPaintTransparent(false); + SetParentClipMode(0); + } + } +} + +void ToolBox::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) { mpData->mbNativeButtons = IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( bFont ) + if (bFont) { vcl::Font aFont = rStyleSettings.GetToolFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(*this, aFont); } - if ( bForeground || bFont ) + if (bForeground || bFont) { Color aColor; - if ( IsControlForeground() ) + if (IsControlForeground()) aColor = GetControlForeground(); - else if ( Window::GetStyle() & WB_3DLOOK ) + else if (Window::GetStyle() & WB_3DLOOK) aColor = rStyleSettings.GetButtonTextColor(); else aColor = rStyleSettings.GetWindowTextColor(); - SetTextColor( aColor ); + SetTextColor(aColor); SetTextFillColor(); } - if ( bBackground ) + if (bBackground) { Color aColor; - if ( IsControlBackground() ) + if (IsControlBackground()) { aColor = GetControlBackground(); SetBackground( aColor ); - SetPaintTransparent( false ); + SetPaintTransparent(false); SetParentClipMode( 0 ); } else { - if( IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) || - ( GetAlign() == WINDOWALIGN_TOP && !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )|| - ( GetAlign() == WINDOWALIGN_BOTTOM && !Application::GetSettings().GetStyleSettings().GetPersonaFooter().IsEmpty()) ) + if (IsNativeControlSupported(CTRL_TOOLBAR, PART_ENTIRE_CONTROL) + || (GetAlign() == WINDOWALIGN_TOP && !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty()) + || (GetAlign() == WINDOWALIGN_BOTTOM && !Application::GetSettings().GetStyleSettings().GetPersonaFooter().IsEmpty())) { SetBackground(); SetTextColor(rStyleSettings.GetMenuBarTextColor()); @@ -1475,14 +1530,14 @@ void ToolBox::ImplInitSettings( bool bFont, } else { - if ( Window::GetStyle() & WB_3DLOOK ) + if (Window::GetStyle() & WB_3DLOOK) aColor = rStyleSettings.GetFaceColor(); else aColor = rStyleSettings.GetWindowColor(); - SetBackground( aColor ); - SetPaintTransparent( false ); - SetParentClipMode( 0 ); + SetBackground(aColor); + SetPaintTransparent(false); + SetParentClipMode(0); } } } @@ -3014,7 +3069,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, vcl::Font aOldFont = rRenderContext.GetFont(); Color aOldTextColor = rRenderContext.GetTextColor(); - SetZoomedPointFont( rStyleSettings.GetAppFont() ); + SetZoomedPointFont(rRenderContext, rStyleSettings.GetAppFont()); rRenderContext.SetLineColor(Color(COL_BLACK)); rRenderContext.SetFillColor(rStyleSettings.GetFieldColor()); rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index eddde5ccacec..730cb0309cfb 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1143,7 +1143,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100; mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100; maFont = rStyleSettings.GetAppFont(); - ImplPointToLogic( maFont ); + + ImplPointToLogic(*this, maFont); if ( nStyle & WB_3DLOOK ) { @@ -1412,7 +1413,7 @@ void Window::ImplRemoveDel( ImplDelData* pDel ) // TODO: make "const" when incom void Window::ImplInitResolutionSettings() { // recalculate AppFont-resolution and DPI-resolution - if ( mpWindowImpl->mbFrame ) + if (mpWindowImpl->mbFrame) { const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom(); @@ -1421,7 +1422,7 @@ void Window::ImplInitResolutionSettings() // setup the scale factor for Hi-DPI displays mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - SetPointFont( rStyleSettings.GetAppFont() ); + SetPointFont(*this, rStyleSettings.GetAppFont()); } else if ( mpWindowImpl->mpParent ) { @@ -1440,15 +1441,15 @@ void Window::ImplInitResolutionSettings() } } -void Window::ImplPointToLogic( vcl::Font& rFont ) const +void Window::ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const { - Size aSize = rFont.GetSize(); - sal_uInt16 nScreenFontZoom = mxSettings->GetStyleSettings().GetScreenFontZoom(); + Size aSize = rFont.GetSize(); + sal_uInt16 nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom(); - if ( aSize.Width() ) + if (aSize.Width()) { aSize.Width() *= mpWindowImpl->mpFrameData->mnDPIX; - aSize.Width() += 72/2; + aSize.Width() += 72 / 2; aSize.Width() /= 72; aSize.Width() *= nScreenFontZoom; aSize.Width() /= 100; @@ -1459,35 +1460,35 @@ void Window::ImplPointToLogic( vcl::Font& rFont ) const aSize.Height() *= nScreenFontZoom; aSize.Height() /= 100; - if ( IsMapModeEnabled() ) - aSize = PixelToLogic( aSize ); + if (rRenderContext.IsMapModeEnabled()) + aSize = rRenderContext.PixelToLogic(aSize); - rFont.SetSize( aSize ); + rFont.SetSize(aSize); } -void Window::ImplLogicToPoint( vcl::Font& rFont ) const +void Window::ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const { - Size aSize = rFont.GetSize(); - sal_uInt16 nScreenFontZoom = mxSettings->GetStyleSettings().GetScreenFontZoom(); + Size aSize = rFont.GetSize(); + sal_uInt16 nScreenFontZoom = rRenderContext.GetSettings().GetStyleSettings().GetScreenFontZoom(); - if ( IsMapModeEnabled() ) - aSize = LogicToPixel( aSize ); + if (rRenderContext.IsMapModeEnabled()) + aSize = rRenderContext.LogicToPixel(aSize); - if ( aSize.Width() ) + if (aSize.Width()) { aSize.Width() *= 100; aSize.Width() /= nScreenFontZoom; aSize.Width() *= 72; - aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX/2; + aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX / 2; aSize.Width() /= mpWindowImpl->mpFrameData->mnDPIX; } aSize.Height() *= 100; aSize.Height() /= nScreenFontZoom; aSize.Height() *= 72; - aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY/2; + aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY / 2; aSize.Height() /= mpWindowImpl->mpFrameData->mnDPIY; - rFont.SetSize( aSize ); + rFont.SetSize(aSize); } bool Window::ImplUpdatePos() @@ -2165,7 +2166,7 @@ long Window::CalcTitleWidth() const // border of external dialogs const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont = GetFont(); - const_cast<vcl::Window*>(this)->SetPointFont( rStyleSettings.GetTitleFont() ); + const_cast<vcl::Window*>(this)->SetPointFont(*const_cast<Window*>(this), rStyleSettings.GetTitleFont()); long nTitleWidth = GetTextWidth( GetText() ); const_cast<vcl::Window*>(this)->SetFont( aFont ); nTitleWidth += rStyleSettings.GetTitleHeight() * 3; @@ -2257,23 +2258,21 @@ void Window::CollectChildren(::std::vector<vcl::Window *>& rAllChildren ) } } -void Window::SetPointFont( const vcl::Font& rFont ) +void Window::SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont) { - vcl::Font aFont = rFont; - ImplPointToLogic( aFont ); - SetFont( aFont ); + ImplPointToLogic(rRenderContext, aFont); + rRenderContext.SetFont(aFont); } -vcl::Font Window::GetPointFont() const +vcl::Font Window::GetPointFont(vcl::RenderContext& rRenderContext) const { - - vcl::Font aFont = GetFont(); - ImplLogicToPoint( aFont ); + vcl::Font aFont = rRenderContext.GetFont(); + ImplLogicToPoint(rRenderContext, aFont); return aFont; } -void Window::Show( bool bVisible, sal_uInt16 nFlags ) +void Window::Show(bool bVisible, sal_uInt16 nFlags) { if ( IsDisposed() || mpWindowImpl->mbVisible == bVisible ) return; @@ -3870,42 +3869,46 @@ bool Window::UsePolyPolygonForComplexGradient() return false; } -void Window::DrawGradientWallpaper( long nX, long nY, - long nWidth, long nHeight, - const Wallpaper& rWallpaper ) +void Window::ApplySettings(vcl::RenderContext& /*rRenderContext*/) { - Rectangle aBound; - GDIMetaFile* pOldMetaFile = mpMetaFile; - const bool bOldMap = mbMap; - bool bNeedGradient = true; +} - aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); +void Window::DrawGradientWallpaper(vcl::RenderContext& rRenderContext, + long nX, long nY, long nWidth, long nHeight, + const Wallpaper& rWallpaper) +{ + Rectangle aBound; + GDIMetaFile* pOldMetaFile = mpMetaFile; + const bool bOldMap = mbMap; + bool bNeedGradient = true; + + aBound = Rectangle(Point(nX, nY), Size(nWidth, nHeight)); mpMetaFile = NULL; - EnableMapMode( false ); - Push( PushFlags::CLIPREGION ); - IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); + rRenderContext.EnableMapMode(false); + rRenderContext.Push(PushFlags::CLIPREGION); + rRenderContext.IntersectClipRegion(Rectangle(Point(nX, nY), Size(nWidth, nHeight))); - if( rWallpaper.GetStyle() == WALLPAPER_APPLICATIONGRADIENT ) + if (rWallpaper.GetStyle() == WALLPAPER_APPLICATIONGRADIENT) { // limit gradient to useful size, so that it still can be noticed // in maximized windows long gradientWidth = GetDesktopRectPixel().GetSize().Width(); - if( gradientWidth > 1024 ) + if (gradientWidth > 1024) gradientWidth = 1024; - if( mnOutOffX+nWidth > gradientWidth ) - DrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor() ); - if( mnOutOffX > gradientWidth ) + if (mnOutOffX + nWidth > gradientWidth) + rRenderContext.DrawColorWallpaper(nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor()); + if (mnOutOffX > gradientWidth) bNeedGradient = false; else - aBound = Rectangle( Point( -mnOutOffX, nY ), Size( gradientWidth, nHeight ) ); + aBound = Rectangle(Point(-mnOutOffX, nY), Size(gradientWidth, nHeight)); } - if( bNeedGradient ) - DrawGradient( aBound, rWallpaper.GetGradient() ); + if (bNeedGradient) + rRenderContext.DrawGradient(aBound, rWallpaper.GetGradient()); - Pop(); - EnableMapMode( bOldMap ); + rRenderContext.Pop(); + rRenderContext.EnableMapMode(bOldMap); mpMetaFile = pOldMetaFile; } @@ -3927,6 +3930,11 @@ Any Window::GetSystemDataAny() const return aRet; } +vcl::RenderSettings& Window::GetRenderSettings() +{ + return mpWindowImpl->maRenderSettings; +} + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 43d3ecda4ef5..e15c8b4fa7be 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -521,42 +521,44 @@ inline long WinFloatRound( double fVal ) return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); } -void Window::SetZoomedPointFont( const vcl::Font& rFont ) +void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont) { const Fraction& rZoom = GetZoom(); - if ( rZoom.GetNumerator() != rZoom.GetDenominator() ) + if (rZoom.GetNumerator() != rZoom.GetDenominator()) { - vcl::Font aFont( rFont ); + vcl::Font aFont(rFont); Size aSize = aFont.GetSize(); - double n = (double)aSize.Width(); - n *= (double)rZoom.GetNumerator(); - n /= (double)rZoom.GetDenominator(); - aSize.Width() = WinFloatRound( n ); - n = (double)aSize.Height(); - n *= (double)rZoom.GetNumerator(); - n /= (double)rZoom.GetDenominator(); - aSize.Height() = WinFloatRound( n ); - aFont.SetSize( aSize ); - SetPointFont( aFont ); + double n = double(aSize.Width()); + n *= double(rZoom.GetNumerator()); + n /= double(rZoom.GetDenominator()); + aSize.Width() = WinFloatRound(n); + n = double(aSize.Height()); + n *= double(rZoom.GetNumerator()); + n /= double(rZoom.GetDenominator()); + aSize.Height() = WinFloatRound(n); + aFont.SetSize(aSize); + SetPointFont(rRenderContext, aFont); // Use another font if the representation is to be scaled, // and the actual font is not scalable - FontMetric aMetric = GetFontMetric(); - long nFontDiff = std::abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() ); - if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) ) + FontMetric aMetric = rRenderContext.GetFontMetric(); + long nFontDiff = std::abs(rRenderContext.GetFont().GetSize().Height() - aMetric.GetSize().Height()); + if ((aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2)) { DefaultFontType nType; - if ( aMetric.GetPitch() == PITCH_FIXED ) + if (aMetric.GetPitch() == PITCH_FIXED) nType = DefaultFontType::FIXED; else nType = DefaultFontType::UI_SANS; - vcl::Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguageTag().getLanguageType(), 0 ); - aFont.SetName( aTempFont.GetName() ); - SetPointFont( aFont ); + vcl::Font aTempFont = OutputDevice::GetDefaultFont(nType, rRenderContext.GetSettings().GetLanguageTag().getLanguageType(), 0); + aFont.SetName(aTempFont.GetName()); + SetPointFont(rRenderContext, aFont); } } else - SetPointFont( rFont ); + { + SetPointFont(rRenderContext, rFont); + } } long Window::CalcZoom( long nCalc ) const @@ -575,37 +577,37 @@ long Window::CalcZoom( long nCalc ) const void Window::SetControlFont() { - if ( mpWindowImpl->mpControlFont ) + if (mpWindowImpl->mpControlFont) { delete mpWindowImpl->mpControlFont; mpWindowImpl->mpControlFont = NULL; - StateChanged( StateChangedType::ControlFont ); + StateChanged(StateChangedType::ControlFont); } } -void Window::SetControlFont( const vcl::Font& rFont ) +void Window::SetControlFont(const vcl::Font& rFont) { - if ( rFont == vcl::Font() ) + if (rFont == vcl::Font()) { SetControlFont(); return; } - if ( mpWindowImpl->mpControlFont ) + if (mpWindowImpl->mpControlFont) { - if ( *mpWindowImpl->mpControlFont == rFont ) + if (*mpWindowImpl->mpControlFont == rFont) return; *mpWindowImpl->mpControlFont = rFont; } else - mpWindowImpl->mpControlFont = new vcl::Font( rFont ); + mpWindowImpl->mpControlFont = new vcl::Font(rFont); - StateChanged( StateChangedType::ControlFont ); + StateChanged(StateChangedType::ControlFont); } vcl::Font Window::GetControlFont() const { - if ( mpWindowImpl->mpControlFont ) + if (mpWindowImpl->mpControlFont) return *mpWindowImpl->mpControlFont; else { @@ -614,70 +616,94 @@ vcl::Font Window::GetControlFont() const } } +void Window::ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont) +{ + vcl::Font aFont(rFont); + if (IsControlFont()) + aFont.Merge(GetControlFont()); + SetZoomedPointFont(rRenderContext, aFont); +} + void Window::SetControlForeground() { - if ( mpWindowImpl->mbControlForeground ) + if (mpWindowImpl->mbControlForeground) { - mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT ); + mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT); mpWindowImpl->mbControlForeground = false; - StateChanged( StateChangedType::ControlForeground ); + StateChanged(StateChangedType::ControlForeground); } } -void Window::SetControlForeground( const Color& rColor ) +void Window::SetControlForeground(const Color& rColor) { - if ( rColor.GetTransparency() ) + if (rColor.GetTransparency()) { - if ( mpWindowImpl->mbControlForeground ) + if (mpWindowImpl->mbControlForeground) { - mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT ); + mpWindowImpl->maControlForeground = Color(COL_TRANSPARENT); mpWindowImpl->mbControlForeground = false; - StateChanged( StateChangedType::ControlForeground ); + StateChanged(StateChangedType::ControlForeground); } } else { - if ( mpWindowImpl->maControlForeground != rColor ) + if (mpWindowImpl->maControlForeground != rColor) { mpWindowImpl->maControlForeground = rColor; mpWindowImpl->mbControlForeground = true; - StateChanged( StateChangedType::ControlForeground ); + StateChanged(StateChangedType::ControlForeground); } } } +void Window::ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor) +{ + Color aTextColor(rDefaultColor); + if (IsControlForeground()) + aTextColor = GetControlForeground(); + rRenderContext.SetTextColor(aTextColor); +} + void Window::SetControlBackground() { - if ( mpWindowImpl->mbControlBackground ) + if (mpWindowImpl->mbControlBackground) { - mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT ); + mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT); mpWindowImpl->mbControlBackground = false; - StateChanged( StateChangedType::ControlBackground ); + StateChanged(StateChangedType::ControlBackground); } } -void Window::SetControlBackground( const Color& rColor ) +void Window::SetControlBackground(const Color& rColor) { - if ( rColor.GetTransparency() ) + if (rColor.GetTransparency()) { - if ( mpWindowImpl->mbControlBackground ) + if (mpWindowImpl->mbControlBackground) { - mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT ); + mpWindowImpl->maControlBackground = Color(COL_TRANSPARENT); mpWindowImpl->mbControlBackground = false; - StateChanged( StateChangedType::ControlBackground ); + StateChanged(StateChangedType::ControlBackground); } } else { - if ( mpWindowImpl->maControlBackground != rColor ) + if (mpWindowImpl->maControlBackground != rColor) { mpWindowImpl->maControlBackground = rColor; mpWindowImpl->mbControlBackground = true; - StateChanged( StateChangedType::ControlBackground ); + StateChanged(StateChangedType::ControlBackground); } } } +void Window::ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor) +{ + Color aColor(rDefaultColor); + if (IsControlBackground()) + aColor = GetControlBackground(); + rRenderContext.SetBackground(aColor); +} + Size Window::CalcWindowSize( const Size& rOutSz ) const { Size aSz = rOutSz; @@ -694,11 +720,11 @@ Size Window::CalcOutputSize( const Size& rWinSz ) const return aSz; } -vcl::Font Window::GetDrawPixelFont( OutputDevice* pDev ) const +vcl::Font Window::GetDrawPixelFont(OutputDevice* pDev) const { - vcl::Font aFont = GetPointFont(); - Size aFontSize = aFont.GetSize(); - MapMode aPtMapMode( MAP_POINT ); + vcl::Font aFont = GetPointFont(*const_cast<Window*>(this)); + Size aFontSize = aFont.GetSize(); + MapMode aPtMapMode(MAP_POINT); aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode ); aFont.SetSize( aFontSize ); return aFont; |