Exemplo n.º 1
0
        /// <summary>
        /// Inserts a Shape Data section into a Shape's Shapesheet, if it doesn't exist.
        /// </summary>
        /// <param name="Shape"></param>
        public static void insertShapeDataSection(Visio.Shape Shape)
        {
            // Only insert Shape Data section into the Shape's Shapesheet if it doesn't exist
            // return value of 0 means section doesn't exists
            short sectionStatus = Shape.get_SectionExists(CaseTypes.SHAPE_DATA_SECTION, 0);

            if (sectionStatus == 0)
            {
                Shape.AddSection(CaseTypes.SHAPE_DATA_SECTION);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }