summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-02 11:43:39 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-02 11:13:48 +0000
commit0762a119fc0a17b80dab1e49fb832a2214f85fdc (patch)
tree707aa8239a80e37ba353f12282ba40365a8f8696 /editeng
parent9162c483bcc6288cc2a92503b6ec34d58496327b (diff)
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 <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx12
-rw-r--r--editeng/source/editeng/impedit.cxx24
-rw-r--r--editeng/source/editeng/impedit.hxx10
-rw-r--r--editeng/source/outliner/outlvw.cxx4
4 files changed, 21 insertions, 29 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 38dac90d197a..f00678fa091e 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 a7b8b409870a..b3cf78477bbc 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 9bd6c6673364..4dd335634195 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 fb18848de740..2665497641b5 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()