Пример #1
0
        private void connect(IVisio.Shape a, IVisio.Shape b, bool a_arrow, bool b_arrow)
        {
            var page = a.ContainingPage;
            var connectors_stencil = page.Application.Documents.OpenStencil("connec_u.vss");
            var connectors_masters = connectors_stencil.Masters;

            var dcm = connectors_masters["Dynamic Connector"];

            var drop_point = new VADRAW.Point(-2, -2);
            var c1         = page.Drop(dcm, drop_point);

            ConnectorHelper.ConnectShapes(a, b, c1);

            //a.AutoConnect(b, connect_dir_none, null);

            if (a_arrow || b_arrow)
            {
                var writer = new SidSrcWriter();
                if (a_arrow)
                {
                    writer.SetValue(c1.ID16, VASS.SrcConstants.LineBeginArrow, "13");
                }
                if (b_arrow)
                {
                    writer.SetValue(c1.ID16, VASS.SrcConstants.LineEndArrow, "13");
                }

                writer.CommitFormulas(page);
            }
        }
Пример #2
0
        private static void _modify_pin_positions(IVisio.Page page, IList <int> sorted_shapeids, List <VisioAutomation.Geometry.Point> newpositions)
        {
            var writer = new SidSrcWriter();

            for (int i = 0; i < newpositions.Count; i++)
            {
                writer.SetValue((short)sorted_shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormPinX, newpositions[i].X);
                writer.SetValue((short)sorted_shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormPinY, newpositions[i].Y);
            }

            writer.Commit(page, VisioAutomation.ShapeSheet.CellValueType.Formula);
        }
Пример #3
0
        private static void _modify_sizes(IVisio.Page page, IList <int> sorted_shapeids, List <VisioAutomation.Geometry.Size> newsizes)
        {
            var writer = new SidSrcWriter();

            for (int i = 0; i < newsizes.Count; i++)
            {
                writer.SetValue((short)sorted_shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormWidth, newsizes[i].Width);
                writer.SetValue((short)sorted_shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormHeight, newsizes[i].Height);
            }

            writer.CommitFormulas(page);
        }
Пример #4
0
        private static short[] DropManyU(
            IVisio.Page page,
            IList <IVisio.Master> masters,
            IList <VisioAutomation.Geometry.Rectangle> rects)
        {
            var points   = rects.Select(r => r.Center).ToList();
            var shapeids = page.DropManyU(masters, points);

            // Dropping takes care of the PinX and PinY
            // Now set the Width's and Heights
            var writer = new SidSrcWriter();

            for (int i = 0; i < rects.Count; i++)
            {
                writer.SetValue(shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormWidth, rects[i].Width);
                writer.SetValue(shapeids[i], VisioAutomation.ShapeSheet.SrcConstants.XFormHeight, rects[i].Height);
            }

            writer.CommitFormulas(page);

            return(shapeids);
        }
Пример #5
0
        public static void set_text_wrapping(IVisio.Page page,
                                             IList <int> shapeids,
                                             bool wrap)
        {
            const string formula_wrap    = "WIDTH*1";
            const string formula_no_wrap = "TEXTWIDTH(TheText)";
            string       formula         = wrap ? formula_wrap : formula_no_wrap;
            var          writer          = new SidSrcWriter();

            foreach (int shapeid in shapeids)
            {
                writer.SetValue((short)shapeid, VisioAutomation.ShapeSheet.SrcConstants.TextXFormWidth, formula);
            }

            writer.CommitFormulas(page);
        }
        public void ShapeSheet_Writer_Formulas_MultipleShapes()
        {
            var page1 = this.GetNewPage();

            var shape1 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape2 = page1.DrawRectangle(-1, -1, 0, 0);
            var shape3 = page1.DrawRectangle(-1, -1, 0, 0);


            // Set the formulas
            var writer = new SidSrcWriter();

            writer.SetValue(shape1.ID16, XFormPinX, 0.5);
            writer.SetValue(shape1.ID16, XFormPinY, 0.5);
            writer.SetValue(shape2.ID16, XFormPinX, 1.5);
            writer.SetValue(shape2.ID16, XFormPinY, 1.5);
            writer.SetValue(shape3.ID16, XFormPinX, 2.5);
            writer.SetValue(shape3.ID16, XFormPinY, 2.5);

            writer.CommitFormulas(page1);

            // Verify that the formulas were set
            var query    = new CellQuery();
            var col_pinx = query.Columns.Add(XFormPinX, nameof(XFormPinX));
            var col_piny = query.Columns.Add(XFormPinY, nameof(XFormPinY));

            var shapeids = new[] { shape1.ID, shape2.ID, shape3.ID };

            var data_formulas = query.GetFormulas(page1, shapeids);
            var data_results  = query.GetResults <double>(page1, shapeids);

            AssertUtil.AreEqual(("0.5 in", 0.5), (data_formulas[0][col_pinx], data_results[0][col_pinx]));
            AssertUtil.AreEqual(("0.5 in", 0.5), (data_formulas[0][col_piny], data_results[0][col_piny]));
            AssertUtil.AreEqual(("1.5 in", 1.5), (data_formulas[1][col_pinx], data_results[1][col_pinx]));
            AssertUtil.AreEqual(("1.5 in", 1.5), (data_formulas[1][col_piny], data_results[1][col_piny]));
            AssertUtil.AreEqual(("2.5 in", 2.5), (data_formulas[2][col_pinx], data_results[2][col_pinx]));
            AssertUtil.AreEqual(("2.5 in", 2.5), (data_formulas[2][col_piny], data_results[2][col_piny]));

            page1.Delete(0);
        }
