[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 3 commits - editeng/source include/editeng include/sfx2 sc/source svx/source sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 3 10:24:33 UTC 2016


 editeng/source/editeng/editundo.cxx            |   12 ++++
 editeng/source/editeng/editview.cxx            |   13 ++---
 editeng/source/editeng/impedit.cxx             |   23 ++++-----
 editeng/source/editeng/impedit.hxx             |   13 ++---
 editeng/source/editeng/impedit5.cxx            |   17 +++++-
 editeng/source/outliner/outlvw.cxx             |    4 -
 include/editeng/editund2.hxx                   |    3 +
 include/editeng/editview.hxx                   |    7 +-
 include/editeng/outliner.hxx                   |   12 ++--
 include/sfx2/viewsh.hxx                        |    5 +
 sc/source/ui/app/inputhdl.cxx                  |    2 
 sc/source/ui/view/viewdata.cxx                 |    2 
 svx/source/svdraw/svdedxv.cxx                  |    2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   63 +++++++++++++++++++++++++
 sw/source/uibase/docvw/SidebarWin.cxx          |    2 
 15 files changed, 135 insertions(+), 45 deletions(-)

New commits:
commit 9ab633b5ea1266e354a3d0f122dff9c10c4e7120
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 2 19:35:05 2016 +0200

    editeng: track view shells in SfxListUndoActions
    
    This is needed for e.g. tracking deletions by backspace in Writer shape
    text.
    
    Reviewed-on: https://gerrit.libreoffice.org/27807
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit c86e89c5bb040786193f7b8bba8516ffa706a14a)
    
    Change-Id: I6f873872566313096c2c57f4a13ac2f1db67e77d

diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ea3780e..b910da6 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -685,6 +685,8 @@ private:
     void ImplUpdateOverflowingLineNum( sal_uInt32, sal_uInt32, sal_uInt32 );
 
     SpellInfo *     CreateSpellInfo( bool bMultipleDocs );
+    /// Obtains a view shell ID from the active EditView.
+    sal_Int32 CreateViewShellId();
 
     ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool);
     void InitDoc(bool bKeepParaAttribs);
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 14b1388..303b447 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -26,6 +26,7 @@
 #include <editdbg.hxx>
 #include <svl/smplhint.hxx>
 #include <editeng/lrspitem.hxx>
+#include <editeng/outliner.hxx>
 
 void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
 {
@@ -222,11 +223,23 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S
     return pUndo;
 }
 
+sal_Int32 ImpEditEngine::CreateViewShellId()
+{
+    sal_Int32 nRet = -1;
+
+    const EditView* pEditView = pEditEngine ? pEditEngine->GetActiveView() : nullptr;
+    const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr;
+    if (pViewShell)
+        nRet = pViewShell->GetViewShellId();
+
+    return nRet;
+}
+
 void ImpEditEngine::UndoActionStart( sal_uInt16 nId, const ESelection& aSel )
 {
     if ( IsUndoEnabled() && !IsInUndo() )
     {
-        GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, -1 );
+        GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() );
         DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
         pUndoMarkSelection = new ESelection( aSel );
     }
@@ -236,7 +249,7 @@ void ImpEditEngine::UndoActionStart( sal_uInt16 nId )
 {
     if ( IsUndoEnabled() && !IsInUndo() )
     {
-        GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, -1 );
+        GetUndoManager().EnterListAction( GetEditEnginePtr()->GetUndoComment( nId ), OUString(), nId, CreateViewShellId() );
         DBG_ASSERT( !pUndoMarkSelection, "UndoAction SelectionMarker?" );
     }
 }
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e4f95d8..340473d 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -62,6 +62,7 @@ public:
     void testTextEditViewInvalidations();
     void testUndoInvalidations();
     void testShapeTextUndoShells();
+    void testShapeTextUndoGroupShells();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -88,6 +89,7 @@ public:
     CPPUNIT_TEST(testTextEditViewInvalidations);
     CPPUNIT_TEST(testUndoInvalidations);
     CPPUNIT_TEST(testShapeTextUndoShells);
