diff options
-rw-r--r-- | include/sfx2/sidebar/SidebarController.hxx | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/XSidebarPanel.idl | 7 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/DeckLayouter.cxx | 24 |
4 files changed, 32 insertions, 3 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 68e97c51cee4..eaed146d3b47 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -169,6 +169,7 @@ public: css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;} 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 3d40cd13a59e..c3649aaab106 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; @@ -369,8 +376,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; } |