Index: StarOffice.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/scripts/StarOffice.py,v
retrieving revision 1.61
diff -u -r1.61 StarOffice.py
--- StarOffice.py	23 Oct 2006 19:31:01 -0000	1.61
+++ StarOffice.py	26 Oct 2006 23:06:37 -0000
@@ -153,6 +153,28 @@
                  rolenames.ROLE_APPLICATION]
     return util.isDesiredFocusedItem(obj, rolesList)
 
+def getTooLongMessage(obj, objectText):
+    """If there is text in this spread sheet cell, compare the size of 
+    the text within the table cell with the size of the actual table 
+    cell and report back to the user if it is larger.
+
+    Arguments:
+    - obj: the object to check.
+    - objectText: the text string in that spread sheet cell.
+
+    Returns an indication of how many characters are greater than the size 
+    of the spread sheet cell, or a zero length message if the text fits.
+    """
+
+    tooLong = ""
+    for i in range(0, len(objectText)):
+        [x, y, width, height] = obj.text.getRangeExtents(0, i+1, 0)
+        if width > obj.extents.width:
+            tooLong = "%d characters too long" % (len(objectText)-i-1)
+            break
+
+    return tooLong
+
 class BrailleGenerator(braillegenerator.BrailleGenerator):
     """Overrides _getBrailleRegionsForTableCellRow so that , when we are
     in a spread sheet, we can braille the dynamic row and column headers
@@ -282,6 +304,7 @@
         """
 
         global inputLineForCell, isSpreadSheetCell, locateInputLine
+        global getTooLongMessage
 
         if isSpreadSheetCell(obj):
             if inputLineForCell == None:
@@ -299,8 +322,12 @@
             #
             if obj.text:
                 objectText = self._script.getText(obj, 0, -1)
+                objectText = objectText.decode("UTF-8")
                 if objectText and len(objectText) != 0:
                     regions.append(braille.Region(" " + obj.name))
+                tooLong = getTooLongMessage(obj, objectText)
+                if len(tooLong) != 0:
+                    regions.append(braille.Region(" " + tooLong))
 
             return [regions, componentRegion]
 
@@ -423,6 +450,7 @@
         """
 
         global inputLineForCell, isSpreadSheetCell, locateInputLine
+        global getTooLongMessage
 
         if isSpreadSheetCell(obj):
             utterances = []
@@ -433,6 +461,10 @@
             if obj.text:
                 objectText = self._script.getText(obj, 0, -1)
                 utterances.append(objectText)
+                objectText = objectText.decode("UTF-8")
+                tooLong = getTooLongMessage(obj, objectText)
+                if len(tooLong) != 0:
+                    utterances.append(tooLong)
 
             nameList = obj.name.split()
             utterances.append(nameList[1])
