[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 2 commits - include/sfx2 include/svx offapi/com officecfg/registry sfx2/source svx/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 26 13:13:47 UTC 2019
include/sfx2/sidebar/SidebarController.hxx | 6 +-
include/svx/sidebar/PanelLayout.hxx | 1
offapi/com/sun/star/ui/XSidebarPanel.idl | 7 ++
officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 12 +++++
sfx2/source/sidebar/DeckLayouter.cxx | 24 +++++++++-
sfx2/source/sidebar/SidebarController.cxx | 4 +
svx/source/sidebar/PanelLayout.cxx | 13 ++++-
7 files changed, 60 insertions(+), 7 deletions(-)
New commits:
commit 5d191ab972456808dcf2a4036dfb4e34529c3117
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 22 11:39:18 2019 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Mar 26 14:13:35 2019 +0100
tdf#124263 Respect XSidebarPanel::getMinimalWidth
even if it's larger than max sidebar width (increase max sidebar width in that case).
Change-Id: I2efbd546596f756df205196fae3e545beddd2f7c
Reviewed-on: https://gerrit.libreoffice.org/69551
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
(cherry picked from commit d0c73ce13c02c37fcc094ac6612d6a8eee2a4026)
Reviewed-on: https://gerrit.libreoffice.org/69647
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 4889b0ad1630..866b8f2c50e1 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -165,6 +165,7 @@ public:
tools::Rectangle GetDeckDragArea() const;
sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
+ void setMaximumWidth(sal_Int32 nMaximumWidth) { mnMaximumSidebarWidth = nMaximumWidth; }
private:
SidebarController(
diff --git a/offapi/com/sun/star/ui/XSidebarPanel.idl b/offapi/com/sun/star/ui/XSidebarPanel.idl
index aa60b328a611..da8f19aa609f 100644
--- a/offapi/com/sun/star/ui/XSidebarPanel.idl
+++ b/offapi/com/sun/star/ui/XSidebarPanel.idl
@@ -40,7 +40,12 @@ interface XSidebarPanel
*/
LayoutSize getHeightForWidth ( [in] long nWidth);
- /** Minimal possible width of this panel.
+ /** Minimal possible width of this panel in pixels.
+
+ If this value is smaller than the maximum allowed size of the Sidebar
+ (see config option 'org.openoffice.Office.UI.Sidebar.General.MaximumWidth'),
+ the config option will be ignored and the new maximum Sidebar width will be
+ getMinimalWidth() + 100px.
*/
long getMinimalWidth();
} ;
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index 2eeed4534040..6ed1d79d80cf 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -237,7 +237,8 @@
</info>
<prop oor:name="MaximumWidth" oor:type="xs:int" oor:nillable="false">
<info>
- <desc>Maximum width the sidebar can ever have</desc>
+ <desc>Maximum width the sidebar can have.
+ Note that this can be overridden by extensions returning a larger value in XSidebarPanel::getMinimalWidth()</desc>
</info>
<value>500</value>
</prop>
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 2b7f7df382b5..104b52ec9c8a 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -22,10 +22,17 @@
#include <sfx2/sidebar/Panel.hxx>
#include <sfx2/sidebar/PanelTitleBar.hxx>
#include <sfx2/sidebar/Deck.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <comphelper/processfactory.hxx>
#include <vcl/window.hxx>
#include <vcl/scrbar.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XDesktop2.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
using namespace css;
using namespace css::uno;
@@ -376,8 +383,23 @@ void GetRequestedSizes (
if (xPanel.is())
{
aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
-
sal_Int32 nWidth = xPanel->getMinimalWidth();
+
+ uno::Reference<frame::XDesktop2> xDesktop
+ = frame::Desktop::create(comphelper::getProcessComponentContext());
+ uno::Reference<frame::XFrame> xFrame = xDesktop->getActiveFrame();
+ if (xFrame.is())
+ {
+ SidebarController* pController
+ = SidebarController::GetSidebarControllerForFrame(xFrame);
+ if (pController && pController->getMaximumWidth() < nWidth)
+ {
+ // Add 100 extra pixels to still have the sidebar resizable
+ // (See also documentation of XSidebarPanel::getMinimalWidth)
+ pController->setMaximumWidth(nWidth + 100);
+ }
+ }
+
if (nWidth > rMinimalWidth)
rMinimalWidth = nWidth;
}
commit 5e1c7da329e10ff2d9d394b7663f1376ced69452
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 22 08:06:25 2019 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Mar 26 14:13:22 2019 +0100
tdf#124255 Make maximum sidebar width configurable
Also change the default max width to 500px (instead of 400px).
Reviewed-on: https://gerrit.libreoffice.org/69545
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
(cherry picked from commit 2a41c31a0627bf752a625f23a64eaf4d3fe82fb9)
Change-Id: Idece5aadaf4c4165cc873b4605d2c0f026c89c6e
Reviewed-on: https://gerrit.libreoffice.org/69646
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 33cdfc395200..4889b0ad1630 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -118,8 +118,6 @@ public:
const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
- const static sal_Int32 gnMaximumSidebarWidth = 400;
-
void OpenThenSwitchToDeck(const OUString& rsDeckId);
void OpenThenToggleDeck(const OUString& rsDeckId);
@@ -166,6 +164,8 @@ public:
tools::Rectangle GetDeckDragArea() const;
+ sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
+
private:
SidebarController(
SidebarDockingWindow* pParentWindow,
@@ -180,6 +180,7 @@ private:
css::uno::Reference<css::frame::XController> mxCurrentController;
/// Use a combination of SwitchFlag_* as value.
sal_Int32 mnRequestedForceFlags;
+ sal_Int32 mnMaximumSidebarWidth;
OUString msCurrentDeckId;
AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate;
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 856785eb8cdf..0932fe459f40 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -27,6 +27,7 @@ class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
private:
Idle m_aPanelLayoutIdle;
bool m_bInClose;
+ css::uno::Reference<css::frame::XFrame> mxFrame;
DECL_DLLPRIVATE_LINK(ImplHandlePanelLayoutTimerHdl, Timer*, void);
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index 3258798d19fc..2eeed4534040 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -231,6 +231,17 @@
</group>
</templates>
<component>
+ <group oor:name="General">
+ <info>
+ <desc>General Sidebar settings.</desc>
+ </info>
+ <prop oor:name="MaximumWidth" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Maximum width the sidebar can ever have</desc>
+ </info>
+ <value>500</value>
+ </prop>
+ </group>
<group oor:name="Content">
<info>
<desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc>
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 14b40e58a6f8..aa30d5cc185e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -43,6 +43,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <o3tl/make_unique.hxx>
+#include <officecfg/Office/UI/Sidebar.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
@@ -98,6 +99,7 @@ SidebarController::SidebarController (
maCurrentContext(OUString(), OUString()),
maRequestedContext(),
mnRequestedForceFlags(SwitchFlag_NoForce),
+ mnMaximumSidebarWidth(officecfg::Office::UI::Sidebar::General::MaximumWidth::get()),
msCurrentDeckId(gsDefaultDeckId),
maPropertyChangeForwarder([this](){ return this->BroadcastPropertyChange(); }),
maContextChangeUpdate([this](){ return this->UpdateConfigurations(); }),
@@ -1196,7 +1198,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
pSplitWindow->SetItemSizeRange(
nSetId,
Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
- gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor()));
+ getMaximumWidth() * mpTabBar->GetDPIScaleFactor()));
}
}
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 90bbd328da8b..2e5cbaa4fe8c 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -20,6 +20,7 @@ PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUStrin
: Control(pParent)
, m_aPanelLayoutIdle("svx sidebar PanelLayoutIdle")
, m_bInClose(false)
+ , mxFrame(rFrame)
{
SetStyle(GetStyle() | WB_DIALOGCONTROL);
m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame));
@@ -48,8 +49,16 @@ Size PanelLayout::GetOptimalSize() const
if (isLayoutEnabled(this))
{
Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
- aSize.setWidth( std::min<long>(aSize.Width(),
- (SidebarController::gnMaximumSidebarWidth - TabBar::GetDefaultWidth()) * GetDPIScaleFactor()) );
+ if (mxFrame)
+ {
+ SidebarController* pController
+ = SidebarController::GetSidebarControllerForFrame(mxFrame);
+ if (pController)
+ aSize.setWidth(std::min<long>(
+ aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth())
+ * GetDPIScaleFactor()));
+ }
+
return aSize;
}
More information about the Libreoffice-commits
mailing list