[orca] Fix some issues with presentation of dynamic headers in LibreOffice



commit dd9f2d945f82af56517b1549a54d487d214d7670
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Feb 1 15:53:50 2014 -0500

    Fix some issues with presentation of dynamic headers in LibreOffice

 src/orca/script_utilities.py                      |    3 +
 src/orca/scripts/apps/soffice/formatting.py       |    3 +-
 src/orca/scripts/apps/soffice/script_utilities.py |   10 ++++-
 src/orca/scripts/apps/soffice/speech_generator.py |   47 +++++++--------------
 4 files changed, 30 insertions(+), 33 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c185d2a..be6d35c 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -602,6 +602,9 @@ class Utilities:
                         break
 
         if not displayedText:
+            # TODO - JD: This should probably get nuked. But all sorts of
+            # existing code might be relying upon this bogus hack. So it
+            # will need thorough testing when removed.
             try:
                 displayedText = obj.name
             except (LookupError, RuntimeError):
diff --git a/src/orca/scripts/apps/soffice/formatting.py b/src/orca/scripts/apps/soffice/formatting.py
index 8dd8625..6f0662f 100644
--- a/src/orca/scripts/apps/soffice/formatting.py
+++ b/src/orca/scripts/apps/soffice/formatting.py
@@ -69,7 +69,8 @@ formatting = {
             'detailedWhereAmI': 'parentRoleName + columnHeader + rowHeader + roleName + cellCheckedState + 
(realActiveDescendantDisplayedText or imageDescription + image) + columnAndRow + tableCellRow + 
expandableState + nodeLevel'
             },
         'REAL_ROLE_TABLE_CELL': {
-            'focused': 'realActiveDescendantDisplayedText',
+            'focused': 'newRowHeader + newColumnHeader + realActiveDescendantDisplayedText',
+            'unfocused': 'newRowHeader + newColumnHeader + realActiveDescendantDisplayedText',
         },
         'ROLE_SPREADSHEET_CELL': {
             # We treat spreadsheet cells differently from other table cells in
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index df67d4b..19ff82a 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -79,7 +79,15 @@ class Utilities(script_utilities.Utilities):
             if text.strip():
                 return text
 
-        return script_utilities.Utilities.displayedText(self, obj)
+        text = script_utilities.Utilities.displayedText(self, obj)
+
+        # TODO - JD: This is needed because the default behavior is to fall
+        # back on the name, which is bogus. Once that has been fixed, this
+        # hack can go.
+        if role == pyatspi.ROLE_TABLE_CELL and text == obj.name:
+            return ""
+
+        return text
 
     def isReadOnlyTextArea(self, obj):
         """Returns True if obj is a text entry area that is read only."""
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py 
b/src/orca/scripts/apps/soffice/speech_generator.py
index b6f55d3..dbe7dd7 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -334,27 +334,28 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
         return []
 
-    def _generateSpreadSheetCell(self, obj, **args):
-        result = []
-        isBasicWhereAmI = args.get('formatType') == 'basicWhereAmI'
-        speakCoordinates = script_settings.speakSpreadsheetCoordinates
+    def _generateRealTableCell(self, obj, **args):
+        """Get the speech for a table cell. If this isn't inside a
+        spread sheet, just return the utterances returned by the default
+        table cell speech handler.
 
-        try:
-            objectText = self._script.utilities.substring(obj, 0, -1)
-        except:
-            objectText = ''
-        if not objectText and (isBasicWhereAmI or not speakCoordinates):
-            objectText = messages.BLANK
+        Arguments:
+        - obj: the table cell
+
+        Returns a list of utterances to be spoken for the object.
+        """
 
-        if objectText:
-            result.append(objectText)
+        result = speech_generator.SpeechGenerator._generateRealTableCell(
+            self, obj, **args)
+
+        if not self._script.utilities.isSpreadSheetCell(obj):
+            return result
 
+        isBasicWhereAmI = args.get('formatType') == 'basicWhereAmI'
+        speakCoordinates = script_settings.speakSpreadsheetCoordinates
         if speakCoordinates and not isBasicWhereAmI:
             result.append(self._script.utilities.spreadSheetCellName(obj))
 
-        if result:
-            result.extend(self.voice(speech_generator.DEFAULT))
-
         if _settingsManager.getSetting('readTableCellRow'):
             row, col, table = self._script.utilities.getRowColumnAndTable(obj)
             lastRow = self._script.pointOfReference.get("lastRow")
@@ -373,22 +374,6 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
         return result
 
-    def _generateRealTableCell(self, obj, **args):
-        """Get the speech for a table cell. If this isn't inside a
-        spread sheet, just return the utterances returned by the default
-        table cell speech handler.
-
-        Arguments:
-        - obj: the table cell
-
-        Returns a list of utterances to be spoken for the object.
-        """
-        if self._script.utilities.isSpreadSheetCell(obj):
-            return self._generateSpreadSheetCell(obj, **args)
-
-        return speech_generator.SpeechGenerator._generateRealTableCell(
-            self, obj, **args)
-
     def _generateTableCellRow(self, obj, **args):
         """Get the speech for a table cell row if the user wants to hear
         the full row and if the row has actually changed."""


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