public PlanningContainer(Page page, Shape planningContainer) : base(page) { Shape = planningContainer; Array ident = planningContainer.ContainerProperties.GetMemberShapes((int)VisContainerFlags.visContainerFlagsExcludeNested); List <Shape> shapes = new List <int>((int[])ident).Select(i => page.Shapes.ItemFromID[i]).ToList(); foreach (Shape shape in shapes.Where(shape => PlanningItemComponent.IsPlanningItem(shape.Name))) { Children.Add(new PlanningItemComponent(page, shape)); } Children = Children.OrderBy(c => c.Index).ToList(); LayoutManager = new VerticalStretchLayout(this); }
public override void AddToTree(Shape s, bool allowAddOfSubpart) { //make s into an rcomponent for access to wrapper VisioShape shapeComponent = new VisioShape(Page) { Shape = s }; if (PlanningItemComponent.IsPlanningItem(s.Name)) { if (Children.All(c => c.Index != shapeComponent.Index)) //there is no forcecontainer stub with this index { Children.Add(new PlanningItemComponent(Page, s)); } else { //remove stub, insert s as new containers PlanningStubItem stub = (PlanningStubItem)Children.First(c => c.Index == shapeComponent.Index); Children.Remove(stub); PlanningItemComponent con = new PlanningItemComponent(Page, s); if (Children.Count < con.Index) { Children.Add(con); } else { Children.Insert(con.Index, con); } } } else { bool isPlanningChild = CheckBoxComponent.IsCheckBoxComponent(s.Name) || PlanningItemTextComponent.IsPlanningItemTextComponent(s.Name); if (isPlanningChild && Children.All(c => c.Index != shapeComponent.Index)) //if parent not exists { PlanningStubItem stub = new PlanningStubItem(Page, shapeComponent.Index); Children.Insert(stub.Index, stub); Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart)); } else { Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart)); } } }