Beispiel #1
0
        public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells cp)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException("shape");
            }

            if (!cp.X.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an X Formula");
            }

            if (!cp.Y.Formula.HasValue)
            {
                throw new System.ArgumentException("Must provide an Y Formula");
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var update = new VA.ShapeSheet.Update();

            update.SetFormulas(cp, n);
            update.Execute(shape);

            return(n);
        }
Beispiel #2
0
        public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells connection_point_cells)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            if (!connection_point_cells.X.Formula.HasValue)
            {
                string msg = "Must provide an X Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            if (!connection_point_cells.Y.Formula.HasValue)
            {
                string msg = "Must provide an Y Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var writer = new FormulaWriterSRC();

            connection_point_cells.SetFormulas(writer, n);
            writer.Commit(shape);

            return(n);
        }
Beispiel #3
0
        public static int Add(
            IVisio.Shape shape,
            ConnectionPointCells connection_point_cells)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            if (connection_point_cells.X.Value == null)
            {
                string msg = "Must provide an X Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            if (connection_point_cells.Y.Value == null)
            {
                string msg = "Must provide an Y Formula";
                throw new System.ArgumentException(msg, nameof(connection_point_cells));
            }

            var n = shape.AddRow((short)IVisio.VisSectionIndices.visSectionConnectionPts,
                                 (short)IVisio.VisRowIndices.visRowLast,
                                 (short)IVisio.VisRowTags.visTagCnnctPt);

            var writer = new VisioAutomation.ShapeSheet.Writers.SrcWriter();

            writer.SetValues(connection_point_cells, n);

            writer.Commit(shape, VASS.CellValueType.Formula);

            return(n);
        }
        public void AddCustomProperty(Visio.Shape shape, string propertyName, string propertyValue)
        {
            short customProps = (short)Visio.VisSectionIndices.visSectionProp;
            short rowNumber   = shape.AddRow(customProps, (short)Visio.VisRowIndices.visRowLast, (short)Visio.VisRowTags.visTagDefault);

            shape.CellsSRC[customProps, rowNumber, (short)Visio.VisCellIndices.visCustPropsLabel].FormulaU = "\"" + propertyName + "\"";
            shape.CellsSRC[customProps, rowNumber, (short)Visio.VisCellIndices.visCustPropsValue].FormulaU = "\"" + propertyValue + "\"";
        }
Beispiel #5
0
        public static bool AddShapeDataRow(Visio.Shape visShape, string strRowName, string strLabel, int iType, string strFormat,
                                           string strValue, int iLanguage)
        {
            int iLocVisSectionIndice, iLocRow, iLocRowControl;

            Visio.Section visSection;
            Visio.Row     visRow;
            Visio.Cell    visCell;
            bool          bReturn = false;


            if (!IsSectionExist(visShape, (int)Visio.VisSectionIndices.visSectionProp, out visSection))
            {
                iLocVisSectionIndice = visShape.AddSection((int)Visio.VisSectionIndices.visSectionProp);
            }
            if (!GetRowIndex(visShape, (int)Visio.VisSectionIndices.visSectionProp, strRowName, out iLocRow))
            {
                iLocRow = visShape.AddRow((int)Visio.VisSectionIndices.visSectionProp, (int)Visio.VisRowIndices.visRowLast,
                                          (int)Visio.VisRowTags.visTagDefault);
            }
            // Vérification de l'existence de la ligne de nom strNameU
            // En effet dans certain cas la ligne est déja présente
            // car dans ces cas le delete section cache la section
            // sans supprimer les lignes, il faut donc vérifier que la ligne
            // n'existe pas avant de la nommer
            if (!GetRowIndex(visShape, (int)Visio.VisSectionIndices.visSectionProp, strRowName, out iLocRowControl))
            {
                // on la nomme
                visSection  = visShape.get_Section((int)Visio.VisSectionIndices.visSectionProp);
                visRow      = visSection[(short)iLocRow];
                visRow.Name = strRowName;
                // On met le libellé
                visCell = visRow.get_CellU((short)Visio.VisCellIndices.visCustPropsLabel);
                SetStringCellVal(visCell, strLabel);
                // On met le type
                visCell = visRow.get_CellU((short)Visio.VisCellIndices.visCustPropsType);
                SetIntCellVal(visCell, iType);
                // On met le format
                visCell = visRow.get_CellU((short)Visio.VisCellIndices.visCustPropsFormat);
                SetStringCellVal(visCell, strFormat);
                // On met la valeur
                visCell = visRow.get_CellU((short)Visio.VisCellIndices.visCustPropsValue);
                SetStringCellVal(visCell, strValue);
                // On met le langage
                visCell = visRow.get_CellU((short)Visio.VisCellIndices.visCustPropsLangID);
                SetIntCellVal(visCell, iLanguage);
            }
            bReturn = true;
            return(bReturn);
        }
Beispiel #6
0
        public static int Add(IVisio.Shape shape, ControlCells ctrl)
        {
            if (shape == null)
            {
                throw new ArgumentNullException(nameof(shape));
            }

            short row = shape.AddRow((short)IVisio.VisSectionIndices.visSectionControls,
                                     (short)IVisio.VisRowIndices.visRowLast,
                                     (short)IVisio.VisRowTags.visTagDefault);

            ControlHelper.Set(shape, row, ctrl);

            return(row);
        }
Beispiel #7
0
        public static short AddSection(IVisio.Shape shape)
        {
            if (shape == null)
            {
                throw new System.ArgumentNullException(nameof(shape));
            }

            int   num_geometry_sections = shape.GeometryCount;
            short new_sec_index         = GeometryHelper.GetGeometrySectionIndex((short)num_geometry_sections);
            short actual_sec_index      = shape.AddSection(new_sec_index);

            if (actual_sec_index != new_sec_index)
            {
                throw new AutomationException("Internal Error");
            }
            short row_index = shape.AddRow(new_sec_index, (short)IVisio.VisRowIndices.visRowComponent, (short)IVisio.VisRowTags.visTagComponent);

            return(new_sec_index);
        }
        public void AddTo(IVisio.Shape shape, ShapeSheet.Writers.SrcWriter writer, short row, short section)
        {
            short row_index = shape.AddRow(section, row, (short)this.GetRowTagType());

            this.Update(section, row_index, writer);
        }
        public void AddTo(IVisio.Shape shape, FormulaWriterSRC writer, short row, short section)
        {
            short row_index = shape.AddRow(section, row, (short)this.GetRowTagType());

            this.Update(section, row_index, writer);
        }
Beispiel #10
0
        public void AddTo(IVisio.Shape shape, ShapeSheet.Update update, short row, short section)
        {
            short row_index = shape.AddRow(section, row, (short)this.GetRowTagType());

            this.Update(section, row_index, update);
        }