+    CPPUNIT_TEST(testShapeTextUndoGroupShells);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -922,6 +924,36 @@ void SwTiledRenderingTest::testShapeTextUndoShells()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SwTiledRenderingTest::testShapeTextUndoGroupShells()
+{
+    // Load a document and create a view.
+    comphelper::LibreOfficeKit::setActive();
+    SwXTextDocument* pXTextDocument = createDoc("shape.fodt");
+    sal_Int32 nView1 = SfxLokHelper::getView();
+
+    // Begin text edit.
+    SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+    SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    SdrObject* pObject = pPage->GetObj(0);
+    SdrView* pView = pWrtShell->GetDrawView();
+    pWrtShell->GetView().BeginTextEdit(pObject, pView->GetSdrPageView(), pWrtShell->GetWin());
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::BACKSPACE);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::BACKSPACE);
+
+    // Make sure that the undo item remembers who created it.
+    SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rUndoManager.GetUndoActionCount());
+    // This was -1: the view shell id for the (top) undo list action wasn't known.
+    CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId());
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 7e89f1ec496c51bf183437ad097c6ed33365b8d3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 2 17:52:44 2016 +0200

    editeng: implement SfxUndoAction::GetViewShellId() interface in EditUndo
    
    With this, e.g. inserting a character in a Writer shape text remembers
    its view shell.
    
    Reviewed-on: https://gerrit.libreoffice.org/27796
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit b567278c4aa6e3dee331b60c71eb996babcc9d08)
    
    Change-Id: Ic82a3f45a66cf622496e3131390d365440dffb3b

diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 63ced0a..0871e9c 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -25,6 +25,7 @@
 #include <editundo.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/editeng.hxx>
+#include <editeng/outliner.hxx>
 
 
 static void lcl_DoSetSelection( EditView* pView, sal_uInt16 nPara )
@@ -118,8 +119,12 @@ bool EditUndoManager::Redo()
 }
 
 EditUndo::EditUndo(sal_uInt16 nI, EditEngine* pEE) :
-    nId(nI), mpEditEngine(pEE)
+    nId(nI), mnViewShellId(-1), mpEditEngine(pEE)
 {
+    const EditView* pEditView = mpEditEngine ? mpEditEngine->GetActiveView() : nullptr;
+    const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr;
+    if (pViewShell)
+        mnViewShellId = pViewShell->GetViewShellId();
 }
 
 EditUndo::~EditUndo()
@@ -147,6 +152,11 @@ OUString EditUndo::GetComment() const
     return aComment;
 }
 
+sal_Int32 EditUndo::GetViewShellId() const
+{
+    return mnViewShellId;
+}
+
 EditUndoDelContent::EditUndoDelContent(
     EditEngine* pEE, ContentNode* pNode, sal_Int32 nPortion) :
     EditUndo(EDITUNDO_DELCONTENT, pEE),
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index cfc33ca..01972d3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -122,6 +122,11 @@ void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell)
     mpViewShell = pViewShell;
 }
 
+const OutlinerViewShell* ImpEditView::GetViewShell() const
+{
+    return mpViewShell;
+}
+
 void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
 {
     // set state before notification
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index f0d1e58..ea3780e 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -370,6 +370,7 @@ public:
 
     /// Informs this edit view about which view shell contains it.
     void RegisterViewShell(OutlinerViewShell* pViewShell);
+    const OutlinerViewShell* GetViewShell() const;
 
     bool            IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong );
     OUString        SpellIgnoreWord();
diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx
index 449c4ad..c6914d3 100644
--- a/include/editeng/editund2.hxx
+++ b/include/editeng/editund2.hxx
@@ -47,6 +47,7 @@ class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
 {
 private:
     sal_uInt16          nId;
+    sal_Int32 mnViewShellId;
     EditEngine* mpEditEngine;
 
 public:
@@ -60,6 +61,8 @@ public:
 
     virtual bool    CanRepeat(SfxRepeatTarget&) const override;
     virtual OUString GetComment() const override;
+    /// See SfxUndoAction::GetViewShellId().
+    sal_Int32 GetViewShellId() const override;
     virtual sal_uInt16  GetId() const override;
 };
 
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 6d65a8e..e4f95d8 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -27,6 +27,7 @@
 #include <ndtxt.hxx>
 #include <wrtsh.hxx>
 #include <view.hxx>
