editeng/source/editeng/editview.cxx   |   12 ++++++------
 editeng/source/editeng/impedit.cxx    |   24 +++++++++---------------
 editeng/source/editeng/impedit.hxx    |   10 ++++------
 editeng/source/outliner/outlvw.cxx    |    4 ++--
 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/source/uibase/docvw/SidebarWin.cxx |    2 +-
 11 files changed, 37 insertions(+), 45 deletions(-)

New commits:
commit 0762a119fc0a17b80dab1e49fb832a2214f85fdc
Author: Miklos Vajna <vmik...@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.
    
    Change-Id: I13708b0e4f58ee86643b913c7d21de022a685223
    Reviewed-on: https://gerrit.libreoffice.org/27788
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 38dac90..f00678f 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -401,9 +401,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 +412,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());
     }
 }
 
@@ -583,9 +583,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 a7b8b40..b3cf784 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 )
@@ -343,7 +337,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)
@@ -386,7 +380,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());
@@ -394,7 +388,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;
@@ -408,7 +402,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();
         }
@@ -986,7 +980,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());
@@ -1005,7 +999,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 9bd6c66..4dd3356 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -221,8 +221,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;
@@ -367,10 +367,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 fb18848..2665497 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1421,9 +1421,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 b8d16cef..3175cd0 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 f019696..495352b 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
 {
@@ -270,8 +269,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();
 
@@ -374,13 +373,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 f6e5777..62df5542 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 aab0500..62efa6c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1882,7 +1882,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 6e56363..aff29ae 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -974,7 +974,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 e68006e..39d68b2 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -542,7 +542,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 9b60e19..1e815ab 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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to