Esempio n. 1
0
        public Dictionary <int, LockCells> GetLockCells(Models.TargetShapes targets, VASS.CellValueType cvt)
        {
            var cmdtarget = this._client.GetCommandTargetPage();

            targets = targets.ResolveShapes(this._client);
            if (targets.Shapes.Count < 1)
            {
                return(new Dictionary <int, LockCells>());
            }

            var dic = new Dictionary <int, LockCells>();

            var page            = cmdtarget.ActivePage;
            var target_shapeids = targets.Shapes.Select(s => (int)s.ID16).ToList();

            var cells = VisioAutomation.Shapes.LockCells.GetCells(page, target_shapeids, cvt);

            for (int i = 0; i < target_shapeids.Count; i++)
            {
                var shapeid   = target_shapeids[i];
                var cur_cells = cells[i];
                dic[shapeid] = cur_cells;
            }

            return(dic);
        }
Esempio n. 2
0
        public static UserDefinedCellDictionary GetDictionary(IVisio.Shape shape, VASS.CellValueType type)
        {
            var pairs = __GetPairs(shape, type);
            var dic   = UserDefinedCellDictionary.FromPairs(pairs);

            return(dic);
        }
        public static CustomPropertyDictionary GetDictionary(IVisio.Shape shape, VASS.CellValueType type)


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

            return(shape_custprop_dic);
        }
Esempio n. 4
0
        public static TextFormat GetFormat(IVisio.Shape shape, VASS.CellValueType type)
        {
            var cells = new TextFormat();

            cells.CharacterFormats = CharacterFormatCells.GetCells(shape, type);
            cells.ParagraphFormats = ParagraphFormatCells.GetCells(shape, type);
            cells.TextBlock        = TextHelper.GetTextBlockCells(shape, type);
            if (HasTextXFormCells(shape))
            {
                cells.TextXForm = TextXFormCells.GetCells(shape, type);
            }
            cells.CharacterTextRuns = TextFormat._get_text_runs(shape, IVisio.VisRunTypes.visCharPropRow, true);
            cells.ParagraphTextRuns = TextFormat._get_text_runs(shape, IVisio.VisRunTypes.visParaPropRow, true);
            cells.TabStops          = TextHelper.GetTabStops(shape);
            return(cells);
        }
        public static DataTable QueryToDataTable(
            VASS.Query.CellQuery query,
            VisioAutomation.ShapeSheet.CellValueType value_type,
            Models.ResultType result_type,
            IList <int> shapeids,
            VisioAutomation.SurfaceTarget surface)
        {
            if (value_type == VASS.CellValueType.Formula)
            {
                var output = query.GetFormulas(surface, shapeids);
                var dt     = DataTableHelpers.querytable_to_datatable(query, output);
                return(dt);
            }

            if (value_type != VASS.CellValueType.Result)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value_type));
            }

            if (result_type == ResultType.String)
            {
                var output = query.GetResults <string>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Bool)
            {
                var output = query.GetResults <string>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Double)
            {
                var output = query.GetResults <double>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else if (result_type == ResultType.Int)
            {
                var output = query.GetResults <int>(surface, shapeids);
                return(DataTableHelpers.querytable_to_datatable(query, output));
            }
            else
            {
                string msg = string.Format("Unsupported value of \"{0}\" for type {1}", result_type, nameof(result_type));
                throw new System.ArgumentOutOfRangeException(nameof(result_type), msg);
            }
        }
        public IDictionary <IVisio.Shape, CustomPropertyDictionary> GetCustomPropertiesAsShapeDictionary(TargetShapes targetshapes, VASS.CellValueType type)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);
            var dicof_shape_to_cpdic = new Dictionary <IVisio.Shape, CustomPropertyDictionary>();
            var listof_cpdic         = GetCustomProperties(targetshapes, type);

            for (int i = 0; i < listof_cpdic.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var cpdic = listof_cpdic[i];
                dicof_shape_to_cpdic[shape] = cpdic;
            }

            return(dicof_shape_to_cpdic);
        }
        public List <CustomPropertyDictionary> GetCustomProperties(TargetShapes targetshapes, VASS.CellValueType type)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(new List <CustomPropertyDictionary>(0));
            }

            var page         = targetshapes.Shapes[0].ContainingPage;
            var shapeidpairs = targetshapes.ToShapeIDPairs();
            var listof_cpdic = CustomPropertyHelper.GetDictionary(page, shapeidpairs, type);

            return(listof_cpdic);
        }
        private static List <UserDefinedCellNameCellsPair> __GetPairs(IVisio.Shape shape, VASS.CellValueType type)
        {
            var listof_udcellcells = UserDefinedCellCells.GetCells(shape, type);


            int num_udcells = listof_udcellcells.Count;

            var udcell_names = UserDefinedCellHelper.GetNames(shape);

            if (udcell_names.Count != num_udcells)
            {
                throw new VisioAutomation.Exceptions.InternalAssertionException("Unexpected number of user-define cell names");
            }

            int shapeid     = shape.ID16;
            var pairs       = new List <UserDefinedCellNameCellsPair>(num_udcells);
            var udcell_rows = Enumerable.Range(0, num_udcells);

            foreach (int udcell_row in udcell_rows)
            {
                var pair = new UserDefinedCellNameCellsPair(shapeid, udcell_row, udcell_names[udcell_row], listof_udcellcells[udcell_row]);
                pairs.Add(pair);
            }

            return(pairs);
        }
        public static List <UserDefinedCellCells> GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = UserDefinedCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(shape, type));
        }
        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);
        }
