Example #1
0
        /// <summary>
        /// Creates the low level OBJ record for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSFShape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType=(CommonObjectType)((HSSFSimpleShape)shape).ShapeType;
            //        c.ObjectId((short) ( 1 ));
            c.ObjectId=((short)(shapeId));
            c.IsLocked=true;
            c.IsPrintable=true;
            c.IsAutoFill=true;
            c.IsAutoline=true;
            //        c.Reserved2( 0x012C0A84 );
            c.Reserved2=(0x0);
            //        UnknownRecord sub1 = new UnknownRecord( (short)0x7, (short)0x2, new byte[] { 0x09, 0x00 } );
            //        UnknownRecord sub2 = new UnknownRecord( (short)0x8, (short)0x2, new byte[] { 0x01, 0x00 } );
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            //        obj.AddSubRecord( sub1 );
            //        obj.AddSubRecord( sub2 );
            obj.AddSubRecord(e);

            return obj;
        }
Example #2
0
 /// <summary>
 /// Construct a new textbox with the given parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
 public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     HorizontalAlignment = HorizontalTextAlignment.Left;
     VerticalAlignment   = VerticalTextAlignment.Top;
     this.String         = (new HSSFRichTextString(""));
 }
Example #3
0
 /// <summary>
 /// Construct a new textbox with the given parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
 public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     HorizontalAlignment = (HORIZONTAL_ALIGNMENT_LEFT);
     VerticalAlignment   = (VERTICAL_ALIGNMENT_TOP);
     this.String         = (new HSSFRichTextString(""));
 }
Example #4
0
 /// <summary>
 /// Construct a new textbox with the given parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
 public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     HorizontalAlignment = HorizontalTextAlignment.Left;
     VerticalAlignment = VerticalTextAlignment.Top;
     this.String = (new HSSFRichTextString(""));
 }
Example #5
0
 /// <summary>
 /// Constructs a picture object.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     base.ShapeType = (OBJECT_TYPE_PICTURE);
     CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];
     cod.ObjectType = CommonObjectType.PICTURE;
 }
Example #6
0
        /// <summary>
        /// Construct a new textbox with the given parent and anchor.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
        public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor) : base(parent, anchor)
        {
            ShapeType = (OBJECT_TYPE_TEXT);

            halign = HORIZONTAL_ALIGNMENT_LEFT;
            valign = VERTICAL_ALIGNMENT_TOP;
        }
Example #7
0
        public HSSFCombobox(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {

            base.ShapeType = (OBJECT_TYPE_COMBO_BOX);
            CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];
            cod.ObjectType = CommonObjectType.ComboBox;
        }
Example #8
0
        /// <summary>
        /// Construct a new textbox with the given parent and anchor.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
        public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
        {
            
            ShapeType = (OBJECT_TYPE_TEXT);

            halign = HORIZONTAL_ALIGNMENT_LEFT;
            valign = VERTICAL_ALIGNMENT_TOP;
        }
Example #9
0
        public HSSFCombobox(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {
            base.ShapeType = (OBJECT_TYPE_COMBO_BOX);
            CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];

            cod.ObjectType = CommonObjectType.COMBO_BOX;
        }
Example #10
0
        /// <summary>
        /// Constructs a picture object.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="anchor">The anchor.</param>
        public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {
            base.ShapeType = (OBJECT_TYPE_PICTURE);
            CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];

            cod.ObjectType = CommonObjectType.PICTURE;
        }
Example #11
0
 /// <summary>
 /// Create a new shape with the specified parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFShape(HSSFShape parent, HSSFAnchor anchor)
 {
     this.parent           = parent;
     this.anchor           = anchor;
     this._escherContainer = CreateSpContainer();
     _optRecord            = (EscherOptRecord)_escherContainer.GetChildById(EscherOptRecord.RECORD_ID);
     _objRecord            = CreateObjRecord();
 }
Example #12
0
        /// <summary>
        /// Construct a new textbox with the given parent and anchor.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="anchor">One of HSSFClientAnchor or HSSFChildAnchor</param>
        public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {

            HorizontalAlignment = (HORIZONTAL_ALIGNMENT_LEFT);
            VerticalAlignment = (VERTICAL_ALIGNMENT_TOP);
            this.String = (new HSSFRichTextString(""));
        }
