Kaydet (Commit) 2a41c31a authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

tdf#124255 Make maximum sidebar width configurable

Also change the default max width to 500px (instead of 400px).

Change-Id: Idece5aadaf4c4165cc873b4605d2c0f026c89c6e
Reviewed-on: https://gerrit.libreoffice.org/69545
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst ad7e2af4
......@@ -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);
......@@ -170,6 +168,8 @@ public:
css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;}
sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
private:
SidebarController(
SidebarDockingWindow* pParentWindow,
......@@ -184,6 +184,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;
......
......@@ -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);
......
......@@ -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>
......
......@@ -45,6 +45,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <sal/log.hxx>
#include <officecfg/Office/UI/Sidebar.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
......@@ -100,6 +101,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(); }),
......@@ -1216,7 +1218,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
pSplitWindow->SetItemSizeRange(
nSetId,
Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor()));
getMaximumWidth() * mpTabBar->GetDPIScaleFactor()));
}
}
......
......@@ -20,6 +20,7 @@ using namespace sfx2::sidebar;
PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
: Control(pParent)
, m_bInClose(false)
, mxFrame(rFrame)
{
SetStyle(GetStyle() | WB_DIALOGCONTROL);
m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE);
......@@ -50,8 +51,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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment