private bool AddToTree(TEscherClientDataRecord obj, bool MightNotBeFirst, IRowColSize Workbook) { TEscherOPTRecord CbObj = (obj.Parent as TEscherSpContainerRecord).FindRec <TEscherOPTRecord>() as TEscherOPTRecord; TClientAnchor CbAnchor = TDrawing.GetObjectAnchorAbsolute(CbObj, Workbook); for (int i = 1; i < Tree.Count; i++) // 0 is desktop { TEscherOPTRecord GrpObj = (Tree[i].Group.Parent as TEscherSpContainerRecord).FindRec <TEscherOPTRecord>() as TEscherOPTRecord; TClientAnchor GAnchor = TDrawing.GetObjectAnchorAbsolute(GrpObj, Workbook); if ((MightNotBeFirst || Tree[i].Buttons.Count == 0) && GAnchor.Contains(CbAnchor)) { AddRadioButton(obj, i); return(true); } } if (MightNotBeFirst || Tree[0].Buttons.Count == 0) { AddRadioButton(obj, 0); return(true); } return(false); }
internal void AddShapeId(TEscherOPTRecord Opt) { long ShapeId = Opt.ShapeId(); if (ShapeId < 0) { NotLoadedOpt.Add(Opt); } else { OptsByShapeId[ShapeId] = Opt; } }
internal void Remove(TEscherOPTRecord Opt, bool AlsoRemoveShapeId) { FillNotLoaded(); if (AlsoRemoveShapeId) { OptsByShapeId.Remove(Opt.ShapeId()); } if (Opt == null || String.IsNullOrEmpty(Opt.ShapeName)) { return; } TLinkedOpts FirstOpt; if (!OptsByName.TryGetValue(Opt.ShapeName, out FirstOpt)) { return; } TLinkedOpts current = FirstOpt; TLinkedOpts previous = null; while (current != null) { if (current.Opt == Opt) { break; } previous = current; current = current.Next; } if (current == null) { return; } if (previous != null) { previous.Next = current.Next; } else { TLinkedOpts next = current.Next; OptsByName.Remove(Opt.ShapeName); if (next != null) { OptsByName.Add(Opt.ShapeName, next); } } }
internal void AddShapeName(TEscherOPTRecord Opt) { if (string.IsNullOrEmpty(Opt.ShapeName)) { return; } TLinkedOpts NeOpt = new TLinkedOpts(); NeOpt.Opt = Opt; TLinkedOpts FirstOpt; if (OptsByName.TryGetValue(Opt.ShapeName, out FirstOpt)) { NeOpt.Next = FirstOpt.Next; FirstOpt.Next = NeOpt; } else { NeOpt.Next = null; OptsByName.Add(Opt.ShapeName, NeOpt); } }