Example #13
0
        /**
         * @param shape to be removed
         * @return true of shape is removed
         */
        public bool RemoveShape(HSSFShape shape)
        {
            bool isRemoved = _mainSpgrContainer.RemoveChildRecord(shape.GetEscherContainer());

            if (isRemoved)
            {
                shape.AfterRemove(this);
                _shapes.Remove(shape);
            }
            return(isRemoved);
        }
Example #14
0
        public bool RemoveShape(HSSFShape shape)
        {
            bool isRemoved = GetEscherContainer().RemoveChildRecord(shape.GetEscherContainer());

            if (isRemoved)
            {
                shape.AfterRemove(this.Patriarch);
                shapes.Remove(shape);
            }
            return(isRemoved);
        }
Example #15
0
 internal override void AfterRemove(HSSFPatriarch patriarch)
 {
     patriarch.GetBoundAggregate().RemoveShapeToObjRecord(GetEscherContainer().ChildContainers[0]
                                                          .GetChildById(EscherClientDataRecord.RECORD_ID));
     for (int i = 0; i < shapes.Count; i++)
     {
         HSSFShape shape = (HSSFShape)shapes[i];
         RemoveShape(shape);
         shape.AfterRemove(Patriarch);
     }
     shapes.Clear();
 }
Example #16
0
        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor) : base(parent, anchor)
        {
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
Example #17
0
        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {
            this.ShapeType = (OBJECT_TYPE_COMMENT);

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            visible = false;

            author = "";
        }
Example #18
0
        private void SetFlipFlags(HSSFShape shape)
        {
            EscherSpRecord sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);

            if (shape.Anchor.IsHorizontallyFlipped)
            {
                sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
            }
            if (shape.Anchor.IsVerticallyFlipped)
            {
                sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
            }
        }
Example #19
0
        private void OnCreate(HSSFShape shape)
        {
            EscherContainerRecord spgrContainer =
                _boundAggregate.GetEscherContainer().ChildContainers[0];

            EscherContainerRecord spContainer = shape.GetEscherContainer();
            int shapeId = NewShapeId();

            shape.ShapeId = shapeId;

            spgrContainer.AddChildRecord(spContainer);
            shape.AfterInsert(this);
            SetFlipFlags(shape);
        }
Example #20
0
        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {
            _note = CreateNoteRecord();

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            Visible = false;

            Author = "";
            CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];
            cod.ObjectType = CommonObjectType.COMMENT; 
        }
Example #21
0
        /// <summary>
        /// Construct a new comment with the given parent and anchor.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="anchor">defines position of this anchor in the sheet</param>
        public HSSFComment(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {
            _note = CreateNoteRecord();

            //default color for comments
            this.FillColor = 0x08000050;

            //by default comments are hidden
            Visible = false;

            Author = "";
            CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord)GetObjRecord().SubRecords[0];

            cod.ObjectType = CommonObjectType.Comment;
        }
Example #22
0
 /// <summary>
 /// Create a new shape object used to Create the escher records.
 /// </summary>
 /// <param name="hssfShape">The simple shape this Is based on.</param>
 /// <param name="shapeId">The shape id.</param>
 /// <returns></returns>
 public static AbstractShape CreateShape(HSSFShape hssfShape, int shapeId)
 {
     AbstractShape shape;
     if (hssfShape is HSSFComment)
     {
         shape = new CommentShape((HSSFComment)hssfShape, shapeId);
     }
     else if (hssfShape is HSSFTextbox)
     {
         shape = new TextboxShape((HSSFTextbox)hssfShape, shapeId);
     }
     else if (hssfShape is HSSFPolygon)
     {
         shape = new PolygonShape((HSSFPolygon)hssfShape, shapeId);
     }
     else if (hssfShape is HSSFSimpleShape)
     {
         HSSFSimpleShape simpleShape = (HSSFSimpleShape)hssfShape;
         switch (simpleShape.ShapeType)
         {
             case HSSFSimpleShape.OBJECT_TYPE_PICTURE:
                 shape = new PictureShape(simpleShape, shapeId);
                 break;
             case HSSFSimpleShape.OBJECT_TYPE_LINE:
                 shape = new LineShape(simpleShape, shapeId);
                 break;
             case HSSFSimpleShape.OBJECT_TYPE_OVAL:
             case HSSFSimpleShape.OBJECT_TYPE_RECTANGLE:
                 shape = new SimpleFilledShape(simpleShape, shapeId);
                 break;
             case HSSFSimpleShape.OBJECT_TYPE_COMBO_BOX:
                 shape = new ComboboxShape(simpleShape, shapeId);
                 break;
             default:
                 throw new ArgumentException("Do not know how to handle this type of shape");
         }
     }
     else
     {
         throw new ArgumentException("Unknown shape type");
     }
     EscherSpRecord sp = (EscherSpRecord)shape.SpContainer.GetChildById(EscherSpRecord.RECORD_ID);
     if (hssfShape.Parent!= null)
         sp.Flags=sp.Flags | EscherSpRecord.FLAG_CHILD;
     return shape;
 }
