Exemplo n.º 1
0
        public RelatedDocumentsContainer(Page page, Shape relatedDocumentsContainer) : base(page)
        {
            Shape = relatedDocumentsContainer;
            Array        ident  = relatedDocumentsContainer.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 => RelatedDocumentContainer.IsRelatedDocumentContainer(shape.Name)))
            {
                Children.Add(new RelatedDocumentContainer(page, shape));
            }
            Children          = Children.OrderBy(c => c.Index).ToList();
            UsedSizingPolicy |= SizingPolicy.ExpandYIfNeeded;
            LayoutManager     = new VerticalStretchLayout(this);
        }
Exemplo n.º 2
0
        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 (RelatedDocumentContainer.IsRelatedDocumentContainer(s.Name))
            {
                if (Children.All(c => c.Index != shapeComponent.Index)) //there is no container stub with this index
                {
                    RelatedDocumentContainer con = new RelatedDocumentContainer(Page, s);
                    Children.Insert(con.Index, con);
                }
                else
                {
                    //remove stub, insert s as the shape of the stub wrapper
                    RelatedDocumentStubContainer stub = (RelatedDocumentStubContainer)Children.First(c => c.Index == shapeComponent.Index);
                    Children.Remove(stub);
                    RelatedDocumentContainer con = new RelatedDocumentContainer(Page, s);
                    Children.Insert(con.Index, con);
                }
            }
            else
            {
                bool isDocumentChild = RelatedDocumentTitleComponent.IsRelatedDocumentTitleContainer(s.Name) || RelatedFileComponent.IsRelatedFileComponent(s.Name) || RelatedUrlComponent.IsRelatedUrlComponent(s.Name) || RelatedURLURLComponent.IsRelatedUrlUrlComponent(s.Name);

                if (isDocumentChild && Children.All(c => c.Index != shapeComponent.Index)) //if parent not exists
                {
                    RelatedDocumentStubContainer stub = new RelatedDocumentStubContainer(Page, shapeComponent.Index);
                    Children.Insert(stub.Index, stub);
                    Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart));
                }
                else
                {
                    Children.ForEach(r => r.AddToTree(s, allowAddOfSubpart));
                }
            }
        }