+#include <UndoManager.hxx>
 #include <sfx2/viewsh.hxx>
 #include <sfx2/lokhelper.hxx>
 
@@ -60,6 +61,7 @@ public:
     void testViewLock();
     void testTextEditViewInvalidations();
     void testUndoInvalidations();
+    void testShapeTextUndoShells();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -85,6 +87,7 @@ public:
     CPPUNIT_TEST(testViewLock);
     CPPUNIT_TEST(testTextEditViewInvalidations);
     CPPUNIT_TEST(testUndoInvalidations);
+    CPPUNIT_TEST(testShapeTextUndoShells);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -891,6 +894,34 @@ void SwTiledRenderingTest::testUndoInvalidations()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SwTiledRenderingTest::testShapeTextUndoShells()
+{
+    // Load a document and create a view.
+    comphelper::LibreOfficeKit::setActive();
+    SwXTextDocument* pXTextDocument = createDoc("shape.fodt");
+    sal_Int32 nView1 = SfxLokHelper::getView();
+
+    // Begin text edit.
+    SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+    SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    SdrObject* pObject = pPage->GetObj(0);
+    SdrView* pView = pWrtShell->GetDrawView();
+    pWrtShell->GetView().BeginTextEdit(pObject, pView->GetSdrPageView(), pWrtShell->GetWin());
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0);
+
+    // Make sure that the undo item remembers who created it.
+    SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
+    sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rUndoManager.GetUndoActionCount());
+    // This was -1: the view shell id for the undo action wasn't known.
+    CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId());
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 3745f16b3139a45d93d694d22a3ca210480012fb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Aug 2 11:43:39 2016 +0200

    editeng: make SfxUndoAction::GetViewShellId() interface available
    
    Extend the existing OutlinerViewCallable interface to be able to obtain
    the view shell ID of a view shell, even from editeng.
    
    Reviewed-on: https://gerrit.libreoffice.org/27788
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit 0762a119fc0a17b80dab1e49fb832a2214f85fdc)
    
    Change-Id: I13708b0e4f58ee86643b913c7d21de022a685223

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 7ace1b8..8dea0b8 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -54,6 +54,7 @@
 #include <editeng/acorrcfg.hxx>
 #include <editeng/unolingu.hxx>
 #include <editeng/fontitem.hxx>
+#include <editeng/outliner.hxx>
 #include <unotools/lingucfg.hxx>
 #include <osl/file.hxx>
 
@@ -401,9 +402,9 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivat
             bGotoCursor = false;
         pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
 
-        if (comphelper::LibreOfficeKit::isActive() && !bActivate)
+        if (pImpEditView->mpViewShell && !bActivate)
         {
-            pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
+            pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
         }
     }
 }
@@ -412,9 +413,9 @@ void EditView::HideCursor(bool bDeactivate)
 {
     pImpEditView->GetCursor()->Hide();
 
-    if (comphelper::LibreOfficeKit::isActive() && !bDeactivate)
+    if (pImpEditView->mpViewShell && !bDeactivate)
     {
-        pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
+        pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
     }
 }
 
@@ -588,9 +589,9 @@ Color EditView::GetBackgroundColor() const
     return pImpEditView->GetBackgroundColor();
 }
 
-void EditView::registerLibreOfficeKitViewCallback(OutlinerViewCallable *pCallable)
+void EditView::RegisterViewShell(OutlinerViewShell* pViewShell)
 {
-    pImpEditView->registerLibreOfficeKitViewCallback(pCallable);
+    pImpEditView->RegisterViewShell(pViewShell);
 }
 
 void EditView::SetControlWord( EVControlBits nWord )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index b54c6d8..cfc33ca 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -79,7 +79,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo
     pOutWin             = pWindow;
     pPointer            = nullptr;
     pBackgroundColor    = nullptr;
-    mpLibreOfficeKitViewCallable = nullptr;
+    mpViewShell = nullptr;
     nScrollDiffX        = 0;
     nExtraCursorFlags   = 0;
     nCursorBidiLevel    = CURSOR_BIDILEVEL_DONTKNOW;
