コード例 #1
0
        public CssSpacingBox(CssBox tableBox, ref CssBox extendedBox, int startRow)
            : base(tableBox, new HtmlTag("none", false, new Dictionary<string, string> { { "colspan", "1" } }))
        {
            _extendedBox = extendedBox;
            Display = CssConstants.None;

            _startRow = startRow;
            _endRow = startRow + Int32.Parse(extendedBox.GetAttribute("rowspan", "1")) - 1;
        }
コード例 #2
0
        /// <summary>
        /// Gets the span attribute of the tag of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetSpan(CssBox b)
        {
            double f = CssValueParser.ParseNumber(b.GetAttribute("span"), 1);

            return Math.Max(1, Convert.ToInt32(f));
        }
コード例 #3
0
        /// <summary>
        /// Gets the rowspan of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetRowSpan(CssBox b)
        {
            string att = b.GetAttribute("rowspan", "1");
            int rowspan;

            if (!int.TryParse(att, out rowspan))
            {
                return 1;
            }

            return rowspan;
        }
コード例 #4
0
        /// <summary>
        /// Gets the colspan of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetColSpan(CssBox b)
        {
            string att = b.GetAttribute("colspan", "1");
            int colspan;

            if (!int.TryParse(att, out colspan))
            {
                return 1;
            }

            return colspan;
        }
コード例 #5
0
ファイル: DomUtils.cs プロジェクト: jcaillon/YamuiFramework
        /// <summary>
        /// returns the box with the attribute "clickable" that has been clicked
        /// </summary>
        /// <param name="box"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        public static CssBox SearchClickedBox(CssBox box, RPoint location)
        {
            if (box != null) {

                if (box.GetAttribute("clickable") != "" && box.ClientRectangle.Contains(location))
                    return box;

                if (box.ClientRectangle.IsEmpty || box.ClientRectangle.Contains(location)) {
                    foreach (var childBox in box.Boxes) {
                        var foundBox = SearchClickedBox(childBox, location);
                        if (foundBox != null)
                            return foundBox;
                    }
                }
            }

            return null;
        }
コード例 #6
0
ファイル: DomUtils.cs プロジェクト: jcaillon/YamuiFramework
 /// <summary>
 /// Get attribute value by given key starting search from given box, search up the tree until
 /// attribute found or root.
 /// </summary>
 /// <param name="box">the box to start lookup at</param>
 /// <param name="attribute">the attribute to get</param>
 /// <returns>the value of the attribute or null if not found</returns>
 public static string GetAttribute(CssBox box, string attribute)
 {
     string value = null;
     while (box != null && value == null)
     {
         value = box.GetAttribute(attribute, null);
         box = box.ParentBox;
     }
     return value;
 }