Example #23
0
        /// <summary>
        /// Creates the low level OBJ record for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType=(CommonObjectType)((HSSFSimpleShape)shape).ShapeType;
            c.ObjectId=((short)(shapeId));
            c.IsLocked=(true);
            c.IsPrintable=(true);
            c.IsAutoFill=(true);
            c.IsAutoline=(true);
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
Example #24
0
        /// <summary>
        /// Creates the lowerlevel OBJ records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType=CommonObjectType.MICROSOFT_OFFICE_DRAWING;
            c.ObjectId=((short)(shapeId));
            c.IsLocked=(true);
            c.IsPrintable=(true);
            c.IsAutoFill=(true);
            c.IsAutoline=(true);
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
Example #25
0
 private void OnCreate(HSSFShape shape)
 {
     if (this.Patriarch != null)
     {
         EscherContainerRecord spContainer = shape.GetEscherContainer();
         int shapeId = this.Patriarch.NewShapeId();
         shape.ShapeId = (shapeId);
         GetEscherContainer().AddChildRecord(spContainer);
         shape.AfterInsert(Patriarch);
         EscherSpRecord sp;
         if (shape is HSSFShapeGroup)
         {
             sp = (EscherSpRecord)shape.GetEscherContainer().ChildContainers[0].GetChildById(EscherSpRecord.RECORD_ID);
         }
         else
         {
             sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);
         }
         sp.Flags = sp.Flags | EscherSpRecord.FLAG_CHILD;
     }
 }
Example #26
0
 public void AddShape(HSSFShape shape)
 {
     shape.Patriarch = (this.Patriarch);
     shape.Parent    = (this);
     shapes.Add(shape);
 }
Example #27
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
        }
Example #28
0
 public static EscherContainerRecord GetEscherContainer(HSSFShape shape)
 {
     return shape.GetEscherContainer();
 }
Example #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HSSFSimpleShape"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFSimpleShape(HSSFShape parent, HSSFAnchor anchor) : base(parent, anchor)
 {
 }
Example #30
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 != HSSFShape.LINESTYLE_SOLID)
     {
         opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, shape.LineStyle));
         opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, 0));
         if (shape.LineStyle == HSSFShape.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
 }
Example #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HSSFSimpleShape"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFSimpleShape(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
 {
     
 }
Example #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HSSFSimpleShape"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFSimpleShape(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     _textObjectRecord = CreateTextObjRecord();
 }
Example #33
0
 /// <summary>
 /// Create a new shape with the specified parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 protected HSSFShape(HSSFShape parent, HSSFAnchor anchor)
 {
     this.parent = parent;
     this.anchor = anchor;
 }
Example #34
0
 public void AddShape(HSSFShape shape)
 {
     shape.Patriarch = this.Patriarch;
     shape.Parent    = this;
     shapes.Add(shape);
 }
Example #35
0
 /// <summary>
 /// Create a new shape with the specified parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 protected HSSFShape(HSSFShape parent, HSSFAnchor anchor)
 {
     this.parent = parent;
     this.anchor = anchor;
 }
Example #36
0
 public HSSFShapeGroup(HSSFShape parent, HSSFAnchor anchor):base(parent, anchor)
 {
     
 }
Example #37
0
 /// <summary>
 /// Constructs a picture object.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     this.ShapeType = (OBJECT_TYPE_PICTURE);
 }
Example #38
0
 /**
  * add a shape to this drawing
  */
 public void AddShape(HSSFShape shape)
 {
     shape.Patriarch = this;
     _shapes.Add(shape);
 }
Example #39
0
 public HSSFShapeGroup(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     _spgrRecord = (EscherSpgrRecord)((EscherContainerRecord)GetEscherContainer().GetChild(0)).GetChildById(EscherSpgrRecord.RECORD_ID);
 }
Example #40
0
 public HSSFPolygon(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
 }
