summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-30 14:11:54 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-10-06 09:50:51 +0200
commit9987804b732b679e0ad969517e8bd49cf1061fa9 (patch)
treeb52416e1a341c75b98f95d409f5fd842df9d0f84 /editeng
parentc426d851fd7a66f826d08691d19ff288a636a445 (diff)
tdf#134566 accept input engine commands in editview in custom widget
for the generic case first Change-Id: I10bd707900b54c70c9bda79d5d09532cc159779e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103692 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 31342a1bda26f4e3dd29274dafd306fd0a9e7047) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103720 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx6
-rw-r--r--editeng/source/editeng/impedit.cxx27
-rw-r--r--editeng/source/editeng/impedit.hxx6
3 files changed, 20 insertions, 19 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 3ea3ac45f5c1..7c6698f7c2c8 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -169,12 +169,12 @@ EditView::~EditView()
{
}
-void EditView::setEditViewCallbacks(const EditViewCallbacks* pEditViewCallbacks)
+void EditView::setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks)
{
pImpEditView->setEditViewCallbacks(pEditViewCallbacks);
}
-const EditViewCallbacks* EditView::getEditViewCallbacks() const
+EditViewCallbacks* EditView::getEditViewCallbacks() const
{
return pImpEditView->getEditViewCallbacks();
}
@@ -207,7 +207,7 @@ tools::Rectangle EditView::GetInvalidateRect() const
void EditView::InvalidateWindow(const tools::Rectangle& rClipRect)
{
- if (const EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks())
+ if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks())
{
// do not invalidate and trigger a global repaint, but forward
// the need for change to the applied EditViewCallback, can e.g.
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index e087305effd1..3d138af94ef3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -190,10 +190,10 @@ static void lcl_translateTwips(vcl::Window const & rParent, vcl::Window& rChild)
// change/update the Selection visualization for enhanced mechanisms
void ImpEditView::SelectionChanged()
{
- if (getEditViewCallbacks())
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
{
// use callback to tell about change in selection visualisation
- getEditViewCallbacks()->EditViewSelectionChange();
+ pCallbacks->EditViewSelectionChange();
}
}
@@ -701,12 +701,12 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& rRect )
void ImpEditView::InvalidateAtWindow(const tools::Rectangle& rRect)
{
- if (getEditViewCallbacks())
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
{
// do not invalidate and trigger a global repaint, but forward
// the need for change to the applied EditViewCallback, can e.g.
// be used to visualize the active edit text in an OverlayObject
- getEditViewCallbacks()->EditViewInvalidate(rRect);
+ pCallbacks->EditViewInvalidate(rRect);
}
else
{
@@ -1247,11 +1247,12 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
{
SvxFont aFont;
pEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
- if (vcl::Window* pWindow = GetWindow())
- {
- InputContextFlags const nContextFlags = InputContextFlags::Text | InputContextFlags::ExtText;
- pWindow->SetInputContext( InputContext( aFont, nContextFlags ) );
- }
+
+ InputContext aInputContext(aFont, InputContextFlags::Text | InputContextFlags::ExtText);
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ pCallbacks->EditViewInputContext(aInputContext);
+ else if (auto xWindow = GetWindow())
+ xWindow->SetInputContext(aInputContext);
}
}
else
@@ -2416,8 +2417,8 @@ void ImpEditView::AddDragAndDropListeners()
return;
css::uno::Reference<css::datatransfer::dnd::XDropTarget> xDropTarget;
- if (getEditViewCallbacks())
- xDropTarget = getEditViewCallbacks()->GetDropTarget();
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ xDropTarget = pCallbacks->GetDropTarget();
else if (GetWindow())
xDropTarget = GetWindow()->GetDropTarget();
@@ -2448,8 +2449,8 @@ void ImpEditView::RemoveDragAndDropListeners()
return;
css::uno::Reference<css::datatransfer::dnd::XDropTarget> xDropTarget;
- if (getEditViewCallbacks())
- xDropTarget = getEditViewCallbacks()->GetDropTarget();
+ if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+ xDropTarget = pCallbacks->GetDropTarget();
else if (GetWindow())
xDropTarget = GetWindow()->GetDropTarget();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index bf6196953ea6..0ecf4c47eb36 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -261,15 +261,15 @@ private:
// incarnation has to handle that. Used e.g. to represent the edited text
// in Draw/Impress in an OverlayObject which avoids evtl. expensive full
// repaints of the EditView(s)
- const EditViewCallbacks* mpEditViewCallbacks;
+ EditViewCallbacks* mpEditViewCallbacks;
bool mbBroadcastLOKViewCursor;
- const EditViewCallbacks* getEditViewCallbacks() const
+ EditViewCallbacks* getEditViewCallbacks() const
{
return mpEditViewCallbacks;
}
- void setEditViewCallbacks(const EditViewCallbacks* pEditViewCallbacks)
+ void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks)
{
mpEditViewCallbacks = pEditViewCallbacks;
}