Beispiel #1
0
        public static IVisio.Shape DrawQuarterArc(this IVisio.Shape shape, VA.Drawing.Point p0, VA.Drawing.Point p1, IVisio.VisArcSweepFlags flags)
        {
            var surface = new VA.Drawing.DrawingSurface(shape);
            var s       = surface.DrawQuarterArc(p0, p1, flags);

            return(s);
        }
Beispiel #2
0
        public static VA.Drawing.Rectangle GetBoundingBox(this IVisio.Shape shape, IVisio.VisBoundingBoxArgs args)
        {
            var surface = new VA.Drawing.DrawingSurface(shape);
            var r       = surface.GetBoundingBox(args);

            return(r);
        }
Beispiel #3
0
        public VA.Drawing.DrawingSurface GetDrawingSurfaceSafe()
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var surf_Application    = this.Client.VisioApplication;
            var surf_Window         = surf_Application.ActiveWindow;
            var surf_Window_subtype = surf_Window.SubType;

            IVisio.Master surf_Master = null;
            IVisio.Page   surf_Page   = null;

            if (surf_Window_subtype == 64)
            {
                this.Client.WriteVerbose("Window = Master Editing");
                surf_Master = (IVisio.Master)surf_Window.Master;
                var surface = new VA.Drawing.DrawingSurface(surf_Master);
                return(surface);
            }
            else
            {
                this.Client.WriteVerbose("Window = Page ");
                surf_Page = surf_Application.ActivePage;
                var surface = new VA.Drawing.DrawingSurface(surf_Page);
                return(surface);
            }
        }
Beispiel #4
0
        public static IVisio.Shape DrawLine(this IVisio.Shape shape, VA.Drawing.Point p1, VA.Drawing.Point p2)
        {
            var surface = new VA.Drawing.DrawingSurface(shape);
            var s       = surface.DrawLine(p1, p2);

            return(s);
        }
        public VA.Drawing.DrawingSurface GetDrawingSurfaceSafe()
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var surf_Application = this.Client.VisioApplication;
            var surf_Window = surf_Application.ActiveWindow;
            var surf_Window_subtype = surf_Window.SubType;

            IVisio.Master surf_Master = null;
            IVisio.Page surf_Page = null;

            if (surf_Window_subtype == 64)
            {
                this.Client.WriteVerbose("Window = Master Editing");
                surf_Master = (IVisio.Master)surf_Window.Master;
                var surface = new VA.Drawing.DrawingSurface(surf_Master);
                return surface;

            }
            else
            {
                this.Client.WriteVerbose("Window = Page ");
                surf_Page = surf_Application.ActivePage;
                var surface = new VA.Drawing.DrawingSurface(surf_Page);
                return surface;
            }
        }
Beispiel #6
0
        public static IVisio.Shape DrawRectangle(this IVisio.Page page, VA.Drawing.Rectangle rect)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            var shape   = surface.DrawRectangle(rect);

            return(shape);
        }
Beispiel #7
0
        public static IVisio.Shape DrawPolyline(this IVisio.Page page, IList <VA.Drawing.Point> points)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            var shape   = surface.DrawBezier(points);

            return(shape);
        }
Beispiel #8
0
        public static IVisio.Shape DrawBezier(this IVisio.Page page, IList <VA.Drawing.Point> points, short degree, short flags)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            var shape   = surface.DrawBezier(points, degree, flags);

            return(shape);
        }
Beispiel #9
0
        public VisioAutomation.Drawing.DrawingSurface GetDrawingSurface()
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            var surf_Application    = this._client.Application.Get();
            var surf_Window         = surf_Application.ActiveWindow;
            var surf_Window_subtype = surf_Window.SubType;

            // TODO: Revisit the logic here
            // TODO: And what about a selected shape as a surface?

            this._client.WriteVerbose("Window SubType: {0}", surf_Window_subtype);
            if (surf_Window_subtype == 64)
            {
                this._client.WriteVerbose("Window = Master Editing");
                var surf_Master = (IVisio.Master)surf_Window.Master;
                var surface     = new VisioAutomation.Drawing.DrawingSurface(surf_Master);
                return(surface);
            }
            else
            {
                this._client.WriteVerbose("Window = Page ");
                var surf_Page = surf_Application.ActivePage;
                var surface   = new VisioAutomation.Drawing.DrawingSurface(surf_Page);
                return(surface);
            }
        }