Пример #7
0
        public void Apply(SidSrcWriter writer, short id)
        {
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormWidth, this.XFormWidth);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormHeight, this.XFormHeight);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormPinX, this.XFormPinX);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormPinY, this.XFormPinY);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormLocPinX, this.XFormLocPinX);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormLocPinY, this.XFormLocPinY);
            writer.SetValue(id, ShapeSheet.SrcConstants.XFormAngle, this.XFormAngle);
            writer.SetValue(id, ShapeSheet.SrcConstants.LineBeginArrow, this.LineBeginArrow);
            writer.SetValue(id, ShapeSheet.SrcConstants.LineBeginArrowSize, this.LineBeginArrowSize);

            writer.SetValue(id, ShapeSheet.SrcConstants.FillBackground, this.FillBackground);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillBackgroundTransparency, this.FillBackgroundTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillForeground, this.FillForeground);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillForegroundTransparency, this.FillForegroundTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillPattern, this.FillPattern);

            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowObliqueAngle, this.FillShadowObliqueAngle);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowOffsetX, this.FillShadowOffsetX);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowOffsetY, this.FillShadowOffsetY);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowScaleFactor, this.FillShadowScaleFactor);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowType, this.FillShadowType);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowBackground, this.FillShadowBackground);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowBackgroundTransparency, this.FillShadowBackgroundTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowForeground, this.FillShadowForeground);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowForegroundTransparency, this.FillShadowForegroundTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.FillShadowPattern, this.FillShadowPattern);

            writer.SetValue(id, ShapeSheet.SrcConstants.CharCase, this.CharCase);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharFont, this.CharFont);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharColor, this.CharColor);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharSize, this.CharSize);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharLetterspace, this.CharLetterspace);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharStyle, this.CharStyle);
            writer.SetValue(id, ShapeSheet.SrcConstants.CharColorTransparency, this.CharTransparency);

            writer.SetValue(id, ShapeSheet.SrcConstants.LineEndArrow, this.LineEndArrow);
            writer.SetValue(id, ShapeSheet.SrcConstants.LineEndArrowSize, this.LineEndArrowSize);

            // Line
            writer.SetValue(id, ShapeSheet.SrcConstants.LineColor, this.LineColor);
            writer.SetValue(id, ShapeSheet.SrcConstants.LineColorTransparency, this.LineColorTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.LinePattern, this.LinePattern);
            writer.SetValue(id, ShapeSheet.SrcConstants.LineWeight, this.LineWeight);

            // Text
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockBottomMargin, this.TextBlockBottomMargin);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockDefaultTabStop, this.TextBlockDefaultTabStop);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockLeftMargin, this.TextBlockLeftMargin);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockRightMargin, this.TextBlockRightMargin);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockBackground, this.TextBlockBackground);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockBackgroundTransparency, this.TextBlockBackgroundTransparency);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockDirection, this.TextBlockDirection);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockTopMargin, this.TextBlockTopMargin);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextBlockVerticalAlign, this.TextBlockVerticalAlign);

            // Paragraph

            writer.SetValue(id, ShapeSheet.SrcConstants.ParaBullet, this.ParaBullet);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaBulletFont, this.ParaBulletFont);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaBulletFontSize, this.ParaBulletFontSize);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaBulletString, this.ParaBulletString);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaFlags, this.ParaFlags);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaHorizontalAlign, this.ParaHorizontalAlign);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaIndentFirst, this.ParaIndentFirst);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaIndentLeft, this.ParaIndentLeft);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaIndentRight, this.ParaIndentRight);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaLocalizeBulletFont, this.ParaLocBulletFont);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaSpacingAfter, this.ParaSpacingAfter);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaSpacingBefore, this.ParaSpacingBefore);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaSpacingLine, this.ParaSpacingLine);
            writer.SetValue(id, ShapeSheet.SrcConstants.ParaTextPosAfterBullet, this.ParaTextPosAfterBullet);

            // TextXForm
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormAngle, this.TextXFormAngle);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormHeight, this.TextXFormHeight);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormLocPinX, this.TextXFormLocPinX);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormLocPinY, this.TextXFormLocPinY);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormPinX, this.TextXFormPinX);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormPinY, this.TextXFormPinY);
            writer.SetValue(id, ShapeSheet.SrcConstants.TextXFormWidth, this.TextXFormWidth);

            // ShapeLayout
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutConnectorFixedCode, this.ShapeLayoutConFixedCode);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutLineJumpCode, this.ShapeLayoutConLineJumpCode);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutLineJumpDirX, this.ShapeLayoutConLineJumpDirX);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutLineJumpDirY, this.ShapeLayoutConLineJumpDirY);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutLineJumpStyle, this.ShapeLayoutConLineJumpStyle);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutLineRouteExt, this.ShapeLayoutConLineRouteExt);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapeFixedCode, this.ShapeLayoutFixedCode);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePermeablePlace, this.ShapeLayoutPermeablePlace);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePermeableX, this.ShapeLayoutPermeableX);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePermeableY, this.ShapeLayoutPermeableY);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePlaceFlip, this.ShapeLayoutPlaceFlip);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePlaceStyle, this.ShapeLayoutPlaceStyle);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapePlowCode, this.ShapeLayoutPlowCode);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapeRouteStyle, this.ShapeLayoutRouteStyle);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapeSplit, this.ShapeLayoutSplit);
            writer.SetValue(id, ShapeSheet.SrcConstants.ShapeLayoutShapeSplittable, this.ShapeLayoutSplittable);
        }
