summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-13 17:49:59 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-14 09:58:14 +0900
commitdcaef20266ef3511f71d3c4b8962af5f03860feb (patch)
tree5727302841b1bf364ee323e3ed74a331c3423734 /sfx2
parent9de1d53a2ce3ee7036b4688b373db7b2235af4d9 (diff)
refactor sidebar classes to use RenderContext, cleanup
Change-Id: Iee68c5791573f720aa286697d1f671ff0fecad0b
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx99
-rw-r--r--sfx2/source/sidebar/Deck.hxx32
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx12
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.hxx22
-rw-r--r--sfx2/source/sidebar/DrawHelper.cxx160
-rw-r--r--sfx2/source/sidebar/DrawHelper.hxx36
-rw-r--r--sfx2/source/sidebar/MenuButton.cxx34
-rw-r--r--sfx2/source/sidebar/Panel.cxx26
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx25
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.hxx22
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx35
-rw-r--r--sfx2/source/sidebar/TabBar.cxx71
-rw-r--r--sfx2/source/sidebar/TabItem.cxx22
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx106
-rw-r--r--sfx2/source/sidebar/TitleBar.hxx37
15 files changed, 287 insertions, 452 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 4b2893e823d2..256cee64b004 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -115,43 +115,33 @@ Rectangle Deck::GetContentArea() const
aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize);
}
-void Deck::Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea)
+void Deck::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
{
(void) rUpdateArea;
const Size aWindowSize (GetSizePixel());
- const SvBorder aPadding (
- Theme::GetInteger(Theme::Int_DeckLeftPadding),
- Theme::GetInteger(Theme::Int_DeckTopPadding),
- Theme::GetInteger(Theme::Int_DeckRightPadding),
- Theme::GetInteger(Theme::Int_DeckBottomPadding));
+ const SvBorder aPadding(Theme::GetInteger(Theme::Int_DeckLeftPadding),
+ Theme::GetInteger(Theme::Int_DeckTopPadding),
+ Theme::GetInteger(Theme::Int_DeckRightPadding),
+ Theme::GetInteger(Theme::Int_DeckBottomPadding));
// Paint deck background outside the border.
- Rectangle aBox(
- 0,
- 0,
- aWindowSize.Width() - 1,
- aWindowSize.Height() - 1);
- DrawHelper::DrawBorder(
- *this,
- aBox,
- aPadding,
- Theme::GetPaint(Theme::Paint_DeckBackground),
- Theme::GetPaint(Theme::Paint_DeckBackground));
+ Rectangle aBox(0, 0, aWindowSize.Width() - 1, aWindowSize.Height() - 1);
+ DrawHelper::DrawBorder(rRenderContext, aBox, aPadding,
+ Theme::GetPaint(Theme::Paint_DeckBackground),
+ Theme::GetPaint(Theme::Paint_DeckBackground));
// Paint the border.
- const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
+ const int nBorderSize(Theme::GetInteger(Theme::Int_DeckBorderSize));
aBox.Left() += aPadding.Left();
aBox.Top() += aPadding.Top();
aBox.Right() -= aPadding.Right();
aBox.Bottom() -= aPadding.Bottom();
- const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
- DrawHelper::DrawBorder(
- *this,
- aBox,
- SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize),
- rHorizontalBorderPaint,
- Theme::GetPaint(Theme::Paint_VerticalBorder));
+ const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder));
+ DrawHelper::DrawBorder(rRenderContext, aBox,
+ SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize),
+ rHorizontalBorderPaint,
+ Theme::GetPaint(Theme::Paint_VerticalBorder));
}
void Deck::DataChanged (const DataChangedEvent& rEvent)
@@ -206,7 +196,7 @@ bool Deck::ProcessWheelEvent(CommandEvent* pCommandEvent)
* This container may contain existing panels that are
* being re-used, and new ones too.
*/
-void Deck::ResetPanels (const SharedPanelContainer& rPanels)
+void Deck::ResetPanels(const SharedPanelContainer& rPanels)
{
// First dispose old panels we no longer need.
for (size_t i = 0; i < maPanels.size(); i++)
@@ -226,15 +216,9 @@ void Deck::RequestLayout()
{
mnMinimalWidth = 0;
- DeckLayouter::LayoutDeck(
- GetContentArea(),
- mnMinimalWidth,
- maPanels,
- *GetTitleBar(),
- *mpScrollClipWindow,
- *mpScrollContainer,
- *mpFiller,
- *mpVerticalScrollBar);
+ DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels,
+ *GetTitleBar(), *mpScrollClipWindow, *mpScrollContainer,
+ *mpFiller, *mpVerticalScrollBar);
}
vcl::Window* Deck::GetPanelParentWindow()
@@ -242,7 +226,7 @@ vcl::Window* Deck::GetPanelParentWindow()
return mpScrollContainer.get();
}
-void Deck::ShowPanel (const Panel& rPanel)
+void Deck::ShowPanel(const Panel& rPanel)
{
if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible())
{
@@ -271,7 +255,7 @@ void Deck::ShowPanel (const Panel& rPanel)
}
}
-const OUString GetWindowClassification (const vcl::Window* pWindow)
+const OUString GetWindowClassification(const vcl::Window* pWindow)
{
const OUString& rsName (pWindow->GetText());
if (!rsName.isEmpty())
@@ -284,31 +268,29 @@ const OUString GetWindowClassification (const vcl::Window* pWindow)
}
}
-void Deck::PrintWindowSubTree (vcl::Window* pRoot, int nIndentation)
+void Deck::PrintWindowSubTree(vcl::Window* pRoot, int nIndentation)
{
static const char* sIndentation = " ";
const Point aLocation (pRoot->GetPosPixel());
const Size aSize (pRoot->GetSizePixel());
SAL_INFO(
"sfx.sidebar",
- sIndentation+strlen(sIndentation)-nIndentation*4 << pRoot << " "
+ sIndentation + strlen(sIndentation) - nIndentation * 4 << pRoot << " "
<< GetWindowClassification(pRoot) << " "
<< (pRoot->IsVisible() ? "visible" : "hidden") << " +"
<< aLocation.X() << "+" << aLocation.Y() << " x" << aSize.Width()
<< "x" << aSize.Height());
- const sal_uInt16 nChildCount (pRoot->GetChildCount());
- for (sal_uInt16 nIndex=0; nIndex<nChildCount; ++nIndex)
- PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation+1);
+ const sal_uInt16 nChildCount(pRoot->GetChildCount());
+ for (sal_uInt16 nIndex = 0; nIndex < nChildCount; ++nIndex)
+ PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation + 1);
}
IMPL_LINK_NOARG(Deck, HandleVerticalScrollBarChange)
{
const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos());
- mpScrollContainer->SetPosPixel(
- Point(
- mpScrollContainer->GetPosPixel().X(),
- nYOffset));
+ mpScrollContainer->SetPosPixel(Point(mpScrollContainer->GetPosPixel().X(),
+ nYOffset));
return sal_IntPtr(true);
}
@@ -323,26 +305,17 @@ Deck::ScrollContainerWindow::ScrollContainerWindow (vcl::Window* pParentWindow)
#endif
}
-void Deck::ScrollContainerWindow::Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea)
+void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rUpdateArea*/)
{
- (void)rUpdateArea;
-
// Paint the separators.
- const sal_Int32 nSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
- const sal_Int32 nLeft (0);
- const sal_Int32 nRight (GetSizePixel().Width()-1);
- const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
- for (::std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()), iEnd(maSeparators.end());
- iY!=iEnd;
- ++iY)
+ const sal_Int32 nSeparatorHeight(Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
+ const sal_Int32 nLeft(0);
+ const sal_Int32 nRight(GetSizePixel().Width() - 1);
+ const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder));
+ for (std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()); iY != maSeparators.end(); ++iY)
{
- DrawHelper::DrawHorizontalLine(
- *this,
- nLeft,
- nRight,
- *iY,
- nSeparatorHeight,
- rHorizontalBorderPaint);
+ DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, *iY,
+ nSeparatorHeight, rHorizontalBorderPaint);
}
}
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index 5db17296aed5..22584f8572ea 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -38,22 +38,26 @@ class DeckTitleBar;
/** This is the parent window of the panels.
It displays the deck title.
*/
-class Deck
- : public vcl::Window
+class Deck : public vcl::Window
{
public:
- Deck (
- const DeckDescriptor& rDeckDescriptor,
- vcl::Window* pParentWindow,
- const ::boost::function<void()>& rCloserAction);
+ Deck(const DeckDescriptor& rDeckDescriptor,
+ vcl::Window* pParentWindow,
+ const boost::function<void()>& rCloserAction);
virtual ~Deck();
virtual void dispose() SAL_OVERRIDE;
- const ::rtl::OUString& GetId() const { return msId;}
+ const OUString& GetId() const
+ {
+ return msId;
+ }
DeckTitleBar* GetTitleBar() const;
Rectangle GetContentArea() const;
void ResetPanels (const SharedPanelContainer& rPanels);
- const SharedPanelContainer& GetPanels() const { return maPanels;}
+ const SharedPanelContainer& GetPanels() const
+ {
+ return maPanels;
+ }
void RequestLayout();
vcl::Window* GetPanelParentWindow();
@@ -63,7 +67,7 @@ public:
*/
void ShowPanel (const Panel& rPanel);
- virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE;
@@ -74,15 +78,15 @@ public:
class ScrollContainerWindow : public vcl::Window
{
public:
- ScrollContainerWindow (vcl::Window* pParentWindow);
- virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
- void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
+ ScrollContainerWindow(vcl::Window* pParentWindow);
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
+ void SetSeparators(const ::std::vector<sal_Int32>& rSeparators);
private:
- ::std::vector<sal_Int32> maSeparators;
+ std::vector<sal_Int32> maSeparators;
};
private:
- const ::rtl::OUString msId;
+ const OUString msId;
Image maIcon;
sal_Int32 mnMinimalWidth;
SharedPanelContainer maPanels;
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index 4e52d1aa57ab..01bbf961b540 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -33,10 +33,9 @@ namespace sfx2 { namespace sidebar {
static const sal_Int32 gaLeftGripPadding (3);
static const sal_Int32 gaRightGripPadding (3);
-DeckTitleBar::DeckTitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- const ::boost::function<void()>& rCloserAction)
+DeckTitleBar::DeckTitleBar (const OUString& rsTitle,
+ vcl::Window* pParentWindow,
+ const boost::function<void()>& rCloserAction)
: TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()),
mnCloserItemIndex(1),
maCloserAction(rCloserAction),
@@ -83,9 +82,8 @@ Rectangle DeckTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
rTitleBarBox.Bottom());
}
-void DeckTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
+void DeckTitleBar::PaintDecoration(vcl::RenderContext& /*rRenderContext*/, const Rectangle& /*rTitleBarBox*/)
{
- (void)rTitleBarBox;
}
sidebar::Paint DeckTitleBar::GetBackgroundPaint()
@@ -107,7 +105,7 @@ void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
css::uno::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessible()
{
- const ::rtl::OUString sAccessibleName(msTitle);
+ const OUString sAccessibleName(msTitle);
SetAccessibleName(sAccessibleName);
SetAccessibleDescription(sAccessibleName);
return TitleBar::CreateAccessible();
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index 871635b42632..2db491ed47e7 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -25,30 +25,28 @@
namespace sfx2 { namespace sidebar {
-class DeckTitleBar
- : public TitleBar
+class DeckTitleBar : public TitleBar
{
public:
- DeckTitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- const ::boost::function<void()>& rCloserAction);
+ DeckTitleBar(const OUString& rsTitle,
+ vcl::Window* pParentWindow,
+ const boost::function<void()>& rCloserAction);
- void SetCloserVisible (const bool bIsCloserVisible);
+ void SetCloserVisible(const bool bIsCloserVisible);
- virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
+ virtual void DataChanged(const DataChangedEvent& rEvent) SAL_OVERRIDE;
protected:
- virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) SAL_OVERRIDE;
- virtual void PaintDecoration (const Rectangle& rTitleBarBox) SAL_OVERRIDE;
+ virtual Rectangle GetTitleArea(const Rectangle& rTitleBarBox) SAL_OVERRIDE;
+ virtual void PaintDecoration(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) SAL_OVERRIDE;
virtual sidebar::Paint GetBackgroundPaint() SAL_OVERRIDE;
virtual Color GetTextColor() SAL_OVERRIDE;
- virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) SAL_OVERRIDE;
+ virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) SAL_OVERRIDE;
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
private:
const sal_uInt16 mnCloserItemIndex;
- const ::boost::function<void()> maCloserAction;
+ const boost::function<void()> maCloserAction;
bool mbIsCloserVisible;
};
diff --git a/sfx2/source/sidebar/DrawHelper.cxx b/sfx2/source/sidebar/DrawHelper.cxx
index 903f63827fa4..66ac2f727421 100644
--- a/sfx2/source/sidebar/DrawHelper.cxx
+++ b/sfx2/source/sidebar/DrawHelper.cxx
@@ -24,146 +24,100 @@
namespace sfx2 { namespace sidebar {
-void DrawHelper::DrawBorder (
- OutputDevice& rDevice,
- const Rectangle& rBox,
- const SvBorder& rBorderSize,
- const Paint& rHorizontalPaint,
- const Paint& rVerticalPaint)
+void DrawHelper::DrawBorder(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const SvBorder& rBorderSize,
+ const Paint& rHorizontalPaint, const Paint& rVerticalPaint)
{
// Draw top line.
- DrawHorizontalLine(
- rDevice,
- rBox.Left(),
- rBox.Right(),
- rBox.Top(),
- rBorderSize.Top(),
- rHorizontalPaint);
+ DrawHorizontalLine(rRenderContext, rBox.Left(), rBox.Right(),
+ rBox.Top(), rBorderSize.Top(), rHorizontalPaint);
+
// Draw bottom line.
- DrawHorizontalLine(
- rDevice,
- rBox.Left()+rBorderSize.Left(),
- rBox.Right(),
- rBox.Bottom()-rBorderSize.Bottom()+1,
- rBorderSize.Bottom(),
- rHorizontalPaint);
+ DrawHorizontalLine(rRenderContext, rBox.Left() + rBorderSize.Left(), rBox.Right(),
+ rBox.Bottom() - rBorderSize.Bottom() + 1, rBorderSize.Bottom(),
+ rHorizontalPaint);
// Draw left line.
- DrawVerticalLine(
- rDevice,
- rBox.Top()+rBorderSize.Top(),
- rBox.Bottom(),
- rBox.Left(),
- rBorderSize.Left(),
- rVerticalPaint);
+ DrawVerticalLine(rRenderContext, rBox.Top() + rBorderSize.Top(), rBox.Bottom(),
+ rBox.Left(), rBorderSize.Left(), rVerticalPaint);
// Draw right line.
- DrawVerticalLine(
- rDevice,
- rBox.Top()+rBorderSize.Top(),
- rBox.Bottom()-rBorderSize.Bottom(),
- rBox.Right()-rBorderSize.Right()+1,
- rBorderSize.Right(),
- rVerticalPaint);
+ DrawVerticalLine(rRenderContext, rBox.Top() + rBorderSize.Top(), rBox.Bottom() - rBorderSize.Bottom(),
+ rBox.Right() - rBorderSize.Right() + 1, rBorderSize.Right(), rVerticalPaint);
}
-void DrawHelper::DrawHorizontalLine(
- OutputDevice& rDevice,
- const sal_Int32 nLeft,
- const sal_Int32 nRight,
- const sal_Int32 nY,
- const sal_Int32 nHeight,
- const Paint& rPaint)
+void DrawHelper::DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight,
+ const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint)
{
switch (rPaint.GetType())
{
- case Paint::NoPaint:
- default:
- break;
-
case Paint::ColorPaint:
{
- const Color aColor (rPaint.GetColor());
- rDevice.SetLineColor(aColor);
- for (sal_Int32 nYOffset=0; nYOffset<nHeight; ++nYOffset)
- rDevice.DrawLine(
- Point(nLeft,nY+nYOffset),
- Point(nRight,nY+nYOffset));
+ const Color aColor(rPaint.GetColor());
+ rRenderContext.SetLineColor(aColor);
+ for (sal_Int32 nYOffset = 0; nYOffset < nHeight; ++nYOffset)
+ {
+ rRenderContext.DrawLine(Point(nLeft, nY + nYOffset),
+ Point(nRight, nY + nYOffset));
+ }
break;
}
case Paint::GradientPaint:
- rDevice.DrawGradient(
- Rectangle(
- nLeft,
- nY,
- nRight,
- nY+nHeight-1),
- rPaint.GetGradient());
+ rRenderContext.DrawGradient(Rectangle(nLeft, nY, nRight, nY + nHeight - 1),
+ rPaint.GetGradient());
+ break;
+
+ case Paint::NoPaint:
+ default:
break;
}
}
-void DrawHelper::DrawVerticalLine(
- OutputDevice& rDevice,
- const sal_Int32 nTop,
- const sal_Int32 nBottom,
- const sal_Int32 nX,
- const sal_Int32 nWidth,
- const Paint& rPaint)
+void DrawHelper::DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom,
+ const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint)
{
switch (rPaint.GetType())
{
- case Paint::NoPaint:
- default:
- break;
-
case Paint::ColorPaint:
{
- const Color aColor (rPaint.GetColor());
- rDevice.SetLineColor(aColor);
- for (sal_Int32 nXOffset=0; nXOffset<nWidth; ++nXOffset)
- rDevice.DrawLine(
- Point(nX+nXOffset, nTop),
- Point(nX+nXOffset, nBottom));
+ const Color aColor(rPaint.GetColor());
+ rRenderContext.SetLineColor(aColor);
+ for (sal_Int32 nXOffset = 0; nXOffset < nWidth; ++nXOffset)
+ {
+ rRenderContext.DrawLine(Point(nX + nXOffset, nTop),
+ Point(nX + nXOffset, nBottom));
+ }
break;
}
case Paint::GradientPaint:
- rDevice.DrawGradient(
- Rectangle(
- nX,
- nTop,
- nX+nWidth-1,
- nBottom),
- rPaint.GetGradient());
+ rRenderContext.DrawGradient(Rectangle(nX, nTop, nX + nWidth - 1, nBottom),
+ rPaint.GetGradient());
break;
- }
-}
-void DrawHelper::DrawRoundedRectangle (
- OutputDevice& rDevice,
- const Rectangle& rBox,
- const sal_Int32 nCornerRadius,
- const Color& rBorderColor,
- const Paint& rFillPaint)
-{
- rDevice.SetLineColor(rBorderColor);
- switch(rFillPaint.GetType())
- {
case Paint::NoPaint:
default:
- rDevice.SetFillColor();
- rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
break;
+ }
+}
+void DrawHelper::DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const sal_Int32 nCornerRadius,
+ const Color& rBorderColor, const Paint& rFillPaint)
+{
+ rRenderContext.SetLineColor(rBorderColor);
+ switch (rFillPaint.GetType())
+ {
case Paint::ColorPaint:
- rDevice.SetFillColor(rFillPaint.GetColor());
- rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
+ rRenderContext.SetFillColor(rFillPaint.GetColor());
+ rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius);
break;
case Paint::GradientPaint:
- rDevice.DrawGradient(
- rBox,
- rFillPaint.GetGradient());
- rDevice.SetFillColor();
- rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius);
+ rRenderContext.DrawGradient(rBox, rFillPaint.GetGradient());
+ rRenderContext.SetFillColor();
+ rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius);
+ break;
+
+ case Paint::NoPaint:
+ default:
+ rRenderContext.SetFillColor();
+ rRenderContext.DrawRect(rBox, nCornerRadius, nCornerRadius);
break;
}
}
diff --git a/sfx2/source/sidebar/DrawHelper.hxx b/sfx2/source/sidebar/DrawHelper.hxx
index f93418f0d4aa..97bdb0c04530 100644
--- a/sfx2/source/sidebar/DrawHelper.hxx
+++ b/sfx2/source/sidebar/DrawHelper.hxx
@@ -34,35 +34,17 @@ class Paint;
class DrawHelper
{
public:
- static void DrawBorder (
- OutputDevice& rDevice,
- const Rectangle& rBox,
- const SvBorder& rBorderSize,
- const Paint& rHorizontalPaint,
- const Paint& rVerticalPaint);
- static void DrawHorizontalLine(
- OutputDevice& rDevice,
- const sal_Int32 nLeft,
- const sal_Int32 nRight,
- const sal_Int32 nY,
- const sal_Int32 nHeight,
- const Paint& rPaint);
- static void DrawVerticalLine(
- OutputDevice& rDevice,
- const sal_Int32 nTop,
- const sal_Int32 nBottom,
- const sal_Int32 nX,
- const sal_Int32 nWidth,
- const Paint& rPaint);
- static void DrawRoundedRectangle (
- OutputDevice& rDevice,
- const Rectangle& rBox,
- const sal_Int32 nCornerRadius,
- const Color& rBorderColor,
- const Paint& rFillPaint);
+ static void DrawBorder(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const SvBorder& rBorderSize,
+ const Paint& rHorizontalPaint, const Paint& rVerticalPaint);
+ static void DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight,
+ const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint);
+ static void DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom,
+ const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint);
+ static void DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const Rectangle& rBox, const sal_Int32 nCornerRadius,
+ const Color& rBorderColor, const Paint& rFillPaint);
};
-} } // end of namespace sfx2::sidebar
+}} // end of namespace sfx2::sidebar
#endif
diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx
index 3bd24c1d4011..47e5971e64e6 100644
--- a/sfx2/source/sidebar/MenuButton.cxx
+++ b/sfx2/source/sidebar/MenuButton.cxx
@@ -39,9 +39,9 @@ MenuButton::MenuButton (vcl::Window* pParentWindow)
#endif
}
-void MenuButton::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
+void MenuButton::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
{
- switch(mePaintType)
+ switch (mePaintType)
{
case PT_Theme:
default:
@@ -49,29 +49,25 @@ void MenuButton::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUp
const bool bIsSelected (IsChecked());
const bool bIsHighlighted (IsMouseOver() || HasFocus());
DrawHelper::DrawRoundedRectangle(
- *this,
- Rectangle(Point(0,0), GetSizePixel()),
- 3,
- bIsHighlighted||bIsSelected
- ? Theme::GetColor(Theme::Color_TabItemBorder)
- : Color(0xffffffff),
- bIsHighlighted
- ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
- : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
+ rRenderContext,
+ Rectangle(Point(0,0), GetSizePixel()),
+ 3,
+ (bIsHighlighted || bIsSelected
+ ? Theme::GetColor(Theme::Color_TabItemBorder)
+ : Color(0xffffffff)),
+ (bIsHighlighted
+ ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
+ : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal)));
const Image aIcon(Button::GetModeImage());
- const Size aIconSize (aIcon.GetSizePixel());
- const Point aIconLocation(
- (GetSizePixel().Width() - aIconSize.Width())/2,
- (GetSizePixel().Height() - aIconSize.Height())/2);
- DrawImage(
- aIconLocation,
- aIcon);
+ const Size aIconSize(aIcon.GetSizePixel());
+ const Point aIconLocation((GetSizePixel().Width() - aIconSize.Width()) / 2,
+ (GetSizePixel().Height() - aIconSize.Height()) / 2);
+ rRenderContext.DrawImage(aIconLocation, aIcon);
break;
}
case PT_Native:
Button::Paint(rRenderContext, rUpdateArea);
- // DrawImage(maIconPosition, maIcon);
break;
}
}
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index f277efd52165..1ce86ff6aa44 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -43,18 +43,14 @@ using namespace css::uno;
namespace sfx2 { namespace sidebar {
-Panel::Panel (
- const PanelDescriptor& rPanelDescriptor,
- vcl::Window* pParentWindow,
- const bool bIsInitiallyExpanded,
- const ::boost::function<void()>& rDeckLayoutTrigger,
- const ::boost::function<Context()>& rContextAccess)
+Panel::Panel(const PanelDescriptor& rPanelDescriptor,
+ vcl::Window* pParentWindow,
+ const bool bIsInitiallyExpanded,
+ const boost::function<void()>& rDeckLayoutTrigger,
+ const boost::function<Context()>& rContextAccess)
: Window(pParentWindow),
msPanelId(rPanelDescriptor.msId),
- mpTitleBar(VclPtr<PanelTitleBar>::Create(
- rPanelDescriptor.msTitle,
- pParentWindow,
- this)),
+ mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this)),
mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional),
mxElement(),
mxPanelComponent(),
@@ -141,15 +137,11 @@ void Panel::Resize()
// Forward new size to window of XUIElement.
Reference<awt::XWindow> xElementWindow (GetElementWindow());
- if (xElementWindow.is())
+ if(xElementWindow.is())
{
- const Size aSize (GetSizePixel());
+ const Size aSize(GetSizePixel());
xElementWindow->setPosSize(
- 0,
- 0,
- aSize.Width(),
- aSize.Height(),
- awt::PosSize::POSSIZE);
+ 0, 0, aSize.Width(), aSize.Height(), awt::PosSize::POSSIZE);
}
}
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 8a4313e7cb55..eda513bd9691 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -39,10 +39,9 @@ namespace sfx2 { namespace sidebar {
static const sal_Int32 gaLeftIconPadding (5);
static const sal_Int32 gaRightIconPadding (5);
-PanelTitleBar::PanelTitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- Panel* pPanel)
+PanelTitleBar::PanelTitleBar(const OUString& rsTitle,
+ vcl::Window* pParentWindow,
+ Panel* pPanel)
: TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()),
mbIsLeftButtonDown(false),
mpPanel(pPanel),
@@ -68,11 +67,10 @@ void PanelTitleBar::dispose()
TitleBar::dispose();
}
-void PanelTitleBar::SetMoreOptionsCommand (
- const ::rtl::OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame)
+void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame)
{
- if ( ! rsCommandName.equals(msMoreOptionsCommand))
+ if (!rsCommandName.equals(msMoreOptionsCommand))
{
if (msMoreOptionsCommand.getLength() > 0)
maToolBox->RemoveItem(maToolBox->GetItemPos(mnMenuItemIndex));
@@ -119,19 +117,16 @@ Rectangle PanelTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
return rTitleBarBox;
}
-void PanelTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
+void PanelTitleBar::PaintDecoration (vcl::RenderContext& rRenderContext, const Rectangle& /*rTitleBarBox*/)
{
- (void)rTitleBarBox;
-
if (mpPanel != nullptr)
{
Image aImage (mpPanel->IsExpanded()
? Theme::GetImage(Theme::Image_Collapse)
: Theme::GetImage(Theme::Image_Expand));
- const Point aTopLeft (
- gaLeftIconPadding,
- (GetSizePixel().Height()-aImage.GetSizePixel().Height())/2);
- DrawImage(aTopLeft, aImage);
+ const Point aTopLeft(gaLeftIconPadding,
+ (GetSizePixel().Height() - aImage.GetSizePixel().Height()) / 2);
+ rRenderContext.DrawImage(aTopLeft, aImage);
}
}
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index 3a00cf780f1e..8c0f7e8849f5 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -32,24 +32,20 @@ class PanelTitleBar
: public TitleBar
{
public:
- PanelTitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- Panel* pPanel );
+ PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel);
virtual ~PanelTitleBar();
virtual void dispose() SAL_OVERRIDE;
- void SetMoreOptionsCommand (
- const ::rtl::OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ void SetMoreOptionsCommand(const OUString& rsCommandName,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
- virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
- virtual void MouseButtonDown (const MouseEvent& rMouseEvent) SAL_OVERRIDE;
- virtual void MouseButtonUp (const MouseEvent& rMouseEvent) SAL_OVERRIDE;
+ virtual void DataChanged(const DataChangedEvent& rEvent) SAL_OVERRIDE;
+ virtual void MouseButtonDown(const MouseEvent& rMouseEvent) SAL_OVERRIDE;
+ virtual void MouseButtonUp(const MouseEvent& rMouseEvent) SAL_OVERRIDE;
protected:
- virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) SAL_OVERRIDE;
- virtual void PaintDecoration (const Rectangle& rTitleBarBox) SAL_OVERRIDE;
+ virtual Rectangle GetTitleArea(const Rectangle& rTitleBarBox) SAL_OVERRIDE;
+ virtual void PaintDecoration(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) SAL_OVERRIDE;
virtual sidebar::Paint GetBackgroundPaint() SAL_OVERRIDE;
virtual Color GetTextColor() SAL_OVERRIDE;
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) SAL_OVERRIDE;
@@ -60,7 +56,7 @@ private:
VclPtr<Panel> mpPanel;
const sal_uInt16 mnMenuItemIndex;
css::uno::Reference<css::frame::XFrame> mxFrame;
- ::rtl::OUString msMoreOptionsCommand;
+ OUString msMoreOptionsCommand;
};
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index bac4b85a3193..46297a31501e 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -31,7 +31,6 @@
using namespace css;
using namespace css::uno;
-using ::rtl::OUString;
namespace sfx2 { namespace sidebar {
@@ -85,7 +84,7 @@ void SidebarToolBox::dispose()
}
void SidebarToolBox::InsertItem(const OUString& rCommand,
- const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
ToolBoxItemBits nBits, const Size& rRequestedSize, sal_uInt16 nPos)
{
ToolBox::InsertItem(rCommand, rFrame, nBits, rRequestedSize, nPos);
@@ -94,24 +93,23 @@ void SidebarToolBox::InsertItem(const OUString& rCommand,
RegisterHandlers();
}
-void SidebarToolBox::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rRect)
+void SidebarToolBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
ToolBox::Paint(rRenderContext, rRect);
if (Theme::GetBoolean(Theme::Bool_UseToolBoxItemSeparator))
{
- const sal_Int32 nSeparatorY ((GetSizePixel().Height() - maItemSeparator.GetSizePixel().Height())/2);
- const sal_uInt16 nItemCount (GetItemCount());
- int nLastRight (-1);
- for (sal_uInt16 nIndex=0; nIndex<nItemCount; ++nIndex)
+ const sal_Int32 nSeparatorY((GetSizePixel().Height() - maItemSeparator.GetSizePixel().Height()) / 2);
+ const sal_uInt16 nItemCount(GetItemCount());
+ int nLastRight(-1);
+ for (sal_uInt16 nIndex = 0; nIndex < nItemCount; ++nIndex)
{
const Rectangle aItemBoundingBox (GetItemPosRect(nIndex));
if (nLastRight >= 0)
{
- const int nSeparatorX ((nLastRight + aItemBoundingBox.Left() - 1) / 2);
- DrawImage(Point(nSeparatorX,nSeparatorY), maItemSeparator);
+ const int nSeparatorX((nLastRight + aItemBoundingBox.Left() - 1) / 2);
+ rRenderContext.DrawImage(Point(nSeparatorX, nSeparatorY), maItemSeparator);
}
-
nLastRight = aItemBoundingBox.Right();
}
}
@@ -142,18 +140,14 @@ void SidebarToolBox::CreateController (
const OUString sCommandName (GetItemCommand(nItemId));
aDescriptor.mxController = sfx2::sidebar::ControllerFactory::CreateToolBoxController(
- this,
- nItemId,
- sCommandName,
- rxFrame,
- VCLUnoHelper::GetInterface(this),
- nItemWidth);
+ this, nItemId, sCommandName, rxFrame,
+ VCLUnoHelper::GetInterface(this), nItemWidth);
if (aDescriptor.mxController.is())
{
aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName);
aDescriptor.msCurrentCommand = sCommandName;
- maControllers.insert(::std::make_pair(nItemId, aDescriptor));
+ maControllers.insert(std::make_pair(nItemId, aDescriptor));
}
}
@@ -166,10 +160,9 @@ Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (con
return NULL;
}
-void SidebarToolBox::SetController(
- const sal_uInt16 nItemId,
- const css::uno::Reference<css::frame::XToolbarController>& rxController,
- const ::rtl::OUString& rsCommandName)
+void SidebarToolBox::SetController(const sal_uInt16 nItemId,
+ const css::uno::Reference<css::frame::XToolbarController>& rxController,
+ const OUString& rsCommandName)
{
ItemDescriptor aDescriptor;
aDescriptor.mxController = rxController;
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 7522c571db25..bc2fe28761b1 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -39,11 +39,10 @@ using namespace css::uno;
namespace sfx2 { namespace sidebar {
-TabBar::TabBar (
- vcl::Window* pParentWindow,
- const Reference<frame::XFrame>& rxFrame,
- const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor,
- const PopupMenuProvider& rPopupMenuProvider)
+TabBar::TabBar(vcl::Window* pParentWindow,
+ const Reference<frame::XFrame>& rxFrame,
+ const boost::function<void(const OUString&)>& rDeckActivationFunctor,
+ const PopupMenuProvider& rPopupMenuProvider)
: Window(pParentWindow, WB_DIALOGCONTROL),
mxFrame(rxFrame),
mpMenuButton(ControlFactory::CreateMenuButton(this)),
@@ -79,15 +78,14 @@ void TabBar::dispose()
vcl::Window::dispose();
}
-void TabBar::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
+void TabBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
{
Window::Paint(rRenderContext, rUpdateArea);
- const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
- SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
- DrawLine(
- Point(nHorizontalPadding, mnMenuSeparatorY),
- Point(GetSizePixel().Width()-nHorizontalPadding, mnMenuSeparatorY));
+ const sal_Int32 nHorizontalPadding(Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
+ rRenderContext.SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
+ rRenderContext.DrawLine(Point(nHorizontalPadding, mnMenuSeparatorY),
+ Point(GetSizePixel().Width() - nHorizontalPadding, mnMenuSeparatorY));
}
sal_Int32 TabBar::GetDefaultWidth()
@@ -97,15 +95,11 @@ sal_Int32 TabBar::GetDefaultWidth()
+ Theme::GetInteger(Theme::Int_TabBarRightPadding);
}
-void TabBar::SetDecks (
- const ResourceManager::DeckContextDescriptorContainer& rDecks)
+void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDecks)
{
// Remove the current buttons.
{
- for(ItemContainer::iterator
- iItem(maItems.begin()), iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for(ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
iItem->mpButton.disposeAndClear();
}
@@ -114,10 +108,7 @@ void TabBar::SetDecks (
maItems.resize(rDecks.size());
sal_Int32 nIndex (0);
for (ResourceManager::DeckContextDescriptorContainer::const_iterator
- iDeck(rDecks.begin()),
- iEnd(rDecks.end());
- iDeck!=iEnd;
- ++iDeck)
+ iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck)
{
const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId);
if (pDescriptor == NULL)
@@ -223,11 +214,9 @@ void TabBar::Layout()
Invalidate();
}
-void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
+void TabBar::HighlightDeck (const OUString& rsDeckId)
{
- for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
if (iItem->msDeckId.equals(rsDeckId))
iItem->mpButton->Check(true);
@@ -259,7 +248,7 @@ bool TabBar::Notify (NotifyEvent&)
return false;
}
-VclPtr<RadioButton> TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
+VclPtr<RadioButton> TabBar::CreateTabItem(const DeckDescriptor& rDeckDescriptor)
{
VclPtr<RadioButton> pItem = ControlFactory::CreateTabItem(this);
pItem->SetAccessibleName(rDeckDescriptor.msTitle);
@@ -269,7 +258,7 @@ VclPtr<RadioButton> TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor
return pItem;
}
-Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const
+Image TabBar::GetItemImage(const DeckDescriptor& rDeckDescriptor) const
{
return Tools::GetImage(
rDeckDescriptor.msIconURL,
@@ -283,7 +272,8 @@ IMPL_LINK(TabBar::Item, HandleClick, Button*,)
{
maDeckActivationFunctor(msDeckId);
}
- catch( const ::com::sun::star::uno::Exception&) {} // workaround for #i123198#
+ catch(const css::uno::Exception&)
+ {} // workaround for #i123198#
return 1;
}
@@ -298,7 +288,7 @@ const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
{
- if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
+ if (nIndex<0 || static_cast<size_t>(nIndex) >= maItems.size())
throw RuntimeException();
else
{
@@ -312,10 +302,8 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
void TabBar::RestoreHideFlags()
{
- bool bNeedsLayout (false);
- for(ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ bool bNeedsLayout(false);
+ for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
{
@@ -327,16 +315,13 @@ void TabBar::RestoreHideFlags()
Layout();
}
-void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
+void TabBar::UpdateFocusManager(FocusManager& rFocusManager)
{
- ::std::vector<Button*> aButtons;
+ std::vector<Button*> aButtons;
aButtons.reserve(maItems.size()+1);
aButtons.push_back(mpMenuButton.get());
- for(ItemContainer::const_iterator
- iItem(maItems.begin()), iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
aButtons.push_back(iItem->mpButton.get());
}
@@ -345,14 +330,12 @@ void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
IMPL_LINK_NOARG(TabBar, OnToolboxClicked)
{
- if ( ! mpMenuButton)
+ if (!mpMenuButton)
return 0;
- ::std::vector<DeckMenuData> aMenuData;
+ std::vector<DeckMenuData> aMenuData;
- for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
{
const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
if (pDeckDescriptor != NULL)
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index 0d7f8667a16b..438291c2aa9b 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -42,9 +42,9 @@ TabItem::TabItem (vcl::Window* pParentWindow)
#endif
}
-void TabItem::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
+void TabItem::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea)
{
- switch(mePaintType)
+ switch (mePaintType)
{
case PT_Theme:
default:
@@ -52,7 +52,7 @@ void TabItem::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdat
const bool bIsSelected (IsChecked());
const bool bIsHighlighted (IsMouseOver() || HasFocus());
DrawHelper::DrawRoundedRectangle(
- *this,
+ rRenderContext,
Rectangle(Point(0,0), GetSizePixel()),
Theme::GetInteger(Theme::Int_ButtonCornerRadius),
bIsHighlighted||bIsSelected
@@ -64,13 +64,9 @@ void TabItem::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdat
const Image aIcon(Button::GetModeImage());
const Size aIconSize (aIcon.GetSizePixel());
- const Point aIconLocation(
- (GetSizePixel().Width() - aIconSize.Width())/2,
- (GetSizePixel().Height() - aIconSize.Height())/2);
- DrawImage(
- aIconLocation,
- aIcon,
- IsEnabled() ? 0 : IMAGE_DRAW_DISABLE);
+ const Point aIconLocation((GetSizePixel().Width() - aIconSize.Width()) / 2,
+ (GetSizePixel().Height() - aIconSize.Height()) / 2);
+ rRenderContext.DrawImage(aIconLocation, aIcon, IsEnabled() ? 0 : IMAGE_DRAW_DISABLE);
break;
}
case PT_Native:
@@ -79,14 +75,14 @@ void TabItem::Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdat
}
}
-void TabItem::MouseMove (const MouseEvent& rEvent)
+void TabItem::MouseMove(const MouseEvent& rEvent)
{
if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow())
Invalidate();
ImageRadioButton::MouseMove(rEvent);
}
-void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
+void TabItem::MouseButtonDown(const MouseEvent& rMouseEvent)
{
if (rMouseEvent.IsLeft())
{
@@ -96,7 +92,7 @@ void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
}
}
-void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent)
+void TabItem::MouseButtonUp(const MouseEvent& rMouseEvent)
{
if (IsMouseCaptured())
ReleaseMouse();
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index d4a0fbea06c7..3e4d77584ac8 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -36,10 +36,9 @@ namespace
namespace sfx2 { namespace sidebar {
-TitleBar::TitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- const sidebar::Paint& rInitialBackgroundPaint)
+TitleBar::TitleBar(const OUString& rsTitle,
+ vcl::Window* pParentWindow,
+ const sidebar::Paint& rInitialBackgroundPaint)
: Window(pParentWindow),
maToolBox(VclPtr<SidebarToolBox>::Create(this)),
msTitle(rsTitle),
@@ -61,35 +60,28 @@ void TitleBar::dispose()
vcl::Window::dispose();
}
-void TitleBar::SetTitle (const ::rtl::OUString& rsTitle)
+void TitleBar::SetTitle(const OUString& rsTitle)
{
msTitle = rsTitle;
Invalidate();
}
-void TitleBar::SetIcon (const Image& rIcon)
+void TitleBar::SetIcon(const Image& rIcon)
{
maIcon = rIcon;
Invalidate();
}
-void TitleBar::Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea)
+void TitleBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rUpdateArea*/)
{
- (void)rUpdateArea;
-
// Paint title bar background.
- Size aWindowSize (GetOutputSizePixel());
- Rectangle aTitleBarBox(
- 0,
- 0,
- aWindowSize.Width(),
- aWindowSize.Height()
- );
-
- PaintDecoration(aTitleBarBox);
- const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
- PaintTitle(aTitleBox);
- PaintFocus(aTitleBox);
+ Size aWindowSize (GetSizePixel());
+ Rectangle aTitleBarBox(0,0, aWindowSize.Width(), aWindowSize.Height());
+
+ PaintDecoration(rRenderContext, aTitleBarBox);
+ const Rectangle aTitleBox(GetTitleArea(aTitleBarBox));
+ PaintTitle(rRenderContext, aTitleBox);
+ PaintFocus(rRenderContext, aTitleBox);
}
void TitleBar::DataChanged (const DataChangedEvent& rEvent)
@@ -99,24 +91,18 @@ void TitleBar::DataChanged (const DataChangedEvent& rEvent)
SetBackground(GetBackgroundPaint().GetWallpaper());
}
-void TitleBar::setPosSizePixel (
- long nX,
- long nY,
- long nWidth,
- long nHeight,
- sal_uInt16 nFlags)
+void TitleBar::setPosSizePixel (long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
{
- Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags);
+ Window::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
// Place the toolbox.
const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth());
- maToolBox->setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
+ maToolBox->setPosSizePixel(nWidth - nToolBoxWidth,0, nToolBoxWidth, nHeight, WINDOW_POSSIZE_POSSIZE);
maToolBox->Show();
}
-void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+void TitleBar::HandleToolBoxItemClick(const sal_uInt16 /*nItemIndex*/)
{
- (void)nItemIndex;
// Any real processing has to be done in derived class.
}
@@ -126,63 +112,53 @@ css::uno::Reference<css::accessibility::XAccessible> TitleBar::CreateAccessible(
return AccessibleTitleBar::Create(*this);
}
-void TitleBar::PaintTitle (const Rectangle& rTitleBox)
+void TitleBar::PaintTitle(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBox)
{
- Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
+ rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
- Rectangle aTitleBox (rTitleBox);
+ Rectangle aTitleBox(rTitleBox);
// When there is an icon then paint it at the left of the given
// box.
- if ( !! maIcon)
+ if (!!maIcon)
{
- DrawImage(
- Point(
- aTitleBox.Left() + gnLeftIconSpace,
- aTitleBox.Top() + (aTitleBox.GetHeight()-maIcon.GetSizePixel().Height())/2),
- maIcon);
+ rRenderContext.DrawImage(Point(aTitleBox.Left() + gnLeftIconSpace,
+ aTitleBox.Top() + (aTitleBox.GetHeight() - maIcon.GetSizePixel().Height()) / 2),
+ maIcon);
aTitleBox.Left() += gnLeftIconSpace + maIcon.GetSizePixel().Width() + gnRightIconSpace;
}
- vcl::Font aFont(GetFont());
+ vcl::Font aFont(rRenderContext.GetFont());
aFont.SetWeight(WEIGHT_BOLD);
- SetFont(aFont);
+ rRenderContext.SetFont(aFont);
// Paint title bar text.
- SetTextColor(GetTextColor());
- DrawText(
- aTitleBox,
- msTitle,
- TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
-
- Pop();
+ rRenderContext.SetTextColor(rRenderContext.GetTextColor());
+ rRenderContext.DrawText(aTitleBox, msTitle, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
+ rRenderContext.Pop();
}
-void TitleBar::PaintFocus (const Rectangle& rFocusBox)
+void TitleBar::PaintFocus(vcl::RenderContext& rRenderContext, const Rectangle& rFocusBox)
{
- Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
+ rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
- vcl::Font aFont(GetFont());
+ vcl::Font aFont(rRenderContext.GetFont());
aFont.SetWeight(WEIGHT_BOLD);
- SetFont(aFont);
-
- const Rectangle aTextBox (
- GetTextRect(
- rFocusBox,
- msTitle,
- TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER));
- const Rectangle aLargerTextBox (
- aTextBox.Left() - 2,
- aTextBox.Top() - 2,
- aTextBox.Right() + 2,
- aTextBox.Bottom() + 2);
+ rRenderContext.SetFont(aFont);
+
+ const Rectangle aTextBox(rRenderContext.GetTextRect(rFocusBox, msTitle, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER));
+
+ const Rectangle aLargerTextBox(aTextBox.Left() - 2,
+ aTextBox.Top() - 2,
+ aTextBox.Right() + 2,
+ aTextBox.Bottom() + 2);
if (HasFocus())
Window::ShowFocus(aLargerTextBox);
else
Window::HideFocus();
- Pop();
+ rRenderContext.Pop();
}
IMPL_LINK_TYPED(TitleBar, SelectionHandler, ToolBox*, pToolBox, void)
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index c65be5ec709d..7c9f03f5c0aa 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -26,39 +26,38 @@
namespace sfx2 { namespace sidebar {
-class TitleBar
- : public vcl::Window
+class TitleBar : public vcl::Window
{
public:
- TitleBar (
- const ::rtl::OUString& rsTitle,
- vcl::Window* pParentWindow,
- const sidebar::Paint& rInitialBackgroundPaint);
+ TitleBar (const OUString& rsTitle,
+ vcl::Window* pParentWindow,
+ const sidebar::Paint& rInitialBackgroundPaint);
virtual ~TitleBar();
virtual void dispose() SAL_OVERRIDE;
void SetTitle (const ::rtl::OUString& rsTitle);
void SetIcon (const Image& rIcon);
- virtual void Paint (vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateArea) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
- virtual void setPosSizePixel (
- long nX,
- long nY,
- long nWidth,
- long nHeight,
- sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;
+ virtual void setPosSizePixel (long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;
- ToolBox& GetToolBox() { return *maToolBox.get();}
- const ToolBox& GetToolBox() const { return *maToolBox.get();}
+ ToolBox& GetToolBox()
+ {
+ return *maToolBox.get();
+ }
+ const ToolBox& GetToolBox() const
+ {
+ return *maToolBox.get();
+ }
protected:
VclPtr<SidebarToolBox> maToolBox;
- ::rtl::OUString msTitle;
+ OUString msTitle;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
- virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
- void PaintFocus (const Rectangle& rFocusBox);
+ virtual void PaintDecoration (vcl::RenderContext& rRenderContext, const Rectangle& rTitleBarBox) = 0;
+ void PaintFocus(vcl::RenderContext& rRenderContext, const Rectangle& rFocusBox);
virtual sidebar::Paint GetBackgroundPaint() = 0;
virtual Color GetTextColor() = 0;
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
@@ -67,7 +66,7 @@ protected:
private:
Image maIcon;
- void PaintTitle (const Rectangle& rTitleBox);
+ void PaintTitle(vcl::RenderContext& rRenderContext, const Rectangle& rTitleBox);
DECL_LINK_TYPED(SelectionHandler, ToolBox*, void);
};