Beispiel #10
0
        public static IVisio.Shape DrawLine(this IVisio.Page page, VA.Drawing.Point p1, VA.Drawing.Point p2)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            var shape   = surface.DrawLine(p1.X, p1.Y, p2.X, p2.Y);

            return(shape);
        }
 public static IVisio.Shape Drop(
     this IVisio.Page page,
     IVisio.Master master,
     VA.Drawing.Point point)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     return surface.Drop(master, point);
 }
 public static IVisio.Shape DrawNURBS(this IVisio.Page page, IList<VA.Drawing.Point> controlpoints,
     IList<double> knots,
     IList<double> weights, int degree)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     var shape = surface.DrawNURBS(controlpoints, knots, weights, degree);
     return shape;
 }
Beispiel #13
0
        public QueryResultList <string> GetFormulas(VA.Drawing.DrawingSurface surface, IList <int> shapeids)
        {
            this.Freeze();
            var srcstream = BuildSIDSRCStream(surface, shapeids);
            var values    = surface.GetFormulasU_4(srcstream);
            var list      = FillValuesForMultipleShapes(shapeids, values);

            return(list);
        }
Beispiel #14
0
        public static IVisio.Shape DrawNURBS(this IVisio.Page page, IList <VA.Drawing.Point> controlpoints,
                                             IList <double> knots,
                                             IList <double> weights, int degree)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            var shape   = surface.DrawNURBS(controlpoints, knots, weights, degree);

            return(shape);
        }
Beispiel #15
0
        private short[] BuildSRCStream(VA.Drawing.DrawingSurface surface)
        {
            if (surface.Shape == null)
            {
                string msg = string.Format("Shape must be set in surface not page or master");
                throw new VA.AutomationException(msg);
            }

            this.PerShapeSectionInfo = new List <List <SectionQueryInfo> >();

            if (this.Sections.Count > 0)
            {
                var section_infos = new List <SectionQueryInfo>();
                foreach (var sec in this.Sections)
                {
                    // Figure out which rows to query
                    int num_rows     = surface.Shape.RowCount[(short)sec.SectionIndex];
                    var section_info = new SectionQueryInfo(sec, surface.Shape.ID16, num_rows);
                    section_infos.Add(section_info);
                }
                this.PerShapeSectionInfo.Add(section_infos);
            }

            int total = this.GetTotalCellCount(1);

            var stream_builder = new StreamBuilder(3, total);

            foreach (var col in this.Columns)
            {
                var src = col.SRC;
                stream_builder.Add(src.Section, src.Row, src.Cell);
            }

            // And then the sections if any exist
            if (this.PerShapeSectionInfo.Count > 0)
            {
                var data_for_shape = this.PerShapeSectionInfo[0];
                foreach (var section in data_for_shape)
                {
                    foreach (int rowindex in section.RowIndexes)
                    {
                        foreach (var col in section.SectionQuery.Columns)
                        {
                            stream_builder.Add((short)section.SectionQuery.SectionIndex, (short)rowindex, col.SRC.Cell);
                        }
                    }
                }
            }

            if (stream_builder.ChunksWrittenCount != total)
            {
                string msg = string.Format("Expected {0} Checks to be written. Actual = {1}", total, stream_builder.ChunksWrittenCount);
                throw new VA.AutomationException(msg);
            }

            return(stream_builder.Stream);
        }
Beispiel #16
0
        public static IVisio.Shape Drop(
            this IVisio.Page page,
            IVisio.Master master,
            VA.Drawing.Point point)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            return(surface.Drop(master, point));
        }
Beispiel #17
0
        public static short[] DropManyU(
            this IVisio.Page page,
            IList <IVisio.Master> masters,
            IEnumerable <VA.Drawing.Point> points)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            short[] shapeids = surface.DropManyU(masters, points);
            return(shapeids);
        }
