diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-25 15:27:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-27 17:00:59 +0100 |
commit | b9405fbc4e19901c78d136895c5ab0437d8450ac (patch) | |
tree | f42d180c9f6b4450959ff94d6f40a2ae881d8984 /sd | |
parent | 23c30c073495201acb82e6e2e83bb0840f25acce (diff) |
Resolves: tdf#137620 add DeleteSurroundingText at vcl::Window level
a) give it a default implementation based on the current one
b) re-use code introduced for WeldEditView::DeleteSurroundingText
for the EditView containing vcl::Window in impress/draw and
various similar Annotation windows
Change-Id: I55547c70e90ee394795b5545450cf8131538fad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104781
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/annotations/annotationwindow.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationwindow.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/Window.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/sdwindow.cxx | 17 |
4 files changed, 27 insertions, 0 deletions
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 5bafcbf1e6d5..b9297961f82a 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -228,6 +228,13 @@ Selection AnnotationTextWindow::GetSurroundingTextSelection() const return Selection( 0, 0 ); } +bool AnnotationTextWindow::DeleteSurroundingText(const Selection& rSelection) +{ + if( mpOutlinerView ) + return mpOutlinerView->DeleteSurroundingText(rSelection); + return false; +} + /************** AnnotationWindow***********************************++*/ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent ) diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx index c57b4bdfce93..3d84202023f2 100644 --- a/sd/source/ui/annotations/annotationwindow.hxx +++ b/sd/source/ui/annotations/annotationwindow.hxx @@ -64,6 +64,7 @@ public: virtual OUString GetSurroundingText() const override; virtual Selection GetSurroundingTextSelection() const override; + virtual bool DeleteSurroundingText(const Selection& rSelection) override; }; class AnnotationWindow : public FloatingWindow diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index a33b009e1b1c..cbbe7311c086 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -191,6 +191,8 @@ protected: OUString GetSurroundingText() const override; Selection GetSurroundingTextSelection() const override; + bool DeleteSurroundingText(const Selection& rSelection) override; + /// @see Window::LogicInvalidate(). void LogicInvalidate(const ::tools::Rectangle* pRectangle) override; /// Same as MouseButtonDown(), but coordinates are in logic unit. diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index bb71ade2f70f..1f99312b51ad 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -1003,6 +1003,23 @@ Selection Window::GetSurroundingTextSelection() const } } +bool Window::DeleteSurroundingText(const Selection& rSelection) +{ + if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) + { + return false; + } + else if ( mpViewShell->GetView()->IsTextEdit() ) + { + OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView(); + return pOLV->GetEditView().DeleteSurroundingText(rSelection); + } + else + { + return false; + } +} + void Window::LogicInvalidate(const ::tools::Rectangle* pRectangle) { DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell); |