[orca] Work on bgo bug #574720



commit 4afaa26a3215400cf8176658c103b8976366b3b2
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon May 25 11:38:46 2009 -0400

    Work on bgo bug #574720
    
    Work on bug #574720 - Table Navigation Keys for OpenOffice Writer.
    This adds in support for Alt + the cursoring keys for navigation
    in OOo tables. Note that you will need to first enable structural
    by pressing Orca + Z. We plan to add in the customizations/settings
    available in the Gecko preferences, as well as for the announcement
    of dynamic row and column headers when navigating.
---
 ChangeLog                                        |   11 +++++
 src/orca/scripts/apps/soffice/script.py          |   51 ++++++++++++++++++++++
 src/orca/scripts/apps/soffice/script_settings.py |    6 +++
 3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6175fc9..774bf42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-25  Joanmarie Diggs <joanmarie diggs gmail com>
+
+        * src/orca/scripts/apps/soffice/script.py:
+          src/orca/scripts/apps/soffice/script_settings.py:
+          Work on bug #574720 - Table Navigation Keys for OpenOffice Writer.
+          This adds in support for Alt + the cursoring keys for navigation
+          in OOo tables. Note that you will need to first enable structural
+          by pressing Orca + Z. We plan to add in the customizations/settings
+          available in the Gecko preferences, as well as for the announcement
+          of dynamic row and column headers when navigating.
+
 2009-05-24  Joanmarie Diggs <joanmarie diggs gmail com>
 
         * src/orca/scripts/toolkits/Gecko/where_am_i.py:
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index fadfa4c..e4dc82e 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -51,6 +51,7 @@ import orca.settings as settings
 import orca.keybindings as keybindings
 
 from orca.orca_i18n import _ # for gettext support
+from orca.structural_navigation import StructuralNavigation
 
 from speech_generator import SpeechGenerator
 from braille_generator import BrailleGenerator
@@ -193,6 +194,15 @@ class Script(default.Script):
 
         return SpeechGenerator(self)
 
+    def getEnabledStructuralNavigationTypes(self):
+        """Returns a list of the structural navigation object types
+        enabled in this script.
+        """
+
+        enabledTypes = [StructuralNavigation.TABLE_CELL]
+
+        return enabledTypes
+
     def getWhereAmI(self):
         """Returns the "where am I" class for this script.
         """
@@ -207,6 +217,8 @@ class Script(default.Script):
         """
 
         default.Script.setupInputEventHandlers(self)
+        self.inputEventHandlers.update(\
+            self.structuralNavigation.inputEventHandlers)
 
         self.inputEventHandlers["speakInputLineHandler"] = \
             input_event.InputEventHandler(
@@ -298,6 +310,10 @@ class Script(default.Script):
                 self.inputEventHandlers["clearDynamicRowHeadersHandler"],
                 2))
 
+        bindings = self.structuralNavigation.keyBindings
+        for keyBinding in bindings.keyBindings:
+            keyBindings.add(keyBinding)
+
         return keyBindings
 
     def getAppPreferencesGUI(self):
@@ -362,6 +378,27 @@ class Script(default.Script):
         except:
             debug.printException(debug.LEVEL_WARNING)
 
+    def isStructuralNavigationCommand(self, inputEvent=None):
+        """Checks to see if the inputEvent was a structural navigation
+        command. This is necessary to prevent double-presentation of
+        items. [[[TODO - JD: Perhaps this should be moved to default.py]]]
+
+        Arguments:
+        - inputEvent: The input event to examine. If none is provided,
+          orca_state.lastInputEvent will be used.
+
+        Returns True if inputEvent is a structural navigation command
+        enabled in this script.
+        """
+
+        inputEvent = inputEvent or orca_state.lastInputEvent
+        if isinstance(inputEvent, input_event.KeyboardEvent):
+            if self.structuralNavigation.keyBindings.\
+                    getInputHandler(inputEvent):
+                return True
+
+        return False
+
     def isReadOnlyTextArea(self, obj):
         """Returns True if obj is a text entry area that is read only."""
         state = obj.getState()
@@ -1672,6 +1709,13 @@ class Script(default.Script):
         - event: the Event
         """
 
+        # If we've used structural navigation commands to get here, the
+        # presentation will be handled by the StructuralNavigation class.
+        # The subsequent event will result in redundant presentation.
+        #
+        if self.isStructuralNavigationCommand():
+            return
+
         # If this is a "focus:" event for the Calc Name combo box, catch
         # it here to reduce verbosity (see bug #364407).
         #
@@ -1990,6 +2034,13 @@ class Script(default.Script):
         - event: the Event
         """
 
+        # If we've used structural navigation commands to get here, the
+        # presentation will be handled by the StructuralNavigation class.
+        # The subsequent event will result in redundant presentation.
+        #
+        if self.isStructuralNavigationCommand():
+            return
+
         # If we are losing focus and we in:
         # 1/ a paragraph in an ooimpress slide presentation
         # 2/ a paragraph in an oowriter text document
diff --git a/src/orca/scripts/apps/soffice/script_settings.py b/src/orca/scripts/apps/soffice/script_settings.py
index 2340bed..cb6cab1 100644
--- a/src/orca/scripts/apps/soffice/script_settings.py
+++ b/src/orca/scripts/apps/soffice/script_settings.py
@@ -26,3 +26,9 @@ __license__   = "LGPL"
 # Whether we speak spread sheet cell coordinates as the user moves around.
 #
 speakCellCoordinates = True
+
+# Whether or not to use the structrual navigation commands (e.g. H
+# for heading, T for table, and so on). At the moment, only table
+# navigation commands will be enabled.
+#
+structuralNavigationEnabled = True



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