Beispiel #18
0
        public QueryResultList <T> GetResults <T>(VA.Drawing.DrawingSurface surface, IList <int> shapeids)
        {
            this.Freeze();
            var srcstream = BuildSIDSRCStream(surface, shapeids);
            var unitcodes = this.BuildUnitCodeArray(shapeids.Count);
            var values    = surface.GetResults_4 <T>(srcstream, unitcodes);
            var list      = FillValuesForMultipleShapes(shapeids, values);

            return(list);
        }
Beispiel #19
0
        public QueryResult <string> GetFormulas(IVisio.Shape shape)
        {
            this.Freeze();
            var surface   = new VA.Drawing.DrawingSurface(shape);
            var srcstream = BuildSRCStream(surface);
            var values    = surface.GetFormulasU_3(srcstream);
            var r         = new QueryResult <string>(shape.ID);

            FillValuesForShape <string>(values, r, 0, 0);

            return(r);
        }
Beispiel #20
0
        private static IList <TabStop> GetTabStops(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            int num_stops = VA.Text.TextFormat.GetTabStopCount(shape);

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

            const short row = 0;


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

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

            var surface = new VA.Drawing.DrawingSurface(shape);


            var stream    = VA.ShapeSheet.SRC.ToStream(srcs);
            var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList();
            var results   = surface.GetResults_3 <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 = (VA.Text.TabStopAlignment)((int)results[(stop_index * 3) + 2]);
                var ts    = new VA.Text.TabStop(pos, align);
                stops_list.Add(ts);
            }

            return(stops_list);
        }
Beispiel #21
0
        public QueryResult <T> GetResults <T>(IVisio.Shape shape)
        {
            this.Freeze();

            var surface = new VA.Drawing.DrawingSurface(shape);

            var srcstream = BuildSRCStream(surface);
            var unitcodes = this.BuildUnitCodeArray(1);
            var values    = surface.GetResults_3 <T>(srcstream, unitcodes);
            var r         = new QueryResult <T>(shape.ID);

            FillValuesForShape <T>(values, r, 0, 0);
            return(r);
        }
Beispiel #22
0
        private short[] BuildSIDSRCStream(VA.Drawing.DrawingSurface surface, IList <int> shapeids)
        {
            CalculatePerShapeInfo(surface, shapeids);

            int total = this.GetTotalCellCount(shapeids.Count);

            var stream_builder = new StreamBuilder(4, total);

            for (int i = 0; i < shapeids.Count; i++)
            {
                // For each shape add the cells to query
                var shapeid = shapeids[i];
                foreach (var col in this.Columns)
                {
                    var src = col.SRC;
                    stream_builder.Add((short)shapeid, src.Section, src.Row, src.Cell);
                }

                // And then the sections if any exist
                if (this.PerShapeSectionInfo.Count > 0)
                {
                    var data_for_shape = this.PerShapeSectionInfo[i];
                    foreach (var section in data_for_shape)
                    {
                        foreach (int rowindex in section.RowIndexes)
                        {
                            foreach (var col in section.SectionQuery.Columns)
                            {
                                stream_builder.Add(
                                    (short)shapeid,
                                    (short)section.SectionQuery.SectionIndex,
                                    (short)rowindex,
                                    col.SRC.Cell);
                            }
                        }
                    }
                }
            }

            if (stream_builder.ChunksWrittenCount != total)
            {
                string msg = string.Format("Expected {0} Checks to be written. Actual = {1}", total, stream_builder.ChunksWrittenCount);
                throw new VA.AutomationException(msg);
            }

            return(stream_builder.Stream);
        }
   	    public static short[] DropManyU(this IVisio.Page page, IList<IVisio.Master> masters, IEnumerable<VA.Drawing.Point> points, IList<string> names)
        {
            var surface = new VA.Drawing.DrawingSurface(page);
            short[] shapeids = surface.DropManyU(masters, points);

            if (names != null)
            {
                var page_shapes = page.Shapes;
                //ShapeIDs should come back in the same order... if Names for the masters are passed in, assign the Name. Makes it easier to find later
                for (int i = 0; i < shapeids.Length; i++)
                {
                    var shapeid = shapeids[i];
                    var cur_shape = page_shapes[shapeid];
                    cur_shape.Name = names[i];
                }
            }
            return shapeids;
        }
        public static short[] DropManyU(this IVisio.Page page, IList <IVisio.Master> masters, IEnumerable <VA.Drawing.Point> points, IList <string> names)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            short[] shapeids = surface.DropManyU(masters, points);

            if (names != null)
            {
                var page_shapes = page.Shapes;
                //ShapeIDs should come back in the same order... if Names for the masters are passed in, assign the Name. Makes it easier to find later
                for (int i = 0; i < shapeids.Length; i++)
                {
                    var shapeid   = shapeids[i];
                    var cur_shape = page_shapes[shapeid];
                    cur_shape.Name = names[i];
                }
            }
            return(shapeids);
        }
