Resolves: tdf#105450 calc navigator gets 0 height on toggle off/on when docked

Change-Id: Icd346cdf0a208ccaeddd77e6803f4f906361324c
This commit is contained in:
Caolán McNamara
2017-01-24 14:42:46 +00:00
parent 25a10ae68e
commit b37ac48935
8 changed files with 29 additions and 32 deletions

View File

@@ -137,6 +137,8 @@ public:
FloatingWindow* GetFloatingWindow() const; FloatingWindow* GetFloatingWindow() const;
static FloatingWindow* GetFloatingWindow(vcl::Window *pParent);
static void RegisterChildWindowContext(SfxModule*, sal_uInt16, SfxChildWinContextFactory*); static void RegisterChildWindowContext(SfxModule*, sal_uInt16, SfxChildWinContextFactory*);
}; };

View File

@@ -194,7 +194,6 @@ private:
OUString aStrHidden; OUString aStrHidden;
OUString aStrActiveWin; OUString aStrActiveWin;
bool bInSidebar;
sal_uInt16 nZoomId; sal_uInt16 nZoomId;
sal_uInt16 nChangeRootId; sal_uInt16 nChangeRootId;
sal_uInt16 nDragModeId; sal_uInt16 nDragModeId;
@@ -257,7 +256,7 @@ private:
static void ReleaseFocus(); static void ReleaseFocus();
public: public:
ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pParent); ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent);
virtual ~ScNavigatorDlg() override; virtual ~ScNavigatorDlg() override;
virtual void dispose() override; virtual void dispose() override;

View File

@@ -422,7 +422,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent,
SfxChildWinInfo* /* pInfo */) SfxChildWinInfo* /* pInfo */)
: SfxChildWindowContext(nId) : SfxChildWindowContext(nId)
{ {
pNavigator = VclPtr<ScNavigatorDlg>::Create(pBind, false, pParent); pNavigator = VclPtr<ScNavigatorDlg>::Create(pBind, pParent);
if (SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(pParent)) if (SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(pParent))
pNav->SetMinOutputSizePixel(pNavigator->GetOptimalSize()); pNav->SetMinOutputSizePixel(pNavigator->GetOptimalSize());
SetWindow(pNavigator); SetWindow(pNavigator);
@@ -433,13 +433,12 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent,
#define REGISTER_SLOT(i,id) \ #define REGISTER_SLOT(i,id) \
ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings); 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) : PanelLayout(pParent, "NavigatorPanel", "modules/scalc/ui/navigatorpanel.ui", nullptr)
, rBindings(*pB) , rBindings(*pB)
, aStrDragMode(ScResId(SCSTR_DRAGMODE)) , aStrDragMode(ScResId(SCSTR_DRAGMODE))
, aStrDisplay(ScResId(SCSTR_DISPLAY)) , aStrDisplay(ScResId(SCSTR_DISPLAY))
, aStrActiveWin(ScResId(SCSTR_ACTIVEWIN)) , aStrActiveWin(ScResId(SCSTR_ACTIVEWIN))
, bInSidebar(bSidebar)
, pMarkArea(nullptr) , pMarkArea(nullptr)
, pViewData(nullptr ) , pViewData(nullptr )
, eListMode(NAV_LMODE_NONE) , eListMode(NAV_LMODE_NONE)
@@ -530,11 +529,11 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pPar
aContentIdle.SetInvokeHandler( LINK( this, ScNavigatorDlg, TimeHdl ) ); aContentIdle.SetInvokeHandler( LINK( this, ScNavigatorDlg, TimeHdl ) );
aContentIdle.SetPriority( TaskPriority::LOWEST ); aContentIdle.SetPriority( TaskPriority::LOWEST );
if (bInSidebar) if (!SfxChildWindowContext::GetFloatingWindow(GetParent()))
{ {
// When the navigator is displayed in the sidebar it has the whole deck // When the navigator is displayed in the sidebar, or is otherwise
// to fill. Therefore hide the button that hides all controls below // docked, it has the whole deck to fill. Therefore hide the button that
// the top two rows of buttons. // hides all controls below the top two rows of buttons.
aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(nZoomId)); aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(nZoomId));
} }
aLbEntries->SetNavigatorDlgFlag(true); aLbEntries->SetNavigatorDlgFlag(true);
@@ -839,7 +838,8 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode)
{ {
if (eMode != eListMode) 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<SfxNavigator*>(GetParent()) : nullptr; SfxNavigator* pNav = bForceParentResize ? dynamic_cast<SfxNavigator*>(GetParent()) : nullptr;
if (pNav && eMode == NAV_LMODE_NONE) //save last normal size on minimizing if (pNav && eMode == NAV_LMODE_NONE) //save last normal size on minimizing
aExpandedSize = GetSizePixel(); aExpandedSize = GetSizePixel();

View File

@@ -93,7 +93,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
else if (rsResourceURL.endsWith("/NavigatorPanel")) else if (rsResourceURL.endsWith("/NavigatorPanel"))
{ {
pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, true, pParentWindow); pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, pParentWindow);
nMinimumSize = 0; nMinimumSize = 0;
} }
else if (rsResourceURL.endsWith("/FunctionsPanel")) else if (rsResourceURL.endsWith("/FunctionsPanel"))

View File

