def getSelectionColumns(grid):
    """Indices of columns that have any cell selected.
    """
    cols = grid.GetNumberCols()
    cset = set()
    if grid.GetSelectedRows():
        cset.update(range(cols))
    cset.update(grid.GetSelectedCols())
    for r, c in grid.GetSelectedCells():
        cset.add(c)
    blocks = zip(grid.GetSelectionBlockTopLeft(), grid.
        GetSelectionBlockBottomRight())
    for tl, br in blocks:
        cset.update(range(tl[1], br[1] + 1))
    rv = sorted(cset)
    return rv