Beispiel #25
0
        private void CalculatePerShapeInfo(VA.Drawing.DrawingSurface surface, IList <int> shapeids)
        {
            this.PerShapeSectionInfo = new List <List <SectionQueryInfo> >();

            if (this.Sections.Count < 1)
            {
                return;
            }

            var pageshapes = surface.Shapes;

            // For each shapeid fetch the corresponding shape from the page
            // this is needed because we'll need to get per shape section information
            var shapes = new List <IVisio.Shape>(shapeids.Count);

            foreach (int shapeid in shapeids)
            {
                var shape = pageshapes.ItemFromID16[(short)shapeid];
                shapes.Add(shape);
            }

            for (int n = 0; n < shapeids.Count; n++)
            {
                var shapeid = (short)shapeids[n];
                var shape   = shapes[n];

                var section_infos = new List <SectionQueryInfo>(this.Sections.Count);
                foreach (var sec in this.Sections)
                {
                    int num_rows     = GetNumRowsForSection(shape, sec);
                    var section_info = new SectionQueryInfo(sec, shapeid, num_rows);
                    section_infos.Add(section_info);
                }
                this.PerShapeSectionInfo.Add(section_infos);
            }

            if (shapeids.Count != this.PerShapeSectionInfo.Count)
            {
                string msg = string.Format("Expected {0} PerShape structs. Actual = {1}", shapeids.Count, this.PerShapeSectionInfo.Count);
                throw new VA.AutomationException(msg);
            }
        }
Beispiel #26
0
        public QueryResultList <CellData <T> > GetFormulasAndResults <T>(VA.Drawing.DrawingSurface surface, IList <int> shapeids)
        {
            this.Freeze();

            var srcstream = BuildSIDSRCStream(surface, shapeids);
            var unitcodes = this.BuildUnitCodeArray(shapeids.Count);

            T[]      results  = surface.GetResults_4 <T>(srcstream, unitcodes);
            string[] formulas = surface.GetFormulasU_4(srcstream);

            // Merge the results and formulas
            var combined_data = new CellData <T> [results.Length];

            for (int i = 0; i < results.Length; i++)
            {
                combined_data[i] = new CellData <T>(formulas[i], results[i]);
            }

            var r = FillValuesForMultipleShapes(shapeids, combined_data);

            return(r);
        }
Beispiel #27
0
        public QueryResult <CellData <T> > GetFormulasAndResults <T>(IVisio.Shape shape)
        {
            this.Freeze();

            var surface = new VA.Drawing.DrawingSurface(shape);

            var srcstream = BuildSRCStream(surface);
            var unitcodes = this.BuildUnitCodeArray(1);
            var formulas  = surface.GetFormulasU_3(srcstream);
            var results   = surface.GetResults_3 <T>(srcstream, unitcodes);

            var combineddata = new CellData <T> [results.Length];

            for (int i = 0; i < results.Length; i++)
            {
                combineddata[i] = new CellData <T>(formulas[i], results[i]);
            }

            var r = new QueryResult <CellData <T> >(shape.ID16);

            FillValuesForShape <CellData <T> >(combineddata, r, 0, 0);
            return(r);
        }
