summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 16:08:55 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-30 09:23:41 +0200
commitfc3896a1c4bfc6b8f15bc4b6fc21dfdfd41805c2 (patch)
tree5bf65304bcc2d987553a5ff4cd54eb98916f8e50 /sd
parentc040ca84e5f6b888f36f4041cdb2bd173d45c716 (diff)
SdXImpressDocument: implement setTextSelection()
With this, it's possible to adjust an Impress shape text selection, using the selection handles already provided by editeng. Change-Id: I16fe3222c9e1289a0a1b5bea9469c88513994e75
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/ViewShell.hxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx26
-rw-r--r--sd/source/ui/view/viewshel.cxx13
4 files changed, 43 insertions, 0 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 710c72293f1a..767a113ae5ae 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -447,6 +447,8 @@ public:
void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
/// Same as MouseButtonUp(), but coordinates are in logic unit.
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
+ /// Allows adjusting the point or mark of the selection to a document coordinate.
+ void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
class Implementation;
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 64080e7ad992..7641e115e8ba 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -246,6 +246,8 @@ public:
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::postMouseEvent().
virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::setTextSelection().
+ virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE;
// XComponent
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index ac41220fd747..4d32ced20217 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2402,6 +2402,32 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount)
}
}
+void SdXImpressDocument::setTextSelection(int nType, int nX, int nY)
+{
+ SolarMutexGuard aGuard;
+
+ DrawViewShell* pViewShell = GetViewShell();
+ if (!pViewShell)
+ return;
+
+ Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY));
+ switch (nType)
+ {
+ case LOK_SETTEXTSELECTION_START:
+ pViewShell->SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
+ break;
+ case LOK_SETTEXTSELECTION_END:
+ pViewShell->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
+ break;
+ case LOK_SETTEXTSELECTION_RESET:
+ pViewShell->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 91efc8ff0c8f..5629fb0398e7 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -77,6 +77,7 @@
#include <editeng/numitem.hxx>
#include <editeng/eeitem.hxx>
+#include <editeng/editview.hxx>
#include <svl/poolitem.hxx>
#include <glob.hrc>
#include "AccessibleDocumentViewBase.hxx"
@@ -531,6 +532,18 @@ void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
mpActiveWindow->SetPointerPosPixel(aPoint);
}
+void ViewShell::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
+{
+ if (SdrView* pSdrView = GetView())
+ {
+ if (pSdrView->GetTextEditObject())
+ {
+ EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
+ rEditView.SetCursorLogicPosition(rPosition, bPoint, bClearMark);
+ }
+ }
+}
+
void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
if (rMEvt.IsLeaveWindow())