summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-01 15:51:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-01 20:35:47 +0100
commitc99e66cb5c75efb933694bfbb8edd7117c3d655f (patch)
tree6b40d24ba0dd8513364d8f02f052fcdffac49550 /sd
parentc26ef8b1f06906fb1acd3999b36f546bf2722461 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/Window.hxx4
-rw-r--r--sd/source/ui/view/sdwindow.cxx49
2 files changed, 29 insertions, 24 deletions
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;
}