Пример #1
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(""));
 }
Пример #2
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;
        }
Пример #3
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();
 }
Пример #4
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;
        }
Пример #5
0
        public bool RemoveShape(HSSFShape shape)
        {
            bool isRemoved = GetEscherContainer().RemoveChildRecord(shape.GetEscherContainer());

            if (isRemoved)
            {
                shape.AfterRemove(this.Patriarch);
                shapes.Remove(shape);
            }
            return(isRemoved);
        }
Пример #6
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);
        }
Пример #7
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();
 }
Пример #8
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);
            }
        }
Пример #9
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);
        }
Пример #10
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
            FillColor = 0x08000050;

            //by default comments are hidden
            Visible = false;

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

            cod.ObjectType = CommonObjectType.Comment;
        }
Пример #11
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;
     }
 }
Пример #12
0
 public HSSFPolygon(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
 }
Пример #13
0
 public HSSFShapeGroup(HSSFShape parent, HSSFAnchor anchor)
     : base(parent, anchor)
 {
     _spgrRecord = (EscherSpgrRecord)((EscherContainerRecord)GetEscherContainer().GetChild(0)).GetChildById(EscherSpgrRecord.RECORD_ID);
 }
Пример #14
0
 public void AddShape(HSSFShape shape)
 {
     shape.Patriarch = (this.Patriarch);
     shape.Parent    = (this);
     shapes.Add(shape);
 }
Пример #15
0
        /**
         * add a shape to this drawing
         */

        public void AddShape(HSSFShape shape)
        {
            shape.Patriarch = this;
            _shapes.Add(shape);
        }
Пример #16
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();
 }