[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 26 18:20:10 UTC 2019
include/sfx2/sidebar/Deck.hxx | 2 ++
include/sfx2/sidebar/DeckLayouter.hxx | 1 +
sfx2/source/sidebar/Deck.cxx | 4 +++-
sfx2/source/sidebar/DeckLayouter.cxx | 27 +++++++++++++++++++--------
sfx2/source/sidebar/SidebarController.cxx | 27 ++++++++++++++++++++-------
5 files changed, 45 insertions(+), 16 deletions(-)
New commits:
commit a6f6a76d6018fd342646982f6e252c8562ebd254
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Dec 10 00:29:31 2018 -0500
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 26 20:19:09 2019 +0200
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
Reviewed-on: https://gerrit.libreoffice.org/73519
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 22ecb71536d0..410f17a22e82 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -69,6 +69,7 @@ public:
static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
+ sal_Int32 GetMinimalHeight() const { return mnMinimalHeight; }
class ScrollContainerWindow : public vcl::Window
{
@@ -83,6 +84,7 @@ public:
private:
const OUString msId;
sal_Int32 mnMinimalWidth;
+ sal_Int32 mnMinimalHeight;
SharedPanelContainer maPanels;
VclPtr<DeckTitleBar> mpTitleBar;
VclPtr<vcl::Window> mpScrollClipWindow;
diff --git a/include/sfx2/sidebar/DeckLayouter.hxx b/include/sfx2/sidebar/DeckLayouter.hxx
index 1208fb94c164..0d9c7c2b90f4 100644
--- a/include/sfx2/sidebar/DeckLayouter.hxx
+++ b/include/sfx2/sidebar/DeckLayouter.hxx
@@ -35,6 +35,7 @@ namespace DeckLayouter
void LayoutDeck (
const tools::Rectangle& rContentArea,
sal_Int32& rMinimalWidth,
+ sal_Int32& rMinimalHeight,
SharedPanelContainer& rPanels,
vcl::Window& pDeckTitleBar,
vcl::Window& pScrollClipWindow,
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index f26a643a083a..1e56a1516105 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -49,6 +49,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))
@@ -249,8 +250,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 591602ccf93a..a49f026df63a 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -57,13 +57,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,
@@ -103,6 +109,7 @@ namespace {
void DeckLayouter::LayoutDeck (
const tools::Rectangle& rContentArea,
sal_Int32& rMinimalWidth,
+ sal_Int32& rMinimalHeight,
SharedPanelContainer& rPanels,
vcl::Window& rDeckTitleBar,
vcl::Window& rScrollClipWindow,
@@ -118,14 +125,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,
@@ -140,6 +147,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,
@@ -169,6 +177,8 @@ tools::Rectangle LayoutPanels (
nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
}
+ // rMinimalHeight = nTotalMinimumHeight;
+ rMinimalHeight = aBox.GetHeight();
if (nTotalMinimumHeight > nAvailableHeight
&& ! bShowVerticalScrollBar)
@@ -179,6 +189,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 7261b12eeb82..83ff4c5354c6 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -380,7 +380,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();
@@ -441,7 +447,7 @@ void SidebarController::UpdateConfigurations()
return;
if ((maCurrentContext.msApplication != "none") &&
- !maCurrentContext.msApplication.isEmpty())
+ !maCurrentContext.msApplication.isEmpty())
{
mpResourceManager->SaveDecksSettings(maCurrentContext);
mpResourceManager->SetLastActiveDeck(maCurrentContext, msCurrentDeckId);
@@ -449,11 +455,11 @@ void SidebarController::UpdateConfigurations()
// get last active deck for this application on first update
if (!maRequestedContext.msApplication.isEmpty() &&
- (maCurrentContext.msApplication != maRequestedContext.msApplication))
+ (maCurrentContext.msApplication != maRequestedContext.msApplication))
{
- OUString sLastActiveDeck = mpResourceManager->GetLastActiveDeck( maRequestedContext );
- if (!sLastActiveDeck.isEmpty())
- msCurrentDeckId = sLastActiveDeck;
+ OUString sLastActiveDeck = mpResourceManager->GetLastActiveDeck( maRequestedContext );
+ if (!sLastActiveDeck.isEmpty())
+ msCurrentDeckId = sLastActiveDeck;
}
maCurrentContext = maRequestedContext;
@@ -1213,7 +1219,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);
// Sidebar too narrow to render the menu; disable it.
More information about the Libreoffice-commits
mailing list