[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - sd/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 23 08:54:33 PDT 2015


 sd/source/ui/inc/ViewShell.hxx   |    2 ++
 sd/source/ui/inc/unomodel.hxx    |    2 ++
 sd/source/ui/unoidl/unomodel.cxx |   26 ++++++++++++++++++++++++++
 sd/source/ui/view/viewshel.cxx   |   13 +++++++++++++
 4 files changed, 43 insertions(+)

New commits:
commit a26b23e9e6f33766d169519d52da98826e179cb0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 23 16:08:55 2015 +0100

    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

diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 710c722..767a113 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 64080e7..7641e11 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 ac41220..4d32ced 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 ce01af2..9bbf61d 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())


More information about the Libreoffice-commits mailing list