summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx9
-rw-r--r--test/source/sheet/xviewsplitable.cxx4
2 files changed, 10 insertions, 3 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index e4bd01b03d1e..f2fa554fb52c 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1216,9 +1216,16 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
{
const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow.get()));
const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
+ const sal_Int32 nRequestedWidth
+ = (TabBar::GetDefaultWidth() + nWidth) * mpTabBar->GetDPIScaleFactor();
+
+ // Make sure the sidebar is wide enough to fit the requested content
+ if (pSplitWindow->GetSizePixel().Width() < nRequestedWidth)
+ SetChildWindowWidth(nRequestedWidth);
+
pSplitWindow->SetItemSizeRange(
nSetId,
- Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
+ Range(nRequestedWidth,
getMaximumWidth() * mpTabBar->GetDPIScaleFactor()));
}
}
diff --git a/test/source/sheet/xviewsplitable.cxx b/test/source/sheet/xviewsplitable.cxx
index 7dd18aed2ebb..d88122f584f6 100644
--- a/test/source/sheet/xviewsplitable.cxx
+++ b/test/source/sheet/xviewsplitable.cxx
@@ -23,12 +23,12 @@ void XViewSplitable::testSplit()
uno::Reference< sheet::XViewSplitable > xViewSplitable(init(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("View is already split", !xViewSplitable->getIsWindowSplit());
- xViewSplitable->splitAtPosition(101, 51);
+ xViewSplitable->splitAtPosition(90, 51);
CPPUNIT_ASSERT_MESSAGE("View wasn't split", xViewSplitable->getIsWindowSplit());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong horizontal pixel position",
- sal_Int32(101), xViewSplitable->getSplitHorizontal());
+ sal_Int32(90), xViewSplitable->getSplitHorizontal());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical pixel position",
sal_Int32(51), xViewSplitable->getSplitVertical());