Пример #1
0
        public bool section_is_skippable(VA.ShapeSheet.SRC src)
        {
            bool can_skip = (src.Section == (short)IVisio.VisSectionIndices.visSectionFirst) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionFirstComponent) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionLast) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionInval) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionNone) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionFirst) ||
                            (src.Section == (short)IVisio.VisSectionIndices.visSectionLastComponent);

            return(can_skip);
        }
Пример #2
0
        private short [] build_stream()
        {
            var st = this._first_update.Value.StreamType;

            if (st == StreamType.SRC)
            {
                var streamb = new List <SRC>(this._updates.Count);
                streamb.AddRange(this._updates.Select(i => i.SIDSRC.SRC));
                return(SRC.ToStream(streamb));
            }
            else
            {
                var streamb = new List <SIDSRC>(this._updates.Count);
                streamb.AddRange(this._updates.Select(i => i.SIDSRC));
                return(SIDSRC.ToStream(streamb));
            }
        }
        public static void SetTabStops(IVisio.Shape shape, IList<TabStop> stops)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            if (stops == null)
            {
                throw new System.ArgumentNullException(nameof(stops));
            }

            TextFormat.ClearTabStops(shape);
            if (stops.Count < 1)
            {
                return;
            }

            const short row = 0;
            var invariant_culture = System.Globalization.CultureInfo.InvariantCulture;
            var vis_tab_stop_count = (short)IVisio.VisCellIndices.visTabStopCount;
            var tabstopcountcell = shape.CellsSRC[TextFormat.tab_section, row, vis_tab_stop_count];
            tabstopcountcell.FormulaU = stops.Count.ToString(invariant_culture);

            // set the number of tab stobs allowed for the shape
            var tagtab = TextFormat.GetTabTagForStops(stops.Count);
            shape.RowType[TextFormat.tab_section, (short)IVisio.VisRowIndices.visRowTab] = (short)tagtab;

            // add tab properties for each stop
            var update = new ShapeSheet.Update();
            for (int stop_index = 0; stop_index < stops.Count; stop_index++)
            {
                int i = stop_index * 3;

                var alignment = ((int)stops[stop_index].Alignment).ToString(invariant_culture);
                var position = ((int)stops[stop_index].Position).ToString(invariant_culture);

                var src_tabpos = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 1));
                var src_tabalign = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 2));
                var src_tabother = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 3));

                update.SetFormula(src_tabpos, position); // tab position
                update.SetFormula(src_tabalign, alignment); // tab alignment
                update.SetFormula(src_tabother, "0"); // tab unknown
            }

            update.Execute(shape);
        }
Пример #4
0
 public bool AreEqual(SRC other)
 {
     return((this.Section == other.Section) && (this.Row == other.Row) && (this.Cell == other.Cell));
 }
Пример #5
0
 public SIDSRC(
     short id,
     SRC src)
     : this(id,src.Section,src.Row,src.Cell)
 {
 }
Пример #6
0
 public void SetResult(SRC streamitem, double value, IVisio.VisUnitCodes unitcode)
 {
     this._SetResult(StreamType.SRC, new SIDSRC(-1, streamitem), value, unitcode);
 }
Пример #7
0
 public void SetFormulaIgnoreNull(SRC streamitem, FormulaLiteral formula)
 {
     this._SetFormulaIgnoreNull(StreamType.SRC, new SIDSRC(-1, streamitem), formula);
 }
Пример #8
0
        public void SetFormula(short shapeid, SRC src, FormulaLiteral formula)
        {
            var streamitem = new SIDSRC(shapeid, src);

            this._SetFormula(StreamType.SIDSRC, streamitem, formula);
        }
Пример #9
0
 public SIDSRC(
     short id,
     SRC src) : this(id, src.Section, src.Row, src.Cell)
 {
 }
Пример #10
0
        public void SetResult(short shapeid, SRC src, string value, IVisio.VisUnitCodes unitcode)
        {
            var streamitem = new SIDSRC(shapeid, src);

            this._SetResult(StreamType.SIDSRC, streamitem, value, unitcode);
        }
Пример #11
0
        public void AddCell(short id, VisioAutomation.ShapeSheet.SRC src)
        {
            var sidsrc = new VisioAutomation.ShapeSheet.SIDSRC(id, src);

            this.SIDSRCs.Add(sidsrc);
        }
Пример #12
0
 public bool AreEqual(SRC other)
 {
     return ((this.Section == other.Section) && (this.Row == other.Row) && (this.Cell == other.Cell));
 }
Пример #13
0
        public void SetFormula(short id, VisioAutomation.ShapeSheet.SRC src, string formula)
        {
            var sidsrc = new VisioAutomation.ShapeSheet.SIDSRC(id, src);

            this.formula_writer.SetFormula(sidsrc, formula);
        }
        /// <summary>
        /// Remove all tab stops on the shape
        /// </summary>
        /// <param name="shape"></param>
        private static void ClearTabStops(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            int num_existing_tabstops = TextFormat.GetTabStopCount(shape);

            if (num_existing_tabstops < 1)
            {
                return;
            }

            var cell_tabstopcount = shape.CellsSRC[TextFormat.src_tabstopcount.Section, TextFormat.src_tabstopcount.Row, TextFormat.src_tabstopcount.Cell];
            cell_tabstopcount.FormulaForce = "0";

            const string formula = "0";

            var update = new ShapeSheet.Update();
            for (int i = 1; i < num_existing_tabstops * 3; i++)
            {
                var src = new ShapeSheet.SRC(TextFormat.tab_section, (short)IVisio.VisRowIndices.visRowTab,
                                                (short)i);
                update.SetFormula(src, formula);
            }

            update.Execute(shape);
        }
Пример #15
0
        public void SetFormulaIgnoreNull(short id, SRC src, FormulaLiteral formula)
        {
            var sidsrc = new SIDSRC(id, src);

            this._SetFormulaIgnoreNull(StreamType.SIDSRC, sidsrc, formula);
        }
        private static IList<TabStop> GetTabStops(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            int num_stops = TextFormat.GetTabStopCount(shape);

            if (num_stops < 1)
            {
                return new List<TabStop>(0);
            }

            const short row = 0;


            var srcs = new List<ShapeSheet.SRC>(num_stops*3);
            for (int stop_index = 0; stop_index < num_stops; stop_index++)
            {
                int i = stop_index * 3;
                
                var src_tabpos = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 1));
                var src_tabalign = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 2));
                var src_tabother = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 3));

                srcs.Add(src_tabpos);
                srcs.Add(src_tabalign );
                srcs.Add(src_tabother);
            }

            var surface = new ShapeSheet.ShapeSheetSurface(shape);


            var stream = ShapeSheet.SRC.ToStream(srcs);
            var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList();
            var results = surface.GetResults_SRC<double>(stream, unitcodes);

            var stops_list = new List<TabStop>(num_stops);
            for (int stop_index = 0; stop_index < num_stops; stop_index++)
            {
                var pos = results[(stop_index*3) + 1];
                var align = (TabStopAlignment) ((int)results[(stop_index*3) + 2]);
                var ts = new TabStop(pos, align);
                stops_list.Add(ts);
            }

            return stops_list;
        }
Пример #17
0
        public void Add(VisioAutomation.ShapeSheet.SRC src, FormatCategory category, string name)
        {
            var format_cell = new FormatPaintCell(src, name, category);

            this.Cells.Add(format_cell);
        }