summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/layout.cxx
diff options
context:
space:
mode:
authorUray M. János <uray.janos@gmail.com>2012-09-05 19:41:42 +0200
committerNoel Power <noel.power@suse.com>2012-09-07 09:14:12 +0000
commit5764c51f2c9870c91727464c0d889d3554a5663e (patch)
tree67ec431c14f0c61e427580d1f5a10863506c6a33 /basctl/source/basicide/layout.cxx
parent7d5911e40855ac6234590e008927c9b819084ad0 (diff)
Fix for docking property browser
This fixes the crash of 'Basic IDE: Docking property browser under object catalog' commit. The aPropertyBrowser data member was replaced by a new-allocated pointer. We need this because toolkit releases it by delete. When the property browser is closed in the floating state, it tells DialogWindowLayout to null the pointer. If the user clicks the 'property browser' button on the toolbar, it is created again. Change-Id: Ie842a72fe37dfdd2ed5921ffa2f1f41d3f2c51c6 Reviewed-on: https://gerrit.libreoffice.org/568 Tested-by: Noel Power <noel.power@suse.com> Reviewed-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'basctl/source/basicide/layout.cxx')
-rw-r--r--basctl/source/basicide/layout.cxx43
1 files changed, 42 insertions, 1 deletions
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 5d1be2e2f278..32edb585fdac 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -56,6 +56,13 @@ Layout::Layout (Window* pParent) :
Layout::~Layout()
{ }
+// removes a docking window
+void Layout::Remove (DockingWindow* pWin)
+{
+ aLeftSide.Remove(pWin);
+ aBottomSide.Remove(pWin);
+}
+
// called by Window when resized
void Layout::Resize()
{
@@ -70,10 +77,18 @@ void Layout::ArrangeWindows ()
int const nWidth = aSize.Width(), nHeight = aSize.Height();
if (!nWidth || !nHeight) // empty size
return;
+
+ // prevent recursion via OnFirstSize() -> Add() -> ArrangeWindows()
+ static bool bRecursion = false;
+ if (bRecursion)
+ return;
+ bRecursion = true;
+
+ // on first call
if (bFirstSize)
{
- this->OnFirstSize(nWidth, nHeight); // virtual
bFirstSize = false;
+ this->OnFirstSize(nWidth, nHeight); // virtual
}
// sides
@@ -84,6 +99,8 @@ void Layout::ArrangeWindows ()
Point(aLeftSide.GetSize(), 0),
Size(nWidth - aLeftSide.GetSize(), nHeight - aBottomSide.GetSize())
);
+
+ bRecursion = false;
}
void Layout::DockaWindow (DockingWindow*)
@@ -175,6 +192,30 @@ void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
}
// nLastPos
nLastPos += nSize2 + nSplitThickness;
+ // refresh
+ rLayout.ArrangeWindows();
+}
+
+// Remove() -- removes a window from the side (if contains)
+void Layout::SplittedSide::Remove (DockingWindow* pWin)
+{
+ // contains?
+ std::vector<DockingWindow*>::iterator const itWin =
+ std::find(vWindows.begin(), vWindows.end(), pWin);
+ if (itWin == vWindows.end())
+ return;
+ // index
+ unsigned const iWin = itWin - vWindows.begin();
+ // nLastPos
+ if (iWin == vWindows.size() - 1) // that is the last one
+ nLastPos = vSplitters.back()->GetSplitPosPixel() + nSplitThickness;
+ // remove
+ vWindows.erase(itWin);
+ // remove a splitter line
+ if (!vSplitters.empty())
+ vSplitters.pop_back();
+ // refresh
+ rLayout.ArrangeWindows();
}
// creating a Point or a Size object