Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2388)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2007-05-15  Rich Burridge <rich.burridge@sun.com>
+
+        * src/orca/where_am_I.py:
+          Fixed bug #435226 – Where-am-I doesn't correctly handle multiple 
+          selected paragraphs in OOo Writer and Evolution.
+
 2007-05-14  Willie Walker <william.walker@sun.com>
 
         * src/orca/speechdispatcherfactory.py: fix for bug 349394
Index: src/orca/where_am_I.py
===================================================================
--- src/orca/where_am_I.py	(revision 2388)
+++ src/orca/where_am_I.py	(working copy)
@@ -869,6 +869,36 @@
 
         return text
 
+    def _getTextSelection(self, obj):
+        """Get the text selection for the given object.
+
+        Arguments:
+        - obj: the text object to extract the selected text from.
+
+        Returns: the selected text contents plus the start and end 
+        offsets within the text.
+        """
+
+        textContents = ""
+        textObj = obj.text
+        nSelections = textObj.getNSelections()
+        for i in range(0, nSelections):
+            [startOffset, endOffset] = textObj.getSelection(i)
+
+            debug.println(self._debugLevel,
+                "_getTextSelection: selection start=%d, end=%d" % \
+                (startOffset, endOffset))
+
+            selectedText = textObj.getText(startOffset, endOffset)
+            debug.println(self._debugLevel,
+                "_getTextSelection: selected text=<%s>" % selectedText)
+
+            if i > 0:
+                textContents += " "
+            textContents += selectedText
+
+        return [textContents, startOffset, endOffset]
+
     def _getTextContents(self, obj, doubleClick):
         """Returns utterences for text.
 
@@ -892,21 +922,47 @@
 
         if nSelections:
             selected = True
-            for i in range(0, nSelections):
-                [startOffset, endOffset] = textObj.getSelection(i)
+            [textContents, startOffset, endOffset] = \
+                           self._getTextSelection(obj)
+            if doubleClick:
+                # If the user doubleclicked, look to see if there are any
+                # previous or next text objects that also have selected text
+                # and add in their text contents.
+                #
+                current = obj
+                morePossibleSelections = True
+                while morePossibleSelections:
+                    morePossibleSelections = False
+                    for relation in current.relations:
+                        if relation.getRelationType() == \
+                               atspi.Accessibility.RELATION_FLOWS_FROM:
+                            prevObj = atspi.Accessible.makeAccessible( \
+                                                      relation.getTarget(0))
+                            if prevObj.text.getNSelections() > 0:
+                                [newTextContents, start, end] = \
+                                             self._getTextSelection(prevObj)
+                                textContents = newTextContents + textContents
+                                current = prevObj
+                                morePossibleSelections = True
+                            break
 
-                debug.println(self._debugLevel,
-                    "_getTextContents: selection start=%d, end=%d" % \
-                    (startOffset, endOffset))
+                current = obj
+                morePossibleSelections = True
+                while morePossibleSelections:
+                    morePossibleSelections = False
+                    for relation in current.relations:
+                        if relation.getRelationType() == \
+                               atspi.Accessibility.RELATION_FLOWS_TO:
+                            nextObj = atspi.Accessible.makeAccessible( \
+                                                      relation.getTarget(0))
+                            if nextObj.text.getNSelections() > 0:
+                                [newTextContents, start, end] = \
+                                             self._getTextSelection(nextObj)
+                                textContents += newTextContents
+                                current = nextObj
+                                morePossibleSelections = True
+                            break
 
-                selectedText = textObj.getText(startOffset, endOffset)
-                debug.println(self._debugLevel,
-                    "_getTextContents: selected text=<%s>" % selectedText)
-
-                if i > 0:
-                    textContents += " "
-                textContents += selectedText
-
         else:
             # Get the line containing the caret
             #
