sd/source/ui/inc/Window.hxx | 4 +++ sd/source/ui/view/sdwindow.cxx | 49 ++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 24 deletions(-)
New commits: commit c99e66cb5c75efb933694bfbb8edd7117c3d655f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Nov 1 15:51:22 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Nov 1 20:35:47 2020 +0100 tdf#137620 support surrounding text for impress outline view Change-Id: I7136ec4237fe41bd7e795594d66413fc7d8c311c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105146 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index cbbe7311c086..979983e492ff 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -25,6 +25,8 @@ #include <vcl/window.hxx> #include <vcl/transfer.hxx> +class OutlinerView; + namespace sd { class ViewShell; @@ -151,6 +153,8 @@ public: void SetUseDropScroll (bool bUseDropScroll); void DropScroll (const Point& rMousePos); virtual void KeyInput(const KeyEvent& rKEvt) override; +private: + OutlinerView* GetOutlinerView() const; protected: Point maWinPos; Point maViewOrigin; diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index eb1d17fca32a..7ab817969516 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -36,6 +36,7 @@ #include <View.hxx> #include <FrameView.hxx> #include <OutlineViewShell.hxx> +#include <OutlineView.hxx> #include <drawdoc.hxx> #include <WindowUpdater.hxx> #include <ViewShellBase.hxx> @@ -973,43 +974,43 @@ css::uno::Reference<css::accessibility::XAccessible> } } -OUString Window::GetSurroundingText() const +OutlinerView* Window::GetOutlinerView() const { - if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) - return OUString(); - else if ( mpViewShell->GetView()->IsTextEdit() ) + OutlinerView *pOLV = nullptr; + sd::View* pView = mpViewShell->GetView(); + if (mpViewShell->GetShellType() == ViewShell::ST_OUTLINE) { - if (OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView()) - return pOLV->GetEditView().GetSurroundingText(); + if (OutlineView* pOView = dynamic_cast<OutlineView*>(pView)) + pOLV = pOView->GetViewByWindow(this); } + else if (pView->IsTextEdit()) + { + pOLV = pView->GetTextEditOutlinerView(); + } + return pOLV; +} + +OUString Window::GetSurroundingText() const +{ + OutlinerView *pOLV = GetOutlinerView(); + if (pOLV) + return pOLV->GetEditView().GetSurroundingText(); return OUString(); } Selection Window::GetSurroundingTextSelection() const { - if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) - { - return Selection( 0, 0 ); - } - else if ( mpViewShell->GetView()->IsTextEdit() ) - { - if (OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView()) - return pOLV->GetEditView().GetSurroundingTextSelection(); - } + OutlinerView *pOLV = GetOutlinerView(); + if (pOLV) + return pOLV->GetEditView().GetSurroundingTextSelection(); return Selection( 0, 0 ); } bool Window::DeleteSurroundingText(const Selection& rSelection) { - if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE ) - { - return false; - } - else if ( mpViewShell->GetView()->IsTextEdit() ) - { - if (OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView()) - return pOLV->GetEditView().DeleteSurroundingText(rSelection); - } + OutlinerView *pOLV = GetOutlinerView(); + if (pOLV) + return pOLV->GetEditView().DeleteSurroundingText(rSelection); return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits