Ejemplo n.º 1
0
        private static List <CustomPropertyDictionary> create_dic(IList <IVisio.Shape> shapes, List <int> shapeids, List <List <CustomPropertyCells> > customprops_per_shape)
        {
            var customprops_dic = new List <CustomPropertyDictionary>(shapeids.Count);


            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 CustomPropertyDictionary GetCellsAsDictionary(IVisio.Shape shape, VASS.CellValueType type)


        {
            var pairs = __GetPairs(shape, type);
            var shape_custprop_dic = CustomPropertyDictionary.FromPairs(pairs);

            return(shape_custprop_dic);
        }
        internal static CustomPropertyDictionary FromPairs(List <CustomPropertyNameCellsPair> pairs)

        {
            var shape_custprop_dic = new CustomPropertyDictionary(pairs.Count);

            foreach (var pair in pairs)
            {
                shape_custprop_dic[pair.Name] = pair.Cells;
            }

            return(shape_custprop_dic);
        }
Ejemplo n.º 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);
        }
        public static List <CustomPropertyDictionary> _get_cells_as_list(
            ShapeIDPairs shapeidpairs,
            List <List <CustomPropertyCells> > customprops_per_shape)
        {
            if (customprops_per_shape.Count != shapeidpairs.Count)
            {
                throw new Exceptions.InternalAssertionException();
            }

            var listof_listof_cppair = __GetListOfCpPairLists(shapeidpairs, customprops_per_shape);
            var enumof_cpdic         = listof_listof_cppair.Select(i => CustomPropertyDictionary.FromPairs(i));
            var list_cpdic           = new List <CustomPropertyDictionary>(shapeidpairs.Count);

            list_cpdic.AddRange(enumof_cpdic);
            return(list_cpdic);
        }
Ejemplo n.º 6
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);
        }