Exemplo n.º 1
0
        private Rows <T> _shapesid_to_rows <T>(IList <int> shapeids, VisioAutomation.Collections.ArraySegmentEnumerator <T> seg_enumerator)
        {
            var rows = new Rows <T>(shapeids.Count);

            foreach (int shapeid in shapeids)
            {
                var row = this._shapedata_to_row((short)shapeid, seg_enumerator);
                rows.Add(row);
            }
            return(rows);
        }
Exemplo n.º 2
0
        public SectionQueryResults <string> GetFormulas(SurfaceTarget surface, ShapeIDPairs shapeidpairs)
        {
            // Store information about the sections we need to query
            var cache = _create_sectionquerycache(shapeidpairs);

            // Perform the query
            var srcstream = this._build_sidsrc_stream(shapeidpairs, cache);
            var values    = surface.GetFormulasU(srcstream);
            var reader    = new VisioAutomation.Collections.ArraySegmentEnumerator <string>(values);
            var results   = this._create_outputs_for_shapes(shapeidpairs, cache, reader);

            return(results);
        }
Exemplo n.º 3
0
        public SectionQueryShapeResults <string> GetFormulas(SurfaceTarget surface)
        {
            _RestrictToShapesOnly(surface);

            var shapeidpairs = ShapeIDPairs.FromShapes(surface.Shape);
            var cache        = this._create_sectionquerycache(shapeidpairs);

            var srcstream        = this._build_src_stream(cache);
            var values           = surface.GetFormulasU(srcstream);
            var shape_index      = 0;
            var shape_cache_item = cache[shape_index];
            var reader           = new VisioAutomation.Collections.ArraySegmentEnumerator <string>(values);
            var output_for_shape = this._create_output_for_shape(surface.ID16, shape_cache_item, reader);

            return(output_for_shape);
        }
Exemplo n.º 4
0
        public SectionQueryShapeResults <TResult> GetResults <TResult>(SurfaceTarget surface)
        {
            _RestrictToShapesOnly(surface);

            var shapeidpairs = ShapeIDPairs.FromShapes(surface.Shape);
            var cache        = this._create_sectionquerycache(shapeidpairs);

            var            srcstream        = this._build_src_stream(cache);
            const object[] unitcodes        = null;
            var            values           = surface.GetResults <TResult>(srcstream, unitcodes);
            var            shape_index      = 0;
            var            sectioncache     = cache[shape_index];
            var            reader           = new VisioAutomation.Collections.ArraySegmentEnumerator <TResult>(values);
            var            output_for_shape = this._create_output_for_shape(surface.ID16, sectioncache, reader);

            return(output_for_shape);
        }
Exemplo n.º 5
0
        private Row <T> _shapedata_to_row <T>(short shapeid, VisioAutomation.Collections.ArraySegmentEnumerator <T> seg_enumerator)
        {
            // From the reader, pull as many cells as there are columns
            int numcols           = this.Columns.Count;
            int original_seg_size = seg_enumerator.Count;
            var cells             = seg_enumerator.GetNextSegment(numcols);

            // verify that nothing strange has happened
            int final_seg_size = seg_enumerator.Count;

            if ((final_seg_size - original_seg_size) != numcols)
            {
                throw new Exceptions.InternalAssertionException("Unexpected cursor");
            }

            var sec_index = IVisio.VisSectionIndices.visSectionInval;
            var row       = new Row <T>(shapeid, sec_index, cells);

            return(row);
        }
Exemplo n.º 6
0
        private SectionQueryShapeResults <T> _create_output_for_shape <T>(short shapeid, ShapeCache shapecacheitems, VisioAutomation.Collections.ArraySegmentEnumerator <T> segreader)
        {
            int original_seg_count = segreader.Count;

            if (shapecacheitems == null)
            {
                throw new VisioAutomation.Exceptions.InternalAssertionException();
            }


            var results_rows = new List <SectionShapeRows <T> >(shapecacheitems.Count);

            foreach (var shapecacheitem in shapecacheitems)
            {
                var secindex         = shapecacheitem.SectionQueryColumns.SectionIndex;
                var sectionshaperows = new SectionShapeRows <T>(shapecacheitem.RowCount, shapeid, secindex);
                results_rows.Add(sectionshaperows);

                int num_cols = shapecacheitem.SectionQueryColumns.Count;
                foreach (int row_index in Enumerable.Range(0, shapecacheitem.RowCount))
                {
                    var cells       = segreader.GetNextSegment(num_cols);
                    var sec_res_row = new Row <T>(shapeid, secindex, cells);
                    sectionshaperows.Add(sec_res_row);
                }
            }

            var results = new SectionQueryShapeResults <T>(shapeid, results_rows);

            // the difference in the segment count must match the total number of output cells

            int final_seg_count     = segreader.Count;
            int segment_count_delta = final_seg_count - original_seg_count;
            int total_cell_count    = shapecacheitems.CountCells();

            if (segment_count_delta != total_cell_count)
            {
                throw new Exceptions.InternalAssertionException("Unexpected cursor");
            }

            return(results);
        }
Exemplo n.º 7
0
        private SectionQueryResults <T> _create_outputs_for_shapes <T>(ShapeIDPairs shapeidpairs, SectionQueryCache sectioncache, VisioAutomation.Collections.ArraySegmentEnumerator <T> segreader)
        {
            var results = new SectionQueryResults <T>();

            for (int pair_index = 0; pair_index < shapeidpairs.Count; pair_index++)
            {
                var pair             = shapeidpairs[pair_index];
                var shapecache       = sectioncache[pair_index];
                var output_for_shape = this._create_output_for_shape((short)pair.ShapeID, shapecache, segreader);
                results.Add(output_for_shape);
            }

            return(results);
        }