Beispiel #1
0
        /// <summary>
        /// Returns the border of the given borders-object of the specified type (top, bottom, ...).
        /// If that border doesn't exist, it returns a new border object that inherits all properties from the given borders object
        /// </summary>
        private static Border GetBorderFromBorders(Borders borders, BorderType type)
        {
            Border returnBorder = borders.GetBorderReadOnly(type);

            if (returnBorder == null)
            {
                returnBorder          = new Border();
                returnBorder._style   = borders._style;
                returnBorder._width   = borders._width;
                returnBorder._color   = borders._color;
                returnBorder._visible = borders._visible;
            }
            return(returnBorder);
        }
Beispiel #2
0
        /// <summary>
        /// Returns the width of the border at the specified position.
        /// </summary>
        private static Unit GetEffectiveBorderWidth(Borders borders, BorderType type)
        {
            if (borders == null)
            {
                return(0);
            }

            Border border = borders.GetBorderReadOnly(type);

            DocumentObject relevantDocObj = border;

            if (relevantDocObj == null || relevantDocObj.IsNull("Width"))
            {
                relevantDocObj = borders;
            }

            // Avoid unnecessary GetValue calls.
            object visible = relevantDocObj.GetValue("visible", GV.GetNull);

            if (visible != null && !(bool)visible)
            {
                return(0);
            }

            object width = relevantDocObj.GetValue("width", GV.GetNull);

            if (width != null)
            {
                return((Unit)width);
            }

            object color = relevantDocObj.GetValue("color", GV.GetNull);

            if (color != null)
            {
                return(0.5);
            }

            object style = relevantDocObj.GetValue("style", GV.GetNull);

            if (style != null)
            {
                return(0.5);
            }
            return(0);
        }