diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-04 17:22:14 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-11 17:42:22 +0100 |
commit | 1653bb9bffaa84a40b7d81a8277e887ea28df4e4 (patch) | |
tree | 5e56142b7b63ab66fb1dcc781ffeb3ae5afda2ad /sfx2 | |
parent | 40c58f6039fb02cff74e442f6adc5ba38adcff1d (diff) |
remove intermediate containers in sidebars
tested extension sidebars of:
a) Wollmux extension sidebars
b) Analog Clock Extension demo
https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension
Change-Id: If9729e20526681928137989f01a8ae733a9b0cb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112035
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/inc/sidebar/PanelDescriptor.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/navigat.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/Panel.cxx | 35 | ||||
-rw-r--r-- | sfx2/source/sidebar/PanelDescriptor.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/PanelLayout.cxx | 124 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarPanelBase.cxx | 76 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/navigator.ui | 14 |
12 files changed, 122 insertions, 169 deletions
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index a21bbeed53bb..4ecfe459be38 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -49,6 +49,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/linkeditdialog \ sfx2/uiconfig/ui/loadtemplatedialog \ sfx2/uiconfig/ui/managestylepage \ + sfx2/uiconfig/ui/navigator \ sfx2/uiconfig/ui/newstyle \ sfx2/uiconfig/ui/notebookbar \ sfx2/uiconfig/ui/optprintpage \ diff --git a/sfx2/inc/sidebar/PanelDescriptor.hxx b/sfx2/inc/sidebar/PanelDescriptor.hxx index be85911ac36b..1033379f7de3 100644 --- a/sfx2/inc/sidebar/PanelDescriptor.hxx +++ b/sfx2/inc/sidebar/PanelDescriptor.hxx @@ -36,6 +36,7 @@ public: sal_Int32 mnOrderIndex; bool mbShowForReadOnlyDocuments; bool mbWantsCanvas; + bool mbWantsAWT; bool mbExperimental; OUString msNodeName; // some impress panel nodes names are different from their Id diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index b833cea80c37..35d3f2ecbaf2 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -435,14 +435,12 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI bool ParentIsFloatingWindow(vcl::Window *pParent) { + if (!pParent) + return false; if (pParent->GetType() == WindowType::DOCKINGWINDOW || pParent->GetType() == WindowType::TOOLBOX) - { return true; - } if (pParent->GetType() == WindowType::FLOATINGWINDOW) - { return true; - } return false; } diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx index 1487bcbcc8f3..90116d8a2064 100644 --- a/sfx2/source/dialog/navigat.cxx +++ b/sfx2/source/dialog/navigat.cxx @@ -48,19 +48,12 @@ void SfxNavigatorWrapper::Initialize(SfxChildWinInfo* pInfo) SfxNavigator::SfxNavigator( SfxBindings* pBind , SfxChildWindow* pChildWin , vcl::Window* pParent ) - : SfxDockingWindow( pBind , - pChildWin , - pParent , - WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK ) + : SfxDockingWindow(pBind , + pChildWin , + pParent , + "Navigator", "sfx/ui/navigator.ui") { SetText(SfxResId(STR_SID_NAVIGATOR)); } -void SfxNavigator::Resize() -{ - SfxDockingWindow::Resize(); - if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild)) - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 27697a46dbfb..608b1790190d 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -364,23 +364,15 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, PopupTreeMenuHdl, const CommandEvent&, r return true; } -SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Window* pParentWindow) - : PanelLayout(pParentWindow, "TemplatePanel", "sfx/ui/templatepanel.ui", nullptr) +SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, weld::Widget* pParent) + : PanelLayout(pParent, "TemplatePanel", "sfx/ui/templatepanel.ui") , pImpl(new SfxTemplateDialog_Impl(pBindings, this)) { OSL_ASSERT(pBindings!=nullptr); - m_pInitialFocusWidget = pImpl->m_xActionTbL.get(); } SfxTemplatePanelControl::~SfxTemplatePanelControl() { - disposeOnce(); -} - -void SfxTemplatePanelControl::dispose() -{ - pImpl.reset(); - PanelLayout::dispose(); } static void MakeExpanded_Impl(const weld::TreeView& rBox, std::vector<OUString>& rEntries) diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 7f7f3aba1b47..39b9b33eabb9 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -38,6 +38,8 @@ class SfxTemplateControllerItem; #include <sfx2/styfitem.hxx> #include <sfx2/templdlg.hxx> +#include <vcl/idle.hxx> + class SfxStyleFamilyItem; class SfxTemplateItem; class SfxBindings; diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 41cfbc096abb..f82ef61dda7b 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -22,8 +22,8 @@ #include <sidebar/PanelDescriptor.hxx> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ResourceManager.hxx> - #include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> #include <tools/json_writer.hxx> @@ -37,6 +37,8 @@ #include <com/sun/star/ui/XSidebarPanel.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <vcl/weldutils.hxx> + using namespace css; using namespace css::uno; @@ -51,6 +53,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, : InterimItemWindow(pParentWindow, "sfx/ui/panel.ui", "Panel") , msPanelId(rPanelDescriptor.msId) , mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional) + , mbWantsAWT(rPanelDescriptor.mbWantsAWT) , mxElement() , mxPanelComponent() , mbIsExpanded(bIsInitiallyExpanded) @@ -60,7 +63,6 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, , mxFrame(rxFrame) , mxTitleBar(new PanelTitleBar(rPanelDescriptor.msTitle, *m_xBuilder, this)) , mxContents(m_xBuilder->weld_container("contents")) - , mxAwtXWindow(mxContents->CreateChildFrame()) { SetText(rPanelDescriptor.msTitle); mxContents->set_visible(mbIsExpanded); @@ -111,10 +113,10 @@ void Panel::dispose() mxTitleBar.reset(); - if (mxAwtXWindow) + if (mxXWindow) { - mxAwtXWindow->dispose(); - mxAwtXWindow.clear(); + mxXWindow->dispose(); + mxXWindow.clear(); } mxContents.reset(); @@ -134,10 +136,14 @@ void Panel::ShowTitlebar(bool bShowTitlebar) void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement) { mxElement = rxElement; - if (mxElement.is()) - { - mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY); - } + if (!mxElement.is()) + return; + mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY); + if (mbWantsAWT) + return; + sfx2::sidebar::SidebarPanelBase* pPanelBase = dynamic_cast<sfx2::sidebar::SidebarPanelBase*>(mxElement.get()); + assert(pPanelBase && "internal panels are all expected to inherit from SidebarPanelBase"); + pPanelBase->SetParentPanel(this); } void Panel::SetExpanded (const bool bIsExpanded) @@ -186,9 +192,14 @@ Reference<awt::XWindow> Panel::GetElementWindow() Reference<awt::XWindow> Panel::GetElementParentWindow() { - if (!mxAwtXWindow) - mxAwtXWindow = mxContents->CreateChildFrame(); - return mxAwtXWindow; + if (!mxXWindow) + { + if (mbWantsAWT) + mxXWindow = mxContents->CreateChildFrame(); + else + mxXWindow = Reference<awt::XWindow>(new weld::TransportAsXWindow(mxContents.get())); + } + return mxXWindow; } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx index bdbec773fcdc..b980d7f1e751 100644 --- a/sfx2/source/sidebar/PanelDescriptor.cxx +++ b/sfx2/source/sidebar/PanelDescriptor.cxx @@ -33,6 +33,7 @@ PanelDescriptor::PanelDescriptor() mnOrderIndex(10000), // Default value as defined in Sidebar.xcs mbShowForReadOnlyDocuments(false), mbWantsCanvas(false), + mbWantsAWT(true), mbExperimental(false) { } @@ -49,6 +50,7 @@ PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther) mnOrderIndex(rOther.mnOrderIndex), mbShowForReadOnlyDocuments(rOther.mbShowForReadOnlyDocuments), mbWantsCanvas(rOther.mbWantsCanvas), + mbWantsAWT(rOther.mbWantsAWT), mbExperimental(rOther.mbExperimental) { } diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx index 0e37e2278a73..3a47773175ce 100644 --- a/sfx2/source/sidebar/PanelLayout.cxx +++ b/sfx2/source/sidebar/PanelLayout.cxx @@ -7,124 +7,78 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/log.hxx> #include <sfx2/sidebar/SidebarController.hxx> -#include <sfx2/sidebar/TabBar.hxx> #include <sfx2/sidebar/PanelLayout.hxx> -#include <vcl/layout.hxx> -#include <vcl/accel.hxx> +#include <sfx2/sidebar/TabBar.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/event.hxx> 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_pInitialFocusWidget(nullptr) - , m_bInClose(false) - , mxFrame(rFrame) -{ - m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE); - m_aPanelLayoutIdle.SetInvokeHandler( LINK( this, PanelLayout, ImplHandlePanelLayoutTimerHdl ) ); - m_aPanelLayoutIdle.SetDebugName("sfx2::PanelLayout m_aPanelLayoutIdle"); - - SetStyle(GetStyle() | WB_DIALOGCONTROL); - - // Builder will trigger resize and start Idle - m_xVclContentArea = VclPtr<VclVBox>::Create(this); - m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, true)); - m_xContainer = m_xBuilder->weld_container(rID); -} - -void PanelLayout::GetFocus() +PanelLayout::PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription) + : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription)) + , m_xContainer(m_xBuilder->weld_container(rID)) { - Control::GetFocus(); - if (m_pInitialFocusWidget) - m_pInitialFocusWidget->grab_focus(); + m_xContainer->set_background(Theme::GetColor(Theme::Color_PanelBackground)); + m_xContainer->connect_get_property_tree(LINK(this, PanelLayout, DumpAsPropertyTreeHdl)); + ::Application::AddEventListener(LINK(this, PanelLayout, DataChangedEventListener)); } -PanelLayout::~PanelLayout() +IMPL_LINK(PanelLayout, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void) { - disposeOnce(); + DumpAsPropertyTree(rJsonWriter); } -void PanelLayout::dispose() +void PanelLayout::DumpAsPropertyTree(tools::JsonWriter&) { - m_bInClose = true; - m_pInitialFocusWidget = nullptr; - m_aPanelLayoutIdle.Stop(); - m_xContainer.reset(); - m_xBuilder.reset(); - m_xVclContentArea.disposeAndClear(); - Control::dispose(); } -Size PanelLayout::GetOptimalSize() const +IMPL_LINK(PanelLayout, DataChangedEventListener, VclSimpleEvent&, rEvent, void) { - Size aSize = m_xContainer->get_preferred_size(); - - if (mxFrame) - { - SidebarController* pController - = SidebarController::GetSidebarControllerForFrame(mxFrame); - if (pController) - aSize.setWidth(std::min<tools::Long>( - aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth()) - * GetDPIScaleFactor())); - } + if (rEvent.GetId() != VclEventId::ApplicationDataChanged) + return; - return aSize; + DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData()); + DataChanged(*pData); } -void PanelLayout::queue_resize(StateChangedType /*eReason*/) +void PanelLayout::DataChanged(const DataChangedEvent& rEvent) { - if (m_bInClose) - return; - if (m_aPanelLayoutIdle.IsActive()) + if (rEvent.GetType() != DataChangedEventType::SETTINGS) return; - InvalidateSizeCache(); - m_aPanelLayoutIdle.Start(); + if (rEvent.GetFlags() & AllSettingsFlags::STYLE) + m_xContainer->set_background(Theme::GetColor(Theme::Color_PanelBackground)); } -IMPL_LINK_NOARG( PanelLayout, ImplHandlePanelLayoutTimerHdl, Timer*, void ) +void PanelLayout::SetPanel(sfx2::sidebar::Panel* pPanel) { - vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); - assert(pChild); - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); + m_xPanel = pPanel; } -void PanelLayout::setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags) +weld::Window* PanelLayout::GetFrameWeld() const { - bool bCanHandleSmallerWidth = false; - bool bCanHandleSmallerHeight = false; - - vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); - - if (pChild->GetType() == WindowType::SCROLLWINDOW) + if (!m_xPanel) { - WinBits nStyle = pChild->GetStyle(); - if (nStyle & (WB_AUTOHSCROLL | WB_HSCROLL)) - bCanHandleSmallerWidth = true; - if (nStyle & (WB_AUTOVSCROLL | WB_VSCROLL)) - bCanHandleSmallerHeight = true; + SAL_WARN("sfx.sidebar", "Expected a toplevel Panel to exist"); + return nullptr; } + return m_xPanel->GetFrameWeld(); +} - Size aSize(GetOptimalSize()); - if (!bCanHandleSmallerWidth) - nWidth = std::max(nWidth,aSize.Width()); - if (!bCanHandleSmallerHeight) - nHeight = std::max(nHeight,aSize.Height()); - - Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); +PanelLayout::~PanelLayout() +{ + ::Application::RemoveEventListener(LINK(this, PanelLayout, DataChangedEventListener)); - if (nFlags & PosSizeFlags::Size) - VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight)); + m_xContainer.reset(); + m_xBuilder.reset(); } -bool PanelLayout::EventNotify(NotifyEvent& rNEvt) +void PanelLayout::queue_resize() { - if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) - Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this); - return Control::EventNotify( rNEvt ); + if (!m_xContainer) + return; + m_xContainer->queue_resize(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index b64b64e2c9ea..3fdfcb25a7b1 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -451,6 +451,7 @@ void ResourceManager::ReadPanelList() rPanelDescriptor.mnOrderIndex = getInt32(aPanelNode, "OrderIndex"); rPanelDescriptor.mbShowForReadOnlyDocuments = getBool(aPanelNode, "ShowForReadOnlyDocument"); rPanelDescriptor.mbWantsCanvas = getBool(aPanelNode, "WantsCanvas"); + rPanelDescriptor.mbWantsAWT = getBool(aPanelNode, "WantsAWT"); rPanelDescriptor.mbExperimental = getBool(aPanelNode, "IsExperimental"); const OUString sDefaultMenuCommand(getString(aPanelNode, "DefaultMenuCommand")); @@ -692,6 +693,8 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XController>& rxC rPanelDescriptor.mnOrderIndex = 100000 + nReadIndex; rPanelDescriptor.mbShowForReadOnlyDocuments = false; rPanelDescriptor.mbWantsCanvas = false; + rPanelDescriptor.mbWantsAWT = true; + fprintf(stderr, "THIS PLACE\n"); rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, "any"), true, OUString()); } } diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx index ea98f7659aef..fd46b96b5c2a 100644 --- a/sfx2/source/sidebar/SidebarPanelBase.cxx +++ b/sfx2/source/sidebar/SidebarPanelBase.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <sfx2/sidebar/SidebarPanelBase.hxx> -#include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ILayoutableWindow.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/PanelLayout.hxx> @@ -36,14 +35,14 @@ namespace sfx2::sidebar { Reference<ui::XUIElement> SidebarPanelBase::Create ( const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pWindow, + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize) { Reference<ui::XUIElement> xUIElement ( new SidebarPanelBase( rsResourceURL, rxFrame, - pWindow, + std::move(xControl), rLayoutSize)); return xUIElement; } @@ -51,11 +50,11 @@ Reference<ui::XUIElement> SidebarPanelBase::Create ( SidebarPanelBase::SidebarPanelBase ( const OUString& rsResourceURL, const css::uno::Reference<css::frame::XFrame>& rxFrame, - PanelLayout* pWindow, + std::unique_ptr<PanelLayout> xControl, const css::ui::LayoutSize& rLayoutSize) : SidebarPanelBaseInterfaceBase(m_aMutex), mxFrame(rxFrame), - mpControl(pWindow), + mxControl(std::move(xControl)), msResourceURL(rsResourceURL), maLayoutSize(rLayoutSize) { @@ -66,22 +65,24 @@ SidebarPanelBase::SidebarPanelBase ( ::comphelper::getProcessComponentContext())); xMultiplexer->addContextChangeEventListener(this, mxFrame->getController()); } - if (mpControl != nullptr) - { - mpControl->SetBackground(Theme::GetColor(Theme::Color_PanelBackground)); - mpControl->Show(); - } } SidebarPanelBase::~SidebarPanelBase() { } +void SidebarPanelBase::SetParentPanel(sfx2::sidebar::Panel* pPanel) +{ + if (!mxControl) + return; + mxControl->SetPanel(pPanel); +} + void SAL_CALL SidebarPanelBase::disposing() { SolarMutexGuard aGuard; - mpControl.disposeAndClear(); + mxControl.reset(); if (mxFrame.is()) { @@ -100,7 +101,7 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent ( SolarMutexGuard aGuard; IContextChangeReceiver* pContextChangeReceiver - = dynamic_cast<IContextChangeReceiver*>(mpControl.get()); + = dynamic_cast<IContextChangeReceiver*>(mxControl.get()); if (pContextChangeReceiver != nullptr) { const vcl::EnumContext aContext( @@ -116,7 +117,7 @@ void SAL_CALL SidebarPanelBase::disposing ( SolarMutexGuard aGuard; mxFrame = nullptr; - mpControl = nullptr; + mxControl.reset(); } css::uno::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame() @@ -142,20 +143,14 @@ Reference<XInterface> SAL_CALL SidebarPanelBase::getRealInterface() Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessible ( const Reference<accessibility::XAccessible>&) { - // Not yet implemented. + // Not implemented. return nullptr; } Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow() { - SolarMutexGuard aGuard; - - if (mpControl != nullptr) - return Reference<awt::XWindow>( - mpControl->GetComponentInterface(), - UNO_QUERY); - else - return nullptr; + // Not implemented + return nullptr; } ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth) @@ -164,46 +159,33 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi if (maLayoutSize.Minimum >= 0) return maLayoutSize; + + ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mxControl.get()); + if (pLayoutableWindow) + return pLayoutableWindow->GetHeightForWidth(nWidth); else { - ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl.get()); - if (pLayoutableWindow) - return pLayoutableWindow->GetHeightForWidth(nWidth); - else if (isLayoutEnabled(mpControl)) - { - // widget layout-based sidebar - mpControl->queue_resize(); - Size aSize(mpControl->get_preferred_size()); - return ui::LayoutSize(aSize.Height(), aSize.Height(), aSize.Height()); - } - else if (mpControl != nullptr) - { - const sal_Int32 nHeight (mpControl->GetSizePixel().Height()); - return ui::LayoutSize(nHeight,nHeight,nHeight); - } + // widget layout-based sidebar + mxControl->queue_resize(); + Size aSize(mxControl->get_preferred_size()); + return ui::LayoutSize(aSize.Height(), aSize.Height(), aSize.Height()); } - - return ui::LayoutSize(0,0,0); } sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth () { SolarMutexGuard aGuard; - if (isLayoutEnabled(mpControl)) - { - // widget layout-based sidebar - Size aSize(mpControl->get_preferred_size()); - return aSize.Width(); - } - return 0; + // widget layout-based sidebar + Size aSize(mxControl->get_preferred_size()); + return aSize.Width(); } void SAL_CALL SidebarPanelBase::updateModel(const css::uno::Reference<css::frame::XModel>& xModel) { SolarMutexGuard aGuard; - SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mpControl.get()); + SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mxControl.get()); if (!pModelUpdate) return; diff --git a/sfx2/uiconfig/ui/navigator.ui b/sfx2/uiconfig/ui/navigator.ui new file mode 100644 index 000000000000..e7dd8ca09087 --- /dev/null +++ b/sfx2/uiconfig/ui/navigator.ui @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="sfx"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="Navigator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <placeholder/> + </child> + </object> +</interface> |