orca r4667 - in trunk: . src/orca/scripts/apps/soffice



Author: joanied
Date: Wed Apr  8 23:19:42 2009
New Revision: 4667
URL: http://svn.gnome.org/viewvc/orca?rev=4667&view=rev

Log:
* src/orca/scripts/apps/soffice/script.py:
  Fix for bug #578072 - Orca does not always present text attributes
  in braille in OOo documents.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/soffice/script.py

Modified: trunk/src/orca/scripts/apps/soffice/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/script.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/script.py	Wed Apr  8 23:19:42 2009
@@ -2137,7 +2137,26 @@
         """
         rv, start, end = \
             default.Script.getTextAttributes(self, acc, offset, get_defaults)
-        return rv, start, end - 1
+
+        # If there are no text attributes associated with the text at a
+        # given offset, we might get some seriously bogus offsets, in
+        # particular, an extremely large start offset and an extremely
+        # large, but negative end offset. As a result, any text attributes
+        # which are present on the line after the specified offset will
+        # not be indicated by braille.py's getAttributeMask. Therefore,
+        # we'll set the start offset to the character being examined,
+        # and the end offset to the next character.
+        #
+        start = min(start, offset)
+        if end < 0:
+            debug.println(debug.LEVEL_WARNING,
+                "soffice.script.py:getTextAttributes: detected a bogus " +
+                "end offset. Start offset: %s, end offset: %s" % (start, end))
+            end = offset + 1
+        else:
+            end -= 1
+
+        return rv, start, end
 
     def getDisplayedText(self, obj):
         """Returns the text being displayed for an object. Overridden here



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]