[Libreoffice-commits] core.git: 2 commits - chart2/source include/sfx2 include/vcl sc/source sd/source sfx2/source sw/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Tue May 12 21:58:20 PDT 2015
chart2/source/controller/main/ChartWindow.cxx | 6 +-
chart2/source/controller/main/ChartWindow.hxx | 4 -
include/sfx2/recentdocsview.hxx | 12 ++--
include/vcl/window.hxx | 3 -
sc/source/ui/inc/gridwin.hxx | 4 -
sc/source/ui/view/gridwin4.cxx | 4 -
sd/source/ui/inc/Window.hxx | 2
sd/source/ui/view/sdwindow.cxx | 2
sfx2/source/control/recentdocsview.cxx | 67 ++++++++++++--------------
sw/source/uibase/docvw/edtwin2.cxx | 2
sw/source/uibase/inc/edtwin.hxx | 4 -
vcl/source/window/paint.cxx | 34 +++++++------
12 files changed, 75 insertions(+), 69 deletions(-)
New commits:
commit 0ac80267730300f53e2410ffe9c0883f19f656a6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 13:36:14 2015 +0900
add PostPaint and change PrePaint to include RenderContext param.
Change-Id: I26e03159fa6115025c6cf376e6ce71443bc98cec
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index c050b5a..57a3066 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -93,12 +93,12 @@ void ChartWindow::clear()
this->ReleaseMouse();
}
-void ChartWindow::PrePaint()
+void ChartWindow::PrePaint(vcl::RenderContext& /*rRenderContext*/)
{
// forward VCLs PrePaint window event to DrawingLayer
- if( m_pWindowController )
+ if (m_pWindowController)
{
- m_pWindowController->PrePaint();
+ m_pWindowController->PrePaint();
}
}
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index d00c2f6..99a0c5f 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -42,8 +42,8 @@ public:
void clear();
//from base class Window:
- virtual void PrePaint() SAL_OVERRIDE;
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+ 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 Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index d509a55..04cdb0f 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -715,8 +715,9 @@ public:
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void KeyUp( const KeyEvent& rKEvt );
- virtual void PrePaint();
+ 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 ); }
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index aa683cb..e4bb56a 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -293,8 +293,8 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects );
protected:
- virtual void PrePaint() SAL_OVERRIDE;
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 2f291d7..a3e5170 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -283,7 +283,7 @@ void ScGridWindow::DoInvertRect( const Rectangle& rPixel )
UpdateHeaderOverlay(); // uses aInvertRect
}
-void ScGridWindow::PrePaint()
+void ScGridWindow::PrePaint(vcl::RenderContext& /*rRenderContext*/)
{
// forward PrePaint to DrawingLayer
ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
@@ -292,7 +292,7 @@ void ScGridWindow::PrePaint()
{
SdrView* pDrawView = pTabViewShell->GetSdrView();
- if(pDrawView)
+ if (pDrawView)
{
pDrawView->PrePaint();
}
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
index b26917e..c1cc214 100644
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -171,7 +171,7 @@ protected:
bool mbUseDropScroll;
virtual void Resize() SAL_OVERRIDE;
- virtual void PrePaint() SAL_OVERRIDE;
+ virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 84da41d..2cacce0 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -207,7 +207,7 @@ void Window::Resize()
mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
-void Window::PrePaint()
+void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/)
{
if ( mpViewShell )
mpViewShell->PrePaint();
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 1b69c0a..67f8570 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -434,7 +434,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
Window::RequestHelp( rEvt );
}
-void SwEditWin::PrePaint()
+void SwEditWin::PrePaint(vcl::RenderContext& /*rRenderContext*/)
{
SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index c440054..28ce774 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -186,8 +186,8 @@ friend void PageNumNotify( SwViewShell* pVwSh,
protected:
virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
- virtual void PrePaint() SAL_OVERRIDE;
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void PrePaint(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 1afd142..4ba545a 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -51,7 +51,7 @@ private:
bool m_bPop;
bool m_bRestoreCursor;
public:
- PaintHelper(vcl::Window *pWindow, sal_uInt16 nPaintFlags);
+ PaintHelper(vcl::Window* pWindow, sal_uInt16 nPaintFlags);
void SetPop()
{
m_bPop = true;
@@ -377,31 +377,31 @@ PaintHelper::~PaintHelper()
namespace vcl {
-void Window::ImplCallPaint( const vcl::Region* pRegion, sal_uInt16 nPaintFlags )
+void Window::ImplCallPaint(const vcl::Region* pRegion, sal_uInt16 nPaintFlags)
{
// call PrePaint. PrePaint may add to the invalidate region as well as
// other parameters used below.
- PrePaint();
+ PrePaint(*this);
mpWindowImpl->mbPaintFrame = false;
- if ( nPaintFlags & IMPL_PAINT_PAINTALLCHILDREN )
+ if (nPaintFlags & IMPL_PAINT_PAINTALLCHILDREN)
mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALLCHILDREN | (nPaintFlags & IMPL_PAINT_PAINTALL);
- if ( nPaintFlags & IMPL_PAINT_PAINTCHILDREN )
+ if (nPaintFlags & IMPL_PAINT_PAINTCHILDREN)
mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTCHILDREN;
- if ( nPaintFlags & IMPL_PAINT_ERASE )
+ if (nPaintFlags & IMPL_PAINT_ERASE)
mpWindowImpl->mnPaintFlags |= IMPL_PAINT_ERASE;
- if ( nPaintFlags & IMPL_PAINT_CHECKRTL )
+ if (nPaintFlags & IMPL_PAINT_CHECKRTL)
mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL;
- if ( !mpWindowImpl->mpFirstChild )
+ if (!mpWindowImpl->mpFirstChild)
mpWindowImpl->mnPaintFlags &= ~IMPL_PAINT_PAINTALLCHILDREN;
- if ( mpWindowImpl->mbPaintDisabled )
+ if (mpWindowImpl->mbPaintDisabled)
{
- if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
- Invalidate( INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
+ if (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL)
+ Invalidate(INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN);
else if ( pRegion )
- Invalidate( *pRegion, INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
+ Invalidate(*pRegion, INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN);
return;
}
@@ -409,10 +409,12 @@ void Window::ImplCallPaint( const vcl::Region* pRegion, sal_uInt16 nPaintFlags )
PaintHelper aHelper(this, nPaintFlags);
- if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT )
+ if (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT)
aHelper.DoPaint(pRegion);
else
mpWindowImpl->mnPaintFlags = 0;
+
+ PostPaint(*this);
}
void Window::ImplCallOverlapPaint()
@@ -822,7 +824,11 @@ void Window::ImplUpdateAll( bool bOverlapWindows )
Flush();
}
-void Window::PrePaint()
+void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/)
+{
+}
+
+void Window::PostPaint(vcl::RenderContext& /*rRenderContext*/)
{
}
commit 822ee8a3395588d2022d3d560ed4e1ed34c369a5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 13 11:10:53 2015 +0900
refactor RecentDocsView to use RenderContext
Change-Id: I0fd6db7c7eb0481f99639ec7520dc01724fc0db8
diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 45276d3..231c47f 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -66,19 +66,19 @@ protected:
virtual void OnItemDblClicked(ThumbnailViewItem *pItem) 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 LoseFocus() SAL_OVERRIDE;
bool isAcceptedFile(const OUString &rURL) const;
/// Set (larger) font for the Welcome message.
- void SetMessageFont();
+ void SetMessageFont(vcl::RenderContext& rRenderContext);
- long mnItemMaxSize;
- long mnTextHeight;
- long mnItemPadding;
- long mnItemMaxTextLength;
+ long mnItemMaxSize;
+ long mnTextHeight;
+ long mnItemPadding;
+ long mnItemMaxTextLength;
size_t mnLastMouseDownItem;
/// Image that appears when there is no recent document.
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 5437aff..5848045 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -110,11 +110,11 @@ bool RecentDocsView::isAcceptedFile(const OUString &rURL) const
(mnFileTypes & TYPE_OTHER && typeMatchesExtension(TYPE_OTHER, aExt));
}
-void RecentDocsView::SetMessageFont()
+void RecentDocsView::SetMessageFont(vcl::RenderContext& rRenderContext)
{
- vcl::Font aFont(GetFont());
- aFont.SetHeight(aFont.GetHeight()*1.3);
- SetFont(aFont);
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetHeight(aFont.GetHeight() * 1.3);
+ rRenderContext.SetFont(aFont);
}
BitmapEx RecentDocsView::getDefaultThumbnail(const OUString &rURL)
@@ -193,19 +193,6 @@ void RecentDocsView::Reload()
CalculateItemPositions();
Invalidate();
-
- // Set preferred width
- if (mFilteredItemList.empty())
- {
- vcl::Font aOldFont(GetFont());
- SetMessageFont();
- set_width_request(std::max(GetTextWidth(maWelcomeLine1), GetTextWidth(maWelcomeLine2)));
- SetFont(aOldFont);
- }
- else
- {
- set_width_request(mnTextHeight + mnItemMaxSize + 2*mnItemPadding);
- }
}
void RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt )
@@ -251,19 +238,33 @@ void RecentDocsView::OnItemDblClicked(ThumbnailViewItem *pItem)
void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const Rectangle &aRect)
{
- if ( mItemList.size() == 0 )
+ // Set preferred width
+ if (mFilteredItemList.empty())
+ {
+ rRenderContext.Push(PushFlags::FONT);
+ SetMessageFont(rRenderContext);
+ set_width_request(std::max(rRenderContext.GetTextWidth(maWelcomeLine1),
+ rRenderContext.GetTextWidth(maWelcomeLine2)));
+ rRenderContext.Pop();
+ }
+ else
+ {
+ set_width_request(mnTextHeight + mnItemMaxSize + 2 * mnItemPadding);
+ }
+
+ if (mItemList.size() == 0)
{
// No recent files to be shown yet. Show a welcome screen.
- vcl::Font aOldFont(GetFont());
- SetMessageFont();
+ rRenderContext.Push(PushFlags::FONT);
+ SetMessageFont(rRenderContext);
- long nTextHeight = GetTextHeight();
+ long nTextHeight = rRenderContext.GetTextHeight();
- long nTextWidth1 = GetTextWidth(maWelcomeLine1);
- long nTextWidth2 = GetTextWidth(maWelcomeLine2);
+ long nTextWidth1 = rRenderContext.GetTextWidth(maWelcomeLine1);
+ long nTextWidth2 = rRenderContext.GetTextWidth(maWelcomeLine2);
- const Size & rImgSize = maWelcomeImage.GetSizePixel();
- const Size & rSize = GetSizePixel();
+ const Size& rImgSize = maWelcomeImage.GetSizePixel();
+ const Size& rSize = GetSizePixel();
const int nX = (rSize.Width() - rImgSize.Width())/2;
const int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2;
@@ -272,14 +273,16 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const Rectangle &
Point aStr1Point((rSize.Width() - nTextWidth1)/2, nY + rImgSize.Height() + 0.7 * nTextHeight);
Point aStr2Point((rSize.Width() - nTextWidth2)/2, nY + rImgSize.Height() + 1.7 * nTextHeight);
- DrawImage(aImgPoint, rImgSize, maWelcomeImage, IMAGE_DRAW_SEMITRANSPARENT);
- DrawText(aStr1Point, maWelcomeLine1);
- DrawText(aStr2Point, maWelcomeLine2);
+ rRenderContext.DrawImage(aImgPoint, rImgSize, maWelcomeImage, IMAGE_DRAW_SEMITRANSPARENT);
+ rRenderContext.DrawText(aStr1Point, maWelcomeLine1);
+ rRenderContext.DrawText(aStr2Point, maWelcomeLine2);
- SetFont(aOldFont);
+ rRenderContext.Pop();
}
else
+ {
ThumbnailView::Paint(rRenderContext, aRect);
+ }
}
void RecentDocsView::LoseFocus()
@@ -292,11 +295,7 @@ void RecentDocsView::LoseFocus()
void RecentDocsView::Clear()
{
- vcl::Font aOldFont(GetFont());
- SetMessageFont();
- set_width_request(std::max(GetTextWidth(maWelcomeLine1), GetTextWidth(maWelcomeLine2)));
- SetFont(aOldFont);
-
+ Invalidate();
ThumbnailView::Clear();
}
More information about the Libreoffice-commits
mailing list