Esempio n. 1
0
        /// <summary>
        /// Returns a new Style object which is value-equal to this Style object.
        /// </summary>
        /// <returns>A new Style object which is value-equal to this Style object.</returns>
        public object Clone()
        {
            Style clone = new Style(this._doc, this._xf);

            //TODO: Add as properties are added to class.
            clone._doc = this._doc;

            return clone;
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a Style object to this collection and returns the Style object's
        /// id value.
        /// </summary>
        /// <param name="style">The Style object to add to this collection.</param>
        /// <returns>The id value of the given Style object which has been added
        /// to this collection.</returns>
        public ushort Add(Style style)
        {
            ushort? id = GetID(style);

            if (id == null)
            {
                if (_styles == null)
                    _styles = new List<Style>();

                id = (ushort)_styles.Count;
                _styles.Add((Style) style.Clone());
            }

            return (ushort)id;
        }
Esempio n. 3
0
        private void SetDefaults()
        {
            _font = new Font(_doc, this);
            _format = Formats.Default;
            _style = new Style(_doc, this);

            _horizontalAlignment = HorizontalAlignments.Default;
            _textWrapRight = false;
            _verticalAlignment = VerticalAlignments.Default;
            _rotation = 0;
            _indentLevel = 0;
            _shrinkToCell = false;
            _textDirection = TextDirections.Default;
            _cellLocked = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData)
            _formulaHidden = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData)
            _isStyleXF = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData)
            _useNumber = true;
            _useFont = true;
            _useMisc = true;
            _useBorder = true;
            _useBackground = true;
            _useProtection = true; //You should ALWAYS use protection ;-)
            _leftLineStyle = 0;
            _rightLineStyle = 0;
            _topLineStyle = 0;
            _bottomLineStyle = 0;
            _leftLineColor = Colors.DefaultLineColor;
            _rightLineColor = Colors.DefaultLineColor;
            _diagonalDescending = false;
            _diagonalAscending = false;
            _topLineColor = Colors.DefaultLineColor;
            _bottomLineColor = Colors.DefaultLineColor;
            _diagonalLineColor = Colors.DefaultLineColor;
            _diagonalLineStyle = LineStyle.None;
            _pattern = 0;
            _patternColor = Colors.DefaultPatternColor;
            _patternBackgroundColor = Colors.DefaultPatternBackgroundColor;

            OnChange();
        }
Esempio n. 4
0
 /// <summary>
 /// Gets whether the given Style object exists in this collection and so will be
 /// written to the XlsDocument.
 /// </summary>
 /// <param name="style">The Style object which is to be checked whether it exists
 /// in this collection.</param>
 /// <returns>true if the given Style object exists in this collection, false otherwise.</returns>
 public bool IsWritten(Style style)
 {
     return (GetID(style) != null);
 }
Esempio n. 5
0
        /// <summary>
        /// Returns the ID of a given Style object in this collection.
        /// </summary>
        /// <param name="style">The Style object whose ID is to be returned.</param>
        /// <returns>The ID of the given Style object in this collection.</returns>
        public ushort? GetID(Style style)
        {
            ushort? id = null;

            if (_styles == null)
                return id;

            for (ushort i = 0; i < _styles.Count; i++)
            {
                Style styleItem = _styles[i];
                if (styleItem.Equals(style))
                {
                    id = i;
                    break;
                }
            }

            return id;
        }
Esempio n. 6
0
 /// <summary>
 /// Returns whether a given Style object is value-equal to this Style object.
 /// </summary>
 /// <param name="that">Another Style object to compare to this Style object.</param>
 /// <returns>true if that Style object is value-equal to this Style object,
 /// false otherwise.</returns>
 public bool Equals(Style that)
 {
     //TODO: Add comparisons when Class members are added
     return true;
 }