Index: src/orca/scripts/Evolution.py
===================================================================
--- src/orca/scripts/Evolution.py	(revision 2396)
+++ src/orca/scripts/Evolution.py	(working copy)
@@ -84,6 +84,72 @@
 
         return text
 
+    def _getTextSelections(self, obj, doubleClick):
+        """Get all the text applicable text selections for the given object.
+        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.
+
+        Arguments:
+        - obj: the text object to start extracting the selected text from.
+        - doubleClick: True if the user double-clicked the "where am I" key.
+
+        Returns: all the selected text contents plus the start and end
+        offsets within the text for the given object.
+        """
+
+        [textContents, startOffset, endOffset] = self._getTextSelection(obj)
+
+        if doubleClick:
+            # Unfortunately, Evolution doesn't use the FLOWS_FROM and 
+            # FLOWS_TO relationships to easily allow us to get to previous 
+            # and next text objects. Instead we have to move up the
+            # component hierarchy until we get to the object containing all
+            # the panels (with each line containing a single text item).
+            # We can then check in both directions to see if there is other
+            # contiguous text that is selected. We also have to jump over 
+            # zero length (empty) text lines and continue checking on the 
+            # other side.
+            #
+            container = obj.parent.parent
+            current = obj.parent.index
+            morePossibleSelections = True
+            while morePossibleSelections:
+                morePossibleSelections = False
+                if (current-1) >= 0:
+                    prevPanel = container.child(current-1)
+                    prevObj = prevPanel.child(0)
+                    displayedText = prevObj.text.getText(0, -1)
+                    if len(displayedText) == 0:
+                        current -= 1
+                        morePossibleSelections = True
+                    elif prevObj.text.getNSelections() > 0:
+                        [newTextContents, start, end] = \
+                                     self._getTextSelection(prevObj)
+                        textContents = newTextContents + " " + textContents
+                        current -= 1
+                        morePossibleSelections = True
+
+            current = obj.parent.index
+            morePossibleSelections = True
+            while morePossibleSelections:
+                morePossibleSelections = False
+                if (current+1) < container.childCount:
+                    nextPanel = container.child(current+1)
+                    nextObj = nextPanel.child(0)
+                    displayedText = nextObj.text.getText(0, -1)
+                    if len(displayedText) == 0:
+                        current += 1
+                        morePossibleSelections = True
+                    elif nextObj.text.getNSelections() > 0:
+                        [newTextContents, start, end] = \
+                                     self._getTextSelection(nextObj)
+                        textContents += " " + newTextContents
+                        current += 1
+                        morePossibleSelections = True
+
+        return [textContents, startOffset, endOffset]
+
 ########################################################################
 #                                                                      #
 # The Evolution script class.                                          #
Index: src/orca/where_am_I.py
===================================================================
--- src/orca/where_am_I.py	(revision 2396)
+++ src/orca/where_am_I.py	(working copy)
@@ -869,6 +869,89 @@
 
         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 _getTextSelections(self, obj, doubleClick):
+        """Get all the text applicable text selections for the given object.
+        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.
+
+        Arguments:
+        - obj: the text object to start extracting the selected text from.
+        - doubleClick: True if the user double-clicked the "where am I" key.
+
+        Returns: all the selected text contents plus the start and end
+        offsets within the text for the given object.
+        """
+
+        [textContents, startOffset, endOffset] = self._getTextSelection(obj)
+
+        if doubleClick:
+            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
+
+            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
+
+        return [textContents, startOffset, endOffset]
+
     def _getTextContents(self, obj, doubleClick):
         """Returns utterences for text.
 
@@ -892,21 +975,8 @@
 
         if nSelections:
             selected = True
-            for i in range(0, nSelections):
-                [startOffset, endOffset] = textObj.getSelection(i)
-
-                debug.println(self._debugLevel,
-                    "_getTextContents: selection start=%d, end=%d" % \
-                    (startOffset, endOffset))
-
-                selectedText = textObj.getText(startOffset, endOffset)
-                debug.println(self._debugLevel,
-                    "_getTextContents: selected text=<%s>" % selectedText)
-
-                if i > 0:
-                    textContents += " "
-                textContents += selectedText
-
+            [textContents, startOffset, endOffset] = \
+                                  self._getTextSelections(obj, doubleClick)
         else:
             # Get the line containing the caret
             #
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2396)
+++ ChangeLog	(working copy)
@@ -1,5 +1,12 @@
 2007-05-16  Rich Burridge <rich.burridge@sun.com>
 
+        * src/orca/where_am_I.py:
+          src/orca/scripts/Evolution.py:
+          Fixed bug #435226 – Where-am-I doesn't correctly handle multiple 
+          selected paragraphs in OOo Writer and Evolution.
+
+2007-05-16  Rich Burridge <rich.burridge@sun.com>
+
         * src/orca/scripts/StarOffice.py:
           src/orca/focus_tracking_presenter.py:
           Work on bug #435199 - Orca is bloating the swap partition, so 
