Make this non-inline (for easier debugging).

Change-Id: I2b7a84c56b8130c6566eb971ba6ba0c3ee487c86
Check IsRefMode() before accessing the ref range.

Else you'd end up with wrong ref range values.  Also in
selectAllAccessibleChildren(), the code is probably meant to select
all sheet, rather than setting the top-left reference position twice
in a row.

Change-Id: I895896418476ffea0862e8df4e03f6efc4c91dd2