[Libreoffice-commits] core.git: 10 commits - reportdesign/source sc/source sd/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu May 14 18:41:41 PDT 2015
reportdesign/source/ui/report/ViewsWindow.cxx | 31 +-
sc/source/ui/app/inputwin.cxx | 177 ++++++------
sc/source/ui/cctrl/checklistmenu.cxx | 156 +++++-----
sc/source/ui/cctrl/tbzoomsliderctrl.cxx | 100 +++----
sc/source/ui/inc/autofmt.hxx | 56 +--
sc/source/ui/inc/checklistmenu.hxx | 18 -
sc/source/ui/inc/tbzoomsliderctrl.hxx | 32 +-
sc/source/ui/miscdlgs/autofmt.cxx | 369 ++++++++++++--------------
sc/source/ui/view/tabsplit.cxx | 59 ++--
sc/source/ui/view/tabview.cxx | 52 +--
sd/source/filter/html/htmlattr.cxx | 40 +-
sd/source/filter/html/htmlattr.hxx | 2
vcl/source/control/button.cxx | 12
13 files changed, 545 insertions(+), 559 deletions(-)
New commits:
commit 9c08a06f5d399a7cd11849a377a82663ef6a528e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 22:15:13 2015 +0900
Fix Button when using double-buffered rendering
Change-Id: Ib2812723141c5dfe39b30c95f12d1aeca9c367bd
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 82af4fa..fac1562 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -951,9 +951,9 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLa
break;
}
- bool bDropDown = ( IsSymbol() && (GetSymbol()==SymbolType::SPIN_DOWN) && GetText().isEmpty() );
+ bool bDropDown = (IsSymbol() && (GetSymbol() == SymbolType::SPIN_DOWN) && GetText().isEmpty());
- if( bDropDown && (aCtrlType == CTRL_COMBOBOX || aCtrlType == CTRL_LISTBOX ) )
+ if( bDropDown && (aCtrlType == CTRL_COMBOBOX || aCtrlType == CTRL_LISTBOX))
{
if (GetParent()->IsNativeControlSupported(aCtrlType, PART_ENTIRE_CONTROL))
{
@@ -1007,7 +1007,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLa
if (!bRollOver && !HasFocus())
bDrawMenuSep = false;
}
- if ((bNativeOK = IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)))
+ if ((bNativeOK = rRenderContext.IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)))
{
PushButtonValue aControlValue;
Rectangle aCtrlRegion(aInRect);
@@ -1045,8 +1045,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLa
// prepare single line hint (needed on mac to decide between normal push button and
// rectangular bevel button look)
Size aFontSize(Application::GetSettings().GetStyleSettings().GetPushButtonFont().GetSize());
- aFontSize = LogicToPixel(aFontSize, MapMode(MAP_POINT));
- Size aInRectSize(LogicToPixel(Size(aInRect.GetWidth(), aInRect.GetHeight())));
+ aFontSize = rRenderContext.LogicToPixel(aFontSize, MapMode(MAP_POINT));
+ Size aInRectSize(rRenderContext.LogicToPixel(Size(aInRect.GetWidth(), aInRect.GetHeight())));
aControlValue.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height());
if (((nState & ControlState::ROLLOVER)) || !(GetStyle() & WB_FLATBUTTON))
@@ -1060,7 +1060,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext, bool bLa
}
// draw content using the same aInRect as non-native VCL would do
- ImplDrawPushButtonContent(this, (nState&ControlState::ROLLOVER) ? WINDOW_DRAW_ROLLOVER : 0,
+ ImplDrawPushButtonContent(&rRenderContext, (nState&ControlState::ROLLOVER) ? WINDOW_DRAW_ROLLOVER : 0,
aInRect, bLayout, bDrawMenuSep);
if (HasFocus())
commit 85b7494e34ccf6b56d68554b7f32c0bebe5a6fed
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 18:33:31 2015 +0900
refactor ScTabSplitter to use RenderContext
Change-Id: I0822bf2fc8752efa16add193b2860c6f9f9668e3
diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx
index 785329a..0a57100 100644
--- a/sc/source/ui/view/tabsplit.cxx
+++ b/sc/source/ui/view/tabsplit.cxx
@@ -24,11 +24,11 @@
#include <vcl/settings.hxx>
ScTabSplitter::ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle, ScViewData* pData ) :
- Splitter( pParent, nWinStyle ),
+ Splitter(pParent, nWinStyle),
pViewData(pData)
{
SetFixed(false);
- EnableRTL( false );
+ EnableRTL(false);
}
ScTabSplitter::~ScTabSplitter()
@@ -54,10 +54,10 @@ void ScTabSplitter::SetFixed(bool bSet)
SetPointer(POINTER_VSPLIT);
}
-void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScTabSplitter::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
{
- const Color oldFillCol = GetFillColor();
- const Color oldLineCol = GetLineColor();
+ rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
if (IsHorizontal())
{
@@ -65,24 +65,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{
case SC_SPLIT_NONE:
{
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle
- SetLineColor(Color(COL_BLACK));
- SetFillColor(Color(COL_BLACK));
- const long xc = rRect.Right()+rRect.Left();
- const long h4 = rRect.GetHeight()/4;
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.SetFillColor(Color(COL_BLACK));
+ const long xc = rRect.Right() + rRect.Left();
+ const long h4 = rRect.GetHeight() / 4;
// First xc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd width and a centered rectangle in those with even width.
- DrawRect(Rectangle(Point(xc/2, rRect.Top()+h4), Point((xc+1)/2, rRect.Bottom()-h4)));
+ rRenderContext.DrawRect(Rectangle(Point(xc / 2, rRect.Top() + h4),
+ Point((xc + 1) / 2, rRect.Bottom() - h4)));
break;
}
case SC_SPLIT_NORMAL:
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break;
case SC_SPLIT_FIX:
// Nothing to draw
@@ -95,24 +96,25 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
{
case SC_SPLIT_NONE:
{
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
// Draw handle
- SetLineColor(Color(COL_BLACK));
- SetFillColor(Color(COL_BLACK));
- const long yc = rRect.Top()+rRect.Bottom();
- const long w4 = rRect.GetWidth()/4;
+ rRenderContext.SetLineColor(Color(COL_BLACK));
+ rRenderContext.SetFillColor(Color(COL_BLACK));
+ const long yc = rRect.Top() + rRect.Bottom();
+ const long w4 = rRect.GetWidth() / 4;
// First yc fraction is truncated, second one is rounded. This will draw a centered line
// in handlers with odd height and a centered rectangle in those with even height.
- DrawRect(Rectangle(Point(rRect.Left()+w4, yc/2), Point(rRect.Right()-w4, (yc+1)/2)));
+ DrawRect(Rectangle(Point(rRect.Left() + w4, yc / 2),
+ Point(rRect.Right() - w4, (yc + 1) / 2)));
break;
}
case SC_SPLIT_NORMAL:
- SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
- SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
- DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ rRenderContext.DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
break;
case SC_SPLIT_FIX:
// Nothing to draw
@@ -120,8 +122,7 @@ void ScTabSplitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectang
}
}
- SetFillColor(oldFillCol);
- SetLineColor(oldLineCol);
+ rRenderContext.Pop();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 763858b2ce2d5751bbf533b21847a5fd9b5fec61
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 18:28:47 2015 +0900
refactor SdHtmlAttrPreview to use RenderContext
Change-Id: I2b23764932df4a078094944d89cebb06f6eb569a
diff --git a/sd/source/filter/html/htmlattr.cxx b/sd/source/filter/html/htmlattr.cxx
index dd1f472..4a7732f 100644
--- a/sd/source/filter/html/htmlattr.cxx
+++ b/sd/source/filter/html/htmlattr.cxx
@@ -22,8 +22,8 @@
#include <vcl/decoview.hxx>
#include <vcl/builderfactory.hxx>
-SdHtmlAttrPreview::SdHtmlAttrPreview( vcl::Window* pParent, WinBits nStyle )
-:Control( pParent, nStyle )
+SdHtmlAttrPreview::SdHtmlAttrPreview(vcl::Window* pParent, WinBits nStyle)
+ : Control(pParent, nStyle)
{
}
@@ -42,43 +42,39 @@ SdHtmlAttrPreview::~SdHtmlAttrPreview()
{
}
-void SdHtmlAttrPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void SdHtmlAttrPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- DecorationView aDecoView( this );
+ DecorationView aDecoView(&rRenderContext);
Rectangle aTextRect;
aTextRect.SetSize(GetOutputSize());
- SetLineColor(m_aBackColor);
- SetFillColor(m_aBackColor);
- DrawRect(rRect);
- SetFillColor();
+ rRenderContext.SetLineColor(m_aBackColor);
+ rRenderContext.SetFillColor(m_aBackColor);
+ rRenderContext.DrawRect(rRect);
+ rRenderContext.SetFillColor();
int nHeight = (aTextRect.Bottom() - aTextRect.Top()) >> 2;
aTextRect.Bottom() = nHeight + aTextRect.Top();
- SetTextColor(m_aTextColor);
- DrawText( aTextRect, SD_RESSTR(STR_HTMLATTR_TEXT),
- TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+ rRenderContext.SetTextColor(m_aTextColor);
+ rRenderContext.DrawText(aTextRect, SD_RESSTR(STR_HTMLATTR_TEXT), TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
aTextRect.Move(0,nHeight);
- SetTextColor(m_aLinkColor);
- DrawText( aTextRect, SD_RESSTR(STR_HTMLATTR_LINK),
- TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+ rRenderContext.SetTextColor(m_aLinkColor);
+ rRenderContext.DrawText(aTextRect, SD_RESSTR(STR_HTMLATTR_LINK), TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
aTextRect.Move(0,nHeight);
- SetTextColor(m_aALinkColor);
- DrawText( aTextRect, SD_RESSTR(STR_HTMLATTR_ALINK),
- TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+ rRenderContext.SetTextColor(m_aALinkColor);
+ rRenderContext.DrawText(aTextRect, SD_RESSTR(STR_HTMLATTR_ALINK), TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
aTextRect.Move(0,nHeight);
- SetTextColor(m_aVLinkColor);
- DrawText( aTextRect, SD_RESSTR(STR_HTMLATTR_VLINK),
- TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER );
+ rRenderContext.SetTextColor(m_aVLinkColor);
+ rRenderContext.DrawText(aTextRect, SD_RESSTR(STR_HTMLATTR_VLINK), TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
}
-void SdHtmlAttrPreview::SetColors( Color& aBack, Color& aText, Color& aLink,
- Color& aVLink, Color& aALink )
+void SdHtmlAttrPreview::SetColors(Color& aBack, Color& aText, Color& aLink,
+ Color& aVLink, Color& aALink)
{
m_aBackColor = aBack;
m_aTextColor = aText;
diff --git a/sd/source/filter/html/htmlattr.hxx b/sd/source/filter/html/htmlattr.hxx
index 2e0b706..07ecf06 100644
--- a/sd/source/filter/html/htmlattr.hxx
+++ b/sd/source/filter/html/htmlattr.hxx
@@ -34,7 +34,7 @@ public:
SdHtmlAttrPreview( vcl::Window* pParent, WinBits nStyle );
virtual ~SdHtmlAttrPreview();
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
void SetColors( Color& aBack, Color& aText, Color& aLink,
Color& aVLink, Color& aALink );
commit 2079b1f407ac5c29f54f90966a317226e57e9169
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 18:25:40 2015 +0900
refacotr ScCornerButton to use RenderContext
Change-Id: I441d87680b22db19d5bc1c2e7e661921f36c2143
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 75cb5c4..ad23cc8 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -71,8 +71,6 @@ ScCornerButton::ScCornerButton( vcl::Window* pParent, ScViewData* pData, bool bA
pViewData( pData ),
bAdd( bAdditional )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetBackground( rStyleSettings.GetFaceColor() );
EnableRTL( false );
}
@@ -80,49 +78,51 @@ ScCornerButton::~ScCornerButton()
{
}
-void ScCornerButton::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
+void ScCornerButton::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- Size aSize = GetOutputSizePixel();
- long nPosX = aSize.Width()-1;
- long nPosY = aSize.Height()-1;
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ SetBackground(rStyleSettings.GetFaceColor());
+
+ Size aSize = rRenderContext.GetOutputSizePixel();
+ long nPosX = aSize.Width() - 1;
+ long nPosY = aSize.Height() - 1;
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Window::Paint(rRenderContext, rRect);
bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
long nDarkX = bLayoutRTL ? 0 : nPosX;
- if ( !bAdd )
+ if (!bAdd)
{
// match the shaded look of column/row headers
- Color aFace( rStyleSettings.GetFaceColor() );
- Color aWhite( COL_WHITE );
- Color aCenter( aFace );
- aCenter.Merge( aWhite, 0xd0 ); // lighten up a bit
- Color aOuter( aFace );
- aOuter.Merge( aWhite, 0xa0 ); // lighten up more
+ Color aFace(rStyleSettings.GetFaceColor());
+ Color aWhite(COL_WHITE);
+ Color aCenter(aFace);
+ aCenter.Merge(aWhite, 0xd0); // lighten up a bit
+ Color aOuter(aFace );
+ aOuter.Merge(aWhite, 0xa0); // lighten up more
long nCenterX = (aSize.Width() / 2) - 1;
long nCenterY = (aSize.Height() / 2) - 1;
- SetLineColor();
- SetFillColor(aCenter);
- DrawRect( Rectangle( nCenterX, nCenterY, nCenterX, nPosY ) );
- DrawRect( Rectangle( nCenterX, nCenterY, nDarkX, nCenterY ) );
- SetFillColor(aOuter);
- DrawRect( Rectangle( 0, 0, nPosX, nCenterY-1 ) );
- if ( bLayoutRTL )
- DrawRect( Rectangle( nCenterX+1, nCenterY, nPosX, nPosY ) );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(aCenter);
+ rRenderContext.DrawRect(Rectangle(nCenterX, nCenterY, nCenterX, nPosY));
+ rRenderContext.DrawRect(Rectangle(nCenterX, nCenterY, nDarkX, nCenterY));
+ rRenderContext.SetFillColor(aOuter);
+ rRenderContext.DrawRect(Rectangle(0, 0, nPosX, nCenterY - 1));
+ if (bLayoutRTL)
+ rRenderContext.DrawRect(Rectangle(nCenterX + 1, nCenterY, nPosX, nPosY));
else
- DrawRect( Rectangle( 0, nCenterY, nCenterX-1, nPosY ) );
+ rRenderContext.DrawRect(Rectangle(0, nCenterY, nCenterX - 1, nPosY));
}
// both buttons have the same look now - only dark right/bottom lines
- SetLineColor( rStyleSettings.GetDarkShadowColor() );
- DrawLine( Point(0,nPosY), Point(nPosX,nPosY) );
- DrawLine( Point(nDarkX,0), Point(nDarkX,nPosY) );
+ rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+ rRenderContext.DrawLine(Point(0, nPosY), Point(nPosX, nPosY));
+ rRenderContext.DrawLine(Point(nDarkX, 0), Point(nDarkX, nPosY));
}
void ScCornerButton::StateChanged( StateChangedType nType )
commit 888f08889fe954e6cb47b26853f5e86ecc7f9a82
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 16:36:33 2015 +0900
refactor AutoFmtPreview to use RenderContext
Change-Id: Icaed24f08cfa85f3f91c3f2351384a0b59242d03
diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx
index 6edfd3b..6beebfd 100644
--- a/sc/source/ui/inc/autofmt.hxx
+++ b/sc/source/ui/inc/autofmt.hxx
@@ -55,10 +55,9 @@ protected:
virtual void Resize() SAL_OVERRIDE;
private:
- ScAutoFormatData* pCurData;
+ ScAutoFormatData* pCurData;
ScopedVclPtrInstance<VirtualDevice> aVD;
- SvtScriptedTextHelper aScriptedText;
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter;
+ css::uno::Reference<css::i18n::XBreakIterator> xBreakIter;
bool bFitWidth;
svx::frame::Array maArray; /// Implementation to draw the frame borders.
bool mbRTL;
@@ -76,40 +75,33 @@ private:
const OUString aStrSum;
SvNumberFormatter* pNumFmt;
- SAL_DLLPRIVATE void Init ();
- SAL_DLLPRIVATE void DoPaint ( const Rectangle& rRect );
- SAL_DLLPRIVATE void CalcCellArray ( bool bFitWidth );
- SAL_DLLPRIVATE void CalcLineMap ();
- SAL_DLLPRIVATE void PaintCells ();
+ SAL_DLLPRIVATE void Init();
+ SAL_DLLPRIVATE void DoPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
+ SAL_DLLPRIVATE void CalcCellArray(bool bFitWidth);
+ SAL_DLLPRIVATE void CalcLineMap();
+ SAL_DLLPRIVATE void PaintCells(vcl::RenderContext& rRenderContext);
/* Usage of type size_t instead of SCCOL/SCROW is correct here - used in
conjunction with class svx::frame::Array (svx/framelinkarray.hxx), which
expects size_t coordinates. */
- SAL_DLLPRIVATE sal_uInt16 GetFormatIndex( size_t nCol, size_t nRow ) const;
- SAL_DLLPRIVATE const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const;
- SAL_DLLPRIVATE const SvxLineItem& GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const;
-
- SAL_DLLPRIVATE void DrawString( size_t nCol, size_t nRow );
- SAL_DLLPRIVATE void DrawStrings();
- SAL_DLLPRIVATE void DrawBackground();
-
- SAL_DLLPRIVATE void MakeFonts ( sal_uInt16 nIndex,
- vcl::Font& rFont,
- vcl::Font& rCJKFont,
- vcl::Font& rCTLFont );
-
- SAL_DLLPRIVATE void CheckPriority ( sal_uInt16 nCurLine,
- AutoFmtLine eLine,
- ::editeng::SvxBorderLine& rLine );
- SAL_DLLPRIVATE void GetLines ( sal_uInt16 nIndex, AutoFmtLine eLine,
- ::editeng::SvxBorderLine& rLineD,
- ::editeng::SvxBorderLine& rLineLT,
- ::editeng::SvxBorderLine& rLineL,
- ::editeng::SvxBorderLine& rLineLB,
- ::editeng::SvxBorderLine& rLineRT,
- ::editeng::SvxBorderLine& rLineR,
- ::editeng::SvxBorderLine& rLineRB );
+ SAL_DLLPRIVATE sal_uInt16 GetFormatIndex( size_t nCol, size_t nRow ) const;
+ SAL_DLLPRIVATE const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const;
+ SAL_DLLPRIVATE const SvxLineItem& GetDiagItem( size_t nCol, size_t nRow, bool bTLBR ) const;
+
+ SAL_DLLPRIVATE void DrawString(vcl::RenderContext& rRenderContext, size_t nCol, size_t nRow);
+ SAL_DLLPRIVATE void DrawStrings(vcl::RenderContext& rRenderContext);
+ SAL_DLLPRIVATE void DrawBackground(vcl::RenderContext& rRenderContext);
+
+ SAL_DLLPRIVATE void MakeFonts(sal_uInt16 nIndex, vcl::Font& rFont,
+ vcl::Font& rCJKFont, vcl::Font& rCTLFont );
+
+ SAL_DLLPRIVATE void CheckPriority(sal_uInt16 nCurLine, AutoFmtLine eLine, editeng::SvxBorderLine& rLine);
+ SAL_DLLPRIVATE void GetLines(sal_uInt16 nIndex, AutoFmtLine eLine,
+ editeng::SvxBorderLine& rLineD, editeng::SvxBorderLine& rLineLT,
+ editeng::SvxBorderLine& rLineL, editeng::SvxBorderLine& rLineLB,
+ editeng::SvxBorderLine& rLineRT, editeng::SvxBorderLine& rLineR,
+ editeng::SvxBorderLine& rLineRB);
};
#endif // INCLUDED_SC_SOURCE_UI_INC_AUTOFMT_HXX
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 45baa5b..6a3d9d5 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -59,7 +59,6 @@ ScAutoFmtPreview::ScAutoFmtPreview(vcl::Window* pParent)
: Window(pParent)
, pCurData(NULL)
, aVD(*this)
- , aScriptedText(*aVD.get())
, bFitWidth(false)
, mbRTL(false)
, aStrJan(ScResId(STR_JAN))
@@ -184,226 +183,224 @@ const SvxLineItem& ScAutoFmtPreview::GetDiagItem( size_t nCol, size_t nRow, bool
return *static_cast< const SvxLineItem* >( pCurData->GetItem( GetFormatIndex( nCol, nRow ), bTLBR ? ATTR_BORDER_TLBR : ATTR_BORDER_BLTR ) );
}
-void ScAutoFmtPreview::DrawString( size_t nCol, size_t nRow )
+void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCol, size_t nRow)
{
- if ( pCurData )
+ if (!pCurData)
{
+ return;
+ }
- // Emit the cell text
+ // Emit the cell text
- OUString cellString;
- bool bNumFormat = pCurData->GetIncludeValueFormat();
- sal_uLong nNum;
- double nVal;
- Color* pDummy = NULL;
- sal_uInt16 nIndex = static_cast< sal_uInt16 >( maArray.GetCellIndex( nCol, nRow, mbRTL ) );
+ OUString cellString;
+ bool bNumFormat = pCurData->GetIncludeValueFormat();
+ sal_uLong nNum;
+ double nVal;
+ Color* pDummy = NULL;
+ sal_uInt16 nIndex = static_cast<sal_uInt16>(maArray.GetCellIndex(nCol, nRow, mbRTL));
- switch( nIndex )
- {
- case 1: cellString = aStrJan; break;
- case 2: cellString = aStrFeb; break;
- case 3: cellString = aStrMar; break;
- case 5: cellString = aStrNorth; break;
- case 10: cellString = aStrMid; break;
- case 15: cellString = aStrSouth; break;
- case 4:
- case 20: cellString = aStrSum; break;
-
- case 6:
- case 8:
- case 16:
- case 18: nVal = nIndex;
- nNum = 5;
- goto mknum;
- case 17:
- case 7: nVal = nIndex;
- nNum = 6;
- goto mknum;
- case 11:
- case 12:
- case 13: nVal = nIndex;
- nNum = 12 == nIndex ? 10 : 9;
- goto mknum;
-
- case 9: nVal = 21; nNum = 7; goto mknum;
- case 14: nVal = 36; nNum = 11; goto mknum;
- case 19: nVal = 51; nNum = 7; goto mknum;
- case 21: nVal = 33; nNum = 13; goto mknum;
- case 22: nVal = 36; nNum = 14; goto mknum;
- case 23: nVal = 39; nNum = 13; goto mknum;
- case 24: nVal = 108; nNum = 15;
- mknum:
- if( bNumFormat )
- {
- ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&)pCurData->GetNumFormat( (sal_uInt16) nNum );
- nNum = rNumFormat.GetFormatIndex( *pNumFmt );
- }
- else
- nNum = 0;
- pNumFmt->GetOutputString( nVal, nNum, cellString, &pDummy );
- break;
- }
+ switch (nIndex)
+ {
+ case 1: cellString = aStrJan; break;
+ case 2: cellString = aStrFeb; break;
+ case 3: cellString = aStrMar; break;
+ case 5: cellString = aStrNorth; break;
+ case 10: cellString = aStrMid; break;
+ case 15: cellString = aStrSouth; break;
+ case 4:
+ case 20: cellString = aStrSum; break;
+
+ case 6:
+ case 8:
+ case 16:
+ case 18: nVal = nIndex;
+ nNum = 5;
+ goto mknum;
+ case 17:
+ case 7: nVal = nIndex;
+ nNum = 6;
+ goto mknum;
+ case 11:
+ case 12:
+ case 13: nVal = nIndex;
+ nNum = 12 == nIndex ? 10 : 9;
+ goto mknum;
+
+ case 9: nVal = 21; nNum = 7; goto mknum;
+ case 14: nVal = 36; nNum = 11; goto mknum;
+ case 19: nVal = 51; nNum = 7; goto mknum;
+ case 21: nVal = 33; nNum = 13; goto mknum;
+ case 22: nVal = 36; nNum = 14; goto mknum;
+ case 23: nVal = 39; nNum = 13; goto mknum;
+ case 24: nVal = 108; nNum = 15;
+ mknum:
+ if (bNumFormat)
+ {
+ ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&) pCurData->GetNumFormat(sal_uInt16(nNum));
+ nNum = rNumFormat.GetFormatIndex(*pNumFmt);
+ }
+ else
+ nNum = 0;
+ pNumFmt->GetOutputString(nVal, nNum, cellString, &pDummy);
+ break;
+ }
+
+ if (!cellString.isEmpty())
+ {
+
+ Size aStrSize;
+ sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
+ Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
+ Point aPos = cellRect.TopLeft();
+ sal_uInt16 nRightX = 0;
+ bool bJustify = pCurData->GetIncludeJustify();
+ SvxHorJustifyItem aHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
+ SvxCellHorJustify eJustification;
- if ( !cellString.isEmpty())
+ SvtScriptedTextHelper aScriptedText(rRenderContext);
+
+ // Justification:
+
+ eJustification = mbRTL ? SVX_HOR_JUSTIFY_RIGHT : bJustify ?
+ (SvxCellHorJustify) (static_cast<const SvxHorJustifyItem*>(pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY))->GetValue()) :
+ SVX_HOR_JUSTIFY_STANDARD;
+
+ if (pCurData->GetIncludeFont())
{
- Size aStrSize;
- sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
- Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
- Point aPos = cellRect.TopLeft();
- sal_uInt16 nRightX = 0;
- bool bJustify = pCurData->GetIncludeJustify();
- SvxHorJustifyItem aHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
- SvxCellHorJustify eJustification;
-
- // Justification:
-
- eJustification = mbRTL ? SVX_HOR_JUSTIFY_RIGHT : bJustify ?
- (SvxCellHorJustify)(static_cast<const SvxHorJustifyItem*>(pCurData->GetItem( nFmtIndex, ATTR_HOR_JUSTIFY ))->GetValue()) :
- SVX_HOR_JUSTIFY_STANDARD;
-
- if ( pCurData->GetIncludeFont() )
- {
- vcl::Font aFont, aCJKFont, aCTLFont;
- Size theMaxStrSize;
+ vcl::Font aFont, aCJKFont, aCTLFont;
+ Size theMaxStrSize;
- MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
+ MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
- theMaxStrSize = cellRect.GetSize();
- theMaxStrSize.Width() -= FRAME_OFFSET;
- theMaxStrSize.Height() -= FRAME_OFFSET;
+ theMaxStrSize = cellRect.GetSize();
+ theMaxStrSize.Width() -= FRAME_OFFSET;
+ theMaxStrSize.Height() -= FRAME_OFFSET;
- aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
- aScriptedText.SetText( cellString, xBreakIter );
- aStrSize = aScriptedText.GetTextSize();
+ aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
+ aScriptedText.SetText(cellString, xBreakIter);
+ aStrSize = aScriptedText.GetTextSize();
- if ( theMaxStrSize.Height() < aStrSize.Height() )
- {
- // if the string does not fit in the row using this font,
- // the default font is used
- aScriptedText.SetDefaultFont();
- aStrSize = aScriptedText.GetTextSize();
- }
- while ( ( theMaxStrSize.Width() <= aStrSize.Width() )
- && ( cellString.getLength() > 1 ) )
- {
- if( eJustification == SVX_HOR_JUSTIFY_RIGHT )
- cellString = cellString.copy(1);
- else
- cellString = cellString.copy(0, cellString.getLength() - 1 );
-
- aScriptedText.SetText( cellString, xBreakIter );
- aStrSize = aScriptedText.GetTextSize();
- }
- }
- else
+ if (theMaxStrSize.Height() < aStrSize.Height())
{
+ // if the string does not fit in the row using this font,
+ // the default font is used
aScriptedText.SetDefaultFont();
- aScriptedText.SetText( cellString, xBreakIter );
aStrSize = aScriptedText.GetTextSize();
}
+ while((theMaxStrSize.Width() <= aStrSize.Width()) && (cellString.getLength() > 1))
+ {
+ if( eJustification == SVX_HOR_JUSTIFY_RIGHT )
+ cellString = cellString.copy(1);
+ else
+ cellString = cellString.copy(0, cellString.getLength() - 1 );
- nRightX = (sal_uInt16)( cellRect.GetWidth()
- - aStrSize.Width()
- - FRAME_OFFSET );
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
+ }
+ }
+ else
+ {
+ aScriptedText.SetDefaultFont();
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
+ }
- // vertical (always center):
+ nRightX = sal_uInt16(cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET);
- aPos.Y() += (mnRowHeight - (sal_uInt16)aStrSize.Height()) / 2;
+ // vertical (always center):
- // horizontal
+ aPos.Y() += (mnRowHeight - (sal_uInt16)aStrSize.Height()) / 2;
- if ( eJustification != SVX_HOR_JUSTIFY_STANDARD )
- {
- sal_uInt16 nHorPos = (sal_uInt16)
- ((cellRect.GetWidth()-aStrSize.Width())/2);
-
- switch ( eJustification )
- {
- case SVX_HOR_JUSTIFY_LEFT:
- aPos.X() += FRAME_OFFSET;
- break;
- case SVX_HOR_JUSTIFY_RIGHT:
- aPos.X() += nRightX;
- break;
- case SVX_HOR_JUSTIFY_BLOCK:
- case SVX_HOR_JUSTIFY_REPEAT:
- case SVX_HOR_JUSTIFY_CENTER:
- aPos.X() += nHorPos;
- break;
- // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
- case SVX_HOR_JUSTIFY_STANDARD:
- default:
- // Standard is not handled here
- break;
- }
- }
- else
- {
+ // horizontal
- // Standard justification
+ if (eJustification != SVX_HOR_JUSTIFY_STANDARD)
+ {
+ sal_uInt16 nHorPos = sal_uInt16((cellRect.GetWidth()-aStrSize.Width()) / 2);
- if ( (nCol == 0) || (nRow == 0) )
- {
- // Text label to the left or sum left adjusted
+ switch (eJustification)
+ {
+ case SVX_HOR_JUSTIFY_LEFT:
aPos.X() += FRAME_OFFSET;
- }
- else
- {
- // Numbers/Dates right adjusted
+ break;
+ case SVX_HOR_JUSTIFY_RIGHT:
aPos.X() += nRightX;
- }
+ break;
+ case SVX_HOR_JUSTIFY_BLOCK:
+ case SVX_HOR_JUSTIFY_REPEAT:
+ case SVX_HOR_JUSTIFY_CENTER:
+ aPos.X() += nHorPos;
+ break;
+ // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
+ case SVX_HOR_JUSTIFY_STANDARD:
+ default:
+ // Standard is not handled here
+ break;
}
+ }
+ else
+ {
- aScriptedText.DrawText( aPos );
+ // Standard justification
+ if (nCol == 0 || nRow == 0)
+ {
+ // Text label to the left or sum left adjusted
+ aPos.X() += FRAME_OFFSET;
+ }
+ else
+ {
+ // Numbers/Dates right adjusted
+ aPos.X() += nRightX;
+ }
}
+ aScriptedText.DrawText(aPos);
}
}
#undef FRAME_OFFSET
-void ScAutoFmtPreview::DrawStrings()
+void ScAutoFmtPreview::DrawStrings(vcl::RenderContext& rRenderContext)
{
- for( size_t nRow = 0; nRow < 5; ++nRow )
- for( size_t nCol = 0; nCol < 5; ++nCol )
- DrawString( nCol, nRow );
+ for(size_t nRow = 0; nRow < 5; ++nRow)
+ for(size_t nCol = 0; nCol < 5; ++nCol)
+ DrawString(rRenderContext, nCol, nRow);
}
-void ScAutoFmtPreview::DrawBackground()
+void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
{
- if( pCurData )
+ if (pCurData)
{
- for( size_t nRow = 0; nRow < 5; ++nRow )
+ for(size_t nRow = 0; nRow < 5; ++nRow)
{
- for( size_t nCol = 0; nCol < 5; ++nCol )
+ for(size_t nCol = 0; nCol < 5; ++nCol)
{
const SvxBrushItem* pItem = static_cast< const SvxBrushItem* >(
pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND ) );
- aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- aVD->SetLineColor();
- aVD->SetFillColor( pItem->GetColor() );
- aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) );
- aVD->Pop();
+ rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor( pItem->GetColor() );
+ rRenderContext.DrawRect( maArray.GetCellRect( nCol, nRow ) );
+ rRenderContext.Pop();
}
}
}
}
-void ScAutoFmtPreview::PaintCells()
+void ScAutoFmtPreview::PaintCells(vcl::RenderContext& rRenderContext)
{
- if ( pCurData )
+ if (pCurData)
{
// 1) background
- if ( pCurData->GetIncludeBackground() )
- DrawBackground();
+ if (pCurData->GetIncludeBackground())
+ DrawBackground(rRenderContext);
// 2) values
- DrawStrings();
+ DrawStrings(rRenderContext);
// 3) border
- if ( pCurData->GetIncludeFrame() )
- maArray.DrawArray( *aVD.get() );
+ if (pCurData->GetIncludeFrame())
+ maArray.DrawArray(rRenderContext);
}
}
@@ -483,42 +480,42 @@ void ScAutoFmtPreview::NotifyChange( ScAutoFormatData* pNewData )
CalcCellArray( bFitWidth );
CalcLineMap();
- DoPaint( Rectangle( Point(0,0), GetSizePixel() ) );
+ Invalidate(Rectangle(Point(0,0), GetSizePixel()));
}
-void ScAutoFmtPreview::DoPaint( const Rectangle& /* rRect */ )
+void ScAutoFmtPreview::DoPaint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
sal_uInt32 nOldDrawMode = aVD->GetDrawMode();
- Size aWndSize( GetSizePixel() );
- vcl::Font aFont( aVD->GetFont() );
- Color aBackCol( GetSettings().GetStyleSettings().GetWindowColor() );
+ Size aWndSize(GetSizePixel());
+ vcl::Font aFont(aVD->GetFont());
+ Color aBackCol(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
Point aTmpPoint;
- Rectangle aRect( aTmpPoint, aWndSize );
+ Rectangle aRect(aTmpPoint, aWndSize);
aFont.SetTransparent( true );
- aVD->SetFont( aFont );
+ aVD->SetFont(aFont);
aVD->SetLineColor();
- aVD->SetFillColor( aBackCol );
- aVD->SetOutputSize( aWndSize );
- aVD->DrawRect( aRect );
+ aVD->SetFillColor(aBackCol);
+ aVD->SetOutputSize(aWndSize);
+ aVD->DrawRect(aRect);
+
+ PaintCells(*aVD.get());
- PaintCells();
- SetLineColor();
- SetFillColor( aBackCol );
- DrawRect( aRect );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor(aBackCol);
+ rRenderContext.DrawRect(aRect);
- Point aPos( (aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2 );
+ Point aPos((aWndSize.Width() - aPrvSize.Width()) / 2, (aWndSize.Height() - aPrvSize.Height()) / 2);
if (AllSettings::GetLayoutRTL())
aPos.X() = -aPos.X();
- DrawOutDev( aPos, aWndSize, Point(), aWndSize, *aVD.get() );
-
- aVD->SetDrawMode( nOldDrawMode );
+ rRenderContext.DrawOutDev(aPos, aWndSize, Point(), aWndSize, *aVD.get());
+ aVD->SetDrawMode(nOldDrawMode);
}
-void ScAutoFmtPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScAutoFmtPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- DoPaint( rRect );
+ DoPaint(rRenderContext, rRect);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3047de0f92c9d18cb77d78e26542ca004d3e4958
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 16:18:27 2015 +0900
refactor ViewsWindow of reportdesign to use RenderContext
Change-Id: I0c1c2df38894f250aa2bec6ab6532ccaca090fa9
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index e7d8e97..1d491d2 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -172,13 +172,13 @@ bool lcl_getNewRectSize(const Rectangle& _aObjRect,long& _nXMov, long& _nYMov,Sd
OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow)
-: Window( _pReportWindow,WB_DIALOGCONTROL)
-,m_pParent(_pReportWindow)
-,m_bInUnmark(false)
+ : Window( _pReportWindow,WB_DIALOGCONTROL)
+ , m_pParent(_pReportWindow)
+ , m_bInUnmark(false)
{
SetPaintTransparent(true);
SetUniqueId(UID_RPT_VIEWSWINDOW);
- SetMapMode( MapMode( MAP_100TH_MM ) );
+ SetMapMode(MapMode(MAP_100TH_MM));
m_aColorConfig.AddListener(this);
ImplInitSettings();
}
@@ -265,24 +265,25 @@ void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rR
{
Window::Paint(rRenderContext, rRect);
- Size aOut = GetOutputSizePixel();
+ rRenderContext.SetBackground();
+ rRenderContext.SetFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+ rRenderContext.SetTextFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+
+ Size aOut = rRenderContext.GetOutputSizePixel();
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
- aStartWidth *= GetMapMode().GetScaleX();
+ aStartWidth *= rRenderContext.GetMapMode().GetScaleX();
- aOut.Width() -= (long)aStartWidth;
- aOut = PixelToLogic(aOut);
+ aOut.Width() -= long(aStartWidth);
+ aOut = rRenderContext.PixelToLogic(aOut);
- Rectangle aRect(PixelToLogic(Point(aStartWidth,0)),aOut);
- Wallpaper aWall( m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor );
- DrawWallpaper(aRect,aWall);
+ Rectangle aRect(rRenderContext.PixelToLogic(Point(aStartWidth,0)), aOut);
+ Wallpaper aWall(m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor);
+ rRenderContext.DrawWallpaper(aRect, aWall);
}
void OViewsWindow::ImplInitSettings()
{
- EnableChildTransparentMode( true );
- SetBackground( );
- SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
- SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
+ EnableChildTransparentMode(true);
}
void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt )
commit a4cb27f61376d8f2d8faed0022c291af68d437bd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 16:11:55 2015 +0900
refactor ScMenuFloatingWindow to use RenderContext
Change-Id: I27b4f412b38788094bb5c78f24123bb28c0e8183
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 8b98dfc..67be6fe 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -82,16 +82,14 @@ ScMenuFloatingWindow::ScMenuFloatingWindow(vcl::Window* pParent, ScDocument* pDo
mpParentMenu(dynamic_cast<ScMenuFloatingWindow*>(pParent))
{
SetMenuStackLevel(nMenuStackLevel);
+ SetText(OUString("ScMenuFloatingWindow"));
+
+ const StyleSettings& rStyle = GetSettings().GetStyleSettings();
- // TODO: How do we get the right font to use here ?
sal_Int32 nScaleFactor = GetDPIScaleFactor();
const sal_uInt16 nPopupFontHeight = 12 * nScaleFactor;
- const StyleSettings& rStyle = GetSettings().GetStyleSettings();
maLabelFont = rStyle.GetLabelFont();
maLabelFont.SetHeight(nPopupFontHeight);
- SetFont(maLabelFont);
-
- SetText( OUString("ScMenuFloatingWindow") );
}
ScMenuFloatingWindow::~ScMenuFloatingWindow()
@@ -238,36 +236,38 @@ void ScMenuFloatingWindow::KeyInput(const KeyEvent& rKEvt)
Window::KeyInput(rKEvt);
}
-void ScMenuFloatingWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& /*rRect*/)
+void ScMenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
const StyleSettings& rStyle = GetSettings().GetStyleSettings();
+
+ SetFont(maLabelFont);
+
Color aBackColor = rStyle.GetMenuColor();
Color aBorderColor = rStyle.GetShadowColor();
- Rectangle aCtrlRect(Point(0, 0), GetOutputSizePixel());
+ Rectangle aCtrlRect(Point(0, 0), rRenderContext.GetOutputSizePixel());
// Window background
bool bNativeDrawn = true;
- if (IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
- SetClipRegion();
- bNativeDrawn = DrawNativeControl(
- CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, ControlState::ENABLED,
- ImplControlValue(), OUString());
+ rRenderContext.SetClipRegion();
+ bNativeDrawn = rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect,
+ ControlState::ENABLED, ImplControlValue(), OUString());
}
else
bNativeDrawn = false;
if (!bNativeDrawn)
{
- SetFillColor(aBackColor);
- SetLineColor(aBorderColor);
- DrawRect(aCtrlRect);
+ rRenderContext.SetFillColor(aBackColor);
+ rRenderContext.SetLineColor(aBorderColor);
+ rRenderContext.DrawRect(aCtrlRect);
}
// Menu items
- SetTextColor(rStyle.GetMenuTextColor());
- drawAllMenuItems();
+ rRenderContext.SetTextColor(rStyle.GetMenuTextColor());
+ drawAllMenuItems(rRenderContext);
}
Reference<XAccessible> ScMenuFloatingWindow::CreateAccessible()
@@ -348,7 +348,7 @@ Size ScMenuFloatingWindow::getMenuSize() const
return Size(aPos.X(), aPos.Y());
}
-void ScMenuFloatingWindow::drawMenuItem(size_t nPos)
+void ScMenuFloatingWindow::drawMenuItem(vcl::RenderContext& rRenderContext, size_t nPos)
{
if (nPos >= maMenuItems.size())
return;
@@ -357,82 +357,84 @@ void ScMenuFloatingWindow::drawMenuItem(size_t nPos)
Size aSize;
getMenuItemPosSize(nPos, aPos, aSize);
- DecorationView aDecoView(this);
+ DecorationView aDecoView(&rRenderContext);
long nXOffset = 5;
long nYOffset = (aSize.Height() - maLabelFont.GetHeight())/2;
- DrawCtrlText(Point(aPos.X()+nXOffset, aPos.Y() + nYOffset), maMenuItems[nPos].maText, 0,
- maMenuItems[nPos].maText.getLength(),
- maMenuItems[nPos].mbEnabled ? TEXT_DRAW_MNEMONIC : TEXT_DRAW_DISABLE);
+ rRenderContext. DrawCtrlText(Point(aPos.X()+nXOffset, aPos.Y() + nYOffset), maMenuItems[nPos].maText, 0,
+ maMenuItems[nPos].maText.getLength(),
+ maMenuItems[nPos].mbEnabled ? TEXT_DRAW_MNEMONIC : TEXT_DRAW_DISABLE);
if (maMenuItems[nPos].mpSubMenuWin)
{
long nFontHeight = maLabelFont.GetHeight();
Point aMarkerPos = aPos;
- aMarkerPos.Y() += aSize.Height()/2 - nFontHeight/4 + 1;
- aMarkerPos.X() += aSize.Width() - nFontHeight + nFontHeight/4;
- Size aMarkerSize(nFontHeight/2, nFontHeight/2);
- aDecoView.DrawSymbol(Rectangle(aMarkerPos, aMarkerSize),
- SymbolType::SPIN_RIGHT, GetTextColor());
+ aMarkerPos.Y() += aSize.Height() / 2 - nFontHeight / 4 + 1;
+ aMarkerPos.X() += aSize.Width() - nFontHeight + nFontHeight / 4;
+ Size aMarkerSize(nFontHeight / 2, nFontHeight / 2);
+ aDecoView.DrawSymbol(Rectangle(aMarkerPos, aMarkerSize), SymbolType::SPIN_RIGHT, GetTextColor());
}
}
-void ScMenuFloatingWindow::drawSeparator(size_t nPos)
+void ScMenuFloatingWindow::drawSeparator(vcl::RenderContext& rRenderContext, size_t nPos)
{
Point aPos;
Size aSize;
getMenuItemPosSize(nPos, aPos, aSize);
Rectangle aRegion(aPos,aSize);
- if (IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
- Push(PushFlags::CLIPREGION);
- IntersectClipRegion(aRegion);
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.IntersectClipRegion(aRegion);
Rectangle aCtrlRect(Point(0,0), GetOutputSizePixel());
- DrawNativeControl(
- CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, ControlState::ENABLED,
- ImplControlValue(), OUString());
+ rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect,
+ ControlState::ENABLED, ImplControlValue(), OUString());
- Pop();
+ rRenderContext.Pop();
}
bool bNativeDrawn = false;
- if (IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_SEPARATOR))
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_SEPARATOR))
{
ControlState nState = ControlState::NONE;
const MenuItemData& rData = maMenuItems[nPos];
if (rData.mbEnabled)
nState |= ControlState::ENABLED;
- bNativeDrawn = DrawNativeControl(
- CTRL_MENU_POPUP, PART_MENU_SEPARATOR,
- aRegion, nState, ImplControlValue(), OUString());
+ bNativeDrawn = rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_MENU_SEPARATOR,
+ aRegion, nState, ImplControlValue(), OUString());
}
if (!bNativeDrawn)
{
- const StyleSettings& rStyle = GetSettings().GetStyleSettings();
+ const StyleSettings& rStyle = rRenderContext.GetSettings().GetStyleSettings();
Point aTmpPos = aPos;
- aTmpPos.Y() += aSize.Height()/2;
- SetLineColor(rStyle.GetShadowColor());
- DrawLine(aTmpPos, Point(aSize.Width()+aTmpPos.X(), aTmpPos.Y()));
+ aTmpPos.Y() += aSize.Height() / 2;
+ rRenderContext.SetLineColor(rStyle.GetShadowColor());
+ rRenderContext.DrawLine(aTmpPos, Point(aSize.Width() + aTmpPos.X(), aTmpPos.Y()));
++aTmpPos.Y();
- SetLineColor(rStyle.GetLightColor());
- DrawLine(aTmpPos, Point(aSize.Width()+aTmpPos.X(), aTmpPos.Y()));
- SetLineColor();
+ rRenderContext.SetLineColor(rStyle.GetLightColor());
+ rRenderContext.DrawLine(aTmpPos, Point(aSize.Width() + aTmpPos.X(), aTmpPos.Y()));
+ rRenderContext.SetLineColor();
}
}
-void ScMenuFloatingWindow::drawAllMenuItems()
+void ScMenuFloatingWindow::drawAllMenuItems(vcl::RenderContext& rRenderContext)
{
size_t n = maMenuItems.size();
+
for (size_t i = 0; i < n; ++i)
{
if (maMenuItems[i].mbSeparator)
+ {
// Separator
- drawSeparator(i);
+ drawSeparator(rRenderContext, i);
+ }
else
+ {
// Normal menu item
- highlightMenuItem(i, i == mnSelectedMenu);
+ highlightMenuItem(rRenderContext, i, i == mnSelectedMenu);
+ }
}
}
@@ -503,7 +505,7 @@ void ScMenuFloatingWindow::handleMenuTimeout(SubMenuItemData* pTimer)
maCloseTimer.mpSubMenu->EndPopupMode();
maCloseTimer.mpSubMenu = NULL;
- highlightMenuItem(maOpenTimer.mnMenuPos, false);
+ Invalidate();
maOpenTimer.mnMenuPos = MENU_NOT_SELECTED;
}
}
@@ -579,8 +581,8 @@ void ScMenuFloatingWindow::endSubMenu(ScMenuFloatingWindow* pSubMenu)
size_t nMenuPos = getSubMenuPos(pSubMenu);
if (nMenuPos != MENU_NOT_SELECTED)
{
- highlightMenuItem(nMenuPos, true);
mnSelectedMenu = nMenuPos;
+ Invalidate();
fireMenuHighlightedEvent();
}
}
@@ -614,7 +616,7 @@ void ScMenuFloatingWindow::selectMenuItem(size_t nPos, bool bSelected, bool bSub
return;
}
- highlightMenuItem(nPos, bSelected);
+ Invalidate();
if (bSelected)
{
@@ -658,41 +660,39 @@ void ScMenuFloatingWindow::setName(const OUString& rName)
maName = rName;
}
-void ScMenuFloatingWindow::highlightMenuItem(size_t nPos, bool bSelected)
+void ScMenuFloatingWindow::highlightMenuItem(vcl::RenderContext& rRenderContext, size_t nPos, bool bSelected)
{
if (nPos == MENU_NOT_SELECTED)
return;
- const StyleSettings& rStyle = GetSettings().GetStyleSettings();
+ const StyleSettings& rStyle = rRenderContext.GetSettings().GetStyleSettings();
Color aBackColor = rStyle.GetMenuColor();
- SetFillColor(aBackColor);
- SetLineColor(aBackColor);
+ rRenderContext.SetFillColor(aBackColor);
+ rRenderContext.SetLineColor(aBackColor);
Point aPos;
Size aSize;
getMenuItemPosSize(nPos, aPos, aSize);
Rectangle aRegion(aPos,aSize);
- if (IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
- Push(PushFlags::CLIPREGION);
- IntersectClipRegion(Rectangle(aPos, aSize));
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.IntersectClipRegion(Rectangle(aPos, aSize));
Rectangle aCtrlRect(Point(0,0), GetOutputSizePixel());
- DrawNativeControl(
- CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, ControlState::ENABLED,
- ImplControlValue(), OUString());
-
- Pop();
+ rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, ControlState::ENABLED,
+ ImplControlValue(), OUString());
+ rRenderContext.Pop();
}
bool bNativeDrawn = true;
- if (IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_ITEM))
+ if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_MENU_ITEM))
{
ControlState nState = bSelected ? ControlState::SELECTED : ControlState::NONE;
if (maMenuItems[nPos].mbEnabled)
nState |= ControlState::ENABLED;
- bNativeDrawn = DrawNativeControl(
- CTRL_MENU_POPUP, PART_MENU_ITEM, aRegion, nState, ImplControlValue(), OUString());
+ bNativeDrawn = rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_MENU_ITEM,
+ aRegion, nState, ImplControlValue(), OUString());
}
else
bNativeDrawn = false;
@@ -702,15 +702,15 @@ void ScMenuFloatingWindow::highlightMenuItem(size_t nPos, bool bSelected)
if (bSelected)
{
aBackColor = rStyle.GetMenuHighlightColor();
- SetFillColor(aBackColor);
- SetLineColor(aBackColor);
+ rRenderContext.SetFillColor(aBackColor);
+ rRenderContext.SetLineColor(aBackColor);
}
- DrawRect(Rectangle(aPos,aSize));
+ rRenderContext.DrawRect(Rectangle(aPos,aSize));
}
Color aTextColor = bSelected ? rStyle.GetMenuHighlightTextColor() : rStyle.GetMenuTextColor();
- SetTextColor(aTextColor);
- drawMenuItem(nPos);
+ rRenderContext.SetTextColor(aTextColor);
+ drawMenuItem(rRenderContext, nPos);
}
void ScMenuFloatingWindow::getMenuItemPosSize(size_t nPos, Point& rPos, Size& rSize) const
@@ -786,8 +786,8 @@ void ScMenuFloatingWindow::setSubMenuFocused(ScMenuFloatingWindow* pSubMenu)
size_t nMenuPos = getSubMenuPos(pSubMenu);
if (mnSelectedMenu != nMenuPos)
{
- highlightMenuItem(nMenuPos, true);
mnSelectedMenu = nMenuPos;
+ Invalidate();
}
}
@@ -1320,14 +1320,14 @@ void ScCheckListMenuWindow::Paint(vcl::RenderContext& rRenderContext, const Rect
getSectionPosSize(aPos, aSize, LISTBOX_AREA_OUTER);
// Member list box background
- SetFillColor(aMemberBackColor);
- SetLineColor(aBorderColor);
- DrawRect(Rectangle(aPos,aSize));
+ rRenderContext.SetFillColor(aMemberBackColor);
+ rRenderContext.SetLineColor(aBorderColor);
+ rRenderContext.DrawRect(Rectangle(aPos,aSize));
// Single-action button box
getSectionPosSize(aPos, aSize, SINGLE_BTN_AREA);
- SetFillColor(rStyle.GetMenuColor());
- DrawRect(Rectangle(aPos,aSize));
+ rRenderContext.SetFillColor(rStyle.GetMenuColor());
+ rRenderContext.DrawRect(Rectangle(aPos,aSize));
}
vcl::Window* ScCheckListMenuWindow::GetPreferredKeyInputWindow()
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index 27a297c..26732c9 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -56,7 +56,7 @@ public:
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 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
void addMenuItem(const OUString& rText, bool bEnabled, Action* pAction);
void addSeparator();
@@ -80,10 +80,13 @@ protected:
virtual void handlePopupEnd();
Size getMenuSize() const;
- void drawMenuItem(size_t nPos);
- void drawSeparator(size_t nPos);
- void drawAllMenuItems();
- const vcl::Font& getLabelFont() const { return maLabelFont;}
+ void drawMenuItem(vcl::RenderContext& rRenderContext, size_t nPos);
+ void drawSeparator(vcl::RenderContext& rRenderContext, size_t nPos);
+ void drawAllMenuItems(vcl::RenderContext& rRenderContext);
+ const vcl::Font& getLabelFont() const
+ {
+ return maLabelFont;
+ }
void queueLaunchSubMenu(size_t nPos, ScMenuFloatingWindow* pMenu);
void queueCloseSubMenu();
@@ -95,15 +98,14 @@ protected:
ScDocument* getDoc() { return mpDoc;}
protected:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > mxAccessible;
+ css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
private:
struct SubMenuItemData;
void handleMenuTimeout(SubMenuItemData* pTimer);
void resizeToFitMenuItems();
- void highlightMenuItem(size_t nPos, bool bSelected);
+ void highlightMenuItem(vcl::RenderContext& rRenderContext, size_t nPos, bool bSelected);
size_t getEnclosingMenuItem(const Point& rPos) const;
size_t getSubMenuPos(ScMenuFloatingWindow* pSubMenu);
commit 0b00791b18fc1f79eefea24a7dc7e02a66b6d156
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 15:43:08 2015 +0900
refactor ScZoomSliderControl to use RenderContext
Change-Id: Ie57c22e12b8b6f68a52e857b815765d2d37fc099
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 806d0cb..17cc747 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -388,102 +388,102 @@ void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem )
Invalidate(aRect);
}
-void ScZoomSliderWnd::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScZoomSliderWnd::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
- DoPaint( rRect );
+ DoPaint(rRenderContext, rRect);
}
-void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ )
+void ScZoomSliderWnd::DoPaint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
- if( mpImpl->mbOmitPaint )
+ if (mpImpl->mbOmitPaint)
return;
- Size aSliderWindowSize = GetOutputSizePixel();
- Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+ Size aSliderWindowSize = rRenderContext.GetOutputSizePixel();
+ Rectangle aRect(Point(0, 0), aSliderWindowSize);
- ScopedVclPtrInstance< VirtualDevice > pVDev( *this );
- pVDev->SetOutputSizePixel( aSliderWindowSize );
+ ScopedVclPtrInstance< VirtualDevice > pVDev(rRenderContext);
+ pVDev->SetOutputSizePixel(aSliderWindowSize);
- Rectangle aSlider = aRect;
+ Rectangle aSlider = aRect;
- aSlider.Top() += ( aSliderWindowSize.Height() - nSliderHeight )/2 - 1;
- aSlider.Bottom() = aSlider.Top() + nSliderHeight;
- aSlider.Left() += nSliderXOffset;
- aSlider.Right() -= nSliderXOffset;
+ aSlider.Top() += (aSliderWindowSize.Height() - nSliderHeight) / 2 - 1;
+ aSlider.Bottom() = aSlider.Top() + nSliderHeight;
+ aSlider.Left() += nSliderXOffset;
+ aSlider.Right() -= nSliderXOffset;
- Rectangle aFirstLine( aSlider );
+ Rectangle aFirstLine(aSlider);
aFirstLine.Bottom() = aFirstLine.Top();
- Rectangle aSecondLine( aSlider );
+ Rectangle aSecondLine(aSlider);
aSecondLine.Top() = aSecondLine.Bottom();
- Rectangle aLeft( aSlider );
+ Rectangle aLeft(aSlider);
aLeft.Right() = aLeft.Left();
- Rectangle aRight( aSlider );
+ Rectangle aRight(aSlider);
aRight.Left() = aRight.Right();
// draw VirtualDevice's background color
- Color aStartColor,aEndColor;
- aStartColor = GetSettings().GetStyleSettings().GetFaceColor();
- aEndColor = GetSettings().GetStyleSettings().GetFaceColor();
- if( aEndColor.IsDark() )
+ Color aStartColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
+ Color aEndColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
+
+ if (aEndColor.IsDark())
aStartColor = aEndColor;
- Gradient g;
- g.SetAngle( 0 );
- g.SetStyle( GradientStyle_LINEAR );
+ Gradient aGradient;
+ aGradient.SetAngle(0);
+ aGradient.SetStyle(GradientStyle_LINEAR);
- g.SetStartColor( aStartColor );
- g.SetEndColor( aEndColor );
- pVDev->DrawGradient( aRect, g );
+ aGradient.SetStartColor(aStartColor);
+ aGradient.SetEndColor(aEndColor);
+ pVDev->DrawGradient(aRect, aGradient);
// draw slider
- pVDev->SetLineColor( Color ( COL_WHITE ) );
- pVDev->DrawRect( aSecondLine );
- pVDev->DrawRect( aRight );
+ pVDev->SetLineColor(Color(COL_WHITE));
+ pVDev->DrawRect(aSecondLine);
+ pVDev->DrawRect(aRight);
- pVDev->SetLineColor( Color( COL_GRAY ) );
- pVDev->DrawRect( aFirstLine );
- pVDev->DrawRect( aLeft );
+ pVDev->SetLineColor(Color(COL_GRAY));
+ pVDev->DrawRect(aFirstLine);
+ pVDev->DrawRect(aLeft);
// draw snapping points:
- std::vector< long >::iterator aSnappingPointIter;
- for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
+ std::vector<long>::iterator aSnappingPointIter;
+ for (aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
- ++aSnappingPointIter )
+ ++aSnappingPointIter)
{
- pVDev->SetLineColor( Color( COL_GRAY ) );
- Rectangle aSnapping( aRect );
+ pVDev->SetLineColor(Color(COL_GRAY));
+ Rectangle aSnapping(aRect);
aSnapping.Bottom() = aSlider.Top();
aSnapping.Top() = aSnapping.Bottom() - nSnappingHeight;
aSnapping.Left() += *aSnappingPointIter;
aSnapping.Right() = aSnapping.Left();
- pVDev->DrawRect( aSnapping );
+ pVDev->DrawRect(aSnapping);
aSnapping.Top() += nSnappingHeight + nSliderHeight;
aSnapping.Bottom() += nSnappingHeight + nSliderHeight;
- pVDev->DrawRect( aSnapping );
+ pVDev->DrawRect(aSnapping);
}
// draw slider button
Point aImagePoint = aRect.TopLeft();
- aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom );
- aImagePoint.X() -= nButtonWidth/2;
- aImagePoint.Y() += ( aSliderWindowSize.Height() - nButtonHeight)/2;
- pVDev->DrawImage( aImagePoint, mpImpl->maSliderButton );
+ aImagePoint.X() += Zoom2Offset(mpImpl->mnCurrentZoom);
+ aImagePoint.X() -= nButtonWidth / 2;
+ aImagePoint.Y() += (aSliderWindowSize.Height() - nButtonHeight) / 2;
+ pVDev->DrawImage(aImagePoint, mpImpl->maSliderButton);
// draw decrease button
aImagePoint = aRect.TopLeft();
- aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2;
- aImagePoint.Y() += ( aSliderWindowSize.Height() - nIncDecHeight)/2;
- pVDev->DrawImage( aImagePoint, mpImpl->maDecreaseButton );
+ aImagePoint.X() += (nSliderXOffset - nIncDecWidth) / 2;
+ aImagePoint.Y() += (aSliderWindowSize.Height() - nIncDecHeight) / 2;
+ pVDev->DrawImage(aImagePoint, mpImpl->maDecreaseButton);
// draw increase button
- aImagePoint.X() = aRect.TopLeft().X() + aSliderWindowSize.Width() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2;
- pVDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton );
+ aImagePoint.X() = aRect.TopLeft().X() + aSliderWindowSize.Width() - nIncDecWidth - (nSliderXOffset - nIncDecWidth) / 2;
+ pVDev->DrawImage(aImagePoint, mpImpl->maIncreaseButton);
- DrawOutDev( Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev );
+ rRenderContext.DrawOutDev(Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx
index 704d534..ac53e20 100644
--- a/sc/source/ui/inc/tbzoomsliderctrl.hxx
+++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx
@@ -26,41 +26,41 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <svx/zoomslideritem.hxx>
-class ScZoomSliderControl: public SfxToolBoxControl
+class ScZoomSliderControl : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~ScZoomSliderControl();
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
};
class ScZoomSliderWnd: public vcl::Window
{
private:
- struct ScZoomSliderWnd_Impl;
- ScZoomSliderWnd_Impl* mpImpl;
- Size aLogicalSize;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ struct ScZoomSliderWnd_Impl;
+ ScZoomSliderWnd_Impl* mpImpl;
+ Size aLogicalSize;
+ css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
+ css::uno::Reference<css::frame::XFrame> m_xFrame;
- sal_uInt16 Offset2Zoom( long nOffset ) const;
- long Zoom2Offset( sal_uInt16 nZoom ) const;
- void DoPaint( const Rectangle& rRect );
+ sal_uInt16 Offset2Zoom(long nOffset) const;
+ long Zoom2Offset(sal_uInt16 nZoom) const;
+ void DoPaint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
public:
- ScZoomSliderWnd( vcl::Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom );
+ ScZoomSliderWnd(vcl::Window* pParent, const css::uno::Reference<css::frame::XDispatchProvider >& rDispatchProvider,
+ const css::uno::Reference<css::frame::XFrame>& _xFrame, sal_uInt16 nCurrentZoom);
virtual ~ScZoomSliderWnd();
virtual void dispose() SAL_OVERRIDE;
- void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
+ void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
protected:
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void MouseMove( const MouseEvent& rMEvt ) 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 Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
};
#endif
commit 848e020fcf3ba4d6c8ff0a03fb6049193cc78848
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 15:26:15 2015 +0900
move Resize code to Paint for ScTextWnd
Change-Id: Icd0e12e02b808c3cf1eacd15021cdf249bdcfab3
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 940b125..d7ae24e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1518,6 +1518,10 @@ void ScTextWnd::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect
{
if (pEditView)
{
+ Size aSize = rRenderContext.GetOutputSizePixel();
+ long nDiff = aSize.Height() - rRenderContext.LogicToPixel(Size(0, rRenderContext.GetTextHeight())).Height();
+ pEditView->SetOutputArea(rRenderContext.PixelToLogic(Rectangle(Point(0, (nDiff > 0) ? nDiff / 2 : 1), aSize)));
+
pEditView->Paint(rRect, &rRenderContext);
}
else
@@ -1544,14 +1548,7 @@ void ScTextWnd::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect
void ScTextWnd::Resize()
{
- if (pEditView)
- {
- Size aSize = GetOutputSizePixel();
- long nDiff = aSize.Height() - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
-
- pEditView->SetOutputArea(PixelToLogic( Rectangle( Point( 0, (nDiff > 0) ? nDiff/2 : 1 ),
- aSize ) ) );
- }
+ Invalidate();
}
void ScTextWnd::MouseMove( const MouseEvent& rMEvt )
commit 71131e2b16272b0a504f44bd0b00a6cbd17aee13
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu May 14 15:21:17 2015 +0900
refactor ScTextWnd to use RenderContext
Change-Id: I6d5ab66df02a527c6643feb46cebe110cd1373b9
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a9cd2b6..940b125 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -202,28 +202,28 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
OSL_ENSURE( pViewSh, "no view shell for input window" );
// Position window, 3 buttons, input window
- InsertWindow ( 1, aWndPos.get(), ToolBoxItemBits::NONE, 0 );
- InsertSeparator ( 1 );
- InsertItem ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), ToolBoxItemBits::NONE, 2 );
- InsertItem ( SID_INPUT_SUM, IMAGE( SID_INPUT_SUM ), ToolBoxItemBits::NONE, 3 );
- InsertItem ( SID_INPUT_EQUAL, IMAGE( SID_INPUT_EQUAL ), ToolBoxItemBits::NONE, 4 );
- InsertSeparator ( 5 );
- InsertWindow ( 7, &aTextWindow, ToolBoxItemBits::NONE, 6 );
-
- aWndPos ->SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) );
- aWndPos ->SetHelpId ( HID_INSWIN_POS );
- aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
- aTextWindow.SetHelpId ( HID_INSWIN_INPUT );
+ InsertWindow (1, aWndPos.get(), ToolBoxItemBits::NONE, 0);
+ InsertSeparator (1);
+ InsertItem (SID_INPUT_FUNCTION, IMAGE(SID_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
+ InsertItem (SID_INPUT_SUM, IMAGE(SID_INPUT_SUM), ToolBoxItemBits::NONE, 3);
+ InsertItem (SID_INPUT_EQUAL, IMAGE(SID_INPUT_EQUAL), ToolBoxItemBits::NONE, 4);
+ InsertSeparator (5);
+ InsertWindow (7, &aTextWindow, ToolBoxItemBits::NONE, 6);
+
+ aWndPos ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
+ aWndPos ->SetHelpId (HID_INSWIN_POS);
+ aTextWindow.SetQuickHelpText(ScResId(SCSTR_QHELP_INPUTWND));
+ aTextWindow.SetHelpId (HID_INSWIN_INPUT);
// No SetHelpText: the helptexts come from the Help
- SetItemText ( SID_INPUT_FUNCTION, ScResId( SCSTR_QHELP_BTNCALC ) );
- SetHelpId ( SID_INPUT_FUNCTION, HID_INSWIN_CALC );
+ SetItemText (SID_INPUT_FUNCTION, ScResId(SCSTR_QHELP_BTNCALC));
+ SetHelpId (SID_INPUT_FUNCTION, HID_INSWIN_CALC);
- SetItemText ( SID_INPUT_SUM, aTextSum );
- SetHelpId ( SID_INPUT_SUM, HID_INSWIN_SUMME );
+ SetItemText (SID_INPUT_SUM, aTextSum);
+ SetHelpId (SID_INPUT_SUM, HID_INSWIN_SUMME);
- SetItemText ( SID_INPUT_EQUAL, aTextEqual );
- SetHelpId ( SID_INPUT_EQUAL, HID_INSWIN_FUNC );
+ SetItemText (SID_INPUT_EQUAL, aTextEqual);
+ SetHelpId (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
@@ -241,7 +241,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
// Also show selection (remember at the InputHdl)
aTextWindow.SetTextString( pInputHdl->GetFormString() );
}
- else if ( pInputHdl && pInputHdl->IsInputMode() )
+ else if (pInputHdl && pInputHdl->IsInputMode())
{
// If the input row was hidden while editing (e.g. when editing a formula
// and then switching to another document or the help), display the text
@@ -250,10 +250,10 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
if ( pInputHdl->IsTopMode() )
pInputHdl->SetMode( SC_INPUT_TABLE ); // Focus ends up at the bottom anyways
}
- else if ( pViewSh )
- pViewSh->UpdateInputHandler( true ); // Absolutely necessary update
+ else if (pViewSh)
+ pViewSh->UpdateInputHandler(true); // Absolutely necessary update
- pImgMgr->RegisterToolBox( this );
+ pImgMgr->RegisterToolBox(this);
SetAccessibleName(ScResId(STR_ACC_TOOLBAR_FORMULA));
}
@@ -562,11 +562,12 @@ void ScInputWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& r
// draw a line at the bottom to distinguish that from the grid
// (we have space for that thanks to ADDITIONAL_BORDER)
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetLineColor( rStyleSettings.GetShadowColor() );
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
Size aSize = GetSizePixel();
- DrawLine( Point( 0, aSize.Height() - 1 ), Point( aSize.Width() - 1, aSize.Height() - 1 ) );
+ rRenderContext.DrawLine(Point(0, aSize.Height() - 1),
+ Point(aSize.Width() - 1, aSize.Height() - 1));
}
void ScInputWindow::Resize()
@@ -967,11 +968,11 @@ void ScInputBarGroup::SetTextString( const OUString& rString )
void ScInputBarGroup::Resize()
{
- vcl::Window *w=GetParent();
+ vcl::Window*w = GetParent();
ScInputWindow *pParent;
- pParent=dynamic_cast<ScInputWindow*>(w);
+ pParent = dynamic_cast<ScInputWindow*>(w);
- if(pParent==NULL)
+ if (pParent == NULL)
{
OSL_FAIL("The parent window pointer pParent is null");
return;
@@ -981,7 +982,7 @@ void ScInputBarGroup::Resize()
long nLeft = GetPosPixel().X();
Size aSize = GetSizePixel();
- aSize.Width() = std::max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
+ aSize.Width() = std::max(long(nWidth - nLeft - LEFT_OFFSET), long(0));
aScrollBar->SetPosPixel(Point( aSize.Width() - aButton->GetSizePixel().Width(), aButton->GetSizePixel().Height() ) );
@@ -995,7 +996,7 @@ void ScInputBarGroup::Resize()
SetSizePixel(aSize);
- if( aMultiTextWnd->GetNumLines() > 1 )
+ if (aMultiTextWnd->GetNumLines() > 1)
{
aButton->SetSymbol( SymbolType::SPIN_UP );
aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) );
@@ -1072,22 +1073,22 @@ void ScInputBarGroup::DecrementVerticalSize()
IMPL_LINK_NOARG(ScInputBarGroup, ClickHdl)
{
- vcl::Window *w=GetParent();
- ScInputWindow *pParent;
- pParent=dynamic_cast<ScInputWindow*>(w);
+ vcl::Window* w = GetParent();
+ ScInputWindow* pParent;
+ pParent = dynamic_cast<ScInputWindow*>(w);
- if(pParent==NULL)
+ if (pParent == NULL)
{
OSL_FAIL("The parent window pointer pParent is null");
return 1;
}
- if( aMultiTextWnd->GetNumLines() > 1 )
+ if (aMultiTextWnd->GetNumLines() > 1)
{
- aMultiTextWnd->SetNumLines( 1 );
+ aMultiTextWnd->SetNumLines(1);
}
else
{
- aMultiTextWnd->SetNumLines( aMultiTextWnd->GetLastNumExpandedLines() );
+ aMultiTextWnd->SetNumLines(aMultiTextWnd->GetLastNumExpandedLines());
}
TriggerToolboxLayout();
@@ -1160,15 +1161,14 @@ void ScInputBarGroup::TextGrabFocus()
}
ScMultiTextWnd::ScMultiTextWnd( ScInputBarGroup* pParen, ScTabViewShell* pViewSh )
- :
- ScTextWnd( pParen, pViewSh ),
- mrGroupBar(* pParen ),
- mnLines( 1 ),
- mnLastExpandedLines( INPUTWIN_MULTILINES ),
- mbInvalidate( false )
+ : ScTextWnd( pParen, pViewSh ),
+ mrGroupBar(* pParen ),
+ mnLines( 1 ),
+ mnLastExpandedLines( INPUTWIN_MULTILINES ),
+ mbInvalidate( false )
{
Size aBorder;
- aBorder = CalcWindowSize( aBorder);
+ aBorder = CalcWindowSize(aBorder);
mnBorderHeight = aBorder.Height();
}
@@ -1176,17 +1176,17 @@ ScMultiTextWnd::~ScMultiTextWnd()
{
}
-void ScMultiTextWnd::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScMultiTextWnd::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
{
EditView* pView = GetEditView();
- if ( pView )
+ if (pView)
{
- if ( mbInvalidate )
+ if (mbInvalidate)
{
pView->Invalidate();
mbInvalidate = false;
}
- pEditView->Paint( rRect );
+ pEditView->Paint(rRect, &rRenderContext);
}
}
@@ -1455,45 +1455,45 @@ void ScMultiTextWnd::SetTextString( const OUString& rNewString )
}
ScTextWnd::ScTextWnd( vcl::Window* pParent, ScTabViewShell* pViewSh )
- : ScTextWndBase ( pParent, WinBits(WB_HIDE | WB_BORDER) ),
- DragSourceHelper( this ),
- pEditEngine ( NULL ),
- pEditView ( NULL ),
- bIsInsertMode( true ),
- bFormulaMode ( false ),
- bInputMode ( false ),
+ : ScTextWndBase(pParent, WinBits(WB_HIDE | WB_BORDER)),
+ DragSourceHelper(this),
+ pEditEngine (NULL),
+ pEditView (NULL),
+ bIsInsertMode(true),
+ bFormulaMode (false),
+ bInputMode (false),
mpViewShell(pViewSh)
{
- EnableRTL( false ); // EditEngine can't be used with VCL EnableRTL
+ EnableRTL(false); // EditEngine can't be used with VCL EnableRTL
bIsRTL = AllSettings::GetLayoutRTL();
// always use application font, so a font with cjk chars can be installed
vcl::Font aAppFont = GetFont();
aTextFont = aAppFont;
- aTextFont.SetSize( PixelToLogic( aAppFont.GetSize(), MAP_TWIP ) ); // AppFont is in pixels
+ aTextFont.SetSize(PixelToLogic(aAppFont.GetSize(), MAP_TWIP)); // AppFont is in pixels
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- Color aBgColor= rStyleSettings.GetWindowColor();
- Color aTxtColor= rStyleSettings.GetWindowTextColor();
+ Color aBgColor = rStyleSettings.GetWindowColor();
+ Color aTxtColor = rStyleSettings.GetWindowTextColor();
- aTextFont.SetTransparent ( true );
- aTextFont.SetFillColor ( aBgColor );
- //aTextFont.SetColor ( COL_FIELDTEXT );
- aTextFont.SetColor (aTxtColor);
- aTextFont.SetWeight ( WEIGHT_NORMAL );
+ aTextFont.SetTransparent(true);
+ aTextFont.SetFillColor(aBgColor);
+ aTextFont.SetColor(aTxtColor);
+ aTextFont.SetWeight(WEIGHT_NORMAL);
Size aSize(1,TBX_WINDOW_HEIGHT);
Size aMinEditSize( Edit::GetMinimumEditSize() );
if( aMinEditSize.Height() > aSize.Height() )
aSize.Height() = aMinEditSize.Height();
- SetSizePixel ( aSize );
- SetBackground ( aBgColor );
- SetLineColor ( COL_BLACK );
- SetMapMode ( MAP_TWIP );
- SetPointer ( POINTER_TEXT );
- SetFont( aTextFont );
+
+ SetSizePixel(aSize);
+ SetBackground(aBgColor);
+ SetLineColor(COL_BLACK);
+ SetMapMode(MAP_TWIP);
+ SetPointer(POINTER_TEXT);
+ SetFont(aTextFont);
}
ScTextWnd::~ScTextWnd()
@@ -1514,30 +1514,32 @@ void ScTextWnd::dispose()
ScTextWndBase::dispose();
}
-void ScTextWnd::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void ScTextWnd::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
if (pEditView)
- pEditView->Paint( rRect );
+ {
+ pEditView->Paint(rRect, &rRenderContext);
+ }
else
{
- SetFont( aTextFont );
+ Size aSize = GetOutputSizePixel();
+ SetFont(aTextFont);
+
+ long nDiff = aSize.Height() - rRenderContext.LogicToPixel(Size(0, rRenderContext.GetTextHeight())).Height();
- long nDiff = GetOutputSizePixel().Height()
- - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
// if (nDiff<2) nDiff=2; // At least 1 pixel
long nStartPos = 0;
- if ( bIsRTL )
+ if (bIsRTL)
{
// right-align
- nStartPos += GetOutputSizePixel().Width() -
- LogicToPixel( Size( GetTextWidth( aString ), 0 ) ).Width();
+ nStartPos += aSize.Width() - rRenderContext.LogicToPixel(Size(rRenderContext.GetTextWidth(aString), 0)).Width();
// LayoutMode isn't changed as long as ModifyRTLDefaults doesn't include SvxFrameDirectionItem
}
-
- DrawText( PixelToLogic( Point( nStartPos, nDiff/2 ) ), aString );
+ rRenderContext.DrawText(rRenderContext.PixelToLogic(Point(nStartPos, nDiff / 2)), aString);
}
+ rRenderContext.Pop();
}
void ScTextWnd::Resize()
@@ -1545,11 +1547,9 @@ void ScTextWnd::Resize()
if (pEditView)
{
Size aSize = GetOutputSizePixel();
- long nDiff = aSize.Height()
- - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
+ long nDiff = aSize.Height() - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
- pEditView->SetOutputArea(
- PixelToLogic( Rectangle( Point( 0, (nDiff > 0) ? nDiff/2 : 1 ),
+ pEditView->SetOutputArea(PixelToLogic( Rectangle( Point( 0, (nDiff > 0) ? nDiff/2 : 1 ),
aSize ) ) );
}
}
More information about the Libreoffice-commits
mailing list