public static List <CustomPropertyDictionary> GetDictionary(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            var listof_listof_custpropscells = CustomPropertyCells.GetCells(page, shapeidpairs, type);
            var listof_custpropdics          = _get_cells_as_list(shapeidpairs, listof_listof_custpropscells);

            return(listof_custpropdics);
        }
        public static List <CustomPropertyDictionary> GetCellsAsDictionary(IVisio.Page page, IList <IVisio.Shape> shapes, VASS.CellValueType type)
        {
            var shapeidpairs = ShapeIDPairs.FromShapes(shapes);

            var listof_listof_custpropscells = CustomPropertyCells.GetCells(page, shapeidpairs, type);
            var listof_custpropdics          = __GetListOfCpDic(shapeidpairs, listof_listof_custpropscells);

            return(listof_custpropdics);
        }
        // ----------------------------------------
        // ----------------------------------------
        // ----------------------------------------
        // ----------------------------------------

        private static List <CustomPropertyNameCellsPair> __GetPairs(IVisio.Shape shape, VASS.CellValueType type)
        {
            var shape_custprop_cells = CustomPropertyCells.GetCells(shape, type);
            var shape_custprop_names = CustomPropertyHelper.GetNames(shape);
            int shapeid = shape.ID16;
            var list    = __CreateListofPairs(shape_custprop_names, shape_custprop_cells, shapeid);

            return(list);
        }
Exemple #4
0
        /// <summary>
        /// Gets all the custom properties defined on a shape
        /// </summary>
        /// <remarks>
        /// If there are no custom properties then null will be returned</remarks>
        /// <param name="shape"></param>
        /// <returns>A list of custom properties</returns>
        public static CustomPropertyDictionary Get(IVisio.Shape shape)
        {
            var prop_names = CustomPropertyHelper.GetNames(shape);
            var dic        = new CustomPropertyDictionary(prop_names.Count);
            var cells      = CustomPropertyCells.GetCells(shape);

            for (int prop_index = 0; prop_index < prop_names.Count(); prop_index++)
            {
                string prop_name = prop_names[prop_index];
                dic[prop_name] = cells[prop_index];
            }

            return(dic);
        }
Exemple #5
0
        public static List <CustomPropertyDictionary> Get(IVisio.Page page, IList <IVisio.Shape> shapes)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            if (shapes == null)
            {
                throw new ArgumentNullException(nameof(shapes));
            }

            var shapeids              = shapes.Select(s => s.ID).ToList();
            var customprops_dic       = new List <CustomPropertyDictionary>(shapeids.Count);
            var customprops_per_shape = CustomPropertyCells.GetCells(page, shapeids);

            if (customprops_per_shape.Count != shapeids.Count)
            {
                throw new InternalAssertionException();
            }

            for (int shape_index = 0; shape_index < shapeids.Count; shape_index++)
            {
                var shape = shapes[shape_index];
                var customprops_for_shape = customprops_per_shape[shape_index];
                var prop_names            = CustomPropertyHelper.GetNames(shape);

                if (customprops_for_shape.Count != prop_names.Count)
                {
                    throw new InternalAssertionException();
                }

                var dic = new CustomPropertyDictionary(prop_names.Count);

                for (int prop_index = 0; prop_index < prop_names.Count(); prop_index++)
                {
                    string prop_name = prop_names[prop_index];
                    dic[prop_name] = customprops_for_shape[prop_index];
                }

                customprops_dic.Add(dic);
            }

            return(customprops_dic);
        }
        public static List <CustomPropertyDictionary> GetCells(IVisio.Page page, IList <IVisio.Shape> shapes, CellValueType type)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            if (shapes == null)
            {
                throw new ArgumentNullException(nameof(shapes));
            }

            var shapeids = shapes.Select(s => s.ID).ToList();
            var customprops_per_shape = CustomPropertyCells.GetCells(page, shapeids, type);
            var customprops_dic       = create_dic(shapes, shapeids, customprops_per_shape);

            return(customprops_dic);
        }