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

Jan Holesovsky kendy at collabora.com
Thu Apr 2 01:03:31 PDT 2015


 sc/source/ui/unoobj/docuno.cxx |   31 +++++++++++++++++++++++++++----
 svx/source/svdraw/svdview.cxx  |   26 ++++++++++++++++----------
 2 files changed, 43 insertions(+), 14 deletions(-)

New commits:
commit 9d8f44d2158fe4ce36145f74597ac18321059621
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Apr 2 10:00:39 2015 +0200

    sc tiled editing: Moving handles in text in drawing shapes in Calc.
    
    Now it is possible to move the cursor or adjust the selection in text in
    drawing shapes in Calc too.
    
    Change-Id: I9ed5b2efa426dda669ec32a2b6aa05d95481ef3d

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1d0684f..06a474f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -21,6 +21,7 @@
 
 #include "scitems.hxx"
 #include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
 #include <svx/fmdpage.hxx>
 #include <svx/fmview.hxx>
 #include <svx/svditer.hxx>
@@ -569,10 +570,11 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
     ScViewData* pViewData = ScDocShell::GetViewData();
     ScTabViewShell* pViewShell = pViewData->GetViewShell();
     ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
+    ScDrawView* pDrawView = pViewData->GetScDrawView();
 
     if (pInputHandler && pInputHandler->IsInputMode())
     {
-        // forwarding to editeng - we are editing a cell content
+        // forwarding to editeng - we are editing the cell content
         EditView* pTableView = pInputHandler->GetTableView();
         assert(pTableView);
 
@@ -593,12 +595,33 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
                 break;
         }
     }
+    else if (pDrawView && pDrawView->IsTextEdit())
+    {
+        // forwarding to editeng - we are editing the text in shape
+        OutlinerView* pOutlinerView = pDrawView->GetTextEditOutlinerView();
+        EditView& rEditView = pOutlinerView->GetEditView();
+
+        Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY));
+        switch (nType)
+        {
+            case LOK_SETTEXTSELECTION_START:
+                rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
+                break;
+            case LOK_SETTEXTSELECTION_END:
+                rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
+                break;
+            case LOK_SETTEXTSELECTION_RESET:
+                rEditView.SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
+                break;
+            default:
+                assert(false);
+                break;
+        }
+    }
     else
     {
-        // There seems to be no clear way of getting the grid window for this
-        // particular document, hence we need to hope we get the right window.
+        // just updating the cell selection
         ScGridWindow* pGridWindow = pViewData->GetActiveWin();
-
         if (!pGridWindow)
             return;
 
commit 18f798e4244d7289a4b2031d337f68fa2d5a1668
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Apr 2 08:26:42 2015 +0200

    Anz -> Count, and some reformatting.
    
    Change-Id: I6d1b34f12e505a6119394a60f6ce6352c35a7fa0

diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index dbfab5a..89589ba 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1246,18 +1246,24 @@ OUString SdrView::GetStatusText()
         // A little imperfection:
         // At the end of a line of any multi-line paragraph, we display the
         // position of the next line of the same paragraph, if there is one.
-        sal_uInt16 nParaLine=0;
-        sal_uIntPtr nParaLineAnz=pTextEditOutliner->GetLineCount(aSel.nEndPara);
-        bool bBrk=false;
-        while (!bBrk) {
-            sal_uInt16 nLen=pTextEditOutliner->GetLineLen(aSel.nEndPara,nParaLine);
-            bool bLastLine=(nParaLine==nParaLineAnz-1);
-            if (nCol>nLen || (!bLastLine && nCol==nLen)) {
-                nCol-=nLen;
+        sal_uInt16 nParaLine = 0;
+        sal_uIntPtr nParaLineCount = pTextEditOutliner->GetLineCount(aSel.nEndPara);
+        bool bBrk = false;
+        while (!bBrk)
+        {
+            sal_uInt16 nLen = pTextEditOutliner->GetLineLen(aSel.nEndPara, nParaLine);
+            bool bLastLine = (nParaLine == nParaLineCount - 1);
+            if (nCol>nLen || (!bLastLine && nCol == nLen))
+            {
+                nCol -= nLen;
                 nLin++;
                 nParaLine++;
-            } else bBrk=true;
-            if (nLen==0) bBrk=true; // to be sure
+            }
+            else
+                bBrk = true;
+
+            if (nLen == 0)
+                bBrk = true; // to be sure
         }
 
         aStr = aStr.replaceFirst("%1", OUString::number(nPar + 1));


More information about the Libreoffice-commits mailing list