[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 26 18:31:39 UTC 2019
include/sfx2/sidebar/Deck.hxx | 3 +++
sfx2/source/sidebar/Deck.cxx | 17 ++++++++++++++---
sfx2/source/sidebar/DeckLayouter.cxx | 4 +---
sfx2/source/sidebar/SidebarController.cxx | 12 +++++++-----
4 files changed, 25 insertions(+), 11 deletions(-)
New commits:
commit 53644c6d62002879431c36b9da5f6771e5234992
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Feb 1 10:56:46 2019 -0500
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 26 20:30:36 2019 +0200
sfx2: LOK: resize the sidebar after layouting to avoid scrollbars
By resizing the deck we ensure that if the contents do not fit
in the existing height, they will after we expand to the minimum
height. Also, the minimum height is now the correct one.
This prevents seeing vertical scrollbar in LOK, which is very
slow and unfriendly, instead renders the full sidebar and lets
the client scroll, if necessary.
Change-Id: Idc2a622a65074b7afb26263624f2df0b5968f40d
Reviewed-on: https://gerrit.libreoffice.org/73523
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index 410f17a22e82..5a3dabe7804a 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -82,6 +82,9 @@ public:
};
private:
+ void RequestLayoutInternal();
+
+private:
const OUString msId;
sal_Int32 mnMinimalWidth;
sal_Int32 mnMinimalHeight;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 1e56a1516105..48f7291e8af7 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -168,7 +168,7 @@ void Deck::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*r
void Deck::DataChanged (const DataChangedEvent&)
{
- RequestLayout();
+ RequestLayoutInternal();
}
bool Deck::EventNotify(NotifyEvent& rEvent)
@@ -244,10 +244,10 @@ void Deck::ResetPanels(const SharedPanelContainer& rPanelContainer)
}
maPanels = rPanelContainer;
- RequestLayout();
+ RequestLayoutInternal();
}
-void Deck::RequestLayout()
+void Deck::RequestLayoutInternal()
{
mnMinimalWidth = 0;
mnMinimalHeight = 0;
@@ -266,6 +266,17 @@ void Deck::RequestLayout()
}
}
+void Deck::RequestLayout()
+{
+ RequestLayoutInternal();
+ if (comphelper::LibreOfficeKit::isActive() && mnMinimalHeight > 0)
+ {
+ const Size aParentSize(GetParent()->GetSizePixel().Width(), mnMinimalHeight);
+ GetParent()->SetSizePixel(aParentSize);
+ setPosSizePixel(0, 0, aParentSize.Width(), aParentSize.Height());
+ }
+}
+
vcl::Window* Deck::GetPanelParentWindow()
{
return mpScrollContainer.get();
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index a49f026df63a..b969dc91a8bb 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -177,9 +177,6 @@ tools::Rectangle LayoutPanels (
nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
}
- // rMinimalHeight = nTotalMinimumHeight;
- rMinimalHeight = aBox.GetHeight();
-
if (nTotalMinimumHeight > nAvailableHeight
&& ! bShowVerticalScrollBar)
{
@@ -252,6 +249,7 @@ tools::Rectangle LayoutPanels (
const sal_Int32 nUsedHeight (PlacePanels(rLayoutItems, nWidth, eMode, rScrollContainer));
aBox.AdjustTop(nUsedHeight );
+ rMinimalHeight = nUsedHeight;
return aBox;
}
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index f099e5f7c5d2..7e1d9ab17bb9 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -405,13 +405,15 @@ void SidebarController::NotifyResize()
// Place the deck first.
if (bIsDeckVisible)
{
- // No TabBar in LOK.
if (comphelper::LibreOfficeKit::isActive())
{
- // The minimal deck height is unreliable because of
- // the fluid way the panels are stretched. Fix minimum manually.
- // const sal_Int32 nMinimalHeight = mpCurrentDeck->GetMinimalHeight();
- mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 600);
+ // No TabBar in LOK (use nWidth in full).
+ // Use the minimum height that is large enough to let the
+ // layouter expand the panes maximally (that have a minimal
+ // height before the scrollbar is shown), so we never get
+ // scrollbars (we want scrolling to be done on the rendered
+ // image in the client, which is much faster).
+ mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 650);
}
else
mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - nTabBarDefaultWidth, nHeight);
More information about the Libreoffice-commits
mailing list