[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 4 commits - desktop/source include/svtools include/vcl svtools/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu Jun 4 01:36:32 PDT 2015
desktop/source/splash/splash.cxx | 19 +-
include/svtools/ruler.hxx | 9 -
include/vcl/status.hxx | 2
svtools/source/contnr/treelistbox.cxx | 2
svtools/source/control/ruler.cxx | 248 +++++++++++++++-------------------
vcl/source/window/status.cxx | 96 ++++---------
6 files changed, 162 insertions(+), 214 deletions(-)
New commits:
commit 4d68f980a5b41b6713563cf7119dd7b9eb5a67d4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Jun 4 16:48:31 2015 +0900
tdf#91529 hopefully fixes the issue by painting immediately
Change-Id: I0c97e489150cd65d1ab1dbff4ee9f1699f89ac2e
(cherry picked from commit aca61aa5ffa4fab458d03e469b569c50952ed077)
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 6794d15..63c8232 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -59,6 +59,8 @@ public:
virtual void dispose() SAL_OVERRIDE;
// workwindow
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
+ void Redraw();
+
};
class SplashScreen
@@ -143,6 +145,15 @@ void SplashScreenWindow::dispose()
IntroWindow::dispose();
}
+void SplashScreenWindow::Redraw()
+{
+ Invalidate();
+ // Trigger direct painting too - otherwise the splash screen won't be
+ // shown in some cases (when the idle timer won't be hit).
+ Paint(*this, Rectangle());
+ Flush();
+}
+
SplashScreen::SplashScreen()
: pWindow( new SplashScreenWindow (this) )
, _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED))
@@ -194,8 +205,7 @@ void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange)
if ( _eBitmapMode == BM_FULLSCREEN )
pWindow->ShowFullScreenMode( true );
pWindow->Show();
- pWindow->Invalidate();
- pWindow->Flush();
+ pWindow->Redraw();
}
}
@@ -352,8 +362,7 @@ void SplashScreen::updateStatus()
return;
if (!_bPaintProgress)
_bPaintProgress = true;
- pWindow->Invalidate();
- pWindow->Flush();
+ pWindow->Redraw();
}
// internal private methods
@@ -364,7 +373,7 @@ IMPL_LINK( SplashScreen, AppEventListenerHdl, VclWindowEvent *, inEvent )
switch ( inEvent->GetId() )
{
case VCLEVENT_WINDOW_SHOW:
- pWindow->Invalidate();
+ pWindow->Redraw();
break;
default:
break;
commit 4ad0738f0203d3219d5570e08836ca801624b0a4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Jun 4 12:18:36 2015 +0900
fix status bar flickering (zoom slider fo example)
Change-Id: I3fb71868a9f8f56c76353f3a2d84fdb078c8f8fb
(cherry picked from commit 758916a88d6dfbabc31b8430b1cc605cb2c1e890)
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index 85a94cd..fd79dd1 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -96,7 +96,7 @@ private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
- SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SAL_DLLPRIVATE void ImplInitSettings();
SAL_DLLPRIVATE void ImplFormat();
SAL_DLLPRIVATE bool ImplIsItemUpdate();
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index b9669d7..211e383 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -123,7 +123,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
// remember WinBits
mpItemList = new ImplStatusItemList;
- mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this );
+ mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this );
mnCurItemId = 0;
mbFormat = true;
mbVisibleItems = true;
@@ -137,8 +137,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
mnItemY = STATUSBAR_OFFSET_Y;
mnTextY = STATUSBAR_OFFSET_TEXTY;
- ImplInitSettings( true, true, true );
- SetLineColor();
+ ImplInitSettings();
SetOutputSizePixel( CalcWindowSizePixel() );
}
@@ -175,6 +174,8 @@ void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI)
void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext)
{
+ rRenderContext.SetLineColor();
+
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
vcl::Font aFont = rStyleSettings.GetToolFont();
if (IsControlFont())
@@ -209,56 +210,15 @@ void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext)
}
}
-void StatusBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
+void StatusBar::ImplInitSettings()
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if (bFont)
- {
- vcl::Font aFont = rStyleSettings.GetToolFont();
- if (IsControlFont())
- aFont.Merge(GetControlFont());
- SetZoomedPointFont(*this, aFont);
- }
-
- if (bForeground || bFont)
- {
- Color aColor;
- if (IsControlForeground())
- aColor = GetControlForeground();
- else if ( GetStyle() & WB_3DLOOK )
- aColor = rStyleSettings.GetButtonTextColor();
- else
- aColor = rStyleSettings.GetWindowTextColor();
- SetTextColor(aColor);
- SetTextFillColor();
-
- mpImplData->mpVirDev->SetFont( GetFont() );
- mpImplData->mpVirDev->SetTextColor( GetTextColor() );
- mpImplData->mpVirDev->SetTextAlign( GetTextAlign() );
- mpImplData->mpVirDev->SetTextFillColor();
- }
+ ApplySettings(*this);
- if ( bBackground )
- {
- Color aColor;
- if ( IsControlBackground() )
- aColor = GetControlBackground();
- else if ( GetStyle() & WB_3DLOOK )
- aColor = rStyleSettings.GetFaceColor();
- else
- aColor = rStyleSettings.GetWindowColor();
- SetBackground( aColor );
- mpImplData->mpVirDev->SetBackground( GetBackground() );
-
- // NWF background
- if( ! IsControlBackground() &&
- IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_WINDOW ) )
- {
- ImplGetWindowImpl()->mnNativeBackground = PART_BACKGROUND_WINDOW;
- EnableChildTransparentMode( true );
- }
- }
+ mpImplData->mpVirDev->SetFont(GetFont());
+ mpImplData->mpVirDev->SetTextColor(GetTextColor());
+ mpImplData->mpVirDev->SetTextAlign(GetTextAlign());
+ mpImplData->mpVirDev->SetTextFillColor();
+ mpImplData->mpVirDev->SetBackground(GetBackground());
}
void StatusBar::ImplFormat()
@@ -745,7 +705,20 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() );
if (mbProgressMode)
+ {
+ rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ Color aProgressColor = rStyleSettings.GetHighlightColor();
+ if (aProgressColor == rStyleSettings.GetFaceColor())
+ aProgressColor = rStyleSettings.GetDarkShadowColor();
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(aProgressColor);
+
ImplDrawProgress(rRenderContext, true, 0, mnPercent);
+
+ rRenderContext.Pop();
+ }
else
{
// draw text
@@ -756,7 +729,7 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
if (mbVisibleItems)
{
for (sal_uInt16 i = 0; i < nItemCount; i++)
- ImplDrawItem(rRenderContext, false, i, true, true);
+ ImplDrawItem(rRenderContext, true, i, true, true);
}
}
@@ -869,17 +842,17 @@ void StatusBar::StateChanged( StateChangedType nType )
(nType == StateChangedType::ControlFont) )
{
mbFormat = true;
- ImplInitSettings( true, false, false );
+ ImplInitSettings();
Invalidate();
}
else if ( nType == StateChangedType::ControlForeground )
{
- ImplInitSettings( false, true, false );
+ ImplInitSettings();
Invalidate();
}
else if ( nType == StateChangedType::ControlBackground )
{
- ImplInitSettings( false, false, true );
+ ImplInitSettings();
Invalidate();
}
}
@@ -897,7 +870,7 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
)
{
mbFormat = true;
- ImplInitSettings( true, true, true );
+ ImplInitSettings();
long nFudge = GetTextHeight() / 4;
for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
{
@@ -1258,7 +1231,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
{
Update();
Rectangle aRect = ImplGetItemRectPos(nPos);
- Invalidate(aRect);
+ Invalidate(aRect, InvalidateFlags::NoErase);
Flush();
}
}
@@ -1379,12 +1352,6 @@ void StatusBar::StartProgressMode( const OUString& rText )
ImplCalcProgressRect();
// trigger Paint, which draws text and frame
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- Color aPrgsColor = rStyleSettings.GetHighlightColor();
- if ( aPrgsColor == rStyleSettings.GetFaceColor() )
- aPrgsColor = rStyleSettings.GetDarkShadowColor();
- SetLineColor();
- SetFillColor( aPrgsColor );
if ( IsReallyVisible() )
{
Invalidate();
@@ -1403,7 +1370,6 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
&& (!mnPercent || (mnPercent != nNewPercent)) )
{
Update();
- SetLineColor();
Invalidate();
Flush();
}
@@ -1417,8 +1383,6 @@ void StatusBar::EndProgressMode()
mbProgressMode = false;
maPrgsTxt.clear();
- // re-trigger Paint to recreate StatusBar
- SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
if ( IsReallyVisible() )
{
Invalidate();
commit 1cd89bbdedca229c950c33374efe664389ac07cd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Jun 3 20:18:31 2015 +0900
forgot to change the Invalidate to InvalidateEntry in treelistbox
Change-Id: Ifa70abbecb6899d0e665039cecc2d9036ffc4b92
(cherry picked from commit 2e4380a0773acb72c5ee30e976b8af6ece71396a)
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 13cefab..8346639 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -2675,7 +2675,7 @@ void SvTreeListBox::EditItemText(SvTreeListEntry* pEntry, SvLBoxString* pItem, c
{
pImp->ShowCursor( false );
SelectListEntry( pEntry, false );
- Invalidate();
+ pImp->InvalidateEntry(pEntry);
SelectListEntry( pEntry, true );
pImp->ShowCursor( true );
}
commit 5c0866da20ebd1ab7ded67153af2b7a43edb69b6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Jun 3 17:49:41 2015 +0900
tdf#91677 fix flickering ruler
Change-Id: Ia14be98fbfd46871b2ac9bd42a07951d86722a8a
(cherry picked from commit f64588a9238cf0cb122c43d927d73822eca3b6ae)
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index 4724334..27b1380 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -663,9 +663,10 @@ private:
SvtRulerAccessible* pAccContext;
- SVT_DLLPRIVATE void ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 );
- SVT_DLLPRIVATE void ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 );
- SVT_DLLPRIVATE void ImplVDrawText( long nX, long nY, const OUString& rText, long nMin = LONG_MIN, long nMax = LONG_MAX );
+ SVT_DLLPRIVATE void ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawText(vcl::RenderContext& rRenderContext, long nX, long nY, const OUString& rText,
+ long nMin = LONG_MIN, long nMax = LONG_MAX );
SVT_DLLPRIVATE void ImplDrawTicks(vcl::RenderContext& rRenderContext,
long nMin, long nMax, long nStart, long nVirTop, long nVirBottom);
@@ -702,8 +703,6 @@ private:
SVT_DLLPRIVATE void ImplDrag( const Point& rPos );
SVT_DLLPRIVATE void ImplEndDrag();
- DECL_DLLPRIVATE_LINK( ImplUpdateHdl, void* );
-
Ruler (const Ruler &) SAL_DELETED_FUNCTION;
Ruler& operator= (const Ruler &) SAL_DELETED_FUNCTION;
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 0e68c79..69bc040 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -45,7 +45,6 @@ using namespace ::com::sun::star::accessibility;
#define RULER_VAR_SIZE 8
#define RULER_UPDATE_LINES 0x01
-#define RULER_UPDATE_DRAW 0x02
#define RULER_CLIP 150
@@ -343,7 +342,7 @@ void Ruler::dispose()
Window::dispose();
}
-void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
+void Ruler::ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2)
{
if ( nX1 < -RULER_CLIP )
{
@@ -360,12 +359,12 @@ void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev->DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
+ rRenderContext.DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
else
- maVirDev->DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
+ rRenderContext.DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
}
-void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
+void Ruler::ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2)
{
if ( nX1 < -RULER_CLIP )
{
@@ -382,15 +381,15 @@ void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev->DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
+ rRenderContext.DrawRect(Rectangle(nX1, nY1, nX2, nY2));
else
- maVirDev->DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
+ rRenderContext.DrawRect(Rectangle(nY1, nX1, nY2, nX2));
}
-void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, long nMax )
+void Ruler::ImplVDrawText(vcl::RenderContext& rRenderContext, long nX, long nY, const OUString& rText, long nMin, long nMax)
{
Rectangle aRect;
- maVirDev->GetTextBoundRect( aRect, rText );
+ rRenderContext.GetTextBoundRect(aRect, rText);
long nShiftX = ( aRect.GetWidth() / 2 ) + aRect.Left();
long nShiftY = ( aRect.GetHeight() / 2 ) + aRect.Top();
@@ -398,9 +397,9 @@ void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, l
if ( (nX > -RULER_CLIP) && (nX < mnVirWidth + RULER_CLIP) && ( nX < nMax - nShiftX ) && ( nX > nMin + nShiftX ) )
{
if ( mnWinStyle & WB_HORZ )
- maVirDev->DrawText( Point( nX - nShiftX, nY - nShiftY ), rText );
+ rRenderContext.DrawText(Point(nX - nShiftX, nY - nShiftY), rText);
else
- maVirDev->DrawText( Point( nY - nShiftX, nX - nShiftY ), rText );
+ rRenderContext.DrawText(Point(nY - nShiftX, nX - nShiftY), rText);
}
}
@@ -463,6 +462,7 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext, bool bErase)
Invert(aRect);
}
}
+ mnUpdateFlags = 0;
}
}
@@ -486,7 +486,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
double nAcceptanceDelta = 0.0001;
- Size aPixSize = maVirDev->LogicToPixel(Size(nTick4, nTick4), maMapMode);
+ Size aPixSize = rRenderContext.LogicToPixel(Size(nTick4, nTick4), maMapMode);
if (mnUnitIndex == RULER_UNIT_CHAR)
{
@@ -518,11 +518,11 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
aFont.SetOrientation(2700);
else
aFont.SetOrientation(900);
- maVirDev->SetFont(aFont);
+ rRenderContext.SetFont(aFont);
nTickWidth = aPixSize.Height();
}
- long nMaxWidth = maVirDev->PixelToLogic(Size(mpData->nPageWidth, 0), maMapMode).Width();
+ long nMaxWidth = rRenderContext.PixelToLogic(Size(mpData->nPageWidth, 0), maMapMode).Width();
if (nMaxWidth < 0)
nMaxWidth = -nMaxWidth;
@@ -532,7 +532,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit;
OUString aNumString = OUString::number(nMaxWidth);
- long nTxtWidth = GetTextWidth( aNumString );
+ long nTxtWidth = rRenderContext.GetTextWidth( aNumString );
const long nTextOff = 4;
// Determine the number divider for ruler drawn numbers - means which numbers
@@ -566,7 +566,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
}
nTick4 = nOrgTick4 * nMulti;
- aPixSize = maVirDev->LogicToPixel(Size(nTick4, nTick4), maMapMode);
+ aPixSize = rRenderContext.LogicToPixel(Size(nTick4, nTick4), maMapMode);
if (mnWinStyle & WB_HORZ)
nTickWidth = aPixSize.Width();
else
@@ -576,7 +576,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
}
else
{
- maVirDev->SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
+ rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
}
if (!bNoTicks)
@@ -593,11 +593,11 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
Size nTickGapSize;
- nTickGapSize = maVirDev->LogicToPixel(Size(nTickCount, nTickCount), maMapMode);
+ nTickGapSize = rRenderContext.LogicToPixel(Size(nTickCount, nTickCount), maMapMode);
long nTickGap1 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev->LogicToPixel(Size(nTick2, nTick2), maMapMode);
+ nTickGapSize = rRenderContext.LogicToPixel(Size(nTick2, nTick2), maMapMode);
long nTickGap2 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev->LogicToPixel(Size(nTick3, nTick3), maMapMode);
+ nTickGapSize = rRenderContext.LogicToPixel(Size(nTick3, nTick3), maMapMode);
long nTickGap3 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
while (((nStart - n) >= nMin) || ((nStart + n) <= nMax))
@@ -611,13 +611,13 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
if ((mpData->nMargin1Style & RULER_STYLE_INVISIBLE) || (mpData->nMargin1 != 0))
{
aNumString = "0";
- ImplVDrawText(nStart, nCenter, aNumString);
+ ImplVDrawText(rRenderContext, nStart, nCenter, aNumString);
}
}
}
else
{
- aPixSize = maVirDev->LogicToPixel(Size(nTick, nTick), maMapMode);
+ aPixSize = rRenderContext.LogicToPixel(Size(nTick, nTick), maMapMode);
if (mnWinStyle & WB_HORZ)
n = aPixSize.Width();
@@ -636,21 +636,23 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
aNumString = OUString::number(nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit);
long nHorizontalLocation = nStart + n;
- ImplVDrawText(nHorizontalLocation, nCenter, aNumString, nMin, nMax);
+ ImplVDrawText(rRenderContext, nHorizontalLocation, nCenter, aNumString, nMin, nMax);
if (nMin < nHorizontalLocation && nHorizontalLocation < nMax)
{
- ImplVDrawRect(nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset, nBottom - 1 * nScale);
- ImplVDrawRect(nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset, nTop + 1 * nScale);
+ ImplVDrawRect(rRenderContext, nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset, nBottom - 1 * nScale);
+ ImplVDrawRect(rRenderContext, nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset, nTop + 1 * nScale);
}
nHorizontalLocation = nStart - n;
- ImplVDrawText(nHorizontalLocation, nCenter, aNumString, nMin, nMax);
+ ImplVDrawText(rRenderContext, nHorizontalLocation, nCenter, aNumString, nMin, nMax);
if (nMin < nHorizontalLocation && nHorizontalLocation < nMax)
{
- ImplVDrawRect(nHorizontalLocation, nBottom, nHorizontalLocation + DPIOffset, nBottom - 1 * nScale);
- ImplVDrawRect( nHorizontalLocation, nTop, nHorizontalLocation + DPIOffset, nTop + 1 * nScale );
+ ImplVDrawRect(rRenderContext, nHorizontalLocation, nBottom,
+ nHorizontalLocation + DPIOffset, nBottom - 1 * nScale);
+ ImplVDrawRect(rRenderContext, nHorizontalLocation, nTop,
+ nHorizontalLocation + DPIOffset, nTop + 1 * nScale);
}
}
// Tick/Tick2 - Output (Strokes)
@@ -679,10 +681,10 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM
nT = nStart + n;
if (nT < nMax)
- ImplVDrawRect(nT, nT1, nT + DPIOffset, nT2);
+ ImplVDrawRect(rRenderContext, nT, nT1, nT + DPIOffset, nT2);
nT = nStart - n;
if (nT > nMin)
- ImplVDrawRect(nT, nT1, nT + DPIOffset, nT2);
+ ImplVDrawRect(rRenderContext, nT, nT1, nT + DPIOffset, nT2);
}
}
}
@@ -713,21 +715,21 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
{
if ((n2 - n1) > 3)
{
- maVirDev->SetLineColor();
- maVirDev->SetFillColor(rStyleSettings.GetFaceColor());
- ImplVDrawRect(n1, nVirTop, n2, nVirBottom);
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(rStyleSettings.GetFaceColor());
+ ImplVDrawRect(rRenderContext, n1, nVirTop, n2, nVirBottom);
- maVirDev->SetLineColor(rStyleSettings.GetLightColor());
- ImplVDrawLine(n1 + 1, nVirTop, n1 + 1, nVirBottom);
- ImplVDrawLine(n1, nVirTop, n2, nVirTop);
+ rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
+ ImplVDrawLine(rRenderContext, n1 + 1, nVirTop, n1 + 1, nVirBottom);
+ ImplVDrawLine(rRenderContext, n1, nVirTop, n2, nVirTop);
- maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
- ImplVDrawLine(n1, nVirTop, n1, nVirBottom);
- ImplVDrawLine(n1, nVirBottom, n2, nVirBottom);
- ImplVDrawLine(n2 - 1, nVirTop, n2 - 1, nVirBottom);
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ ImplVDrawLine(rRenderContext, n1, nVirTop, n1, nVirBottom);
+ ImplVDrawLine(rRenderContext, n1, nVirBottom, n2, nVirBottom);
+ ImplVDrawLine(rRenderContext, n2 - 1, nVirTop, n2 - 1, nVirBottom);
- maVirDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
- ImplVDrawLine(n2, nVirTop, n2, nVirBottom);
+ rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+ ImplVDrawLine(rRenderContext, n2, nVirTop, n2, nVirBottom);
if (mpData->pBorders[i].nStyle & RULER_BORDER_VARIABLE)
{
@@ -739,18 +741,18 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
long nTemp4 = nTemp2 + RULER_VAR_SIZE - 1;
long nTempY = nTemp2;
- maVirDev->SetLineColor(rStyleSettings.GetLightColor());
+ rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
while (nTempY <= nTemp4)
{
- ImplVDrawLine(nTemp1, nTempY, nTemp3, nTempY);
+ ImplVDrawLine(rRenderContext, nTemp1, nTempY, nTemp3, nTempY);
nTempY += 2;
}
nTempY = nTemp2 + 1;
- maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
while (nTempY <= nTemp4)
{
- ImplVDrawLine(nTemp1, nTempY, nTemp3, nTempY);
+ ImplVDrawLine(rRenderContext, nTemp1, nTempY, nTemp3, nTempY);
nTempY += 2;
}
}
@@ -760,31 +762,31 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long
{
if (n2 - n1 > RULER_VAR_SIZE + 10)
{
- maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
- ImplVDrawLine(n1 + 4, nVirTop + 3, n1 + 4, nVirBottom - 3);
- ImplVDrawLine(n2 - 5, nVirTop + 3, n2 - 5, nVirBottom - 3);
- maVirDev->SetLineColor( rStyleSettings.GetLightColor());
- ImplVDrawLine(n1 + 5, nVirTop + 3, n1 + 5, nVirBottom - 3);
- ImplVDrawLine(n2 - 4, nVirTop + 3, n2 - 4, nVirBottom - 3);
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ ImplVDrawLine(rRenderContext, n1 + 4, nVirTop + 3, n1 + 4, nVirBottom - 3);
+ ImplVDrawLine(rRenderContext, n2 - 5, nVirTop + 3, n2 - 5, nVirBottom - 3);
+ rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
+ ImplVDrawLine(rRenderContext, n1 + 5, nVirTop + 3, n1 + 5, nVirBottom - 3);
+ ImplVDrawLine(rRenderContext, n2 - 4, nVirTop + 3, n2 - 4, nVirBottom - 3);
}
}
}
else
{
n = n1 + ((n2 - n1) / 2);
- maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
if (mpData->pBorders[i].nStyle & RULER_BORDER_SNAP)
- ImplVDrawLine(n, nVirTop, n, nVirBottom);
+ ImplVDrawLine(rRenderContext, n, nVirTop, n, nVirBottom);
else if (mpData->pBorders[i].nStyle & RULER_BORDER_MARGIN)
- ImplVDrawLine(n, nVirTop, n, nVirBottom);
+ ImplVDrawLine(rRenderContext, n, nVirTop, n, nVirBottom);
else
{
- ImplVDrawLine(n - 1, nVirTop, n - 1, nVirBottom);
- ImplVDrawLine(n + 1, nVirTop, n + 1, nVirBottom);
- maVirDev->SetLineColor();
- maVirDev->SetFillColor(rStyleSettings.GetWindowColor());
- ImplVDrawRect(n, nVirTop, n, nVirBottom);
+ ImplVDrawLine(rRenderContext, n - 1, nVirTop, n - 1, nVirBottom);
+ ImplVDrawLine(rRenderContext, n + 1, nVirTop, n + 1, nVirBottom);
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(rStyleSettings.GetWindowColor());
+ ImplVDrawRect(rRenderContext, n, nVirTop, n, nVirBottom);
}
}
}
@@ -798,9 +800,9 @@ void Ruler::ImplDrawIndent(vcl::RenderContext& rRenderContext, const Polygon& rP
if (nStyle & RULER_STYLE_INVISIBLE)
return;
- maVirDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
- maVirDev->SetFillColor(bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor());
- maVirDev->DrawPolygon(rPoly);
+ rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+ rRenderContext.SetFillColor(bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor());
+ rRenderContext.DrawPolygon(rPoly);
}
void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom)
@@ -827,8 +829,8 @@ void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long
if (nIndentStyle == RULER_INDENT_BORDER)
{
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
- ImplVDrawLine(n, nVirTop + 1, n, nVirBottom - 1);
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ ImplVDrawLine(rRenderContext, n, nVirTop + 1, n, nVirBottom - 1);
}
else if (nIndentStyle == RULER_INDENT_BOTTOM)
{
@@ -1020,7 +1022,7 @@ void Ruler::ImplDrawTab(vcl::RenderContext& rRenderContext, const Point& rPos, s
ImplDrawRulerTab(rRenderContext, rPos, nStyle, GetStyle());
}
-void Ruler::ImplDrawTabs(vcl::RenderContext& /*rRenderContext*/, long nMin, long nMax, long nVirTop, long nVirBottom)
+void Ruler::ImplDrawTabs(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom)
{
for (sal_uInt32 i = 0; i < mpData->pTabs.size(); i++)
{
@@ -1032,7 +1034,7 @@ void Ruler::ImplDrawTabs(vcl::RenderContext& /*rRenderContext*/, long nMin, long
aPosition += +mpData->nNullVirOff;
long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom;
if (nMin <= aPosition && aPosition <= nMax)
- ImplDrawTab(*maVirDev.get(), Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle);
+ ImplDrawTab(rRenderContext, Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle);
}
}
@@ -1245,8 +1247,8 @@ void Ruler::ImplFormat(vcl::RenderContext& rRenderContext)
// top/bottom border
maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
- ImplVDrawLine(nVirLeft, nVirTop + 1, nM1, nVirTop + 1); //top left line
- ImplVDrawLine(nM2, nVirTop + 1, nP2 - 1, nVirTop + 1); //top right line
+ ImplVDrawLine(*maVirDev.get(), nVirLeft, nVirTop + 1, nM1, nVirTop + 1); //top left line
+ ImplVDrawLine(*maVirDev.get(), nM2, nVirTop + 1, nP2 - 1, nVirTop + 1); //top right line
nVirTop++;
nVirBottom--;
@@ -1255,31 +1257,31 @@ void Ruler::ImplFormat(vcl::RenderContext& rRenderContext)
maVirDev->SetLineColor();
maVirDev->SetFillColor(rStyleSettings.GetDialogColor());
if (nM1 > nVirLeft)
- ImplVDrawRect(nP1, nVirTop + 1, nM1, nVirBottom); //left gray rectangle
+ ImplVDrawRect(*maVirDev.get(), nP1, nVirTop + 1, nM1, nVirBottom); //left gray rectangle
if (nM2 < nP2)
- ImplVDrawRect(nM2, nVirTop + 1, nP2, nVirBottom); //right gray rectangle
+ ImplVDrawRect(*maVirDev.get(), nM2, nVirTop + 1, nP2, nVirBottom); //right gray rectangle
if (nM2 - nM1 > 0)
{
maVirDev->SetFillColor(rStyleSettings.GetWindowColor());
- ImplVDrawRect(nM1 + 1, nVirTop, nM2 - 1, nVirBottom); //center rectangle
+ ImplVDrawRect(*maVirDev.get(), nM1 + 1, nVirTop, nM2 - 1, nVirBottom); //center rectangle
}
maVirDev->SetLineColor(rStyleSettings.GetShadowColor());
if (nM1 > nVirLeft)
{
- ImplVDrawLine(nM1, nVirTop + 1, nM1, nVirBottom); //right line of the left rectangle
- ImplVDrawLine(nP1, nVirBottom, nM1, nVirBottom); //bottom line of the left rectangle
+ ImplVDrawLine(*maVirDev.get(), nM1, nVirTop + 1, nM1, nVirBottom); //right line of the left rectangle
+ ImplVDrawLine(*maVirDev.get(), nP1, nVirBottom, nM1, nVirBottom); //bottom line of the left rectangle
if (nP1 >= nVirLeft)
{
- ImplVDrawLine(nP1, nVirTop + 1, nP1, nVirBottom); //left line of the left rectangle
- ImplVDrawLine(nP1, nVirBottom, nP1 + 1, nVirBottom); //?
+ ImplVDrawLine(*maVirDev.get(), nP1, nVirTop + 1, nP1, nVirBottom); //left line of the left rectangle
+ ImplVDrawLine(*maVirDev.get(), nP1, nVirBottom, nP1 + 1, nVirBottom); //?
}
}
if (nM2 < nP2)
{
- ImplVDrawLine(nM2, nVirBottom, nP2 - 1, nVirBottom); //bottom line of the right rectangle
- ImplVDrawLine(nM2, nVirTop + 1, nM2, nVirBottom); //left line of the right rectangle
+ ImplVDrawLine(*maVirDev.get(), nM2, nVirBottom, nP2 - 1, nVirBottom); //bottom line of the right rectangle
+ ImplVDrawLine(*maVirDev.get(), nM2, nVirTop + 1, nM2, nVirBottom); //left line of the right rectangle
if (nP2 <= nVirRight + 1)
- ImplVDrawLine(nP2 - 1, nVirTop + 1, nP2 - 1, nVirBottom); //right line of the right rectangle
+ ImplVDrawLine(*maVirDev.get(), nP2 - 1, nVirTop + 1, nP2 - 1, nVirBottom); //right line of the right rectangle
}
long nMin = nVirLeft;
@@ -1298,19 +1300,19 @@ void Ruler::ImplFormat(vcl::RenderContext& rRenderContext)
nMax--;
// Draw captions
- ImplDrawTicks(rRenderContext, nMin, nMax, nStart, nVirTop, nVirBottom);
+ ImplDrawTicks(*maVirDev.get(), nMin, nMax, nStart, nVirTop, nVirBottom);
// Draw borders
if (!mpData->pBorders.empty())
- ImplDrawBorders(rRenderContext, nVirLeft, nP2, nVirTop, nVirBottom);
+ ImplDrawBorders(*maVirDev.get(), nVirLeft, nP2, nVirTop, nVirBottom);
// Draw indents
if (!mpData->pIndents.empty())
- ImplDrawIndents(rRenderContext, nVirLeft, nP2, nVirTop - 1, nVirBottom + 1);
+ ImplDrawIndents(*maVirDev.get(), nVirLeft, nP2, nVirTop - 1, nVirBottom + 1);
// Tabs
if (!mpData->pTabs.empty())
- ImplDrawTabs(rRenderContext, nVirLeft, nP2, nVirTop-1, nVirBottom + 1);
+ ImplDrawTabs(*maVirDev.get(), nVirLeft, nP2, nVirTop-1, nVirBottom + 1);
mbFormat = false;
}
@@ -1467,7 +1469,7 @@ void Ruler::ImplUpdate( bool bMustCalc )
{
// clear lines in this place so they aren't considered at recalculation
if (!mbFormat)
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
// set flags
if (bMustCalc)
@@ -1481,9 +1483,7 @@ void Ruler::ImplUpdate( bool bMustCalc )
// otherwise trigger update
if (IsReallyVisible() && IsUpdateMode())
{
- mnUpdateFlags |= RULER_UPDATE_DRAW;
- if (!mnUpdateEvtId)
- mnUpdateEvtId = Application::PostUserEvent(LINK( this, Ruler, ImplUpdateHdl), NULL, true);
+ Invalidate(InvalidateFlags::NoErase);
}
}
@@ -1876,10 +1876,10 @@ bool Ruler::ImplStartDrag( RulerSelection* pHitTest, sal_uInt16 nModifier )
if (StartDrag())
{
// if the handler allows dragging, initialize dragging
- Invalidate();
mbDrag = true;
mnStartDragPos = mnDragPos;
StartTracking();
+ Invalidate(InvalidateFlags::NoErase);
return true;
}
else
@@ -1946,7 +1946,7 @@ void Ruler::ImplDrag( const Point& rPos )
Drag();
// and redraw
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
// reset the data as before cancel
*mpDragData = aTempData;
@@ -1966,8 +1966,8 @@ void Ruler::ImplDrag( const Point& rPos )
Drag();
// redraw
- if ( mbFormat )
- Invalidate();
+ if (mbFormat)
+ Invalidate(InvalidateFlags::NoErase);
}
}
@@ -1996,26 +1996,7 @@ void Ruler::ImplEndDrag()
mnStartDragPos = 0;
// redraw
- Invalidate();
-}
-
-IMPL_LINK_NOARG(Ruler, ImplUpdateHdl)
-{
- mnUpdateEvtId = 0;
-
- // what should be updated
- if (mnUpdateFlags & RULER_UPDATE_DRAW)
- {
- mnUpdateFlags = 0;
- Invalidate();
- }
- else if (mnUpdateFlags & RULER_UPDATE_LINES)
- {
- mnUpdateFlags = 0;
- Invalidate();
- }
-
- return 0;
+ Invalidate(InvalidateFlags::NoErase);
}
void Ruler::MouseButtonDown( const MouseEvent& rMEvt )
@@ -2029,8 +2010,7 @@ void Ruler::MouseButtonDown( const MouseEvent& rMEvt )
// update ruler
if ( mbFormat )
{
- Invalidate();
- mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ Invalidate(InvalidateFlags::NoErase);
}
if ( maExtraRect.IsInside( aMousePos ) )
@@ -2090,6 +2070,8 @@ void Ruler::MouseMove( const MouseEvent& rMEvt )
{
PointerStyle ePtrStyle = PointerStyle::Arrow;
+ mxPreviousHitTest.swap(mxCurrentHitTest);
+
mxCurrentHitTest.reset(new RulerSelection);
maHoverSelection.eType = RULER_TYPE_DONTKNOW;
@@ -2128,19 +2110,17 @@ void Ruler::MouseMove( const MouseEvent& rMEvt )
}
}
- if(mxPreviousHitTest.get() != NULL && mxPreviousHitTest->eType != mxCurrentHitTest->eType)
+ if (mxPreviousHitTest.get() != NULL && mxPreviousHitTest->eType != mxCurrentHitTest->eType)
{
mbFormat = true;
}
SetPointer( Pointer(ePtrStyle) );
- if ( mbFormat )
+ if (mbFormat)
{
- Invalidate();
- mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ Invalidate(InvalidateFlags::NoErase);
}
- mxPreviousHitTest.swap(mxCurrentHitTest);
}
void Ruler::Tracking( const TrackingEvent& rTEvt )
@@ -2189,16 +2169,15 @@ void Ruler::Resize()
nNewHeight = 0;
}
+ mbFormat = true;
+
// clear lines
bool bVisible = IsReallyVisible();
if ( bVisible && !mpData->pLines.empty() )
{
- Invalidate();
mnUpdateFlags |= RULER_UPDATE_LINES;
- if ( !mnUpdateEvtId )
- mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL, true );
+ Invalidate(InvalidateFlags::NoErase);
}
- mbFormat = true;
// recalculate some values if the height/width changes
// extra field should always be updated
@@ -2220,7 +2199,7 @@ void Ruler::Resize()
if ( bVisible )
{
if ( nNewHeight )
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
else if ( mpData->bAutoPageWidth )
{
// only at AutoPageWidth muss we redraw
@@ -2247,7 +2226,7 @@ void Ruler::Resize()
aRect.Right() = RULER_OFF + mnVirHeight;
}
- Invalidate( aRect );
+ Invalidate(aRect, InvalidateFlags::NoErase);
}
}
@@ -2339,14 +2318,13 @@ void Ruler::Activate()
// update positionlies - draw is delayed
mnUpdateFlags |= RULER_UPDATE_LINES;
- if ( !mnUpdateEvtId )
- mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL, true );
+ Invalidate(InvalidateFlags::NoErase);
}
void Ruler::Deactivate()
{
// clear positionlines
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
mbActive = false;
}
@@ -2366,8 +2344,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
// update ruler
if ( mbFormat )
{
- Invalidate();
- mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ Invalidate(InvalidateFlags::NoErase);
}
if ( nMouseClicks == 1 )
@@ -2432,8 +2409,7 @@ RulerType Ruler::GetType( const Point& rPos, sal_uInt16* pAryPos )
// update ruler
if ( IsReallyVisible() && mbFormat )
{
- Invalidate();
- mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ Invalidate(InvalidateFlags::NoErase);
}
(void)ImplHitTest(rPos, &aHitTest);
@@ -2483,7 +2459,7 @@ void Ruler::SetBorderPos( long nOff )
mnBorderOff = nOff;
if ( IsReallyVisible() && IsUpdateMode() )
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
}
}
}
@@ -2558,7 +2534,7 @@ void Ruler::SetExtraType( RulerExtra eNewExtraType, sal_uInt16 nStyle )
meExtraType = eNewExtraType;
mnExtraStyle = nStyle;
if (IsReallyVisible() && IsUpdateMode())
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
}
}
@@ -2644,7 +2620,7 @@ void Ruler::SetLines( sal_uInt32 aLineArraySize, const RulerLine* pLineArray )
// Delete old lines
if ( bMustUpdate )
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
// New data set
if ( !aLineArraySize || !pLineArray )
@@ -2665,7 +2641,7 @@ void Ruler::SetLines( sal_uInt32 aLineArraySize, const RulerLine* pLineArray )
mpData->pLines.begin() );
if ( bMustUpdate )
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
}
}
@@ -2857,7 +2833,7 @@ RulerUnitData Ruler::GetCurrentRulerUnit() const
void Ruler::DrawTicks()
{
mbFormat = true;
- Invalidate();
+ Invalidate(InvalidateFlags::NoErase);
}
uno::Reference< XAccessible > Ruler::CreateAccessible()
More information about the Libreoffice-commits
mailing list