[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - android/experimental editeng/source include/tools libreofficekit/source tools/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 16 07:35:58 PDT 2015


 android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java |    8 +++---
 editeng/source/editeng/impedit.cxx                                                |   13 +++++++++-
 include/tools/gen.hxx                                                             |    1 
 libreofficekit/source/gtk/lokdocview.cxx                                          |    8 +++---
 tools/source/generic/gen.cxx                                                      |    2 -
 5 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 72aeee3a21dbd7dd8ebe3f1d6ffb027d94d89f97
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 16 15:33:25 2015 +0100

    Rectangle::toString(): output position, then size
    
    This order seems to be less confusing.
    
    Change-Id: I95a7e3e2f6244915c820bb86e67745a777714e2d

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 22aeda3..d94c93a 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -97,10 +97,10 @@ public class InvalidationHandler implements Document.MessageCallback {
             return null;
         }
 
-        int width = Integer.decode(coordinates[0]);
-        int height = Integer.decode(coordinates[1]);
-        int x = Integer.decode(coordinates[2]);
-        int y = Integer.decode(coordinates[3]);
+        int x = Integer.decode(coordinates[0]);
+        int y = Integer.decode(coordinates[1]);
+        int width = Integer.decode(coordinates[2]);
+        int height = Integer.decode(coordinates[3]);
 
         float dpi = (float) LOKitShell.getDpi();
 
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index b17cb19..c5d898b 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -440,6 +440,7 @@ public:
     void                setY( long n ) { nBottom += n-nTop; nTop = n; }
     void                setWidth( long n ) { nRight = nLeft + n; }
     void                setHeight( long n ) { nBottom = nTop + n; }
+    /// Returns the string representation of the rectangle, format is "x, y, width, height".
     rtl::OString        toString() const;
 
 private:
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 1f542b5..03fab48 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -741,19 +741,19 @@ static GdkRectangle lcl_payloadToRectangle(const char* pPayload)
     gchar** ppCoordinate = ppCoordinates;
     if (!*ppCoordinate)
         return aRet;
-    aRet.width = atoi(*ppCoordinate);
+    aRet.x = atoi(*ppCoordinate);
     ++ppCoordinate;
     if (!*ppCoordinate)
         return aRet;
-    aRet.height = atoi(*ppCoordinate);
+    aRet.y = atoi(*ppCoordinate);
     ++ppCoordinate;
     if (!*ppCoordinate)
         return aRet;
-    aRet.x = atoi(*ppCoordinate);
+    aRet.width = atoi(*ppCoordinate);
     ++ppCoordinate;
     if (!*ppCoordinate)
         return aRet;
-    aRet.y = atoi(*ppCoordinate);
+    aRet.height = atoi(*ppCoordinate);
     g_strfreev(ppCoordinates);
     return aRet;
 }
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index e2a61c5..925d4d6 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -198,7 +198,7 @@ SvStream& WriteRectangle( SvStream& rOStream, const Rectangle& rRect )
 OString Rectangle::toString() const
 {
     std::stringstream ss;
-    ss << getWidth() << ", " << getHeight() << ", " << getX() << ", " << getY();
+    ss << getX() << ", " << getY() << ", " << getWidth() << ", " << getHeight();
     return ss.str().c_str();
 }
 
commit a7d2e4af1f3e9f039f6688904d170a996edb5788
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 16 12:18:18 2015 +0100

    ImpEditView::DrawSelection: emit TEXT_SELECTION_START/END callbacks
    
    Change-Id: I5ea37875aa36cc30847643721b369bbe491101e8

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index ed456a1..5f102f5 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -326,8 +326,19 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
         {
             std::vector<Rectangle> aRectangles;
             pRegion->GetRegionRectangles(aRectangles);
-            std::stringstream ss;
 
+            if (!aRectangles.empty())
+            {
+                Rectangle& rStart = aRectangles.front();
+                Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom());
+                libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
+
+                Rectangle& rEnd = aRectangles.back();
+                Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom());
+                libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
+            }
+
+            std::stringstream ss;
             for (size_t i = 0; i < aRectangles.size(); ++i)
             {
                 const Rectangle& rRectangle = aRectangles[i];


More information about the Libreoffice-commits mailing list