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

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: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst cc4228b0
...@@ -169,6 +169,7 @@ public: ...@@ -169,6 +169,7 @@ public:
css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;} css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;}
sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; } sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
void setMaximumWidth(sal_Int32 nMaximumWidth) { mnMaximumSidebarWidth = nMaximumWidth; }
private: private:
SidebarController( SidebarController(
......
...@@ -40,7 +40,12 @@ interface XSidebarPanel ...@@ -40,7 +40,12 @@ interface XSidebarPanel
*/ */
LayoutSize getHeightForWidth ( [in] long nWidth); 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(); long getMinimalWidth();
} ; } ;
......
...@@ -237,7 +237,8 @@ ...@@ -237,7 +237,8 @@
</info> </info>
<prop oor:name="MaximumWidth" oor:type="xs:int" oor:nillable="false"> <prop oor:name="MaximumWidth" oor:type="xs:int" oor:nillable="false">
<info> <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> </info>
<value>500</value> <value>500</value>
</prop> </prop>
......
...@@ -22,10 +22,17 @@ ...@@ -22,10 +22,17 @@
#include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Panel.hxx>
#include <sfx2/sidebar/PanelTitleBar.hxx> #include <sfx2/sidebar/PanelTitleBar.hxx>
#include <sfx2/sidebar/Deck.hxx> #include <sfx2/sidebar/Deck.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
#include <comphelper/processfactory.hxx>
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/scrbar.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;
using namespace css::uno; using namespace css::uno;
...@@ -369,8 +376,23 @@ void GetRequestedSizes ( ...@@ -369,8 +376,23 @@ void GetRequestedSizes (
if (xPanel.is()) if (xPanel.is())
{ {
aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth()); aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
sal_Int32 nWidth = xPanel->getMinimalWidth(); 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) if (nWidth > rMinimalWidth)
rMinimalWidth = nWidth; rMinimalWidth = nWidth;
} }
......
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