Index: src/orca/scripts/Evolution.py
===================================================================
--- src/orca/scripts/Evolution.py	(revision 2409)
+++ src/orca/scripts/Evolution.py	(working copy)
@@ -84,6 +84,62 @@
 
         return text
 
+    def _hasTextSelections(self, obj):
+        """Return an indication of whether this object has selected text.
+        Note that it's possible that this object has no text, but is part
+        of a selected text area. Because of this, we need to check the
+        objects on either side to see if they are none zero length and 
+        have text selections.
+
+        Arguments:
+        - obj: the text object to start checking for selected text.
+
+        Returns: an indication of whether this object has selected text,
+        or adjacent text objects have selected text.
+        """
+
+        currentSelected = False
+        otherSelected = False
+        nSelections = obj.text.getNSelections()
+        if nSelections:
+            currentSelected = True
+        else:
+            otherSelected = False
+            displayedText = obj.text.getText(0, -1)
+            if len(displayedText) == 0:
+                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)
+                        if prevObj.text.getNSelections() > 0:
+                            otherSelected = True
+                        else:
+                            displayedText = prevObj.text.getText(0, -1)
+                            if len(displayedText) == 0:
+                                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)
+                        if nextObj.text.getNSelections() > 0:
+                            otherSelected = True
+                        else:
+                            displayedText = nextObj.text.getText(0, -1)
+                            if len(displayedText) == 0:
+                                current += 1
+                                morePossibleSelections = True
+
+        return [currentSelected, otherSelected]
+
     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
@@ -98,7 +154,12 @@
         offsets within the text for the given object.
         """
 
-        [textContents, startOffset, endOffset] = self._getTextSelection(obj)
+        textContents = ""
+        startOffset = 0
+        endOffset = 0
+        if obj.text.getNSelections() > 0:
+            [textContents, startOffset, endOffset] = \
+                                            self._getTextSelection(obj)
 
         if doubleClick:
             # Unfortunately, Evolution doesn't use the FLOWS_FROM and 
Index: src/orca/where_am_I.py
===================================================================
--- src/orca/where_am_I.py	(revision 2409)
+++ src/orca/where_am_I.py	(working copy)
@@ -913,7 +913,12 @@
         offsets within the text for the given object.
         """
 
-        [textContents, startOffset, endOffset] = self._getTextSelection(obj)
+        textContents = ""
+        startOffset = 0
+        endOffset = 0
+        if obj.text.getNSelections() > 0:
+            [textContents, startOffset, endOffset] = \
+                                            self._getTextSelection(obj)
 
         if doubleClick:
             current = obj
@@ -931,6 +936,11 @@
                             textContents = newTextContents + textContents
                             current = prevObj
                             morePossibleSelections = True
+                        else:
+                            displayedText = prevObj.text.getText(0, -1)
+                            if len(displayedText) == 0:
+                                current = prevObj
+                                morePossibleSelections = True
                         break
 
             current = obj
@@ -948,10 +958,76 @@
                             textContents += newTextContents
                             current = nextObj
                             morePossibleSelections = True
+                        else:
+                            displayedText = nextObj.text.getText(0, -1)
+                            if len(displayedText) == 0:
+                                current = nextObj
+                                morePossibleSelections = True
                         break
 
         return [textContents, startOffset, endOffset]
 
+    def _hasTextSelections(self, obj):
+        """Return an indication of whether this object has selected text.
+        Note that it's possible that this object has no text, but is part
+        of a selected text area. Because of this, we need to check the
+        objects on either side to see if they are none zero length and
+        have text selections.
+
+        Arguments:
+        - obj: the text object to start checking for selected text.
+
+        Returns: an indication of whether this object has selected text,
+        or adjacent text objects have selected text.
+        """
+
+        currentSelected = False
+        otherSelected = False
+        nSelections = obj.text.getNSelections()
+        if nSelections:
+            currentSelected = True
+        else:
+            otherSelected = False
+            displayedText = obj.text.getText(0, -1)
+            if len(displayedText) == 0:
+                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:
+                                otherSelected = True
+                            else:
+                                displayedText = prevObj.text.getText(0, -1)
+                                if len(displayedText) == 0:
+                                    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:
+                                otherSelected = True
+                            else:
+                                displayedText = nextObj.text.getText(0, -1)
+                                if len(displayedText) == 0:
+                                    current = nextObj
+                                    morePossibleSelections = True
+                            break
+
+        return [currentSelected, otherSelected]
+
     def _getTextContents(self, obj, doubleClick):
         """Returns utterences for text.
 
@@ -973,7 +1049,9 @@
             "_getTextContents: caretOffset=%d, nSelections=%d" % \
             (caretOffset, nSelections))
 
-        if nSelections:
+        [current, other] = self._hasTextSelections(obj)
+        if (doubleClick and (current or other)) or \
+           (not doubleClick and current):
             selected = True
             [textContents, startOffset, endOffset] = \
                                   self._getTextSelections(obj, doubleClick)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2409)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-05-21  Rich Burridge <rich.burridge@sun.com>
+
+        * src/orca/where_am_I.py:
+          src/orca/scripts/Evolution.py:
+          More work on bug #435226 – Where-am-I doesn't correctly handle 
+          multiple selected paragraphs in OOo Writer and Evolution. Orca
+          should hopefully now handle speaking selections that start or
+          include blank lines/paragraphs.
+
 2007-05-19  Joanmarie Diggs <j-diggs@comcast.net>
 
         * src/orca/Gecko.py: More work on Bug 420540 – Firefox keyboard 
