summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-12-10 00:29:31 -0500
committerJan Holesovsky <kendy@collabora.com>2019-04-30 18:06:30 +0200
commitf14bd82933246211266ae1db2bb1e00857b02c3f (patch)
tree3ce823e0454d3711f65467bfdc06eccb32420ab9 /sfx2
parentbe9296d7219c95312191feebec05d25dfea75fc7 (diff)
sfx: LOK: don't shrink sidebar height below minimum
This avoids scrolling within the sidebar and makes it possible to scroll the rendred sidebar image in the client, which is more responsive and lighter. Change-Id: I0713c699ba82bfc5fe503c9351402c67aef4494e
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx4
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx36
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx17
3 files changed, 40 insertions, 17 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index b3ab0d22ad84..83873d7c9950 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -46,6 +46,7 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow,
: Window(pParentWindow, 0)
, msId(rDeckDescriptor.msId)
, mnMinimalWidth(0)
+ , mnMinimalHeight(0)
, maPanels()
, mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, rCloserAction))
, mpScrollClipWindow(VclPtr<vcl::Window>::Create(this))
@@ -220,8 +221,9 @@ void Deck::ResetPanels(const SharedPanelContainer& rPanelContainer)
void Deck::RequestLayout()
{
mnMinimalWidth = 0;
+ mnMinimalHeight = 0;
- DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels,
+ DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, mnMinimalHeight, maPanels,
*GetTitleBar(), *mpScrollClipWindow, *mpScrollContainer,
*mpFiller, *mpVerticalScrollBar);
}
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 9ca553dd66c1..04dca5eb8989 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -49,13 +49,19 @@ namespace {
sal_Int32 mnWeight;
bool mbShowTitleBar;
- LayoutItem()
- : mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mbShowTitleBar(true)
- {}
+ LayoutItem(const VclPtr<Panel>& rPanel)
+ : mpPanel(rPanel)
+ , maLayoutSize(0, 0, 0)
+ , mnDistributedHeight(0)
+ , mnWeight(0)
+ , mbShowTitleBar(true)
+ {
+ }
};
tools::Rectangle LayoutPanels (
const tools::Rectangle& rContentArea,
sal_Int32& rMinimalWidth,
+ sal_Int32& rMinimalHeight,
::std::vector<LayoutItem>& rLayoutItems,
vcl::Window& rScrollClipWindow,
vcl::Window& rScrollContainer,
@@ -95,6 +101,7 @@ namespace {
void DeckLayouter::LayoutDeck (
const tools::Rectangle& rContentArea,
sal_Int32& rMinimalWidth,
+ sal_Int32& rMinimalHeight,
SharedPanelContainer& rPanels,
vcl::Window& rDeckTitleBar,
vcl::Window& rScrollClipWindow,
@@ -110,14 +117,14 @@ void DeckLayouter::LayoutDeck (
{
// Prepare the layout item container.
::std::vector<LayoutItem> aLayoutItems;
- aLayoutItems.resize(rPanels.size());
- for (sal_Int32 nIndex(0),nCount(rPanels.size()); nIndex<nCount; ++nIndex)
- {
- aLayoutItems[nIndex].mpPanel = rPanels[nIndex];
- }
+ aLayoutItems.reserve(rPanels.size());
+ for (const auto& rPanel : rPanels)
+ aLayoutItems.emplace_back(rPanel);
+
aBox = LayoutPanels(
aBox,
rMinimalWidth,
+ rMinimalHeight,
aLayoutItems,
rScrollClipWindow,
rScrollContainer,
@@ -132,6 +139,7 @@ namespace {
tools::Rectangle LayoutPanels (
const tools::Rectangle& rContentArea,
sal_Int32& rMinimalWidth,
+ sal_Int32& rMinimalHeight,
::std::vector<LayoutItem>& rLayoutItems,
vcl::Window& rScrollClipWindow,
vcl::Window& rScrollContainer,
@@ -155,15 +163,14 @@ tools::Rectangle LayoutPanels (
sal_Int32 nTotalPreferredHeight (0);
sal_Int32 nTotalMinimumHeight (0);
- for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
- iEnd(rLayoutItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (const LayoutItem& rItem : rLayoutItems)
{
- nTotalMinimumHeight += iItem->maLayoutSize.Minimum;
- nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
+ nTotalMinimumHeight += rItem.maLayoutSize.Minimum;
+ nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
}
+ // rMinimalHeight = nTotalMinimumHeight;
+ rMinimalHeight = aBox.GetHeight();
if (nTotalMinimumHeight > nAvailableHeight
&& ! bShowVerticalScrollBar)
@@ -174,6 +181,7 @@ tools::Rectangle LayoutPanels (
return LayoutPanels(
rContentArea,
rMinimalWidth,
+ rMinimalHeight,
rLayoutItems,
rScrollClipWindow,
rScrollContainer,
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 3018f24c03f3..fb1d3ae17b05 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -388,7 +388,13 @@ void SidebarController::NotifyResize()
{
// No TabBar in LOK.
if (comphelper::LibreOfficeKit::isActive())
- mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+ {
+ const sal_Int32 nMinimalHeight = mpCurrentDeck->GetMinimalHeight();
+ if (nMinimalHeight > 0)
+ mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nMinimalHeight);
+ else
+ mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+ }
else
mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - nTabBarDefaultWidth, nHeight);
mpCurrentDeck->Show();
@@ -1184,7 +1190,14 @@ void SidebarController::UpdateDeckOpenState()
mnSavedSidebarWidth = aNewSize.Width(); // Save the current width to restore.
aNewPos.setX(aNewPos.X() + mnSavedSidebarWidth - nTabBarDefaultWidth);
- aNewSize.setWidth(nTabBarDefaultWidth);
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // Hide by collapsing, otherwise with 0x0 the client might expect
+ // to get valid dimensions on rendering and not collapse the sidebar.
+ aNewSize.setWidth(1);
+ }
+ else
+ aNewSize.setWidth(nTabBarDefaultWidth);
mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, aNewSize);