[Libreoffice-commits] core.git: 2 commits - sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Wed May 25 11:33:41 UTC 2016


 sfx2/source/appl/workwin.cxx         |   23 ++++++++++-------------
 sw/source/uibase/inc/inputwin.hxx    |    2 +-
 sw/source/uibase/ribbar/inputwin.cxx |    9 ++++++---
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 77e7dc648ebb8b7d946111e2be4dfdbba72840b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 25 11:53:34 2016 +0100

    Resolves: tdf#96244 get the right Writer window view for Formula window
    
    if you hit F1 and F2 together, then the help window is a writer window
    too (in disguise) so asking for the "active view" on processing the F2
    in the real writer will get the help window as the active view, which
    doesn't match expectations.
    
    Take the view from the bindings, where its correct from when the event
    has been dispatched.
    
    Investigating a bit further, the F2 formula window only works correctly
    when its in an "active" window. So get the correct view from the dispatcher
    but only accept that view if its the active one.
    
    Change-Id: I2fd52ca6b68e887d34b07b70b830722f1d00b37a

diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx
index e333898..78531cb 100644
--- a/sw/source/uibase/inc/inputwin.hxx
+++ b/sw/source/uibase/inc/inputwin.hxx
@@ -79,7 +79,7 @@ protected:
     void            CancelFormula();
 
 public:
-                    SwInputWindow( vcl::Window* pParent );
+    SwInputWindow(vcl::Window* pParent, SfxDispatcher* pDispatcher);
     virtual         ~SwInputWindow();
     virtual void    dispose() override;
 
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index c58953e..90df573 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -56,7 +56,7 @@
 
 SFX_IMPL_POS_CHILDWINDOW_WITHID( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT )
 
-SwInputWindow::SwInputWindow( vcl::Window* pParent )
+SwInputWindow::SwInputWindow(vcl::Window* pParent, SfxDispatcher* pDispatcher)
     : ToolBox(  pParent ,   SW_RES( RID_TBX_FORMULA )),
     aPos(       VclPtr<Edit>::Create(this,       SW_RES(ED_POS))),
     aEdit(      VclPtr<InputEdit>::Create(this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION)),
@@ -79,7 +79,10 @@ SwInputWindow::SwInputWindow( vcl::Window* pParent )
     SfxImageManager* pManager = SfxImageManager::GetImageManager( *SW_MOD() );
     pManager->RegisterToolBox(this);
 
-    pView = ::GetActiveView();
+    SwView *pDispatcherView = dynamic_cast<SwView*>(pDispatcher ? pDispatcher->GetFrame()->GetViewShell() : nullptr);
+    SwView* pActiveView = ::GetActiveView();
+    if (pDispatcherView == pActiveView)
+        pView = pActiveView;
     pWrtShell = pView ? pView->GetWrtShellPtr() : nullptr;
 
     InsertWindow( ED_POS, aPos.get(), ToolBoxItemBits::NONE, 0);
@@ -620,7 +623,7 @@ SwInputChild::SwInputChild(vcl::Window* _pParent,
                                 SfxChildWindow( _pParent, nId )
 {
     pDispatch = pBindings->GetDispatcher();
-    SetWindow( VclPtr<SwInputWindow>::Create( _pParent ) );
+    SetWindow(VclPtr<SwInputWindow>::Create(_pParent, pDispatch));
     static_cast<SwInputWindow*>(GetWindow())->ShowWin();
     SetAlignment(SfxChildAlignment::LOWESTTOP);
 }
commit 7e5ade130910006d50a8fdb9cde00c17c06014b7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 25 10:45:36 2016 +0100

    because pCW->bCreate is always set to true, the conditional isn't useful
    
    Change-Id: Icba66b3832cdf8dbd916604f08cb1d5f9bb81873

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 462b8a5..537405c 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1897,20 +1897,17 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus)
             else
             {
                 pCW->bCreate = true;
-                if ( pCW->bCreate )
+                if ( pChild )
                 {
-                    if ( pChild )
-                    {
-                        ShowChildWindow_Impl( nId, true, bSetFocus );
-                    }
-                    else
-                    {
-                        // create actual Window
-                        CreateChildWin_Impl( pCW, bSetFocus );
-                        if ( !pCW->pWin )
-                            // no success
-                            pCW->bCreate = false;
-                    }
+                    ShowChildWindow_Impl( nId, true, bSetFocus );
+                }
+                else
+                {
+                    // create actual Window
+                    CreateChildWin_Impl( pCW, bSetFocus );
+                    if ( !pCW->pWin )
+                        // no success
+                        pCW->bCreate = false;
                 }
             }
         }


More information about the Libreoffice-commits mailing list