From b37ac48935621fcc7b71f81a8b892f24e85e5b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 24 Jan 2017 14:42:46 +0000 Subject: [PATCH] Resolves: tdf#105450 calc navigator gets 0 height on toggle off/on when docked Change-Id: Icd346cdf0a208ccaeddd77e6803f4f906361324c --- include/sfx2/childwin.hxx | 2 ++ sc/source/ui/inc/navipi.hxx | 3 +-- sc/source/ui/navipi/navipi.cxx | 16 ++++++++-------- sc/source/ui/sidebar/ScPanelFactory.cxx | 2 +- sfx2/source/appl/childwin.cxx | 16 ++++++++-------- sw/source/uibase/inc/navipi.hxx | 4 +--- sw/source/uibase/sidebar/SwPanelFactory.cxx | 2 +- sw/source/uibase/utlui/navipi.cxx | 16 +++++++--------- 8 files changed, 29 insertions(+), 32 deletions(-) diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index a8c1b23c142e..10aa39a9b666 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -137,6 +137,8 @@ public: FloatingWindow* GetFloatingWindow() const; + static FloatingWindow* GetFloatingWindow(vcl::Window *pParent); + static void RegisterChildWindowContext(SfxModule*, sal_uInt16, SfxChildWinContextFactory*); }; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 68fdba9be8fb..128b146b4a3e 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -194,7 +194,6 @@ private: OUString aStrHidden; OUString aStrActiveWin; - bool bInSidebar; sal_uInt16 nZoomId; sal_uInt16 nChangeRootId; sal_uInt16 nDragModeId; @@ -257,7 +256,7 @@ private: static void ReleaseFocus(); public: - ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pParent); + ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent); virtual ~ScNavigatorDlg() override; virtual void dispose() override; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index efcd4070f109..45a24ec6438a 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -422,7 +422,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent, SfxChildWinInfo* /* pInfo */) : SfxChildWindowContext(nId) { - pNavigator = VclPtr::Create(pBind, false, pParent); + pNavigator = VclPtr::Create(pBind, pParent); if (SfxNavigator* pNav = dynamic_cast(pParent)) pNav->SetMinOutputSizePixel(pNavigator->GetOptimalSize()); SetWindow(pNavigator); @@ -433,13 +433,12 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent, #define REGISTER_SLOT(i,id) \ ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings); -ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pParent) +ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) : PanelLayout(pParent, "NavigatorPanel", "modules/scalc/ui/navigatorpanel.ui", nullptr) , rBindings(*pB) , aStrDragMode(ScResId(SCSTR_DRAGMODE)) , aStrDisplay(ScResId(SCSTR_DISPLAY)) , aStrActiveWin(ScResId(SCSTR_ACTIVEWIN)) - , bInSidebar(bSidebar) , pMarkArea(nullptr) , pViewData(nullptr ) , eListMode(NAV_LMODE_NONE) @@ -530,11 +529,11 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pPar aContentIdle.SetInvokeHandler( LINK( this, ScNavigatorDlg, TimeHdl ) ); aContentIdle.SetPriority( TaskPriority::LOWEST ); - if (bInSidebar) + if (!SfxChildWindowContext::GetFloatingWindow(GetParent())) { - // When the navigator is displayed in the sidebar it has the whole deck - // to fill. Therefore hide the button that hides all controls below - // the top two rows of buttons. + // When the navigator is displayed in the sidebar, or is otherwise + // docked, it has the whole deck to fill. Therefore hide the button that + // hides all controls below the top two rows of buttons. aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(nZoomId)); } aLbEntries->SetNavigatorDlgFlag(true); @@ -839,7 +838,8 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode) { if (eMode != eListMode) { - bool bForceParentResize = (eMode == NAV_LMODE_NONE || eListMode == NAV_LMODE_NONE); + bool bForceParentResize = SfxChildWindowContext::GetFloatingWindow(GetParent()) && + (eMode == NAV_LMODE_NONE || eListMode == NAV_LMODE_NONE); SfxNavigator* pNav = bForceParentResize ? dynamic_cast(GetParent()) : nullptr; if (pNav && eMode == NAV_LMODE_NONE) //save last normal size on minimizing aExpandedSize = GetSizePixel(); diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index e7054009704f..95740e46731f 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -93,7 +93,7 @@ Reference SAL_CALL ScPanelFactory::createUIElement ( pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NavigatorPanel")) { - pPanel = VclPtr::Create(pBindings, true, pParentWindow); + pPanel = VclPtr::Create(pBindings, pParentWindow); nMinimumSize = 0; } else if (rsResourceURL.endsWith("/FunctionsPanel")) diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 54a581cad7c8..f9735e23b2f1 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -518,22 +518,22 @@ SfxChildWindowContext::~SfxChildWindowContext() pWindow.disposeAndClear(); } -FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const +FloatingWindow* SfxChildWindowContext::GetFloatingWindow(vcl::Window *pParent) { - vcl::Window *pParent = pWindow->GetParent(); if (pParent->GetType() == WINDOW_DOCKINGWINDOW || pParent->GetType() == WINDOW_TOOLBOX) { return static_cast(pParent)->GetFloatingWindow(); } - else if (pParent->GetType() == WINDOW_FLOATINGWINDOW) + if (pParent->GetType() == WINDOW_FLOATINGWINDOW) { return static_cast(pParent); } - else - { - OSL_FAIL("No FloatingWindow-Context!"); - return nullptr; - } + return nullptr; +} + +FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const +{ + return SfxChildWindowContext::GetFloatingWindow(pWindow->GetParent()); } void SfxChildWindow::SetFactory_Impl( SfxChildWinFactory *pF ) diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 1c650ca360cf..80b8c9e4d10d 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -85,8 +85,6 @@ class SwNavigationPI : public PanelLayout, VclPtr m_pPopupWindow; VclPtr m_pFloatingWindow; - SfxChildWindowContext* m_pContextWin; - SwNavigationConfig *m_pConfig; SfxBindings &m_rBindings; @@ -134,7 +132,7 @@ protected: public: - SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*); + SwNavigationPI(SfxBindings*, vcl::Window*); virtual ~SwNavigationPI() override; virtual void dispose() override; diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx index a0a1a85593e4..3a33252d7703 100644 --- a/sw/source/uibase/sidebar/SwPanelFactory.cxx +++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx @@ -165,7 +165,7 @@ Reference SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/NavigatorPanel")) { - VclPtrInstance pPanel(pBindings, nullptr, pParentWindow); + VclPtrInstance pPanel(pBindings, pParentWindow); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 6aff4df8deda..9fc3a696abc1 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -244,7 +244,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void ) } else if (sCommand == "listbox") { - if (m_pContextWin && m_pContextWin->GetFloatingWindow()) + if (SfxChildWindowContext::GetFloatingWindow(GetParent())) { if (IsZoomedIn()) { @@ -583,7 +583,6 @@ void SwNavigationPI::ZoomIn() } SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings, - SfxChildWindowContext* pCw, vcl::Window* pParent) : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", nullptr) , SfxControllerItem(SID_DOCFULLNAME, *_pBindings) @@ -594,7 +593,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings, , m_pCreateView(nullptr) , m_pPopupWindow(nullptr) , m_pFloatingWindow(nullptr) - , m_pContextWin(pCw) , m_pConfig(SW_MOD()->GetNavigationConfig()) , m_rBindings(*_pBindings) , m_nAutoMarkIdx(1) @@ -730,12 +728,12 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings, m_aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); m_aDocListBox->SetAccessibleName(m_aStatusArr[3]); - if (m_pContextWin == nullptr) + if (!SfxChildWindowContext::GetFloatingWindow(GetParent())) { - // When the context window is missing then the navigator is - // displayed in the sidebar. While the navigator could change - // its size, the sidebar can not, and the navigator would just - // waste space. Therefore hide this button. + // if the parent isn't a float, then then the navigator is displayed in + // the sidebar or is otherwise docked. While the navigator could change + // its size, the sidebar can not, and the navigator would just waste + // space. Therefore hide this button. m_aContentToolBox->RemoveItem(m_aContentToolBox->GetItemPos(m_aContentToolBox->GetItemId("listbox"))); } @@ -1194,7 +1192,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent, SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - VclPtr pNavi = VclPtr::Create( _pBindings, this, pParent ); + VclPtr pNavi = VclPtr::Create(_pBindings, pParent); _pBindings->Invalidate(SID_NAVIGATOR); SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();