summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-10 16:42:00 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-12 22:06:35 -0400
commit6bda991914d6e0d08db1ec7f8b1fe80701a8b583 (patch)
tree8d530348ca4cae8a7169e069ef8697e6c02ad683 /editeng
parentebd3cb79940bb08fa3aa1578859e3d6a550fae7e (diff)
editeng: implement per-view LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
Given that the per-view callback is in SfxViewShell, and editeng doesn't depend on sfx2, add an interface class in editeng to invert the dependency. With this, gtktiledviewer no longer crashes when starting editeng text edit with per-view callbacks. Change-Id: I783cdc646b890a6b597000f1d88428c8042417cf Reviewed-on: https://gerrit.libreoffice.org/26169 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 89bbd0ecbf18a1e9030e49443fa15d068b19f767)
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx5
-rw-r--r--editeng/source/editeng/impedit.cxx19
-rw-r--r--editeng/source/editeng/impedit.hxx9
-rw-r--r--editeng/source/outliner/outlvw.cxx5
4 files changed, 36 insertions, 2 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index f3aff8e17925..57c4c215040c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -588,6 +588,11 @@ void EditView::registerLibreOfficeKitCallback(OutlinerSearchable *pSearchable)
pImpEditView->registerLibreOfficeKitCallback(pSearchable);
}
+void EditView::registerLibreOfficeKitViewCallback(OutlinerViewCallable *pCallable)
+{
+ pImpEditView->registerLibreOfficeKitViewCallback(pCallable);
+}
+
void EditView::SetControlWord( EVControlBits nWord )
{
pImpEditView->nControl = nWord;
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 6703b9e758fe..f6e3ba9f5f4e 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -80,6 +80,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo
pPointer = nullptr;
pBackgroundColor = nullptr;
mpLibreOfficeKitSearchable = nullptr;
+ mpLibreOfficeKitViewCallable = nullptr;
nScrollDiffX = 0;
nExtraCursorFlags = 0;
nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
@@ -119,6 +120,8 @@ void ImpEditView::SetBackgroundColor( const Color& rColor )
void ImpEditView::registerLibreOfficeKitCallback(OutlinerSearchable* pSearchable)
{
+ // Per-view callbacks should always invoke ImpEditView::registerLibreOfficeKitViewCallback().
+ assert(!comphelper::LibreOfficeKit::isViewCallback());
mpLibreOfficeKitSearchable = pSearchable;
}
@@ -128,6 +131,17 @@ void ImpEditView::libreOfficeKitCallback(int nType, const char* pPayload) const
mpLibreOfficeKitSearchable->libreOfficeKitCallback(nType, pPayload);
}
+void ImpEditView::registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable)
+{
+ mpLibreOfficeKitViewCallable = pCallable;
+}
+
+void ImpEditView::libreOfficeKitViewCallback(int nType, const char* pPayload) const
+{
+ if (mpLibreOfficeKitViewCallable)
+ mpLibreOfficeKitViewCallable->libreOfficeKitViewCallback(nType, pPayload);
+}
+
void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
{
// set state before notification
@@ -1001,7 +1015,10 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
aRect.setWidth(0);
OString sRect = aRect.toString();
- libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
+ if (comphelper::LibreOfficeKit::isViewCallback())
+ libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
+ else
+ libreOfficeKitCallback(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 d4f9f2b47df6..59acc1a0e814 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -222,7 +222,10 @@ private:
EditView* pEditView;
vcl::Cursor* pCursor;
Color* pBackgroundColor;
+ /// Model callback.
OutlinerSearchable* mpLibreOfficeKitSearchable;
+ /// Per-view callback.
+ OutlinerViewCallable* mpLibreOfficeKitViewCallable;
EditEngine* pEditEngine;
VclPtr<vcl::Window> pOutWin;
Pointer* pPointer;
@@ -369,8 +372,12 @@ public:
/// @see vcl::ITiledRenderable::registerCallback().
void registerLibreOfficeKitCallback(OutlinerSearchable* pSearchable);
- /// Invokes the registered callback, if there are any.
+ /// Invokes the registered model callback, if there are any.
void libreOfficeKitCallback(int nType, const char* pPayload) const;
+ /// @see vcl::ITiledRenderable::registerCallback().
+ void registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable);
+ /// Invokes the registered view callback, if there are any.
+ void libreOfficeKitViewCallback(int nType, const char* pPayload) const;
bool IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong );
OUString SpellIgnoreWord();
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 9b37632c0f98..c6bc75483200 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1432,6 +1432,11 @@ void OutlinerView::registerLibreOfficeKitCallback(OutlinerSearchable* pSearchabl
pEditView->registerLibreOfficeKitCallback(pSearchable);
}
+void OutlinerView::registerLibreOfficeKitViewCallback(OutlinerViewCallable* pCallable)
+{
+ pEditView->registerLibreOfficeKitViewCallback(pCallable);
+}
+
Color OutlinerView::GetBackgroundColor()
{
return pEditView->GetBackgroundColor();