[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - include/sfx2 sc/source sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Fri Jan 27 17:41:44 UTC 2017


 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(-)

New commits:
commit 0cfda5204184fa937a948b3d273ac1083896bcc7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 24 14:42:46 2017 +0000

    Resolves: tdf#105450 calc navigator gets 0 height on toggle off/on when docked
    
    Change-Id: Icd346cdf0a208ccaeddd77e6803f4f906361324c
    (cherry picked from commit b37ac48935621fcc7b71f81a8b892f24e85e5b6f)
    Reviewed-on: https://gerrit.libreoffice.org/33498
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 3068d00..45d6a94 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 ac588dd..c0dd4c7 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 4c5df44..fc96351 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -423,7 +423,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent,
                                                    SfxChildWinInfo* /* pInfo */)
     : SfxChildWindowContext(nId)
 {
-    pNavigator = VclPtr<ScNavigatorDlg>::Create(pBind, false, pParent);
+    pNavigator = VclPtr<ScNavigatorDlg>::Create(pBind, pParent);
     if (SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(pParent))
         pNav->SetMinOutputSizePixel(pNavigator->GetOptimalSize());
     SetWindow(pNavigator);
@@ -434,13 +434,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)
@@ -531,11 +530,11 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pPar
     aContentIdle.SetIdleHdl( LINK( this, ScNavigatorDlg, TimeHdl ) );
     aContentIdle.SetPriority( SchedulerPriority::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);
@@ -841,7 +840,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<SfxNavigator*>(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 e705400..95740e4 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -93,7 +93,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
             pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
         else if (rsResourceURL.endsWith("/NavigatorPanel"))
         {
-            pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, true, pParentWindow);
+            pPanel = VclPtr<ScNavigatorDlg>::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 a637818..e08141e 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -519,22 +519,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<DockingWindow*>(pParent)->GetFloatingWindow();
     }
-    else if (pParent->GetType() == WINDOW_FLOATINGWINDOW)
+    if (pParent->GetType() == WINDOW_FLOATINGWINDOW)
     {
         return static_cast<FloatingWindow*>(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 503c1d7..c7417dd 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -85,8 +85,6 @@ class SwNavigationPI : public PanelLayout,
     VclPtr<SfxPopupWindow>      m_pPopupWindow;
     VclPtr<SfxPopupWindow>      m_pFloatingWindow;
 
-    SfxChildWindowContext* m_pContextWin;
-
     SwNavigationConfig  *m_pConfig;
     SfxBindings         &m_rBindings;
 
@@ -135,7 +133,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 d1d85d1..426b91e 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -170,7 +170,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
     }
     else if (rsResourceURL.endsWith("/NavigatorPanel"))
     {
-        VclPtrInstance<SwNavigationPI> pPanel(pBindings, nullptr, pParentWindow);
+        VclPtrInstance<SwNavigationPI> 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 18aaeb7..6204b0e 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -245,7 +245,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void )
     }
     else if (sCommand == "listbox")
     {
-        if (m_pContextWin && m_pContextWin->GetFloatingWindow())
+        if (SfxChildWindowContext::GetFloatingWindow(GetParent()))
         {
             if (IsZoomedIn())
             {
@@ -584,7 +584,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)
@@ -595,7 +594,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)
@@ -734,12 +732,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")));
     }
 
@@ -1206,7 +1204,7 @@ SwNavigationChild::SwNavigationChild( vcl::Window* pParent,
                         SfxChildWinInfo* )
     : SfxChildWindowContext( nId )
 {
-    VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create( _pBindings, this, pParent );
+    VclPtr<SwNavigationPI> pNavi = VclPtr<SwNavigationPI>::Create(_pBindings, pParent);
     _pBindings->Invalidate(SID_NAVIGATOR);
 
     SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();


More information about the Libreoffice-commits mailing list