[Libreoffice-commits] core.git: 6 commits - basctl/source cui/source dbaccess/source extensions/source include/sfx2 include/svtools include/vcl sc/source sfx2/source starmath/source svtools/source svx/source sw/source vcl/inc vcl/Library_vcl.mk vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Sun May 17 19:23:35 PDT 2015
basctl/source/basicide/baside2b.cxx | 2
basctl/source/basicide/baside3.cxx | 3
cui/source/dialogs/hlmarkwn.cxx | 2
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 11 +
dbaccess/source/ui/app/AppDetailView.cxx | 29 ++--
dbaccess/source/ui/app/AppDetailView.hxx | 4
dbaccess/source/ui/app/AppSwapWindow.cxx | 3
dbaccess/source/ui/app/AppTitleWindow.cxx | 3
dbaccess/source/ui/app/AppView.cxx | 6
dbaccess/source/ui/control/VertSplitView.cxx | 3
dbaccess/source/ui/querydesign/JoinTableView.cxx | 3
dbaccess/source/ui/querydesign/TableWindow.cxx | 4
dbaccess/source/ui/querydesign/TableWindowTitle.cxx | 2
dbaccess/source/ui/tabledesign/TableDesignView.cxx | 4
extensions/source/scanner/grid.cxx | 110 ++++++++-------
extensions/source/scanner/sanedlg.cxx | 139 ++++++++++----------
include/sfx2/thumbnailview.hxx | 3
include/sfx2/titledockwin.hxx | 11 -
include/svtools/calendar.hxx | 3
include/svtools/headbar.hxx | 2
include/svtools/ruler.hxx | 2
include/svtools/treelistbox.hxx | 5
include/svtools/valueset.hxx | 3
include/vcl/ctrl.hxx | 2
include/vcl/dialog.hxx | 2
include/vcl/edit.hxx | 6
include/vcl/outdev.hxx | 18 +-
include/vcl/outdevstate.hxx | 1
include/vcl/rendersettings.hxx | 45 ++++++
include/vcl/status.hxx | 3
include/vcl/toolbox.hxx | 6
include/vcl/vclmedit.hxx | 1
include/vcl/window.hxx | 102 +++++++-------
sc/source/ui/inc/content.hxx | 4
sc/source/ui/navipi/content.cxx | 14 +-
sfx2/source/control/thumbnailview.cxx | 32 ++--
sfx2/source/dialog/titledockwin.cxx | 31 +---
starmath/source/edit.cxx | 4
svtools/source/brwbox/datwin.cxx | 38 +----
svtools/source/brwbox/editbrowsebox.cxx | 31 ----
svtools/source/contnr/imivctl1.cxx | 29 ++--
svtools/source/contnr/ivctrl.cxx | 13 +
svtools/source/contnr/treelistbox.cxx | 61 +++++---
svtools/source/control/calendar.cxx | 15 +-
svtools/source/control/headbar.cxx | 51 +++----
svtools/source/control/ruler.cxx | 64 +++++----
svtools/source/control/tabbar.cxx | 27 +--
svtools/source/control/toolbarmenu.cxx | 7 -
svtools/source/control/valueset.cxx | 46 +++---
svtools/source/toolpanel/toolpaneldrawer.cxx | 24 +--
svtools/source/toolpanel/toolpaneldrawer.hxx | 4
svx/source/fmcomp/gridcell.cxx | 52 +++----
svx/source/fmcomp/gridctrl.cxx | 10 -
sw/source/uibase/docvw/HeaderFooterWin.cxx | 4
sw/source/uibase/docvw/srcedtw.cxx | 4
vcl/Library_vcl.mk | 1
vcl/inc/helpwin.hxx | 14 +-
vcl/inc/ilstbox.hxx | 11 +
vcl/inc/window.h | 33 ++--
vcl/source/app/help.cxx | 42 ++++--
vcl/source/control/ctrl.cxx | 20 ++
vcl/source/control/edit.cxx | 58 ++++++--
vcl/source/control/ilstbox.cxx | 126 +++++++++++++-----
vcl/source/control/lstbox.cxx | 2
vcl/source/edit/vclmedit.cxx | 89 +++++++++---
vcl/source/outdev/outdevstate.cxx | 5
vcl/source/outdev/rendersettings.cxx | 59 ++++++++
vcl/source/window/brdwin.cxx | 17 +-
vcl/source/window/dialog.cxx | 28 +++-
vcl/source/window/dockingarea.cxx | 2
vcl/source/window/dockmgr.cxx | 2
vcl/source/window/menubarwindow.cxx | 4
vcl/source/window/menuwindow.cxx | 5
vcl/source/window/paint.cxx | 77 +++++------
vcl/source/window/printdlg.cxx | 2
vcl/source/window/splitwin.cxx | 2
vcl/source/window/status.cxx | 53 ++++++-
vcl/source/window/toolbox.cxx | 101 +++++++++++---
vcl/source/window/window.cxx | 110 ++++++++-------
vcl/source/window/window2.cxx | 134 +++++++++++--------
80 files changed, 1296 insertions(+), 809 deletions(-)
New commits:
commit e5bb5c52aeaeb60c8592b004efd88c30242e03a1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon May 18 11:20:48 2015 +0900
add RenderContext to Window::PushPaintHelper, use Erase correctly
Change-Id: Icc684a2dcfb4d92752b09768e5a908636910f302
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 3f857f2..f7615e3 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -544,8 +544,8 @@ protected:
SAL_DLLPRIVATE WindowResHeader ImplLoadResHeader( const ResId& rResId );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
- SAL_DLLPRIVATE void PushPaintHelper(PaintHelper *pHelper);
- SAL_DLLPRIVATE void PopPaintHelper(PaintHelper *pHelper);
+ SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void PopPaintHelper(PaintHelper* pHelper);
private:
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 07851b2..a7aa9b4 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -121,11 +121,12 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
if (!pWindowImpl->maInvalidateRegion.IsEmpty())
{
m_pWindow->BeginPaint();
- m_pWindow->PushPaintHelper(this);
// double-buffering - so far an experimental feature
if (officecfg::Office::Common::Misc::ExperimentalMode::get())
{
+ m_pWindow->PushPaintHelper(this, *m_pWindow);
+
ScopedVclPtrInstance<VirtualDevice> pDevice;
// transfer various settings
@@ -186,6 +187,8 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
else
{
// direct painting
+ m_pWindow->PushPaintHelper(this, *m_pWindow);
+ m_pWindow->ApplySettings(*m_pWindow);
m_pWindow->Paint(*m_pWindow, m_aPaintRect);
}
@@ -348,7 +351,7 @@ void RenderTools::DrawSelectionBackground(vcl::RenderContext& rRenderContext, vc
rRenderContext.Pop(); // LINECOLOR | FILLCOLOR
}
-void Window::PushPaintHelper(PaintHelper *pHelper)
+void Window::PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext& rRenderContext)
{
pHelper->SetPop();
@@ -361,49 +364,48 @@ void Window::PushPaintHelper(PaintHelper *pHelper)
// restore Paint-Region
vcl::Region &rPaintRegion = pHelper->GetPaintRegion();
rPaintRegion = mpWindowImpl->maInvalidateRegion;
- Rectangle aPaintRect = rPaintRegion.GetBoundRect();
+ Rectangle aPaintRect = rPaintRegion.GetBoundRect();
// - RTL - re-mirror paint rect and region at this window
- if( ImplIsAntiparallel() )
+ if (ImplIsAntiparallel())
{
- const OutputDevice *pOutDev = GetOutDev();
- pOutDev->ReMirror( aPaintRect );
- pOutDev->ReMirror( rPaintRegion );
+ rRenderContext.ReMirror(aPaintRect);
+ rRenderContext.ReMirror(rPaintRegion);
}
- aPaintRect = ImplDevicePixelToLogic( aPaintRect);
+ aPaintRect = ImplDevicePixelToLogic(aPaintRect);
mpWindowImpl->mpPaintRegion = &rPaintRegion;
mpWindowImpl->maInvalidateRegion.SetEmpty();
- if ( (pHelper->GetPaintFlags() & IMPL_PAINT_ERASE) && IsBackground() )
+ if ((pHelper->GetPaintFlags() & IMPL_PAINT_ERASE) && rRenderContext.IsBackground())
{
- if ( IsClipRegion() )
+ if (rRenderContext.IsClipRegion())
{
- vcl::Region aOldRegion = GetClipRegion();
- SetClipRegion();
- Erase();
- SetClipRegion( aOldRegion );
+ vcl::Region aOldRegion = rRenderContext.GetClipRegion();
+ rRenderContext.SetClipRegion();
+ Erase(rRenderContext);
+ rRenderContext.SetClipRegion(aOldRegion);
}
else
- Erase();
+ Erase(rRenderContext);
}
// #98943# trigger drawing of toolbox selection after all childern are painted
- if( mpWindowImpl->mbDrawSelectionBackground )
+ if (mpWindowImpl->mbDrawSelectionBackground)
pHelper->SetSelectionRect(aPaintRect);
pHelper->SetPaintRect(aPaintRect);
}
void Window::PopPaintHelper(PaintHelper *pHelper)
{
- if ( mpWindowImpl->mpWinData )
+ if (mpWindowImpl->mpWinData)
{
- if ( mpWindowImpl->mbFocusVisible )
- ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) );
+ if (mpWindowImpl->mbFocusVisible)
+ ImplInvertFocus(*(mpWindowImpl->mpWinData->mpFocusRect));
}
mpWindowImpl->mbInPaint = false;
mbInitClipRegion = true;
mpWindowImpl->mpPaintRegion = NULL;
- if ( mpWindowImpl->mpCursor )
+ if (mpWindowImpl->mpCursor)
mpWindowImpl->mpCursor->ImplResume(pHelper->GetRestoreCursor());
}
@@ -906,7 +908,6 @@ void Window::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRec
void Window::SetPaintTransparent( bool bTransparent )
{
-
// transparency is not useful for frames as the background would have to be provided by a different frame
if( bTransparent && mpWindowImpl->mbFrame )
return;
@@ -1305,7 +1306,7 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
// background
if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & PARENTCLIPMODE_NOCLIP ) )
- Erase();
+ Erase(*this);
// foreground
Paint(*this, aPaintRect);
// put a pop action to metafile
commit 6656e915c8e0348dcaeedb40a68ba308e174960b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon May 18 11:18:49 2015 +0900
ApplySettings for dialog
Change-Id: I30f26799e0dfa059ad754eead5ba382f44bf1310
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 4678645..c7f0a74 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -53,6 +53,8 @@ private:
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext);
+
SAL_DLLPRIVATE Dialog (const Dialog &) SAL_DELETED_FUNCTION;
SAL_DLLPRIVATE Dialog & operator= (const Dialog &) SAL_DELETED_FUNCTION;
diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx
index b553c6e..5889a4f 100644
--- a/vcl/inc/helpwin.hxx
+++ b/vcl/inc/helpwin.hxx
@@ -44,11 +44,15 @@ private:
QuickHelpFlags mnStyle;
protected:
- DECL_LINK_TYPED( TimerHdl, Timer*, void );
- virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) SAL_OVERRIDE;
- virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
- virtual OUString GetText() const SAL_OVERRIDE;
- void ImplShow();
+ DECL_LINK_TYPED( TimerHdl, Timer*, void );
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
+ virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+
+ virtual OUString GetText() const SAL_OVERRIDE;
+ void ImplShow();
+
public:
HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle );
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index f9d02fc..6bdb60e 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -253,17 +253,18 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal
// FIXME RenderContext
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetPointFont(*this, rStyleSettings.GetHelpFont());
- SetTextColor( rStyleSettings.GetHelpTextColor() );
- SetTextAlign( ALIGN_TOP );
- if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) )
+ SetTextColor(rStyleSettings.GetHelpTextColor());
+ SetTextAlign(ALIGN_TOP);
+ if (IsNativeControlSupported(CTRL_TOOLTIP, PART_ENTIRE_CONTROL))
{
- EnableChildTransparentMode( true );
- SetParentClipMode( PARENTCLIPMODE_NOCLIP );
- SetPaintTransparent( true );
+ EnableChildTransparentMode(true);
+ SetParentClipMode(PARENTCLIPMODE_NOCLIP);
+ SetPaintTransparent(true);
SetBackground();
}
else
- SetBackground( Wallpaper( rStyleSettings.GetHelpColor() ) );
+ SetBackground(Wallpaper(rStyleSettings.GetHelpColor()));
+
if( rStyleSettings.GetHelpColor().IsDark() )
SetLineColor( COL_WHITE );
else
@@ -289,6 +290,30 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal
maHideTimer.SetTimeout( rHelpSettings.GetTipTimeout() );
}
+void HelpTextWindow::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ SetPointFont(rRenderContext, rStyleSettings.GetHelpFont());
+ rRenderContext.SetTextColor(rStyleSettings.GetHelpTextColor());
+ rRenderContext.SetTextAlign(ALIGN_TOP);
+
+ if (rRenderContext.IsNativeControlSupported(CTRL_TOOLTIP, PART_ENTIRE_CONTROL))
+ {
+ EnableChildTransparentMode(true);
+ SetParentClipMode(PARENTCLIPMODE_NOCLIP);
+ SetPaintTransparent(true);
+ rRenderContext.SetBackground();
+ }
+ else
+ rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetHelpColor()));
+
+ if (rStyleSettings.GetHelpColor().IsDark())
+ rRenderContext.SetLineColor(COL_WHITE);
+ else
+ rRenderContext.SetLineColor(COL_BLACK);
+ rRenderContext.SetFillColor();
+}
+
HelpTextWindow::~HelpTextWindow()
{
disposeOnce();
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 4aa3e15..93273a7 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -432,20 +432,40 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
ImplInitSettings();
}
+void Dialog::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+ if (IsControlBackground())
+ {
+ // user override
+ SetBackground(GetControlBackground());
+ }
+ else if (rRenderContext.IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG))
+ {
+ // NWF background
+ mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG;
+ EnableChildTransparentMode(true);
+ }
+ else
+ {
+ // fallback to settings color
+ rRenderContext.SetBackground(GetSettings().GetStyleSettings().GetDialogColor());
+ }
+}
+
void Dialog::ImplInitSettings()
{
// user override
- if ( IsControlBackground() )
- SetBackground( GetControlBackground() );
+ if (IsControlBackground())
+ SetBackground(GetControlBackground());
// NWF background
- else if( IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG ) )
+ else if( IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_DIALOG))
{
mpWindowImpl->mnNativeBackground = PART_BACKGROUND_DIALOG;
EnableChildTransparentMode( true );
}
// fallback to settings color
else
- SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+ SetBackground(GetSettings().GetStyleSettings().GetDialogColor());
}
Dialog::Dialog( WindowType nType )
commit 6fa87f3fde8316fe1e4c35d1dd5132dbd7d7d903
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon May 18 11:17:49 2015 +0900
use RenderTools variant of DrawSelectionBackground
Change-Id: Ia7a0f0a4d62e478876743c019865e7878bcbf596
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index f348842..0c75a87 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -312,7 +312,7 @@ void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos
if (rRenderContext.IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL))
{
- aCtrlRegion=aRect;
+ aCtrlRegion = aRect;
rRenderContext.DrawNativeControl(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL,
aCtrlRegion, nState, aControlValue, OUString());
@@ -358,9 +358,9 @@ void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos
// draw ButtonStyle
// avoid 3D borders
if (bHigh)
- DrawSelectionBackground(aRect, 1, true, false, false, &aSelectionTextColor);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 1, true, false, false, &aSelectionTextColor);
else if (!mbButtonStyle || (nBits & HeaderBarItemBits::FLAT))
- DrawSelectionBackground(aRect, 0, true, false, false, &aSelectionTextColor);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 0, true, false, false, &aSelectionTextColor);
}
// do not draw if there is no space
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 1931592d..96b776c 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -639,7 +639,7 @@ void ImplPopupFloatWin::DrawGrip(vcl::RenderContext& rRenderContext)
if (mbHighlight)
{
rRenderContext.Erase(aRect);
- DrawSelectionBackground(aRect, 2, false, true, false);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 2, false, true, false);
}
else
{
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 7e1a472..df362cd 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -1914,7 +1914,7 @@ void SplitWindow::ImplDrawGrip(vcl::RenderContext& rRenderContext, const Rectang
if (rRect.IsInside(GetPointerPosPixel()))
{
rRenderContext.DrawWallpaper(rRect, Wallpaper(Color(COL_WHITE)));
- DrawSelectionBackground(rRect, 2, false, false, false);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, 2, false, false, false);
}
if (bHorz)
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 00370ff..ca362fd 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2975,7 +2975,7 @@ void ToolBox::ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle
}
if (!bNativeOk)
- DrawSelectionBackground(rRect, bIsWindow ? 3 : highlight, bChecked, true, bIsWindow, 2, NULL, NULL);
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, bIsWindow ? 3 : highlight, bChecked, true, bIsWindow, NULL, 2, NULL);
}
void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, bool bLayout)
commit e27ee95cced755e52b62d6cb095bc911ca3fbbe6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon May 18 11:14:17 2015 +0900
pass RenderContext to PreparePaint in TreeListBox
Change-Id: I32961f5cd511b9ecc756e99ca95e4e9ddbc6b795
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index bd4ba2f..0ae17bf 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -98,31 +98,32 @@ void OCreationList::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _
rRenderContext.SetFont(m_aOriginalFont);
}
-void OCreationList::PreparePaint( SvTreeListEntry* _pEntry )
+void OCreationList::PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry* _pEntry)
{
- Wallpaper aEntryBackground( m_aOriginalBackgroundColor );
- if ( _pEntry )
+ Wallpaper aEntryBackground(m_aOriginalBackgroundColor);
+ if (_pEntry)
{
- if ( _pEntry == GetCurEntry() )
+ if (_pEntry == GetCurEntry())
{
// draw a selection background
bool bIsMouseDownEntry = ( _pEntry == m_pMouseDownEntry );
- DrawSelectionBackground( GetBoundingRect( _pEntry ), bIsMouseDownEntry ? 1 : 2, false, true, false );
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, GetBoundingRect(_pEntry),
+ bIsMouseDownEntry ? 1 : 2, false, true, false );
- if ( bIsMouseDownEntry )
+ if (bIsMouseDownEntry)
{
- vcl::Font aFont( GetFont() );
- aFont.SetColor( GetSettings().GetStyleSettings().GetHighlightTextColor() );
- Control::SetFont( aFont );
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetColor(rRenderContext.GetSettings().GetStyleSettings().GetHighlightTextColor());
+ rRenderContext.SetFont(aFont);
}
// and temporary set a transparent background, for all the other
// paint operations the SvTreeListBox is going to do
- aEntryBackground = Wallpaper( Color( COL_TRANSPARENT ) );
+ aEntryBackground = Wallpaper(Color(COL_TRANSPARENT));
}
}
- SetBackground( aEntryBackground );
+ rRenderContext.SetBackground(aEntryBackground);
}
void OCreationList::SelectSearchEntry( const void* _pEntry )
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index e4f7974..3b4286a 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -61,7 +61,7 @@ namespace dbaui
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
@@ -71,7 +71,7 @@ namespace dbaui
void updateHelpText();
protected:
- virtual void PreparePaint( SvTreeListEntry* _pEntry ) SAL_OVERRIDE;
+ virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry* _pEntry) SAL_OVERRIDE;
virtual Rectangle GetFocusRect( SvTreeListEntry* _pEntry, long _nLine ) SAL_OVERRIDE;
virtual void ModelHasCleared() SAL_OVERRIDE;
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 90d8eae..24446dcc 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -617,7 +617,7 @@ protected:
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
- virtual void PreparePaint( SvTreeListEntry* );
+ virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry* pEntry);
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
void InitSettings(bool bFont, bool bForeground, bool bBackground);
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index b6d18de..3b27f3d 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -2565,7 +2565,7 @@ void SvTreeListBox::AdjustEntryHeightAndRecalc( const vcl::Font& rFont )
void SvTreeListBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
Control::Paint(rRenderContext, rRect);
- if(nTreeFlags & SvTreeFlags::RECALCTABS)
+ if (nTreeFlags & SvTreeFlags::RECALCTABS)
SetTabs();
pImp->Paint(rRenderContext, rRect);
@@ -2837,21 +2837,20 @@ SvTreeListEntry* SvTreeListBox::GetCurEntry() const
void SvTreeListBox::ImplInitStyle()
{
-
const WinBits nWindowStyle = GetStyle();
nTreeFlags |= SvTreeFlags::RECALCTABS;
- if( nWindowStyle & WB_SORT )
+ if (nWindowStyle & WB_SORT)
{
- GetModel()->SetSortMode( SortAscending );
- GetModel()->SetCompareHdl( LINK(this,SvTreeListBox,DefaultCompare));
+ GetModel()->SetSortMode(SortAscending);
+ GetModel()->SetCompareHdl(LINK(this, SvTreeListBox, DefaultCompare));
}
else
{
- GetModel()->SetSortMode( SortNone );
- GetModel()->SetCompareHdl( Link<>() );
+ GetModel()->SetSortMode(SortNone);
+ GetModel()->SetCompareHdl(Link<>());
}
- pImp->SetStyle( nWindowStyle );
+ pImp->SetStyle(nWindowStyle);
pImp->Resize();
Invalidate();
}
@@ -2884,7 +2883,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
Rectangle aRect; // multi purpose
bool bHorSBar = pImp->HasHorScrollBar();
- PreparePaint(pEntry);
+ PreparePaint(rRenderContext, pEntry);
pImp->UpdateContextBmpWidthMax(pEntry);
@@ -2986,7 +2985,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
{
// if the face color is bright then the deactive color is also bright
// -> so you can't see any deactive selection
- if ( bHideSelection && !rSettings.GetFaceColor().IsBright()
+ if (bHideSelection && !rSettings.GetFaceColor().IsBright()
&& aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright())
{
aNewWallColor = rSettings.GetDeactiveColor();
@@ -3054,7 +3053,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
// A custom selection that starts at a tab position > 0, do not fill
// the background of the 0th item, else e.g. we might not be able to
// realize tab listboxes with lines.
- if (!(nCurTab==0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
+ if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
{
rRenderContext.SetFillColor(aWallpaper.GetColor());
// this case may occur for smaller horizontal resizes
@@ -3087,7 +3086,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
// cursor emphasis
rRenderContext.SetFillColor();
Color aOldLineColor = rRenderContext.GetLineColor();
- SetLineColor(Color(COL_BLACK));
+ rRenderContext.SetLineColor(Color(COL_BLACK));
aRect = GetFocusRect(pEntry, nLine);
aRect.Top()++;
aRect.Bottom()--;
@@ -3197,7 +3196,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
return 0; // nRowLen;
}
-void SvTreeListBox::PreparePaint( SvTreeListEntry* )
+void SvTreeListBox::PreparePaint(vcl::RenderContext& /*rRenderContext*/, SvTreeListEntry* /*pEntry*/)
{
}
commit a97fc29f726b7fcc5ab36496e117e2a1aec9747d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon May 18 11:12:59 2015 +0900
refactor scanner ext. to use RenderContext
Change-Id: I31e4ea09b3a7bd65e589481c4c128275a8a7c1b7
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 682839b..6fa2dc7 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -50,10 +50,10 @@ class GridWindow : public vcl::Window
return (maPos.X() < rComp.maPos.X());
}
- void draw(vcl::Window& rWin, const BitmapEx& rBitmapEx)
+ void draw(vcl::RenderContext& rRenderContext, const BitmapEx& rBitmapEx)
{
- const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
- rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx);
+ const Point aOffset(rRenderContext.PixelToLogic(Point(mnOffX, mnOffY)));
+ rRenderContext.DrawBitmapEx(maPos - aOffset, rBitmapEx);
}
bool isHit(vcl::Window& rWin, const Point& rPos)
@@ -100,10 +100,10 @@ class GridWindow : public vcl::Window
double findMaxX();
double findMaxY();
- void drawGrid();
- void drawOriginal();
- void drawNew();
- void drawHandles();
+ void drawGrid(vcl::RenderContext& rRenderContext);
+ void drawOriginal(vcl::RenderContext& rRenderContext);
+ void drawNew(vcl::RenderContext& rRenderContext);
+ void drawHandles(vcl::RenderContext& rRenderContext);
void computeExtremes();
static void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
@@ -116,7 +116,7 @@ class GridWindow : public vcl::Window
void onResize();
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
- void drawLine( double x1, double y1, double x2, double y2 );
+ void drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2);
public:
GridWindow(vcl::Window* pParent);
void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
@@ -336,9 +336,9 @@ void GridWindow::transform( const Point& rOriginal, double& x, double& y )
y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)nHeight + m_fMinY;
}
-void GridWindow::drawLine( double x1, double y1, double x2, double y2 )
+void GridWindow::drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2 )
{
- DrawLine( transform( x1, y1 ), transform( x2, y2 ) );
+ rRenderContext.DrawLine(transform(x1, y1), transform(x2, y2));
}
void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut )
@@ -455,87 +455,89 @@ void GridWindow::setBoundings(double fMinX, double fMinY, double fMaxX, double f
computeChunk( m_fMinY, m_fMaxY, m_fChunkY, m_fMinChunkY );
}
-void GridWindow::drawGrid()
+void GridWindow::drawGrid(vcl::RenderContext& rRenderContext)
{
char pBuf[256];
- SetLineColor( Color( COL_BLACK ) );
+ rRenderContext.SetLineColor(Color(COL_BLACK));
// draw vertical lines
- for( double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX )
+ for (double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX)
{
- drawLine( fX, m_fMinY, fX, m_fMaxY );
+ drawLine(rRenderContext, fX, m_fMinY, fX, m_fMaxY);
// draw tickmarks
- Point aPt = transform( fX, m_fMinY );
- std::sprintf( pBuf, "%g", fX );
- OUString aMark( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
- Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
- aPt.X() -= aTextSize.Width()/2;
- aPt.Y() += aTextSize.Height()/2;
- DrawText( aPt, aMark );
+ Point aPt = transform(fX, m_fMinY);
+ std::sprintf(pBuf, "%g", fX);
+ OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
+ Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
+ aPt.X() -= aTextSize.Width() / 2;
+ aPt.Y() += aTextSize.Height() / 2;
+ rRenderContext.DrawText(aPt, aMark);
}
// draw horizontal lines
- for( double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY )
+ for (double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY)
{
- drawLine( m_fMinX, fY, m_fMaxX, fY );
+ drawLine(rRenderContext, m_fMinX, fY, m_fMaxX, fY);
// draw tickmarks
- Point aPt = transform( m_fMinX, fY );
- std::sprintf( pBuf, "%g", fY );
- OUString aMark( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
- Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
+ Point aPt = transform(m_fMinX, fY);
+ std::sprintf(pBuf, "%g", fY);
+ OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
+ Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
aPt.X() -= aTextSize.Width() + 2;
- aPt.Y() -= aTextSize.Height()/2;
- DrawText( aPt, aMark );
+ aPt.Y() -= aTextSize.Height() / 2;
+ rRenderContext.DrawText(aPt, aMark);
}
// draw boundings
- drawLine( m_fMinX, m_fMinY, m_fMaxX, m_fMinY );
- drawLine( m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY );
- drawLine( m_fMinX, m_fMinY, m_fMinX, m_fMaxY );
- drawLine( m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY );
+ drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMaxX, m_fMinY);
+ drawLine(rRenderContext, m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY);
+ drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMinX, m_fMaxY);
+ drawLine(rRenderContext, m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY);
}
-void GridWindow::drawOriginal()
+void GridWindow::drawOriginal(vcl::RenderContext& rRenderContext)
{
- if( m_nValues && m_pXValues && m_pOrigYValues )
+ if (m_nValues && m_pXValues && m_pOrigYValues)
{
- SetLineColor( Color( COL_RED ) );
- for( int i = 0; i < m_nValues-1; i++ )
+ rRenderContext.SetLineColor(Color(COL_RED));
+ for (int i = 0; i < m_nValues - 1; i++)
{
- drawLine( m_pXValues[ i ], m_pOrigYValues[ i ],
- m_pXValues[ i+1 ], m_pOrigYValues[ i+1 ] );
+ drawLine(rRenderContext,
+ m_pXValues[i], m_pOrigYValues[i],
+ m_pXValues[i + 1], m_pOrigYValues[i + 1]);
}
}
}
-void GridWindow::drawNew()
+void GridWindow::drawNew(vcl::RenderContext& rRenderContext)
{
- if( m_nValues && m_pXValues && m_pNewYValues )
+ if (m_nValues && m_pXValues && m_pNewYValues)
{
- SetClipRegion(vcl::Region(m_aGridArea));
- SetLineColor( Color( COL_YELLOW ) );
- for( int i = 0; i < m_nValues-1; i++ )
+ rRenderContext.SetClipRegion(vcl::Region(m_aGridArea));
+ rRenderContext.SetLineColor(Color(COL_YELLOW));
+ for (int i = 0; i < m_nValues - 1; i++)
{
- drawLine( m_pXValues[ i ], m_pNewYValues[ i ],
- m_pXValues[ i+1 ], m_pNewYValues[ i+1 ] );
+ drawLine(rRenderContext,
+ m_pXValues[i], m_pNewYValues[i],
+ m_pXValues[i + 1], m_pNewYValues[i + 1]);
}
- SetClipRegion();
+ rRenderContext.SetClipRegion();
}
}
-void GridWindow::drawHandles()
+void GridWindow::drawHandles(vcl::RenderContext& rRenderContext)
{
for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
{
- m_aHandles[i].draw(*this, m_aMarkerBitmap);
+ m_aHandles[i].draw(rRenderContext, m_aMarkerBitmap);
}
}
-void GridWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
+void GridWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
Window::Paint(rRenderContext, rRect);
- drawGrid();
- drawOriginal();
- drawNew();
- drawHandles();
+ drawGrid(rRenderContext);
+ drawOriginal(rRenderContext);
+ drawNew(rRenderContext);
+ drawHandles(rRenderContext);
}
void GridWindow::MouseMove( const MouseEvent& rEvt )
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 8ebcf69..3d743a3 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -50,7 +50,7 @@ private:
bool mbDragDrawn;
bool mbIsDragging;
- void DrawRectangles(Point& rUL, Point& rBR);
+ void DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR);
public:
ScanPreview(vcl::Window* pParent, WinBits nStyle)
: Window(pParent, nStyle)
@@ -62,16 +62,23 @@ public:
, mbIsDragging(false)
{
}
- virtual ~ScanPreview() { disposeOnce(); }
+
+ virtual ~ScanPreview()
+ {
+ disposeOnce();
+ }
+
virtual void dispose() SAL_OVERRIDE
{
mpParentDialog.clear();
vcl::Window::dispose();
}
+
void Init(SaneDlg *pParent)
{
mpParentDialog = pParent;
}
+
void ResetForNewScanner()
{
maTopLeft = Point();
@@ -79,15 +86,27 @@ public:
maMinTopLeft = Point();
maMaxBottomRight = Point(PREVIEW_WIDTH, PREVIEW_HEIGHT);
}
- void EnableDrag() { mbDragEnable = true; }
- void DisableDrag() { mbDragEnable = false; }
- bool IsDragEnabled() { return mbDragEnable; }
- virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) SAL_OVERRIDE;
+
+ void EnableDrag()
+ {
+ mbDragEnable = true;
+ }
+ void DisableDrag()
+ {
+ mbDragEnable = false;
+ }
+ bool IsDragEnabled()
+ {
+ return mbDragEnable;
+ }
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
Point GetPixelPos(const Point& rIn) const;
Point GetLogicPos(const Point& rIn) const;
+
void GetPreviewLogicRect(Point& rTopLeft, Point &rBottomRight) const
{
rTopLeft = GetLogicPos(maTopLeft);
@@ -127,17 +146,16 @@ public:
{
maTopLeft = GetPixelPos(rTopLeft);
maBottomRight = GetPixelPos(rBottomRight);
- maPreviewRect = Rectangle( maTopLeft,
- Size( maBottomRight.X() - maTopLeft.X(),
- maBottomRight.Y() - maTopLeft.Y() )
- );
+ maPreviewRect = Rectangle(maTopLeft,
+ Size(maBottomRight.X() - maTopLeft.X(),
+ maBottomRight.Y() - maTopLeft.Y()));
}
void SetPreviewMaxRect(const Point& rTopLeft, const Point &rBottomRight)
{
maMinTopLeft = rTopLeft;
maMaxBottomRight = rBottomRight;
}
- void DrawDrag();
+ void DrawDrag(vcl::RenderContext& rRenderContext);
void UpdatePreviewBounds();
void SetBitmap(SvStream &rStream)
{
@@ -233,14 +251,10 @@ SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
maOldLink = mrSane.SetReloadOptionsHdl( LINK( this, SaneDlg, ReloadSaneOptionsHdl ) );
mpOptionBox->SetNodeBitmaps(get<FixedImage>("plus")->GetImage(),
- get<FixedImage>("minus")->GetImage());
- mpOptionBox->SetStyle( mpOptionBox->GetStyle()|
- WB_HASLINES |
- WB_HASBUTTONS |
- WB_NOINITIALSELECTION |
- WB_HASBUTTONSATROOT |
- WB_HASLINESATROOT
- );
+ get<FixedImage>("minus")->GetImage());
+ mpOptionBox->SetStyle(mpOptionBox->GetStyle() |
+ WB_HASLINES | WB_HASBUTTONS | WB_NOINITIALSELECTION |
+ WB_HASBUTTONSATROOT | WB_HASLINESATROOT);
}
SaneDlg::~SaneDlg()
@@ -250,7 +264,7 @@ SaneDlg::~SaneDlg()
void SaneDlg::dispose()
{
- mrSane.SetReloadOptionsHdl( maOldLink );
+ mrSane.SetReloadOptionsHdl(maOldLink);
mpOKButton.clear();
mpCancelButton.clear();
mpDeviceInfoButton.clear();
@@ -811,22 +825,22 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit )
else if( pEdit == mpTopField )
{
mpPreview->ChangePreviewLogicTopLeftY(mpTopField->GetValue());
- mpPreview->DrawDrag();
+ mpPreview->Invalidate();
}
else if( pEdit == mpLeftField )
{
mpPreview->ChangePreviewLogicTopLeftX(mpLeftField->GetValue());
- mpPreview->DrawDrag();
+ mpPreview->Invalidate();
}
else if( pEdit == mpBottomField )
{
mpPreview->ChangePreviewLogicBottomRightY(mpBottomField->GetValue());
- mpPreview->DrawDrag();
+ mpPreview->Invalidate();
}
else if( pEdit == mpRightField )
{
mpPreview->ChangePreviewLogicBottomRightX(mpRightField->GetValue());
- mpPreview->DrawDrag();
+ mpPreview->Invalidate();
}
}
return 0;
@@ -918,18 +932,17 @@ void ScanPreview::UpdatePreviewBounds()
void ScanPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
Window::Paint(rRenderContext, rRect);
- SetMapMode(MAP_APPFONT);
- SetFillColor( Color( COL_WHITE ) );
- SetLineColor( Color( COL_WHITE ) );
- DrawRect( Rectangle( Point( 0, 0 ),
- Size( PREVIEW_WIDTH, PREVIEW_HEIGHT ) ) );
- SetMapMode( MapMode( MAP_PIXEL ) );
+ rRenderContext.SetMapMode(MAP_APPFONT);
+ rRenderContext.SetFillColor(Color(COL_WHITE));
+ rRenderContext.SetLineColor(Color(COL_WHITE));
+ rRenderContext.DrawRect(Rectangle(Point(0, 0),
+ Size(PREVIEW_WIDTH, PREVIEW_HEIGHT)));
+ rRenderContext.SetMapMode(MapMode(MAP_PIXEL));
// check for sane values
- DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(),
- maPreviewBitmap );
+ rRenderContext.DrawBitmap(maPreviewRect.TopLeft(), maPreviewRect.GetSize(), maPreviewBitmap);
mbDragDrawn = false;
- DrawDrag();
+ DrawDrag(rRenderContext);
}
void SaneDlg::DisableOption()
@@ -1102,7 +1115,7 @@ void ScanPreview::MouseMove(const MouseEvent& rMEvt)
maTopLeft.Y() = maBottomRight.Y();
maBottomRight.Y() = nSwap;
}
- DrawDrag();
+ Invalidate();
mpParentDialog->UpdateScanArea(false);
}
Window::MouseMove( rMEvt );
@@ -1188,7 +1201,7 @@ void ScanPreview::MouseButtonDown( const MouseEvent& rMEvt )
if( mbIsDragging )
{
SetPointerPosPixel( aMousePixel );
- DrawDrag();
+ Invalidate();
}
Window::MouseButtonDown( rMEvt );
}
@@ -1204,51 +1217,51 @@ void ScanPreview::MouseButtonUp( const MouseEvent& rMEvt )
Window::MouseButtonUp( rMEvt );
}
-void ScanPreview::DrawRectangles( Point& rUL, Point& rBR )
+void ScanPreview::DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR)
{
int nMiddleX, nMiddleY;
Point aBL, aUR;
- aUR = Point( rBR.X(), rUL.Y() );
- aBL = Point( rUL.X(), rBR.Y() );
- nMiddleX = ( rBR.X() - rUL.X() ) / 2 + rUL.X();
- nMiddleY = ( rBR.Y() - rUL.Y() ) / 2 + rUL.Y();
-
- DrawLine( rUL, aBL );
- DrawLine( aBL, rBR );
- DrawLine( rBR, aUR );
- DrawLine( aUR, rUL );
- DrawRect( Rectangle( rUL, Size( RECT_SIZE_PIX,RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( aBL, Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( rBR, Size( -RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( aUR, Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rUL.Y() ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rBR.Y() ), Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( Point( rUL.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
- DrawRect( Rectangle( Point( rBR.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
+ aUR = Point(rBR.X(), rUL.Y());
+ aBL = Point(rUL.X(), rBR.Y());
+ nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X();
+ nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y();
+
+ rRenderContext.DrawLine(rUL, aBL);
+ rRenderContext.DrawLine(aBL, rBR);
+ rRenderContext.DrawLine(rBR, aUR);
+ rRenderContext.DrawLine(aUR, rUL);
+ rRenderContext.DrawRect(Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX )));
+ rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX)));
+ rRenderContext.DrawRect(Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX)));
}
-void ScanPreview::DrawDrag()
+void ScanPreview::DrawDrag(vcl::RenderContext& rRenderContext)
{
static Point aLastUL, aLastBR;
- if( ! mbDragEnable )
+ if (!mbDragEnable)
return;
- RasterOp eROP = GetRasterOp();
- SetRasterOp( ROP_INVERT );
- SetMapMode( MapMode( MAP_PIXEL ) );
+ RasterOp eROP = rRenderContext.GetRasterOp();
+ rRenderContext.SetRasterOp(ROP_INVERT);
+ rRenderContext.SetMapMode(MapMode(MAP_PIXEL));
- if( mbDragDrawn )
- DrawRectangles( aLastUL, aLastBR );
+ if (mbDragDrawn)
+ DrawRectangles(rRenderContext, aLastUL, aLastBR);
aLastUL = maTopLeft;
aLastBR = maBottomRight;
- DrawRectangles( maTopLeft, maBottomRight );
+ DrawRectangles(rRenderContext, maTopLeft, maBottomRight);
mbDragDrawn = true;
- SetRasterOp( eROP );
- SetMapMode(MAP_APPFONT);
+ rRenderContext.SetRasterOp(eROP);
+ rRenderContext.SetMapMode(MAP_APPFONT);
}
Point ScanPreview::GetPixelPos( const Point& rIn) const
commit b4bbb5e5d7b31caad2fbcc00382ad27df3c81001
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sun May 17 22:56:46 2015 +0900
refactor how font, fg. and bg. are applied in widgets/controls
- Move vcl::RenderContext to outdev.
- Change some methods on vcl::Window to accept RenderContext
as parameter.
- Add ApplySettings to vcl::Window - This method is called before
painting. Refactor existing classes that use InitSettings to
have ApplySettings or mark the classes to be refactored later.
- Add RenderSettings for adding defered settings to rendering.
This is similar to ApplySettings but for more ad-hoc calls.
Change-Id: I4ea58461f3b6b08ccfa3e0ddd1a4a3e04f8c4f45
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 351bc13..95b6a95 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 6ccdcab..0c6c64a 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 faeb2d7..b43338f 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 44284fb..c3dc8ef 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 c547945..bd4ba2f 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 37df472..05f9a06 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 71317b0..1a28fb7 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 8947c9e..4c56fa8 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 5644fbb..469536b 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 16879ed..e444861 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 fefb91d..971ff21 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 2cb3efe..8adf24f 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 9b5598f..90e012f 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 bcf9e57..04c251c 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 8293eb0..af4859f 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 7e57510..9aa1cdba 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 cd99e31..9feeaa2 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 537aa3b..b951069 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 5babd96..90d8eae 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 0497bdd..8c2cd2a 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 7c3c9e6..e526e31 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 a543ce5..8a9e2d5 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 3d1b0db..3655e44 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 1e9c2ef..0625517 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 0000000..f6df721
--- /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 270ef4e..85a94cd 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 8b94b6b..98e73e0 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 12d03e1..d7eb480 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 ae4b4e3..3f857f2 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 a801a97..004b538 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 3b58311..e6f607a 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 d5a14b2..ba6f706 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 8b579df..91623bf 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 65906f0..e42749e 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 e3dfa38..74f2f25 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 31424b3..0c07e7c 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 0db2da3..64dbe4d3 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 fe721c4..56fff11 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 aba60a7..b6d18de 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 24f5e6a..ffd68d6 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 6d4be8b..f348842 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 35d5be2..b6ff5aa 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 0b8ca9e..291786f 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 ab7da47..bb9d1a3 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 b2c84dd..a3398c9 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 )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list