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: ...@@ -118,8 +118,6 @@ public:
const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02; const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02; const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
const static sal_Int32 gnMaximumSidebarWidth = 400;
void OpenThenSwitchToDeck(const OUString& rsDeckId); void OpenThenSwitchToDeck(const OUString& rsDeckId);
void OpenThenToggleDeck(const OUString& rsDeckId); void OpenThenToggleDeck(const OUString& rsDeckId);
...@@ -170,6 +168,8 @@ public: ...@@ -170,6 +168,8 @@ public:
css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;} css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;}
sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
private: private:
SidebarController( SidebarController(
SidebarDockingWindow* pParentWindow, SidebarDockingWindow* pParentWindow,
...@@ -184,6 +184,7 @@ private: ...@@ -184,6 +184,7 @@ private:
css::uno::Reference<css::frame::XController> mxCurrentController; css::uno::Reference<css::frame::XController> mxCurrentController;
/// Use a combination of SwitchFlag_* as value. /// Use a combination of SwitchFlag_* as value.
sal_Int32 mnRequestedForceFlags; sal_Int32 mnRequestedForceFlags;
sal_Int32 mnMaximumSidebarWidth;
OUString msCurrentDeckId; OUString msCurrentDeckId;
AsynchronousCall maPropertyChangeForwarder; AsynchronousCall maPropertyChangeForwarder;
AsynchronousCall maContextChangeUpdate; AsynchronousCall maContextChangeUpdate;
......
...@@ -27,6 +27,7 @@ class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer ...@@ -27,6 +27,7 @@ class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
private: private:
Idle m_aPanelLayoutIdle; Idle m_aPanelLayoutIdle;
bool m_bInClose; bool m_bInClose;
css::uno::Reference<css::frame::XFrame> mxFrame;
DECL_DLLPRIVATE_LINK(ImplHandlePanelLayoutTimerHdl, Timer*, void); DECL_DLLPRIVATE_LINK(ImplHandlePanelLayoutTimerHdl, Timer*, void);
......
...@@ -231,6 +231,17 @@ ...@@ -231,6 +231,17 @@
</group> </group>
</templates> </templates>
<component> <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"> <group oor:name="Content">
<info> <info>
<desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc> <desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc>
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx> #include <comphelper/namedvaluecollection.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <officecfg/Office/UI/Sidebar.hxx>
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
...@@ -100,6 +101,7 @@ SidebarController::SidebarController ( ...@@ -100,6 +101,7 @@ SidebarController::SidebarController (
maCurrentContext(OUString(), OUString()), maCurrentContext(OUString(), OUString()),
maRequestedContext(), maRequestedContext(),
mnRequestedForceFlags(SwitchFlag_NoForce), mnRequestedForceFlags(SwitchFlag_NoForce),
mnMaximumSidebarWidth(officecfg::Office::UI::Sidebar::General::MaximumWidth::get()),
msCurrentDeckId(gsDefaultDeckId), msCurrentDeckId(gsDefaultDeckId),
maPropertyChangeForwarder([this](){ return this->BroadcastPropertyChange(); }), maPropertyChangeForwarder([this](){ return this->BroadcastPropertyChange(); }),
maContextChangeUpdate([this](){ return this->UpdateConfigurations(); }), maContextChangeUpdate([this](){ return this->UpdateConfigurations(); }),
...@@ -1216,7 +1218,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth) ...@@ -1216,7 +1218,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
pSplitWindow->SetItemSizeRange( pSplitWindow->SetItemSizeRange(
nSetId, nSetId,
Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth, Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor())); getMaximumWidth() * mpTabBar->GetDPIScaleFactor()));
} }
} }
......
...@@ -20,6 +20,7 @@ using namespace sfx2::sidebar; ...@@ -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) PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
: Control(pParent) : Control(pParent)
, m_bInClose(false) , m_bInClose(false)
, mxFrame(rFrame)
{ {
SetStyle(GetStyle() | WB_DIALOGCONTROL); SetStyle(GetStyle() | WB_DIALOGCONTROL);
m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE); m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE);
...@@ -50,8 +51,16 @@ Size PanelLayout::GetOptimalSize() const ...@@ -50,8 +51,16 @@ Size PanelLayout::GetOptimalSize() const
if (isLayoutEnabled(this)) if (isLayoutEnabled(this))
{ {
Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild)); Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
aSize.setWidth( std::min<long>(aSize.Width(), if (mxFrame)
(SidebarController::gnMaximumSidebarWidth - TabBar::GetDefaultWidth()) * GetDPIScaleFactor()) ); {
SidebarController* pController
= SidebarController::GetSidebarControllerForFrame(mxFrame);
if (pController)
aSize.setWidth(std::min<long>(
aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth())
* GetDPIScaleFactor()));
}
return aSize; 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