summaryrefslogtreecommitdiff
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
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>
-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
-rw-r--r--include/editeng/editview.hxx7
-rw-r--r--include/editeng/outliner.hxx12
-rw-r--r--include/sfx2/viewsh.hxx5
-rw-r--r--sc/source/ui/app/inputhdl.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx2
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx2
11 files changed, 37 insertions, 45 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()
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index b8d16cefd22d..3175cd0d10c8 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 f019696d43e0..495352b044e6 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 f6e5777bee1d..62df5542da7f 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 aab0500e9f89..62efa6ce93a9 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 6e56363712a7..aff29aec0e64 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 e68006e40ce4..39d68b2d62b8 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 9b60e19a8212..1e815abffa46 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