Esempio n. 11
0
        public static LockCells GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = LockCells_lazy_builder.Value;

            return(reader.GetCellsSingleRow(shape, type));
        }
        public static List <ShapeFormatCells> GetCells(IVisio.Page page, IList <int> shapeids, VASS.CellValueType type)
        {
            var reader = shape_format_lazy_builder.Value;

            return(reader.GetCellsSingleRow(page, shapeids, type));
        }
Esempio n. 13
0
        public static PageRulerAndGridCells GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = PageRulerAndGridCells_lazy_builder.Value;

            return(reader.GetCellsSingleRow(shape, type));
        }
Esempio n. 14
0
        public static List <List <CustomPropertyCells> > GetCells(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            var reader = Custom_Property_lazy_builder.Value;

            return(reader.GetCellsMultiRow(page, shapeidpairs, type));
        }
Esempio n. 15
0
        public static List <TextFormat> GetFormat(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            var shapeids = shapeidpairs.Select(s => s.ShapeID).ToList();

            var charcells      = CharacterFormatCells.GetCells(page, shapeidpairs, type);
            var paracells      = ParagraphFormatCells.GetCells(page, shapeidpairs, type);
            var textblockcells = TextHelper.GetTextBlockCells(page, shapeids, type);

            var page_shapes = page.Shapes;
            var formats     = new List <TextFormat>(shapeidpairs.Count);

            for (int i = 0; i < shapeidpairs.Count; i++)
            {
                var format = new TextFormat();
                format.CharacterFormats = charcells[i];
                format.ParagraphFormats = paracells[i];
                format.TextBlock        = textblockcells[i];
                formats.Add(format);

                var shape = page_shapes.ItemFromID[shapeidpairs[i].ShapeID];
                format.CharacterTextRuns = TextFormat._get_text_runs(shape, IVisio.VisRunTypes.visCharPropRow, true);
                format.ParagraphTextRuns = TextFormat._get_text_runs(shape, IVisio.VisRunTypes.visParaPropRow, true);

                format.TabStops = TextHelper.GetTabStops(shape);
            }

            return(formats);
        }
        public static List <ConnectionPointCells> GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = ConnectionPointCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(shape, type));
        }
        public static List <List <ConnectionPointCells> > GetCells(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            var reader = ConnectionPointCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(page, shapeidpairs, type));
        }
        public Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary> GetUserDefinedCells(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            var cmdtarget = this._client.GetCommandTargetPage();
            var dicof_shape_to_udcelldic = new Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary>();

            targetshapes = targetshapes.Resolve(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(dicof_shape_to_udcelldic);
            }

            var page             = cmdtarget.ActivePage;
            var shapeidpairs     = targetshapes.ToShapeIDPairs();
            var listof_udcelldic = VA.Shapes.UserDefinedCellHelper.GetCellsAsDictionary((IVisio.Page)page, shapeidpairs, cvt);

            for (int i = 0; i < targetshapes.Shapes.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var props = listof_udcelldic[i];
                dicof_shape_to_udcelldic[shape] = props;
            }

            return(dicof_shape_to_udcelldic);
        }
