summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-09-06 22:12:22 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-09-06 22:23:41 +0300
commit8b8ca054f8de37018313ef57a96ebcdfeaf9a358 (patch)
treedfa19ace97262372d7d425cd9a276e42ce07c47f /vcl/source
parent6fb54d7bd3eb8efb2223c6a7250852fb6ad22b89 (diff)
Related: tdf#84277 Hide separator only between two windows
Change-Id: I3176933d20dce9f595fd6a9c0ee434a3709fa560
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/toolbox.cxx71
1 files changed, 36 insertions, 35 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 628bb3bf4dd0..5e75a1548903 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2908,45 +2908,46 @@ void ToolBox::ImplDrawSpin(vcl::RenderContext& rRenderContext, bool bUpperIn, bo
void ToolBox::ImplDrawSeparator(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, const Rectangle& rRect)
{
+ if ( nPos >= mpData->m_aItems.size() - 1 )
+ // no separator if it's the last item
+ return;
+
ImplToolItem* pItem = &mpData->m_aItems[nPos];
- ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1];
+ ImplToolItem* pPreviousItem = &mpData->m_aItems[nPos-1];
+ ImplToolItem* pNextItem = &mpData->m_aItems[nPos+1];
+
+ if ( ( pPreviousItem->mbShowWindow && pNextItem->mbShowWindow ) || pNextItem->mbBreak )
+ // no separator between two windows or before a break
+ return;
- // no separator before or after windows or at breaks
- if (pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size() - 1)
+ bool bNativeOk = false;
+ ControlPart nPart = IsHorizontal() ? PART_SEPARATOR_VERT : PART_SEPARATOR_HORZ;
+ if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, nPart))
{
- pTempItem = &mpData->m_aItems[nPos+1];
- if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak )
- {
- bool bNativeOk = false;
- ControlPart nPart = IsHorizontal() ? PART_SEPARATOR_VERT : PART_SEPARATOR_HORZ;
- if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, nPart))
- {
- ImplControlValue aControlValue;
- ControlState nState = ControlState::NONE;
- bNativeOk = rRenderContext.DrawNativeControl(CTRL_TOOLBAR, nPart, rRect, nState, aControlValue, OUString());
- }
+ ImplControlValue aControlValue;
+ ControlState nState = ControlState::NONE;
+ bNativeOk = rRenderContext.DrawNativeControl(CTRL_TOOLBAR, nPart, rRect, nState, aControlValue, OUString());
+ }
- /* Draw the widget only if it can't be drawn natively. */
- if (!bNativeOk)
- {
- long nCenterPos, nSlim;
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- rRenderContext.SetLineColor(rStyleSettings.GetSeparatorColor());
- if (IsHorizontal())
- {
- nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
- nCenterPos = pItem->maRect.Center().X();
- rRenderContext.DrawLine(Point(nCenterPos, pItem->maRect.Top() + nSlim),
- Point(nCenterPos, pItem->maRect.Bottom() - nSlim));
- }
- else
- {
- nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
- nCenterPos = pItem->maRect.Center().Y();
- rRenderContext.DrawLine(Point(pItem->maRect.Left() + nSlim, nCenterPos),
- Point(pItem->maRect.Right() - nSlim, nCenterPos));
- }
- }
+ /* Draw the widget only if it can't be drawn natively. */
+ if (!bNativeOk)
+ {
+ long nCenterPos, nSlim;
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ rRenderContext.SetLineColor(rStyleSettings.GetSeparatorColor());
+ if (IsHorizontal())
+ {
+ nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
+ nCenterPos = pItem->maRect.Center().X();
+ rRenderContext.DrawLine(Point(nCenterPos, pItem->maRect.Top() + nSlim),
+ Point(nCenterPos, pItem->maRect.Bottom() - nSlim));
+ }
+ else
+ {
+ nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
+ nCenterPos = pItem->maRect.Center().Y();
+ rRenderContext.DrawLine(Point(pItem->maRect.Left() + nSlim, nCenterPos),
+ Point(pItem->maRect.Right() - nSlim, nCenterPos));
}
}
}