Beispiel #28
0
        public QueryResultList <CellData <T> > GetFormulasAndResults <T>(IVisio.Page page, IList <int> shapeids)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            return(GetFormulasAndResults <T>(surface, shapeids));
        }
 public static IVisio.Shape DrawPolyline(this IVisio.Page page, IList<VA.Drawing.Point> points)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     var shape = surface.DrawBezier(points);
     return shape;
 }
 public static IVisio.Shape DrawRectangle(this IVisio.Page page, VA.Drawing.Rectangle rect)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     var shape = surface.DrawRectangle(rect);
     return shape;
 }
 public static short[] DropManyU(
     this IVisio.Page page,
     IList<IVisio.Master> masters,
     IEnumerable<VA.Drawing.Point> points)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     short[] shapeids = surface.DropManyU(masters, points);
     return shapeids;
 }
Beispiel #32
0
        private void _Execute(VA.Drawing.DrawingSurface surface)
        {
            // Do nothing if there aren't any updates
            if (this.updates.Count < 1)
            {
                return;
            }

            if (surface.Shape != null)
            {
                if (first_update.Value.StreamType == StreamType.SIDSRC)
                {
                    throw new VA.AutomationException("Contains a SIDSRC updates. Need SRC updates");
                }
            }
            else if (surface.Master != null)
            {
                if (first_update.Value.StreamType == StreamType.SIDSRC)
                {
                    throw new VA.AutomationException("Contains a SIDSRC updates. Need SRC updates");
                }
            }
            else if (surface.Page != null)
            {
                if (first_update.Value.StreamType == StreamType.SRC)
                {
                    throw new VA.AutomationException("Contains a SRC updates. Need SIDSRC updates");
                }
            }

            var stream = this.build_stream();

            if (first_update.Value.UpdateType == UpdateType.ResultNumeric || first_update.Value.UpdateType == UpdateType.ResultString)
            {
                // Set Results

                // Create the unitcodes and results arrays
                var unitcodes = new object[this.updates.Count];
                var results   = new object[this.updates.Count];
                int i         = 0;
                foreach (var update in this.updates)
                {
                    unitcodes[i] = update.UnitCode;
                    if (update.UpdateType == UpdateType.ResultNumeric)
                    {
                        results[i] = update.ResultNumeric;
                    }
                    else if (update.UpdateType == UpdateType.ResultString)
                    {
                        results[i] = update.ResultString;
                    }
                    else
                    {
                        throw new AutomationException("Unhandled update type");
                    }
                    i++;
                }

                var flags = this.ResultFlags;

                if (first_update.Value.UpdateType == UpdateType.ResultNumeric)
                {
                }
                else if (first_update.Value.UpdateType == UpdateType.ResultString)
                {
                    flags |= IVisio.VisGetSetArgs.visGetStrings;
                }

                surface.SetResults(stream, unitcodes, results, (short)flags);
            }
            else
            {
                // Set Formulas

                // Create the formulas array
                var formulas = new object[this.updates.Count];
                int i        = 0;
                foreach (var rec in this.updates)
                {
                    formulas[i] = rec.Formula;
                    i++;
                }

                var flags = this.FormulaFlags;

                int c = surface.SetFormulas(stream, formulas, (short)flags);
            }
        }
