def getSelectionRows(grid):
    """Indices of the rows that have any cell selected.
    """
    rows = grid.GetNumberRows()
    rset = set()
    if grid.GetSelectedCols():
        rset.update(range(rows))
    rset.update(grid.GetSelectedRows())
    for r, c in grid.GetSelectedCells():
        rset.add(r)
    blocks = zip(grid.GetSelectionBlockTopLeft(), grid.
        GetSelectionBlockBottomRight())
    for tl, br in blocks:
        rset.update(range(tl[0], br[0] + 1))
    rv = sorted(rset)
    return rv