Esempio n. 19
0
        public Dictionary <int, VA.Shapes.LockCells> GetLockCells(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            targetshapes = targetshapes.Resolve(this._client);
            if (targetshapes.Shapes.Count < 1)
            {
                return(new Dictionary <int, VA.Shapes.LockCells>());
            }

            var dic = new Dictionary <int, VA.Shapes.LockCells>();

            var page = targetshapes.Shapes[0].ContainingPage;

            var target_shapeids = targetshapes.ToShapeIDs();

            var cells = VisioAutomation.Shapes.LockCells.GetCells(page, target_shapeids, cvt);

            for (int i = 0; i < target_shapeids.Count; i++)
            {
                var shapeid   = target_shapeids[i];
                var cur_cells = cells[i];
                dic[shapeid] = cur_cells;
            }

            return(dic);
        }
        public static List <List <ParagraphFormatCells> > GetCells(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)

        {
            var reader = ParagraphFormatCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(page, shapeidpairs, type));
        }
        public Dictionary <IVisio.Shape, IList <HyperlinkCells> > GetHyperlinks(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(new Dictionary <IVisio.Shape, IList <HyperlinkCells> >(0));
            }

            var dic = new Dictionary <IVisio.Shape, IList <HyperlinkCells> >();

            foreach (var shape in targetshapes.Shapes)
            {
                var hyperlinks = HyperlinkCells.GetCells(shape, cvt);
                dic[shape] = hyperlinks;
            }
            return(dic);
        }
        public static List <ParagraphFormatCells> GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = ParagraphFormatCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(shape, type));
        }
        // ----------------------------------------
        // ----------------------------------------
        // ----------------------------------------
        // ----------------------------------------

        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);
        }
        public static List <List <CharacterFormatCells> > GetCells(IVisio.Page page, ShapeIDPairs pairs, VASS.CellValueType type)
        {
            var reader = CharacterFormatCells_lazy_builder.Value;

            return(reader.GetCellsMultiRow(page, pairs, type));
        }
Esempio n. 25
0
        public static List <LockCells> GetCells(IVisio.Page page, IList <int> shapeid, VASS.CellValueType type)
        {
            var reader = LockCells_lazy_builder.Value;

            return(reader.GetCellsSingleRow(page, shapeid, type));
        }
Esempio n. 26
0
        public Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary> GetUserDefinedCellsAsShapeDictionary(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);
            var listof_udcelldic = GetUserDefinedCells(targetshapes, cvt);

            var dicof_shape_to_udcelldic = new Dictionary <IVisio.Shape, VA.Shapes.UserDefinedCellDictionary>();

            for (int i = 0; i < listof_udcelldic.Count; i++)
            {
                var shape = targetshapes.Shapes[i];
                var props = listof_udcelldic[i];
                dicof_shape_to_udcelldic[shape] = props;
            }

            return(dicof_shape_to_udcelldic);
        }
        private static List <List <UserDefinedCellNameCellsPair> > __GetPairs(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            var list_list_udcells = UserDefinedCellCells.GetCells(page, shapeidpairs, type);
            int num_shapes        = shapeidpairs.Count;
            var list_list_pairs   = new List <List <UserDefinedCellNameCellsPair> >(num_shapes);
            var shape_indices     = Enumerable.Range(0, num_shapes);

            foreach (int shape_index in shape_indices)
            {
                var shapeidpair  = shapeidpairs[shape_index];
                var udcell_names = UserDefinedCellHelper.GetNames(shapeidpair.Shape);
                var list_udcells = list_list_udcells[shape_index];
                var list_pairs   = __CreateNamePairs(shapeidpair.ShapeID, udcell_names, list_udcells);


                list_list_pairs.Add(list_pairs);
            }

            return(list_list_pairs);
        }
Esempio n. 28
0
        public List <VA.Shapes.UserDefinedCellDictionary> GetUserDefinedCells(TargetShapes targetshapes, VASS.CellValueType cvt)
        {
            targetshapes = targetshapes.ResolveToShapes(this._client);

            if (targetshapes.Shapes.Count < 1)
            {
                return(new List <VA.Shapes.UserDefinedCellDictionary>(0));
            }

            var page             = targetshapes.Shapes[0].ContainingPage;
            var shapeidpairs     = targetshapes.ToShapeIDPairs();
            var listof_udcelldic = VA.Shapes.UserDefinedCellHelper.GetDictionary((IVisio.Page)page, shapeidpairs, cvt);

            return(listof_udcelldic);
        }
        public static List <UserDefinedCellDictionary> GetCellsAsDictionary(IVisio.Page page, ShapeIDPairs shapeidpairs, VASS.CellValueType type)
        {
            int num_shapes     = shapeidpairs.Count;
            var list_list_pair = __GetPairs(page, shapeidpairs, type);

            var list_dic = new List <UserDefinedCellDictionary>(num_shapes);
            var dics     = list_list_pair.Select(list_pair => UserDefinedCellDictionary.FromPairs(list_pair));

            list_dic.AddRange(dics);

            return(list_dic);
        }
Esempio n. 30
0
        public static List <CustomPropertyCells> GetCells(IVisio.Shape shape, VASS.CellValueType type)
        {
            var reader = Custom_Property_lazy_builder.Value;

            return(reader.GetCellsMultiRow(shape, type));
        }