@@ -117,15 +117,9 @@ void ImpEditView::SetBackgroundColor( const Color& rColor )
     pBackgroundColor = new Color( rColor );
 }
 
-void ImpEditView::registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable)
+void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell)
 {
-    mpLibreOfficeKitViewCallable = pCallable;
-}
-
-void ImpEditView::libreOfficeKitViewCallback(int nType, const char* pPayload) const
-{
-    if (mpLibreOfficeKitViewCallable)
-        mpLibreOfficeKitViewCallable->libreOfficeKitViewCallback(nType, pPayload);
+    mpViewShell = pViewShell;
 }
 
 void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
@@ -341,7 +335,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
     {
         *pRegion = vcl::Region( *pPolyPoly );
 
-        if (comphelper::LibreOfficeKit::isActive() && !pOldRegion)
+        if (comphelper::LibreOfficeKit::isActive() && mpViewShell && !pOldRegion)
         {
             pOutWin->Push(PushFlags::MAPMODE);
             if (pOutWin->GetMapMode().GetMapUnit() == MAP_TWIP)
@@ -384,7 +378,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
                         aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP);
                     aStart.Move(aOrigin.getX(), aOrigin.getY());
 
-                    libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
+                    mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
 
                     Rectangle& rEnd = aRectangles.back();
                     Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom());
@@ -392,7 +386,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
                         aEnd = OutputDevice::LogicToLogic(aEnd, MAP_100TH_MM, MAP_TWIP);
                     aEnd.Move(aOrigin.getX(), aOrigin.getY());
 
-                    libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
+                    mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
                 }
 
                 std::vector<OString> v;
@@ -407,7 +401,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
                 sRectangle = comphelper::string::join("; ", v);
             }
 
-            libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr());
+            mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr());
 
             pOutWin->Pop();
         }
@@ -985,7 +979,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
 
         GetCursor()->SetSize( aCursorSz );
 
-        if (comphelper::LibreOfficeKit::isActive())
+        if (comphelper::LibreOfficeKit::isActive() && mpViewShell)
         {
             const Point& rPos = GetCursor()->GetPos();
             Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight());
@@ -1004,7 +998,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
             aRect.setWidth(0);
 
             OString sRect = aRect.toString();
-            libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
+            mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
         }
 
         CursorDirection nCursorDir = CursorDirection::NONE;
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index fe9895b..f0d1e58 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -222,8 +222,8 @@ private:
     EditView*           pEditView;
     vcl::Cursor*        pCursor;
     Color*              pBackgroundColor;
-    /// Per-view callback.
-    OutlinerViewCallable* mpLibreOfficeKitViewCallable;
+    /// Containing view shell, if any.
+    OutlinerViewShell* mpViewShell;
     EditEngine*         pEditEngine;
     VclPtr<vcl::Window> pOutWin;
     Pointer*            pPointer;
@@ -368,10 +368,8 @@ public:
     const Color&    GetBackgroundColor() const {
                         return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); }
 
-    /// @see SfxViewShell::registerLibreOfficeKitViewCallback().
-    void registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable);
-    /// Invokes the registered view callback, if there are any.
-    void libreOfficeKitViewCallback(int nType, const char* pPayload) const;
+    /// Informs this edit view about which view shell contains it.
+    void RegisterViewShell(OutlinerViewShell* pViewShell);
 
     bool            IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong );
     OUString        SpellIgnoreWord();
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index a6fed49..2e5b0b4 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1426,9 +1426,9 @@ void OutlinerView::SetBackgroundColor( const Color& rColor )
     pEditView->SetBackgroundColor( rColor );
 }
 
-void OutlinerView::registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable)
+void OutlinerView::RegisterViewShell(OutlinerViewShell* pViewShell)
 {
-    pEditView->registerLibreOfficeKitViewCallback(pCallable);
+    pEditView->RegisterViewShell(pViewShell);
 }
 
 Color OutlinerView::GetBackgroundColor()
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 818f503..032a4e0 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -35,8 +35,7 @@
 class EditEngine;
 class ImpEditEngine;
 class ImpEditView;
-class OutlinerSearchable;
-class OutlinerViewCallable;
+class OutlinerViewShell;
 class SvxSearchItem;
 class SvxFieldItem;
 namespace vcl { class Window; }
