orca.scripts.StarOffice (version 2068, $Date$)
index
/usr/lib/python2.5/site-packages/orca/scripts/StarOffice.py

Custom script for StarOffice and OpenOffice.

 
Modules
       
orca.atspi
orca.braille
orca.braillegenerator
orca.chnames
orca.debug
orca.default
orca.input_event
orca.keybindings
orca.orca
orca.orca_state
orca.rolenames
orca.settings
orca.speech
orca.speechgenerator
orca.util

 
Classes
       
orca.braillegenerator.BrailleGenerator
BrailleGenerator
orca.default.Script(orca.script.Script)
Script
orca.speechgenerator.SpeechGenerator
SpeechGenerator

 
class BrailleGenerator(orca.braillegenerator.BrailleGenerator)
    Overrides _getBrailleRegionsForTableCellRow so that , when we are
in a spread sheet, we can braille the dynamic row and column headers
(assuming they are set).
Overrides _getBrailleRegionsForTableCell so that, when we are in
a spread sheet, we can braille the location of the table cell as well
as the contents.
 
  Methods defined here:
__init__(self, script)

Methods inherited from orca.braillegenerator.BrailleGenerator:
getBrailleContext(self, obj)
Get the braille regions that describe the context (i.e.,
names/roles of the container hierarchy) of the object.
 
Arguments:
- obj: the object
 
Returns a list of Regions to display.
getBrailleRegions(self, obj, groupChildren=True)
Get the braille regions for an Accessible object.  This
will look first to the specific braille generators and then to
the default braille generator.  This method is the primary
method that external callers of this class should use.
 
Arguments:
- obj: the object
- groupChildren: if True, children of an object should be displayed
                 together with their parent, where each child is
                 separated by _ and the selected child is the Region
                 that should get focus.  The default here is True,
                 but this also is used in conjunction with
                 settings.enableBrailleGrouping.
 
Returns a list where the first element is a list of Regions to
display and the second element is the Region which should get
focus.

 
class Script(orca.default.Script)
    
Method resolution order:
Script
orca.default.Script
orca.script.Script

Methods defined here:
__init__(self, app)
Creates a new script for the given application.
 
Arguments:
- app: the application to create a script for.
checkForTableBoundry(self, oldFocus, newFocus)
Check to see if we've entered or left a table.
When entering a table, announce the table dimensions.
When leaving a table, announce that the table has been exited.
 
Arguments:
- oldFocus: Accessible that is the old locus of focus
- newFocus: Accessible that is the new locus of focus
columnConvert(self, column)
Convert a spreadsheet column into it's column label
 
Arguments:
- column: the column number to convert.
 
Returns a string representing the spread sheet column.
endOfLink(self, obj, word, startOffset, endOffset)
Return an indication of whether the given word contains the
   end of a hypertext link.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
- word: the word to check
- startOffset: the start offset for this word
- endOffset: the end offset for this word
 
Returns True if this word contains the end of a hypertext link.
getBrailleGenerator(self)
Returns the braille generator for this script.
getKeyBindings(self)
Defines the key bindings for this script. Setup the default
key bindings, then add one in for reading the input line.
 
Returns an instance of keybindings.KeyBindings.
getSpeechGenerator(self)
Returns the speech generator for this script.
getTableColumn(self, cell)
Get the column number in the table that this table cell is on.
 
Arguments:
- cell: the table cell to get the column number for.
 
Return the column number that this table cell is on, or None if
this isn't a table cell.
getTableRow(self, cell)
Get the row number in the table that this table cell is on.
 
Arguments:
- cell: the table cell to get the row number for.
 
Return the row number that this table cell is on, or None if
this isn't a table cell.
getText(self, obj, startOffset, endOffset)
Returns the substring of the given object's text specialization.
 
NOTE: This is here to handle the problematic implementation of
getText by OpenOffice.  See the bug discussion at:
 
   http://bugzilla.gnome.org/show_bug.cgi?id=356425)
 
