public static List <TabStop> GetTabStops(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            int num_stops = _get_tab_stop_count(shape);

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

            const short row = 0;

            var srcs = new List <VASS.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(tab_section, row, (short)(i + 1));
                var src_tabalign = new ShapeSheet.Src(tab_section, row, (short)(i + 2));
                var src_tabother = new ShapeSheet.Src(tab_section, row, (short)(i + 3));

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

            var streamarray = VASS.Streams.StreamArray.FromSrc(srcs);

            var surface = new SurfaceTarget(shape);

            const object[] unitcodes = null;

            var results = surface.GetResults <double>(streamarray, 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);
        }
        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);
        }
        public void Text_TabStops_Set()
        {
            var no_tab_stops = new VisioAutomation.Text.TabStop[] { };
            var tabstops     = new[]
            {
                new VisioAutomation.Text.TabStop(0.5, VATEXT.TabStopAlignment.Left),
                new VisioAutomation.Text.TabStop(1.5, VATEXT.TabStopAlignment.Right),
                new VisioAutomation.Text.TabStop(2.5, VATEXT.TabStopAlignment.Center),
                new VisioAutomation.Text.TabStop(4.0, VATEXT.TabStopAlignment.Decimal)
            };

            var page1 = this.GetNewPage();

            var s1 = page1.DrawRectangle(0, 0, 4, 4);

            // shapes shoould not have any tab stops by default
            var m0 = VATEXT.TextFormat.GetFormat(s1, VASS.CellValueType.Formula);

            Assert.AreEqual(0, m0.TabStops.Count);

            // clearing tab stops shoudl work even if there are no tab stops
            VATEXT.TextHelper.SetTabStops(s1, no_tab_stops);
            var m1 = VATEXT.TextFormat.GetFormat(s1, VASS.CellValueType.Formula);

            Assert.AreEqual(0, m1.TabStops.Count);

            // set the 3 tab stops
            VATEXT.TextHelper.SetTabStops(s1, tabstops);

            // should have exactly the same number we set
            var m2 = VATEXT.TextFormat.GetFormat(s1, VASS.CellValueType.Formula);

            Assert.AreEqual(tabstops.Length, m2.TabStops.Count);
            Assert.AreEqual(0.5, tabstops[0].Position);
            Assert.AreEqual(1.5, tabstops[1].Position);
            Assert.AreEqual(2.5, tabstops[2].Position);
            Assert.AreEqual(4.0, tabstops[3].Position);
            Assert.AreEqual(VATEXT.TabStopAlignment.Left, tabstops[0].Alignment);
            Assert.AreEqual(VATEXT.TabStopAlignment.Right, tabstops[1].Alignment);
            Assert.AreEqual(VATEXT.TabStopAlignment.Center, tabstops[2].Alignment);
            Assert.AreEqual(VATEXT.TabStopAlignment.Decimal, tabstops[3].Alignment);

            // clear the tab stops
            VATEXT.TextHelper.SetTabStops(s1, no_tab_stops);
            var m3 = VATEXT.TextFormat.GetFormat(s1, VASS.CellValueType.Formula);

            Assert.AreEqual(0, m3.TabStops.Count);

            page1.Delete(0);
        }
        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;
        }