Example #41
0
        private void OnCreate(HSSFShape shape)
        {
            EscherContainerRecord spgrContainer =
                    _boundAggregate.GetEscherContainer().ChildContainers[0];

            EscherContainerRecord spContainer = shape.GetEscherContainer();
            int shapeId = NewShapeId();
            shape.ShapeId = shapeId;

            spgrContainer.AddChildRecord(spContainer);
            shape.AfterInsert(this);
            SetFlipFlags(shape);
        }
Example #42
0
 private void SetFlipFlags(HSSFShape shape)
 {
     EscherSpRecord sp = (EscherSpRecord)shape.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID);
     if (shape.Anchor.IsHorizontallyFlipped)
     {
         sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ);
     }
     if (shape.Anchor.IsVerticallyFlipped)
     {
         sp.Flags = (sp.Flags | EscherSpRecord.FLAG_FLIPVERT);
     }
 }
Example #43
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
        }
Example #44
0
 public static EscherOptRecord GetOptRecord(HSSFShape shape)
 {
     return shape.GetOptRecord();
 }
Example #45
0
        /// <summary>
        /// Constructs a picture object.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="anchor">The anchor.</param>
        public HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {

            this.ShapeType = (OBJECT_TYPE_PICTURE);
        }
Example #46
0
 /// <summary>
 /// Construct a new comment with the given parent and anchor.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="anchor">defines position of this anchor in the sheet</param>
 public HSSFComment(HSSFShape parent, HSSFAnchor anchor) :
     this(parent, anchor, CreateNoteRecord())
 {
 }
Example #47
0
 public static ObjRecord GetObjRecord(HSSFShape shape)
 {
     return shape.GetObjRecord();
 }
Example #48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HSSFSimpleShape"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFSimpleShape(HSSFShape parent, HSSFAnchor anchor)
     :base(parent, anchor)
 {
     _textObjectRecord = CreateTextObjRecord();
 }
Example #49
0
 public static void SetShapeId(HSSFShape shape, int id)
 {
     shape.ShapeId = (id);
 }
Example #50
0
 public HSSFShapeGroup(HSSFShape parent, HSSFAnchor anchor) : base(parent, anchor)
 {
 }
Example #51
0
 /**
  * add a shape to this drawing
  */
 internal void AddShape(HSSFShape shape)
 {
     shape._patriarch = this;
     _shapes.Add(shape);
 }
Example #52
0
 /// <summary>
 /// Create a new shape with the specified parent and anchor.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="anchor">The anchor.</param>
 public HSSFShape(HSSFShape parent, HSSFAnchor anchor)
 {
     this.parent = parent;
     this.anchor = anchor;
     this._escherContainer = CreateSpContainer();
     _optRecord = (EscherOptRecord)_escherContainer.GetChildById(EscherOptRecord.RECORD_ID);
     _objRecord = CreateObjRecord();
 }
Example #53
0
 /**
  * add a shape to this drawing
  */
 public void AddShape(HSSFShape shape)
 {
     shape.Patriarch = this;
     _shapes.Add(shape);
 }
Example #54
0
 /**
  * @param shape to be removed
  * @return true of shape is removed
  */
 public bool RemoveShape(HSSFShape shape)
 {
     bool isRemoved = _mainSpgrContainer.RemoveChildRecord(shape.GetEscherContainer());
     if (isRemoved)
     {
         shape.AfterRemove(this);
         _shapes.Remove(shape);
     }
     return isRemoved;
 }
Example #55
0
        /// <summary>
        /// Creates the lowerlevel OBJ records for this shape.
        /// </summary>
        /// <param name="hssfShape">The HSSF shape.</param>
        /// <param name="shapeId">The shape id.</param>
        /// <returns></returns>
        private ObjRecord CreateObjRecord(HSSFShape hssfShape, int shapeId)
        {
            HSSFShape shape = hssfShape;

            ObjRecord obj = new ObjRecord();
            CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
            c.ObjectType = (CommonObjectType)OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING;
            c.ObjectId = GetCmoObjectId(shapeId);
            c.IsLocked = true;
            c.IsPrintable = true;
            c.IsAutoFill = true;
            c.IsAutoline = true;
            EndSubRecord e = new EndSubRecord();

            obj.AddSubRecord(c);
            obj.AddSubRecord(e);

            return obj;
        }
Example #56
0
        public HSSFPolygon(HSSFShape parent, HSSFAnchor anchor)
            : base(parent, anchor)
        {

        }