Exemple #1
0
        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            IList props = (IList)opt.EscherProperties.Clone();

            for (IEnumerator iterator = props.GetEnumerator(); iterator.MoveNext();)
            {
                EscherProperty prop = (EscherProperty)iterator.Current;
                switch (prop.Id)
                {
                case EscherProperties.TEXT__TEXTLEFT:
                case EscherProperties.TEXT__TEXTRIGHT:
                case EscherProperties.TEXT__TEXTTOP:
                case EscherProperties.TEXT__TEXTBOTTOM:
                case EscherProperties.GROUPSHAPE__PRINT:
                case EscherProperties.Fill__FillBACKCOLOR:
                case EscherProperties.LINESTYLE__COLOR:
                    opt.EscherProperties.Remove(prop);
                    break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;

            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return(opt.EscherProperties.Count);   // # options Added
        }
Exemple #2
0
        /// <summary>
        /// Sets standard escher options for a comment.
        /// This method is responsible for Setting default background,
        /// shading and other comment properties.
        /// </summary>
        /// <param name="shape">The highlevel shape.</param>
        /// <param name="opt">The escher records holding the proerties</param>
        /// <returns>The number of escher options added</returns>
        protected override int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            base.AddStandardOptions(shape, opt);

            //Remove Unnecessary properties inherited from TextboxShape
            for (int i = 0; i < opt.EscherProperties.Count; i++)
            {
                EscherProperty prop = opt.EscherProperties[i];
                switch (prop.Id)
                {
                case EscherProperties.TEXT__TEXTLEFT:
                case EscherProperties.TEXT__TEXTRIGHT:
                case EscherProperties.TEXT__TEXTTOP:
                case EscherProperties.TEXT__TEXTBOTTOM:
                case EscherProperties.GROUPSHAPE__PRINT:
                case EscherProperties.Fill__FillBACKCOLOR:
                case EscherProperties.LINESTYLE__COLOR:
                    opt.EscherProperties.Remove(prop);
                    i--;
                    break;
                }
            }

            HSSFComment comment = (HSSFComment)shape;

            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, comment.Visible ? 0x000A0000 : 0x000A0002));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__SHADOWOBSURED, 0x00030003));
            opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x00000000));
            opt.SortProperties();
            return(opt.EscherProperties.Count);   // # options Added
        }
Exemple #3
0
        /**
         * Set an escher property for this shape.
         *
         * @param opt       The opt record to Set the properties to.
         * @param propId    The id of the property. One of the constants defined in EscherOptRecord.
         * @param value     value of the property. If value = -1 then the property is Removed.
         */
        public static void SetEscherProperty(EscherOptRecord opt, short propId, int value)
        {
            List <EscherProperty> props = opt.EscherProperties;

            for (List <EscherProperty> .Enumerator iterator = props.GetEnumerator(); iterator.MoveNext();)
            {
                EscherProperty prop = (EscherProperty)iterator.Current;
                if (prop.Id == propId)
                {
                    props.Remove(iterator.Current);
                }
            }
            if (value != -1)
            {
                opt.AddEscherProperty(new EscherSimpleProperty(propId, value));
                opt.SortProperties();
            }
        }
Exemple #4
0
        /// <summary>
        /// Add standard properties to the opt record.  These properties effect
        /// all records.
        /// </summary>
        /// <param name="shape">The user model shape.</param>
        /// <param name="opt">The opt record to Add the properties to.</param>
        /// <returns>The number of options Added.</returns>
        protected virtual int AddStandardOptions(HSSFShape shape, EscherOptRecord opt)
        {
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x080000));
            //        opt.AddEscherProperty( new EscherBoolProperty( EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x080008 ) );
            if (shape.IsNoFill)
            {
                // Wonderful... none of the spec's give any clue as to what these constants mean.
                opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 0x00110000));
            }
            else
            {
                opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 0x00010000));
            }
            opt.AddEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, shape.FillColor));
            opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
            opt.AddEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, shape.LineStyleColor));
            int options = 5;

            if (shape.LineWidth != HSSFShape.LINEWIDTH_DEFAULT)
            {
                opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, shape.LineWidth));
                options++;
            }
            if (shape.LineStyle != LineStyle.Solid)
            {
                opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, (int)shape.LineStyle));
                opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, 0));
                if (shape.LineStyle == LineStyle.None)
                {
                    opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080000));
                }
                else
                {
                    opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
                }
                options += 3;
            }
            opt.SortProperties();
            return(options);   // # options Added
        }