Beispiel #33
0
 public static System.Data.DataTable QueryToDataTable(VA.ShapeSheet.Query.CellQuery cellQuery, bool getresults, ResultType ResultType, IList <int> shapeids, VA.Drawing.DrawingSurface surface)
 {
     if (getresults)
     {
         if (ResultType == ResultType.String)
         {
             var output = cellQuery.GetResults <string>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Boolean)
         {
             var output = cellQuery.GetResults <bool>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Double)
         {
             var output = cellQuery.GetResults <double>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else if (ResultType == ResultType.Integer)
         {
             var output = cellQuery.GetResults <int>(surface, shapeids);
             return(Helpers.querytable_to_datatable(cellQuery, output));
         }
         else
         {
             throw new VA.Scripting.VisioApplicationException("Unsupported Result type");
         }
     }
     else
     {
         var output = cellQuery.GetFormulas(surface, shapeids);
         return(Helpers.querytable_to_datatable(cellQuery, output));
     }
 }
Beispiel #34
0
        protected override void ProcessRecord()
        {
            var query = new VA.ShapeSheet.Query.CellQuery();

            addcell(query, this.AvenueSizeX, "AvenueSizeX");
            addcell(query, this.AvenueSizeY, "AvenueSizeY");
            addcell(query, this.AvoidPageBreaks, "AvoidPageBreaks");
            addcell(query, this.BlockSizeX, "BlockSizeX");
            addcell(query, this.BlockSizeY, "BlockSizeY");
            addcell(query, this.CenterX, "CenterX");
            addcell(query, this.CenterY, "CenterY");
            addcell(query, this.CtrlAsInput, "CtrlAsInput");
            addcell(query, this.DrawingResizeType, "DrawingResizeType");
            addcell(query, this.DrawingScale, "DrawingScale");
            addcell(query, this.DrawingScaleType, "DrawingScaleType");
            addcell(query, this.DrawingSizeType, "DrawingSizeType");
            addcell(query, this.DynamicsOff, "DynamicsOff");
            addcell(query, this.EnableGrid, "EnableGrid");
            addcell(query, this.InhibitSnap, "InhibitSnap");
            addcell(query, this.LineAdjustFrom, "LineAdjustFrom");
            addcell(query, this.LineAdjustTo, "LineAdjustTo");
            addcell(query, this.LineJumpCode, "LineJumpCode");
            addcell(query, this.LineJumpFactorX, "LineJumpFactorX");
            addcell(query, this.LineJumpFactorY, "LineJumpFactorY");
            addcell(query, this.LineJumpStyle, "LineJumpStyle");
            addcell(query, this.LineRouteExt, "LineRouteExt");
            addcell(query, this.LineToLineX, "LineToLineX");
            addcell(query, this.LineToLineY, "LineToLineY");
            addcell(query, this.LineToNodeX, "LineToNodeX");
            addcell(query, this.LineToNodeY, "LineToNodeY");
            addcell(query, this.PageBottomMargin, "PageBottomMargin");
            addcell(query, this.PageHeight, "PageHeight");
            addcell(query, this.PageLeftMargin, "PageLeftMargin");
            addcell(query, this.PageLineJumpDirX, "PageLineJumpDirX");
            addcell(query, this.PageLineJumpDirY, "PageLineJumpDirY");
            addcell(query, this.PageRightMargin, "PageRightMargin");
            addcell(query, this.PageScale, "PageScale");
            addcell(query, this.PageShapeSplit, "PageShapeSplit");
            addcell(query, this.PageTopMargin, "PageTopMargin");
            addcell(query, this.PageWidth, "PageWidth");
            addcell(query, this.PaperKind, "PaperKind");
            addcell(query, this.PaperSource, "PaperSource");
            addcell(query, this.PlaceDepth, "PlaceDepth");
            addcell(query, this.PlaceFlip, "PlaceFlip");
            addcell(query, this.PlaceStyle, "PlaceStyle");
            addcell(query, this.PlowCode, "PlowCode");
            addcell(query, this.PrintGrid, "PrintGrid");
            addcell(query, this.PrintPageOrientation, "PrintPageOrientation");
            addcell(query, this.ResizePage, "ResizePage");
            addcell(query, this.RouteStyle, "RouteStyle");
            addcell(query, this.ScaleX, "ScaleX");
            addcell(query, this.ScaleY, "ScaleY");
            addcell(query, this.ShdwObliqueAngle, "ShdwObliqueAngle");
            addcell(query, this.ShdwOffsetX, "ShdwOffsetX");
            addcell(query, this.ShdwOffsetY, "ShdwOffsetY");
            addcell(query, this.ShdwScaleFactor, "ShdwScaleFactor");
            addcell(query, this.ShdwType, "ShdwType");
            addcell(query, this.UIVisibility, "UIVisibility");
            addcell(query, this.XGridDensity, "XGridDensity");
            addcell(query, this.XGridOrigin, "XGridOrigin");
            addcell(query, this.XGridSpacing, "XGridSpacing");
            addcell(query, this.XRulerDensity, "XRulerDensity");
            addcell(query, this.XRulerOrigin, "XRulerOrigin");
            addcell(query, this.YGridDensity, "YGridDensity");
            addcell(query, this.YGridOrigin, "YGridOrigin");
            addcell(query, this.YGridSpacing, "YGridSpacing");
            addcell(query, this.YRulerDensity, "YRulerDensity");
            addcell(query, this.YRulerOrigin, "YRulerOrigin");

            var dic = GetPageCellDictionary();

            SetFromCellNames(query, this.Cells, dic);

            var surface = new VA.Drawing.DrawingSurface(this.client.Page.Get());

            var target_shapeids = new[] { surface.Page.ID };

            this.WriteVerbose("Number of Cells: {0}", query.Columns.Count);

            this.WriteVerbose("Start Query");

            var dt = Helpers.QueryToDataTable(query, this.GetResults, this.ResultType, target_shapeids, surface);

            this.WriteObject(dt);
            this.WriteVerbose("End Query");
        }
Beispiel #35
0
        public QueryResultList <string> GetFormulas(IVisio.Page page, IList <int> shapeids)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            return(this.GetFormulas(surface, shapeids));
        }
Beispiel #36
0
        public QueryResultList <T> GetResults <T>(IVisio.Page page, IList <int> shapeids)
        {
            var surface = new VA.Drawing.DrawingSurface(page);

            return(this.GetResults <T>(surface, shapeids));
        }
 public static IVisio.Shape DrawQuarterArc(this IVisio.Shape shape, VA.Drawing.Point p0, VA.Drawing.Point p1, IVisio.VisArcSweepFlags flags)
 {
     var surface = new VA.Drawing.DrawingSurface(shape);
     var s = surface.DrawQuarterArc(p0, p1, flags);
     return s;
 }
 public static IVisio.Shape DrawLine(this IVisio.Page page, VA.Drawing.Point p1, VA.Drawing.Point p2)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     var shape = surface.DrawLine(p1.X, p1.Y, p2.X, p2.Y);
     return shape;
 }
Beispiel #39
0
        public static Drawing.Rectangle GetBoundingBox(this IVisio.Master master, IVisio.VisBoundingBoxArgs args)
        {
            var surface = new VisioAutomation.Drawing.DrawingSurface(master);

            return(surface.GetBoundingBox(args));
        }
        private static IList<TabStop> GetTabStops(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            int num_stops = VA.Text.TextFormat.GetTabStopCount(shape);

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

            const short row = 0;

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

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

            var surface = new VA.Drawing.DrawingSurface(shape);

            var stream = VA.ShapeSheet.SRC.ToStream(srcs);
            var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList();
            var results = surface.GetResults_3<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 = (VA.Text.TabStopAlignment) ((int)results[(stop_index*3) + 2]);
                var ts = new VA.Text.TabStop(pos, align);
                stops_list.Add(ts);
            }

            return stops_list;
        }
 public static IVisio.Shape DrawLine(this IVisio.Shape shape, VA.Drawing.Point p1, VA.Drawing.Point p2)
 {
     var surface = new VA.Drawing.DrawingSurface(shape);
     var s = surface.DrawLine(p1, p2);
     return s;
 }
        protected override void ProcessRecord()
        {
            var query = new VA.ShapeSheet.Query.CellQuery();

            addcell(query, this.AvenueSizeX, "AvenueSizeX");
            addcell(query, this.AvenueSizeY, "AvenueSizeY");
            addcell(query, this.AvoidPageBreaks, "AvoidPageBreaks");
            addcell(query, this.BlockSizeX, "BlockSizeX");
            addcell(query, this.BlockSizeY, "BlockSizeY");
            addcell(query, this.CenterX, "CenterX");
            addcell(query, this.CenterY, "CenterY");
            addcell(query, this.CtrlAsInput, "CtrlAsInput");
            addcell(query, this.DrawingResizeType, "DrawingResizeType");
            addcell(query, this.DrawingScale, "DrawingScale");
            addcell(query, this.DrawingScaleType, "DrawingScaleType");
            addcell(query, this.DrawingSizeType, "DrawingSizeType");
            addcell(query, this.DynamicsOff, "DynamicsOff");
            addcell(query, this.EnableGrid, "EnableGrid");
            addcell(query, this.InhibitSnap, "InhibitSnap");
            addcell(query, this.LineAdjustFrom, "LineAdjustFrom");
            addcell(query, this.LineAdjustTo, "LineAdjustTo");
            addcell(query, this.LineJumpCode, "LineJumpCode");
            addcell(query, this.LineJumpFactorX, "LineJumpFactorX");
            addcell(query, this.LineJumpFactorY, "LineJumpFactorY");
            addcell(query, this.LineJumpStyle, "LineJumpStyle");
            addcell(query, this.LineRouteExt, "LineRouteExt");
            addcell(query, this.LineToLineX, "LineToLineX");
            addcell(query, this.LineToLineY, "LineToLineY");
            addcell(query, this.LineToNodeX, "LineToNodeX");
            addcell(query, this.LineToNodeY, "LineToNodeY");
            addcell(query, this.PageBottomMargin, "PageBottomMargin");
            addcell(query, this.PageHeight, "PageHeight");
            addcell(query, this.PageLeftMargin, "PageLeftMargin");
            addcell(query, this.PageLineJumpDirX, "PageLineJumpDirX");
            addcell(query, this.PageLineJumpDirY, "PageLineJumpDirY");
            addcell(query, this.PageRightMargin, "PageRightMargin");
            addcell(query, this.PageScale, "PageScale");
            addcell(query, this.PageShapeSplit, "PageShapeSplit");
            addcell(query, this.PageTopMargin, "PageTopMargin");
            addcell(query, this.PageWidth, "PageWidth");
            addcell(query, this.PaperKind, "PaperKind");
            addcell(query, this.PaperSource, "PaperSource");
            addcell(query, this.PlaceDepth, "PlaceDepth");
            addcell(query, this.PlaceFlip, "PlaceFlip");
            addcell(query, this.PlaceStyle, "PlaceStyle");
            addcell(query, this.PlowCode, "PlowCode");
            addcell(query, this.PrintGrid, "PrintGrid");
            addcell(query, this.PrintPageOrientation, "PrintPageOrientation");
            addcell(query, this.ResizePage, "ResizePage");
            addcell(query, this.RouteStyle, "RouteStyle");
            addcell(query, this.ScaleX, "ScaleX");
            addcell(query, this.ScaleY, "ScaleY");
            addcell(query, this.ShdwObliqueAngle, "ShdwObliqueAngle");
            addcell(query, this.ShdwOffsetX, "ShdwOffsetX");
            addcell(query, this.ShdwOffsetY, "ShdwOffsetY");
            addcell(query, this.ShdwScaleFactor, "ShdwScaleFactor");
            addcell(query, this.ShdwType, "ShdwType");
            addcell(query, this.UIVisibility, "UIVisibility");
            addcell(query, this.XGridDensity, "XGridDensity");
            addcell(query, this.XGridOrigin, "XGridOrigin");
            addcell(query, this.XGridSpacing, "XGridSpacing");
            addcell(query, this.XRulerDensity, "XRulerDensity");
            addcell(query, this.XRulerOrigin, "XRulerOrigin");
            addcell(query, this.YGridDensity, "YGridDensity");
            addcell(query, this.YGridOrigin, "YGridOrigin");
            addcell(query, this.YGridSpacing, "YGridSpacing");
            addcell(query, this.YRulerDensity, "YRulerDensity");
            addcell(query, this.YRulerOrigin, "YRulerOrigin");

            var dic = GetPageCellDictionary();
            SetFromCellNames(query, this.Cells, dic);

            var surface = new VA.Drawing.DrawingSurface(this.client.Page.Get());

            var target_shapeids = new[] { surface.Page.ID };

            this.WriteVerbose("Number of Cells: {0}", query.Columns.Count);

            this.WriteVerbose("Start Query");

            var dt = Helpers.QueryToDataTable(query, this.GetResults, this.ResultType, target_shapeids, surface);

            this.WriteObject(dt);
            this.WriteVerbose("End Query");
        }
 public static VA.Drawing.Rectangle GetBoundingBox(this IVisio.Shape shape, IVisio.VisBoundingBoxArgs args)
 {
     var surface = new VA.Drawing.DrawingSurface(shape);
     var r = surface.GetBoundingBox(args);
     return r;
 }
 public static IVisio.Shape DrawBezier(this IVisio.Page page, IList<VA.Drawing.Point> points, short degree, short flags)
 {
     var surface = new VA.Drawing.DrawingSurface(page);
     var shape = surface.DrawBezier(points,degree,flags);
     return shape;
 }