@@ -518,22 +518,22 @@ SfxChildWindowContext::~SfxChildWindowContext()
pWindow.disposeAndClear(); 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) if (pParent->GetType() == WINDOW_DOCKINGWINDOW || pParent->GetType() == WINDOW_TOOLBOX)
{ {
return static_cast<DockingWindow*>(pParent)->GetFloatingWindow(); return static_cast<DockingWindow*>(pParent)->GetFloatingWindow();
} }
else if (pParent->GetType() == WINDOW_FLOATINGWINDOW) if (pParent->GetType() == WINDOW_FLOATINGWINDOW)
{ {
return static_cast<FloatingWindow*>(pParent); return static_cast<FloatingWindow*>(pParent);
} }
else return nullptr;
{ }
OSL_FAIL("No FloatingWindow-Context!");
return nullptr; FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const
} {
return SfxChildWindowContext::GetFloatingWindow(pWindow->GetParent());
} }
void SfxChildWindow::SetFactory_Impl( SfxChildWinFactory *pF ) void SfxChildWindow::SetFactory_Impl( SfxChildWinFactory *pF )

View File

@@ -85,8 +85,6 @@ class SwNavigationPI : public PanelLayout,
VclPtr<SfxPopupWindow> m_pPopupWindow; VclPtr<SfxPopupWindow> m_pPopupWindow;
VclPtr<SfxPopupWindow> m_pFloatingWindow; VclPtr<SfxPopupWindow> m_pFloatingWindow;
SfxChildWindowContext* m_pContextWin;
SwNavigationConfig *m_pConfig; SwNavigationConfig *m_pConfig;
SfxBindings &m_rBindings; SfxBindings &m_rBindings;
@@ -134,7 +132,7 @@ protected:
public: public:
SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*); SwNavigationPI(SfxBindings*, vcl::Window*);
virtual ~SwNavigationPI() override; virtual ~SwNavigationPI() override;
virtual void dispose() override; virtual void dispose() override;

View File

@@ -165,7 +165,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
} }
else if (rsResourceURL.endsWith("/NavigatorPanel")) else if (rsResourceURL.endsWith("/NavigatorPanel"))
{ {
VclPtrInstance<SwNavigationPI> pPanel(pBindings, nullptr, pParentWindow); VclPtrInstance<SwNavigationPI> pPanel(pBindings, pParentWindow);
xElement = sfx2::sidebar::SidebarPanelBase::Create( xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL, rsResourceURL,
xFrame, xFrame,

View File

@@ -244,7 +244,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void )
} }
else if (sCommand == "listbox") else if (sCommand == "listbox")
{ {
if (m_pContextWin && m_pContextWin->GetFloatingWindow()) if (SfxChildWindowContext::GetFloatingWindow(GetParent()))
{ {
if (IsZoomedIn()) if (IsZoomedIn())
{ {
@@ -583,7 +583,6 @@ void SwNavigationPI::ZoomIn()
} }
SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings, SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
SfxChildWindowContext* pCw,
vcl::Window* pParent) vcl::Window* pParent)
: PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", nullptr) : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", nullptr)
, SfxControllerItem(SID_DOCFULLNAME, *_pBindings) , SfxControllerItem(SID_DOCFULLNAME, *_pBindings)
@@ -594,7 +593,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
, m_pCreateView(nullptr) , m_pCreateView(nullptr)
, m_pPopupWindow(nullptr) , m_pPopupWindow(nullptr)
, m_pFloatingWindow(nullptr) , m_pFloatingWindow(nullptr)
, m_pContextWin(pCw)
, m_pConfig(SW_MOD()->GetNavigationConfig()) , m_pConfig(SW_MOD()->GetNavigationConfig())
, m_rBindings(*_pBindings) , m_rBindings(*_pBindings)
, m_nAutoMarkIdx(1) , m_nAutoMarkIdx(1)
@@ -730,12 +728,12 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
m_aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); m_aGlobalTree->SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
m_aDocListBox->SetAccessibleName(m_aStatusArr[3]); m_aDocListBox->SetAccessibleName(m_aStatusArr[3]);
if (m_pContextWin == nullptr) if (!SfxChildWindowContext::GetFloatingWindow(GetParent()))
{ {
// When the context window is missing then the navigator is // if the parent isn't a float, then then the navigator is displayed in
// displayed in the sidebar. While the navigator could change // the sidebar or is otherwise docked. While the navigator could change
// its size, the sidebar can not, and the navigator would just // its size, the sidebar can not, and the navigator would just waste
// waste space. Therefore hide this button. // space. Therefore hide this button.
m_aContentToolBox->RemoveItem(m_aContentToolBox->GetItemPos(m_aContentToolBox->GetItemId("listbox"))); m_aContentToolBox->RemoveItem(m_aContentToolBox->GetItemPos(m_aContentToolBox->GetItemId("listbox")));
} }
@@ -1194,7 +1192,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
SfxChildWinInfo* ) SfxChildWinInfo* )
: SfxChildWindowContext( nId ) : SfxChildWindowContext( nId )
{ {
VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create( _pBindings, this, pParent ); VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create(_pBindings, pParent);
_pBindings->Invalidate(SID_NAVIGATOR); _pBindings->Invalidate(SID_NAVIGATOR);
SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig(); SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();