@@ -183,8 +182,8 @@ public:
     void            SetBackgroundColor( const Color& rColor );
     Color           GetBackgroundColor() const;
 
-    /// Register a LOK view callback.
-    void registerLibreOfficeKitViewCallback(OutlinerViewCallable *pCallable);
+    /// Informs this edit view about which view shell contains it.
+    void RegisterViewShell(OutlinerViewShell* pViewShell);
 
     void            SetControlWord( EVControlBits nWord );
     EVControlBits   GetControlWord() const;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 99b79fe..52383ac 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -72,8 +72,7 @@ class SvKeyValueIterator;
 class SvxForbiddenCharactersTable;
 class OverflowingText;
 class NonOverflowingText;
-class OutlinerSearchable;
-class OutlinerViewCallable;
+class OutlinerViewShell;
 
 namespace svl
 {
@@ -274,8 +273,8 @@ public:
     void        SetBackgroundColor( const Color& rColor );
     Color       GetBackgroundColor();
 
-    /// Registers a LOK view callback.
-    void registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable);
+    /// Informs this edit view about which view shell contains it.
+    void RegisterViewShell(OutlinerViewShell* pViewShell);
 
     SfxItemSet  GetAttribs();
 
@@ -378,13 +377,14 @@ public:
 };
 
 /// Interface class to not depend on SfxViewShell in editeng.
-class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewCallable
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell
 {
 public:
     virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0;
+    virtual sal_uInt32 GetViewShellId() const = 0;
 
 protected:
-    ~OutlinerViewCallable() throw () {}
+    ~OutlinerViewShell() throw () {}
 };
 
 // some thesaurus functionality to avoid code duplication in different projects...
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index dc12978..03b696c 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -141,7 +141,7 @@ template<class T> bool checkSfxViewShell(const SfxViewShell* pShell)
     return dynamic_cast<const T*>(pShell) != nullptr;
 }
 
-class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener, public OutlinerViewCallable
+class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener, public OutlinerViewShell
 {
 #ifdef INCLUDED_SFX2_VIEWSH_HXX
 friend class SfxViewFrame;
@@ -334,7 +334,8 @@ public:
     /// See lok::Document::getPart().
     virtual int getPart() const;
     virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
-    sal_uInt32 GetViewShellId() const;
+    /// See OutlinerViewShell::GetViewShellId().
+    sal_uInt32 GetViewShellId() const override;
 };
 
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index a901f65..2ea037f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1713,7 +1713,7 @@ void ScInputHandler::UpdateActiveView()
     {
         if (comphelper::LibreOfficeKit::isActive())
         {
-            pTableView->registerLibreOfficeKitViewCallback(pActiveViewSh);
+            pTableView->RegisterViewShell(pActiveViewSh);
         }
     }
 
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 47a844f..167d125 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -948,7 +948,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 
         if (comphelper::LibreOfficeKit::isActive())
         {
-            pEditView[eWhich]->registerLibreOfficeKitViewCallback(pViewShell);
+            pEditView[eWhich]->RegisterViewShell(pViewShell);
         }
     }
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 0731dfd..5c719e1 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -543,7 +543,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP
     // depend on the application owning this draw view to provide the view
     // shell.
     SfxViewShell* pSfxViewShell = pViewShell ? pViewShell : GetSfxViewShell();
-    pOutlView->registerLibreOfficeKitViewCallback(pSfxViewShell ? pSfxViewShell : SfxViewShell::Current());
+    pOutlView->RegisterViewShell(pSfxViewShell ? pSfxViewShell : SfxViewShell::Current());
 
     if (pText!=nullptr)
     {
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index e82c6d2..fb8031c 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -614,7 +614,7 @@ void SwSidebarWin::InitControls()
     if (comphelper::LibreOfficeKit::isActive())
     {
         // If there is a callback already registered, inform the new outliner view about it.
-        mpOutlinerView->registerLibreOfficeKitViewCallback(&mrView);
+        mpOutlinerView->RegisterViewShell(&mrView);
     }
 
     //create Scrollbars


More information about the Libreoffice-commits mailing list