summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-30 14:11:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-30 17:13:13 +0200
commit31342a1bda26f4e3dd29274dafd306fd0a9e7047 (patch)
treeff55c1961391d911b9e62a866b7cf38aa4ddf23a /editeng
parent9e129e8557370207f784cba0f40643044ead88be (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>
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 b8e3a8a6e75b..b0f229ad9cef 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 f6851b5f292f..55d1239acb60 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -304,10 +304,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();
}
}
@@ -832,12 +832,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
{
@@ -1411,11 +1411,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
@@ -2579,8 +2580,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();
@@ -2611,8 +2612,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 cacd0440f4e1..0efc9d552074 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -295,19 +295,19 @@ 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;
std::unique_ptr<LOKSpecialPositioning> mpLOKSpecialPositioning;
bool mbBroadcastLOKViewCursor:1;
bool mbSuppressLOKMessages:1;
- const EditViewCallbacks* getEditViewCallbacks() const
+ EditViewCallbacks* getEditViewCallbacks() const
{
return mpEditViewCallbacks;
}
void lokSelectionCallback(std::unique_ptr<tools::PolyPolygon> &pPolyPoly, bool bStartHandleVisible, bool bEndHandleVisible);
- void setEditViewCallbacks(const EditViewCallbacks* pEditViewCallbacks)
+ void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks)
{
mpEditViewCallbacks = pEditViewCallbacks;
}