Once the OpenOffice issue has been resolved, this method probably
should be removed.
 
Arguments:
- obj: an accessible supporting the accessible text specialization
- startOffset: the starting character position
- endOffset: the ending character position
handleSetupPanel(self, panel)
Find all the labels in this Setup panel and speak them.
 
Arguments:
- panel: the Setup panel.
isSetupDialog(self, obj)
Check to see if this object is in the Setup dialog by walking
back up the object hierarchy until we get to the dialog object and
checking to see if it has a name that starts with "Welcome to
StarOffice".
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
 
Returns an indication of whether this object is in the Setup dialog.
locusOfFocusChanged(self, event, oldLocusOfFocus, newLocusOfFocus)
Called when the visual object with focus changes.
 
Arguments:
- event: if not None, the Event that caused the change
- oldLocusOfFocus: Accessible that is the old locus of focus
- newLocusOfFocus: Accessible that is the new locus of focus
onCaretMoved(self, event)
Called whenever the caret moves.
 
Arguments:
- event: the Event
onFocus(self, event)
Called whenever an object gets focus. Overridden in this script 
so that we can adjust "focus:" events for children of a combo-box 
to just set the focus to the combo box. This is needed to help 
reduce the verbosity of focusing on the Calc Name combo box (see 
bug #364407).
 
Arguments:
- event: the Event
onNameChanged(self, event)
Called whenever a property on an object changes.
 
Arguments:
- event: the Event
onSelectionChanged(self, event)
Called when an object's selection changes.
 
Arguments:
- event: the Event
onStateChanged(self, event)
Called whenever an object's state changes.
 
Arguments:
- event: the Event
onWindowActivated(self, event)
Called whenever a property on an object changes.
 
Arguments:
- event: the Event
readMisspeltWord(self, event, pane)
Speak/braille the current misspelt word plus its context.
   The spell check dialog contains a "paragraph" which shows the
   context for the current spelling mistake. After speaking/brailling
   the default action for this component, that a selection of the
   surronding text from that paragraph with the misspelt word is also
   spoken.
 
Arguments:
- event: the event.
- pane: the option pane in the spell check dialog.
sayWriterWord(self, obj, word, startOffset, endOffset)
Speaks the given word in the appropriate voice. If this word is
a hypertext link and it is also at the end offset for one of the
links, then the word "link" is also spoken.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
- word: the word to speak
- startOffset: the start offset for this word
- endOffset: the end offset for this word
setDynamicColumnHeaders(self, inputEvent)
Set the row for the dynamic header columns to use when speaking
calc cell entries. In order to set the row, the user should first set
focus to the row that they wish to define and then press Insert-r.
 
Once the user has defined the row, it will be used to first speak
this header when moving between columns.
 
A "double-click" of the Insert-c hotkey, will clear the dynamic
header column.
 
Arguments:
- inputEvent: if not None, the input event that caused this action.
setDynamicRowHeaders(self, inputEvent)
Set the column for the dynamic header rows to use when speaking
calc cell entries. In order to set the column, the user should first
set focus to the column that they wish to define and then press
Insert-c.
 
Once the user has defined the column, it will be used to first speak
this header when moving between rows.
 
A "double-click" of the Insert-r hotkey, will clear the dynamic
header row.
 
Arguments:
- inputEvent: if not None, the input event that caused this action.
setupInputEventHandlers(self)
Defines InputEventHandler fields for this script that can be
called by the key and braille bindings. In this particular case,
we just want to be able to add a handler to return the contents of
the input line.
speakBlankLine(self, obj)
Returns True if a blank line should be spoken.
Otherwise, returns False.
speakCellName(self, name)
Speaks the given cell name.
 
Arguments:
- name: the name of the cell
speakInputLine(self, inputEvent)
Speak the contents of the spread sheet input line (assuming we
have a handle to it - generated when we first focus on a spread
sheet table cell.
 
This will be either the contents of the table cell that has focus
or the formula associated with it.
 
Arguments:
- inputEvent: if not None, the input event that caused this action.
speakNewLine(self, obj)
Returns True if a newline should be spoken.
Otherwise, returns False.
speakSetupLabel(self, label)
Speak this Setup dialog label.
 
Arguments:
- label: the Setup dialog Label.

Methods inherited from orca.default.Script:
echoPreviousWord(self, obj)
Speaks the word prior to the caret, as long as there is
a word prior to the caret and there is no intervening word
delimiter between the caret and the end of the word.
 
The entry condition for this method is that the character
prior to the current caret position is a word delimiter,
and it's what caused this method to be called in the first
place.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface.
enterLearnMode(self, inputEvent=None)
Turns learn mode on.  The user must press the escape key to exit
learn mode.
 
Returns True to indicate the input event has been consumed.
exitLearnMode(self, inputEvent=None)
Turns learn mode off.
 
Returns True to indicate the input event has been consumed.
find(self, query=None)
Searches for the specified query.  If no query is specified,
it searches for the query specified in the Orca Find dialog.
 
Arguments:
- query: The search query to find.
findCommonAncestor(self, a, b)
Finds the common ancestor between Accessible a and Accessible b.
 
Arguments:
- a: Accessible
- b: Accessible
findNext(self, inputEvent)
Searches forward for the next instance of the string
searched for via the Orca Find dialog.  Other than direction
and the starting point, the search options initially specified
(case sensitivity, window wrap, and full/partial match) are
preserved.
findPrevious(self, inputEvent)
Searches backwards for the next instance of the string
searched for via the Orca Find dialog.  Other than direction
and the starting point, the search options initially specified
(case sensitivity, window wrap, and full/partial match) are
preserved.
getBrailleBindings(self)
Defines the braille bindings for this script.
 
Returns a dictionary where the keys are BrlTTY commands and the
values are InputEventHandler instances.
getFlatReviewContext(self)
Returns the flat review context, creating one if necessary.
getInputEventHandlerKey(self, inputEventHandler)
Returns the name of the key that contains an inputEventHadler
passed as argument
getListeners(self)
Sets up the AT-SPI event listeners for this script.
goBrailleHome(self, inputEvent=None)
Returns to the component with focus.
isLayoutOnly(self, obj)
Returns True if the given object is a table and is for layout
purposes only.
isTextArea(self, obj)
Returns True if obj is a GUI component that is for entering text.
 
Arguments:
- obj: an accessible
leftClickReviewItem(self, inputEvent=None)
Performs a left mouse button click on the current item.
noOp(self, event)
Just here to capture events.
 
Arguments:
- event: the Event
onActiveDescendantChanged(self, event)
Called when an object who manages its own descendants detects a
change in one of its children.
 
Arguments:
- event: the Event
onLinkSelected(self, event)
Called when a hyperlink is selected in a text area.
 
Arguments:
- event: the Event
onTextDeleted(self, event)
Called whenever text is deleted from an object.
 
Arguments:
- event: the Event
onTextInserted(self, event)
Called whenever text is inserted into an object.
 
Arguments:
- event: the Event
onValueChanged(self, event)
Called whenever an object's value changes.  Currently, the
value changes for non-focused objects are ignored.
 
Arguments:
- event: the Event
onWindowDeactivated(self, event)
Called whenever a toplevel window is deactivated.
 
Arguments:
- event: the Event
outputCharAttributes(self, keys, attributes)
Speak each of the text attributes given dictionary.
 
Arguments:
- attributes: a dictionary of text attributes to speak.
panBrailleLeft(self, inputEvent=None, panAmount=0)
Pans the braille display to the left.  If panAmount is non-zero,
the display is panned by that many cells.  If it is 0, the display
is panned one full display width.  In flat review mode, panning
beyond the beginning will take you to the end of the previous line.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleLeftOneChar(self, inputEvent=None)
Nudges the braille display one character to the left.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleRight(self, inputEvent=None, panAmount=0)
Pans the braille display to the right.  If panAmount is non-zero,
the display is panned by that many cells.  If it is 0, the display
is panned one full display width.  In flat review mode, panning
beyond the end will take you to the begininng of the next line.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
panBrailleRightOneChar(self, inputEvent=None)
Nudges the braille display one character to the right.
 
In focus tracking mode, the cursor stays at its logical position.
In flat review mode, the review cursor moves to character
associated with cell 0.
processKeyboardEvent(self, keyboardEvent)
Processes the given keyboard event. It uses the super
class equivalent to do most of the work. The only thing done here
is to detect when the user is trying to get out of learn mode.
 
Arguments:
- keyboardEvent: an instance of input_event.KeyboardEvent
pursueForFlatReview(self, obj)
Determines if we should look any further at the object
for flat review.
readCharAttributes(self, inputEvent=None)
Reads the attributes associated with the current text character.
Calls outCharAttributes to speak a list of attributes. By default,
a certain set of attributes will be spoken. If this is not desired,
then individual application scripts should override this method to
only speak the subset required.
reportScriptInfo(self, inputEvent=None)
Output useful information on the current script via speech
and braille.  This information will be helpful to script writers.
reviewAbove(self, inputEvent)
Moves the flat review context to the character most directly
above the current flat review cursor.  Places the flat review
cursor at character.
reviewBelow(self, inputEvent)
Moves the flat review context to the character most directly
below the current flat review cursor.  Places the flat review
cursor at character.
reviewBottomLeft(self, inputEvent)
Moves the flat review context to the beginning of the
last line in the window.  Places the flat review cursor at
the beginning of the line.
reviewCurrentAccessible(self, inputEvent)
reviewCurrentCharacter(self, inputEvent)
Presents the current flat review character via braille and speech.
reviewCurrentItem(self, inputEvent, targetCursorCell=0)
Speak/Braille the current item to the user. A "double-click"
of this key will cause the word to be spelt. A "triple-click"
will cause the word to be phonetically spelt.
reviewCurrentLine(self, inputEvent)
Presents the current flat review line via braille and speech.
reviewEnd(self, inputEvent)
Moves the flat review context to the end of the
last line in the window.  Places the flat review cursor
at the end of the line.
reviewEndOfLine(self, inputEvent)
Moves the flat review context to the end of the line.  Places
the flat review cursor at the end of the line.
reviewHome(self, inputEvent)
Moves the flat review context to the top left of the current
window.
reviewNextCharacter(self, inputEvent)
Moves the flat review context to the next character.  Places
the flat review cursor at character.
reviewNextItem(self, inputEvent)
Moves the flat review context to the next item.  Places
the flat review cursor at the beginning of the item.
reviewNextLine(self, inputEvent)
Moves the flat review context to the beginning of the
next line.  Places the flat review cursor at the beginning
of the line.
reviewPreviousCharacter(self, inputEvent)
Moves the flat review context to the previous character.  Places
the flat review cursor at character.
reviewPreviousItem(self, inputEvent)
Moves the flat review context to the previous item.  Places
the flat review cursor at the beginning of the item.
reviewPreviousLine(self, inputEvent)
Moves the flat review context to the beginning of the
previous line.
rightClickReviewItem(self, inputEvent=None)
Performs a right mouse button click on the current item.
sayAll(self, inputEvent)
sayCharacter(self, obj)
Speak the character under the caret.  [[[TODO: WDW - isn't the
caret between characters?]]]
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
sayLine(self, obj)
Speaks the line of an AccessibleText object that contains the
caret, unless the line is empty in which case it's ignored.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
sayPhrase(self, obj, startOffset, endOffset)
Speaks the text of an Accessible object between the start and
end offsets, unless the phrase is empty in which case it's ignored.
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
- startOffset: the start text offset.
- endOffset: the end text offset.
sayWord(self, obj)
Speaks the word at the caret.  [[[TODO: WDW - what if there is no
word at the caret?]]]
 
Arguments:
- obj: an Accessible object that implements the AccessibleText
       interface
showZones(self, inputEvent)
Debug routine to paint rectangles around the discrete
interesting (e.g., text)  zones in the active window for
this application.
speakTextIndentation(self, obj, line)
Speaks a summary of the number of spaces and/or tabs at the
beginning of the given line.
 
Arguments:
- obj: the text object.
- line: the string to check for spaces and tabs.
spellCurrentItem(self, string)
Spell the current flat review word or line.
 
Arguments:
- string: the string to spell.
textAttrsToDictionary(self, str)
Converts a string of text attribute tokens of the form
<key>:<value>; into a dictionary of keys and values.
Text before the colon is the key and text afterwards is the
value. If there is a final semi-colon, then it's ignored.
 
Arguments:
- str: the string of tokens containing <key>:<value>; pairs.
 
Returns a list containing two items:
A list of the keys in the order they were extracted from the
text attribute string and a dictionary of key/value items.
toggleFlatReviewMode(self, inputEvent=None)
Toggles between flat review mode and focus tracking mode.
toggleTableCellReadMode(self, inputEvent=None)
Toggles an indicator for whether we should just read the current
table cell or read the whole row.
updateBraille(self, obj, extraRegion=None)
Updates the braille display to show the give object.
 
Arguments:
- obj: the Accessible
- extra: extra Region to add to the end
updateBrailleReview(self, targetCursorCell=0)
Obtains the braille regions for the current flat review line
and displays them on the braille display.  If the targetCursorCell
is non-0, then an attempt will be made to postion the review cursor
at that cell.  Otherwise, we will pan in display-sized increments
to show the review cursor.
visualAppearanceChanged(self, event, obj)
Called when the visual appearance of an object changes.  This
method should not be called for objects whose visual appearance
changes solely because of focus -- setLocusOfFocus is used for that.
Instead, it is intended mostly for objects whose notional 'value' has
changed, such as a checkbox changing state, a progress bar advancing,
a slider moving, text inserted, caret moved, etc.
 
Arguments:
- event: if not None, the Event that caused this to happen
- obj: the Accessible whose visual appearance changed.
whereAmI(self, inputEvent)
Speaks information about the current object of interest.

Methods inherited from orca.script.Script:
consumesBrailleEvent(self, brailleEvent)
Called when a key is pressed on the braille display.
 
Arguments:
- brailleEvent: an instance of input_event.KeyboardEvent
 
Returns True if the event is of interest.
consumesKeyboardEvent(self, keyboardEvent)
Called when a key is pressed on the keyboard.
 
Arguments:
- keyboardEvent: an instance of input_event.KeyboardEvent
 
Returns True if the event is of interest.
getBrailleCommandsForInputHandler(self, inputEventHandler)
Returns a list of BrlTTY commands (they're in braille.py) that
match the given inputEventHandler passed as argument.
 
Arguments:
- inputEventHandler: an instance of input_event.InputEventHandler
 
Returns a list (possibly empty) of BrlTTY commands (they're in
braille.py) that match the given inputEventHandler passed.
getKeyBindingsForInputHandler(self, inputEventHandler)
Returns a KeyBindings object with the list of KeyBindings that
matche the passed inputEventHandler as argument (at least the
inputEventHandler that has the same handler function)
 
Arguments:
- inputEventHandler: an instance of input_event.InputEventHandler
 
Returns an instance of keybindings.KeyBindings populated with
keybindings.KeyBinding instances that match the inputEventHandler.
processBrailleEvent(self, brailleEvent)
Called whenever a key is pressed on the Braille display.
 
This method will primarily use the brailleBindings field of
this script instance see if this script has an interest in the
event.
 
NOTE: there is latent, but unsupported, logic for allowing
the user's user-settings.py file to extend and/or override
the brailleBindings for a script.
 
Arguments:
- brailleEvent: an instance of input_event.BrailleEvent
processObjectEvent(self, event)
Processes all AT-SPI object events of interest to this
script.  The interest in events is specified via the
'listeners' field that was defined during the construction of
this script.
 
In general, the primary purpose of handling object events is to
keep track of changes to the locus of focus and notify the
orca module of these changes via orca.setLocusOfFocus and
orca.visualAppearanceChanged.
 
Note that this script may be passed events it doesn't care
about, so it needs to react accordingly.
 
Arguments:
- event: the Event

 
class SpeechGenerator(orca.speechgenerator.SpeechGenerator)
    Overrides _getSpeechForComboBox so that we can provide a name for
the Calc Name combo box.
Overrides _getSpeechForTableCellRow so that , when we are in a
spread sheet, we can speak the dynamic row and column headers
(assuming they are set).
Overrides _getSpeechForTableCell so that, when we are in a spread
sheet, we can speak the location of the table cell as well as the
contents.
Overrides _getSpeechForToggleButton so that, when the toggle buttons
on the Formatting toolbar change state, we provide both the name and
the state (as "on" or "off")
Overrides _getSpeechForPushButton because sometimes the toggle buttons
on the Formatting toolbar claim to be push buttons.
 
  Methods defined here:
__init__(self, script)

Methods inherited from orca.speechgenerator.SpeechGenerator:
getSpeech(self, obj, already_focused)
Get the speech for an Accessible object.  This will look
first to the specific speech generators and then to the
default speech generator.  This method is the primary method
that external callers of this class should use.
 
Arguments:
- obj: the object
- already_focused: False if object just received focus
 
Returns a list of utterances to be spoken.
getSpeechContext(self, obj, stopAncestor=None)
Get the speech that describes the names and role of
the container hierarchy of the object, stopping at and
not including the stopAncestor.
 
Arguments:
- obj: the object
- stopAncestor: the anscestor to stop at and not include (None
  means include all ancestors)
 
Returns a list of utterances to be spoken.

 
Functions
       
adjustForWriterTable(obj)
Check to see if we are in Writer, where the object with focus is a
paragraph, and the parent is the table cell. If it is, then, return the
parent table cell otherwise return the current object.
 
Arguments:
- obj: the accessible object to check.
 
Returns parent table cell (if in a Writer table ) or the current object.
getDynamicColumnHeaderCell(obj, column)
Given a table cell, return the dynamic column header cell associated
with it.
 
Arguments:
- obj: the table cell.
- column: the column that this dynamic header is on.
 
Return the dynamic column header cell associated with the given table cell.
getDynamicRowHeaderCell(obj, row)
Given a table cell, return the dynamic row header cell associated
with it.
 
Arguments:
- obj: the table cell.
- row: the row that this dynamic header is on.
 
Return the dynamic row header cell associated with the given table cell.
getTable(obj)
Get the table that this table cell is in.
 
Arguments:
- obj: the table cell.
 
Return the table that this table cell is in, or None if this object
isn't in a table.
isSpreadSheetCell(obj)
Return an indication of whether the given obj is a spread sheet
table cell.
 
Arguments:
- obj: the object to check.
 
Returns True if this is a table cell, False otherwise.
locateInputLine(obj)
Return the spread sheet input line. This only needs to be found
the very first time a spread sheet table cell gets focus. We use the
table cell to work back up the component hierarchy until we have found
the common panel that both it and the input line reside in. We then
use that as the base component to search for a component which has a
paragraph role. This will be the input line.
 
Arguments:
- obj: the spread sheet table cell that has just got focus.
 
Returns the spread sheet input line component.

 
Data
        __copyright__ = 'Copyright (c) 2005-2006 Sun Microsystems Inc.'
__date__ = '$Date$'
__id__ = '$Id$'
__license__ = 'LGPL'
__version__ = '$Revision$'
dynamicColumnHeaders = {}
dynamicRowHeaders = {}
inputLineForCell = None