private bool GetCurrentSelection(out int clev, out SelLevInfo[] rgvsli, out int tag, out int ichAnchor, out int ichEnd, out int ws)
{
clev = -1;
rgvsli = null;
tag = -1;
ichAnchor = -1;
ichEnd = -1;
ws = -1;
var sel = EditingHelper.RootBoxSelection;
if (sel == null)
return false;
// which "line choice" is active in this segment?
if (sel.SelType != VwSelType.kstText || !sel.IsValid || !sel.IsEditable)
return false;
clev = sel.CLevels(true);
ITsTextProps ttp;
using (ArrayPtr rgvsliTemp = MarshalEx.ArrayToNative<SelLevInfo>(clev))
{
int ihvoRoot;
int ihvoEnd1;
int cpropPrevious;
bool fAssocPrev;
sel.AllTextSelInfo(out ihvoRoot, clev, rgvsliTemp, out tag, out cpropPrevious,
out ichAnchor, out ichEnd, out ws, out fAssocPrev, out ihvoEnd1, out ttp);
rgvsli = MarshalEx.NativeToArray<SelLevInfo>(rgvsliTemp, clev);
}
return true;
}