Пример #8
0
 public void Apply(SidSrcWriter writer, short id)
 {
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutAvenueSizeX, this.PageLayoutAvenueSizeX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutAvenueSizeY, this.PageLayoutAvenueSizeY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutBlockSizeX, this.PageLayoutBlockSizeX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutBlockSizeY, this.PageLayoutBlockSizeY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutControlAsInput, this.PageLayoutControlAsInput);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutDynamicsOff, this.PageLayoutDynamicsOff);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutEnableGrid, this.PageLayoutEnableGrid);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineAdjustFrom, this.PageLayoutLineAdjustFrom);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineAdjustTo, this.PageLayoutLineAdjustTo);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpCode, this.PageLayoutLineJumpCode);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpFactorX, this.PageLayoutLineJumpFactorX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpFactorY, this.PageLayoutLineJumpFactorY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpStyle, this.PageLayoutLineJumpStyle);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineRouteExt, this.PageLayoutLineRouteExt);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineToLineX, this.PageLayoutLineToLineX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineToLineY, this.PageLayoutLineToLineY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineToNodeX, this.PageLayoutLineToNodeX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineToNodeY, this.PageLayoutLineToNodeY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpDirX, this.PageLayoutPageLineJumpDirX);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutLineJumpDirY, this.PageLayoutPageLineJumpDirY);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutShapeSplit, this.PageShapeSplit);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutPlaceDepth, this.PlaceDepth);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutPlaceFlip, this.PlaceFlip);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutPlaceStyle, this.PlaceStyle);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutPlowCode, this.PlowCode);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutResizePage, this.ResizePage);
     writer.SetValue(id, ShapeSheet.SrcConstants.PageLayoutRouteStyle, this.RouteStyle);
 }