summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/layout.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 15:04:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 21:48:16 +0200
commitcd0ab2cf5063242ef3bff3c6899cea4d4bd53485 (patch)
tree2631f9c128209d178cf2f6b946f5882a5c49e6b2 /basctl/source/basicide/layout.cxx
parenteab4993eab9a2a9e0660a827ed60f0125cf20d53 (diff)
loplugin:flatten in basctl
Change-Id: I66e3f46fcaae4e15d230a5a7c98c1b20cfb4dbda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92485 Tested-by: Jenkins Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl/source/basicide/layout.cxx')
-rw-r--r--basctl/source/basicide/layout.cxx93
1 files changed, 47 insertions, 46 deletions
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 3fd4f98a6d57..eb81e7964b2a 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -135,27 +135,27 @@ void Layout::Deactivating ()
void Layout::DataChanged (DataChangedEvent const& rDCEvt)
{
Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ if (!(rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)))
+ return;
+
+ bool bInvalidate = false;
+ Color aColor = GetSettings().GetStyleSettings().GetWindowColor();
+ const AllSettings* pOldSettings = rDCEvt.GetOldSettings();
+ if (!pOldSettings || aColor != pOldSettings->GetStyleSettings().GetWindowColor())
{
- bool bInvalidate = false;
- Color aColor = GetSettings().GetStyleSettings().GetWindowColor();
- const AllSettings* pOldSettings = rDCEvt.GetOldSettings();
- if (!pOldSettings || aColor != pOldSettings->GetStyleSettings().GetWindowColor())
- {
- SetBackground(Wallpaper(aColor));
- bInvalidate = true;
- }
- aColor = GetSettings().GetStyleSettings().GetWindowTextColor();
- if (!pOldSettings || aColor != pOldSettings->GetStyleSettings().GetWindowTextColor())
- {
- vcl::Font aFont(GetFont());
- aFont.SetColor(aColor);
- SetFont(aFont);
- bInvalidate = true;
- }
- if (bInvalidate)
- Invalidate();
+ SetBackground(Wallpaper(aColor));
+ bInvalidate = true;
+ }
+ aColor = GetSettings().GetStyleSettings().GetWindowTextColor();
+ if (!pOldSettings || aColor != pOldSettings->GetStyleSettings().GetWindowTextColor())
+ {
+ vcl::Font aFont(GetFont());
+ aFont.SetColor(aColor);
+ SetFont(aFont);
+ bInvalidate = true;
}
+ if (bInvalidate)
+ Invalidate();
}
@@ -346,19 +346,19 @@ void Layout::SplittedSide::ArrangeIn (tools::Rectangle const& rRect)
}
// filling the remaining space with the last docking window
- if (!bEmpty && vItems[iLastWin].nEndPos != nLength)
- {
- Item& rItem = vItems[iLastWin];
- Size aSize = rItem.pWin->GetDockingSize();
- if (bVertical)
- aSize.AdjustHeight( nLength - rItem.nEndPos );
- else
- aSize.AdjustWidth( nLength - rItem.nEndPos );
- rItem.pWin->ResizeIfDocking(aSize);
- // and hiding the split line after the window
- if (iLastWin < vItems.size() - 1)
- vItems[iLastWin + 1].pSplit->Hide();
- }
+ if (bEmpty || vItems[iLastWin].nEndPos == nLength)
+ return;
+
+ Item& rItem = vItems[iLastWin];
+ Size aSize = rItem.pWin->GetDockingSize();
+ if (bVertical)
+ aSize.AdjustHeight( nLength - rItem.nEndPos );
+ else
+ aSize.AdjustWidth( nLength - rItem.nEndPos );
+ rItem.pWin->ResizeIfDocking(aSize);
+ // and hiding the split line after the window
+ if (iLastWin < vItems.size() - 1)
+ vItems[iLastWin + 1].pSplit->Hide();
}
IMPL_LINK(Layout::SplittedSide, SplitHdl, Splitter*, pSplitter, void)
@@ -397,20 +397,21 @@ void Layout::SplittedSide::CheckMarginsFor (Splitter* pSplitter)
// The splitter line cannot be closer to the edges than nMargin pixels.
static long const nMargin = 16;
// Checking margins:
- if (long const nLength = pSplitter->IsHorizontal() ?
- aRect.GetWidth() : aRect.GetHeight()
- ) {
- // bounds
- long const nLower = (pSplitter->IsHorizontal() ? aRect.Left() : aRect.Top()) + nMargin;
- long const nUpper = nLower + nLength - 2*nMargin;
- // split position
- long const nPos = pSplitter->GetSplitPosPixel();
- // checking bounds
- if (nPos < nLower)
- pSplitter->SetSplitPosPixel(nLower);
- if (nPos > nUpper)
- pSplitter->SetSplitPosPixel(nUpper);
- }
+ long const nLength = pSplitter->IsHorizontal() ?
+ aRect.GetWidth() : aRect.GetHeight();
+ if (!nLength)
+ return;
+
+ // bounds
+ long const nLower = (pSplitter->IsHorizontal() ? aRect.Left() : aRect.Top()) + nMargin;
+ long const nUpper = nLower + nLength - 2*nMargin;
+ // split position
+ long const nPos = pSplitter->GetSplitPosPixel();
+ // checking bounds
+ if (nPos < nLower)
+ pSplitter->SetSplitPosPixel(nLower);
+ if (nPos > nUpper)
+ pSplitter->SetSplitPosPixel(nUpper);
}
void Layout::SplittedSide::InitSplitter (Splitter& rSplitter)