Exemplo n.º 1
0
        /// <summary>
        /// Starts the new size rule.
        /// </summary>
        /// <param name="borderSize">Border size to be applied.</param>
        /// <returns>Next rule reference.</returns>
        public IFluentBorderWithAll WithSize(BorderSize borderSize)
        {
            if (rules == null)
            {
                rules = new Dictionary <BorderSize, List <BorderDefinition> >();
            }

            var borderDefinition = new BorderDefinition {
                Side = BorderSide.All
            };

            if (!rules.ContainsKey(borderSize))
            {
                rules.Add(borderSize, new List <BorderDefinition> {
                    borderDefinition
                });
            }
            else
            {
                rules[borderSize].Add(borderDefinition);
            }

            currentBorderDefinition = borderDefinition;
            Dirty();

            return(this);
        }
Exemplo n.º 2
0
        public static BorderDefinitionList JsonToBorderList(string txt)
        {
            try
            {
                var retval      = new BorderDefinitionList();
                var jBorderList = JArray.Parse(txt);

                // Parse out BORDER Definitions
                foreach (var jRec in jBorderList)
                {
                    var rec = new BorderDefinition();
                    rec.Active   = StringToBool((string)jRec["active"]);
                    rec.Id       = (int)jRec["id"];
                    rec.Initial  = JsonToCordinate(jRec["initial"]);
                    rec.LeftName = (string)jRec["left_name"];
                    rec.Name     = (string)jRec["right_name"];
                    rec.Terminal = JsonToCordinate(jRec["terminal"]);
                    retval.BorderDefinitions.Add(rec);
                }

                return(retval);
            }
            catch (Exception ex)
            {
                var newEx = new Exception("Invalid JSON data format returned for 'State'.", ex);
                throw newEx;
            }
        }
Exemplo n.º 3
0
 public Frame(IRender content, BorderType border)
 {
     fill         = content == null;
     this.content = content;
     borderType   = border;
     this.border  = BoxArt.Border[border];
 }
Exemplo n.º 4
0
        public HttpStatusCode GetListOfBorders(out BorderDefinitionList rec)
        {
            // To allow legacy code to work with the new SVG Configuration now used by MOVE, we'll map
            // the SVG structures into the legacy structures.
            // todo: CONTROL needs to upgrade to using the new SVG calls and data structures.

            AreaDefinitionList ignored;
            LineDefinitionList linesList;

            rec = new BorderDefinitionList();
            var responseCode = GetSVGLayoutInfo(out ignored, out linesList);

            // Map SVG structure "LineDefinitionList" into legacy "BorderDefinitionList"
            foreach (var line in linesList.LineDefinitions)
            {
                var border = new BorderDefinition();
                border.Active     = line.Active;
                border.Id         = line.Id;
                border.Initial.X  = line.Initial.X;
                border.Initial.Y  = line.Initial.Y;
                border.LeftName   = line.LeftName;
                border.RightName  = line.RightName;
                border.Name       = line.Name;
                border.Terminal.X = line.Terminal.X;
                border.Terminal.Y = line.Terminal.Y;
                rec.BorderDefinitions.Add(border);
            }

            return(responseCode);
        }
Exemplo n.º 5
0
        //To execute this command, a drawing document with a view need to be available
        private void Border2_Click(object sender, EventArgs e)
        {
            DrawingDocument oDrawDoc = mApp.ActiveDocument as DrawingDocument;

            TransientGeometry oTG = mApp.TransientGeometry;

            //Create the new border definition
            BorderDefinition oBorderDef = oDrawDoc.BorderDefinitions.Add("Sample Border");

            //Open the border definition's sketch for edit.  This is done by calling the Edit
            // method of the BorderDefinition to obtain a DrawingSketch.  This actually creates
            // a copy of the border definition's and opens it for edit.
            DrawingSketch oSketch = null;

            oBorderDef.Edit(out oSketch);

            //Use the functionality of the sketch to add geometry
            oSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(2, 2), oTG.CreatePoint2d(25.94, 19.59));

            oBorderDef.ExitEdit(true, "");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Starts the new size rule.
        /// </summary>
        /// <param name="borderSize">Border size to be applied.</param>
        /// <returns>Next rule reference.</returns>
        public IFluentBorderWithAll WithSize(BorderSize borderSize)
        {
            rules ??= new();

            var borderDefinition = new BorderDefinition {
                Side = BorderSide.All
            };

            if (rules.TryGetValue(borderSize, out var rule))
            {
                rule.Add(borderDefinition);
            }
            else
            {
                rules.Add(borderSize, new() { borderDefinition });
            }

            currentBorderDefinition = borderDefinition;
            Dirty();

            return(this);
        }
Exemplo n.º 7
0
        void AddMembersIfNull(BorderDefinition borders)
        {
            if (borders == null)
                return;

            if (m_dataObject.TableBorders == null)
            {
                m_dataObject.TableBorders = new BorderDefinition();
            }
            if (borders.Top != null && 
                m_dataObject.TableBorders.Top == null)
            {
                m_dataObject.TableBorders.Top = new Border();
            }
            if (borders.Left != null && 
                m_dataObject.TableBorders.Left == null)
            {
                m_dataObject.TableBorders.Left = new Border();
            }
            if (borders.Bottom != null && 
                m_dataObject.TableBorders.Bottom == null)
            {
                m_dataObject.TableBorders.Bottom = new Border();
            }
            if (borders.Right != null && 
                m_dataObject.TableBorders.Right == null)
            {
                m_dataObject.TableBorders.Right = new Border();
            }
            if (borders.VerticalInside != null && 
                m_dataObject.TableBorders.VerticalInside == null)
            {
                m_dataObject.TableBorders.VerticalInside = new Border();
            }
            if (borders.HorizontalInside != null && 
                m_dataObject.TableBorders.HorizontalInside == null)
            {
                m_dataObject.TableBorders.HorizontalInside = new Border();
            }
        }
Exemplo n.º 8
0
 void ResolveParagraphBorders(BorderDefinition borders)
 {
     AddMembersIfNull(borders);
     HandlerSupportUtilities.SetBorderProperties(borders, m_dataObject.Borders);
     HandlerSupportUtilities.ResolveBorderColourProperties(Context, m_dataObject.Borders);
 }
Exemplo n.º 9
0
 void AddMembersIfNull(BorderDefinition borders)
 {
     if (m_dataObject.Borders == null)
     {
         m_dataObject.Borders = new BorderDefinition();
     }
     if (borders.Top != null &&
         borders.Top.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Top == null)
     {
         m_dataObject.Borders.Top = new Border();
     }
     if (borders.Left != null &&
         borders.Left.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Left == null)
     {
         m_dataObject.Borders.Left = new Border();
     }
     if (borders.Bottom != null &&
         borders.Bottom.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Bottom == null)
     {
         m_dataObject.Borders.Bottom = new Border();
     }
     if (borders.Right != null &&
         borders.Right.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Right == null)
     {
         m_dataObject.Borders.Right = new Border();
     }
     if (borders.Between != null &&
         borders.Between.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Between == null)
     {
         m_dataObject.Borders.Between = new Border();
     }
     if (borders.BorderBar != null &&
         borders.BorderBar.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.BorderBar == null)
     {
         m_dataObject.Borders.BorderBar = new Border();
     }
     if (borders.Box != null &&
         borders.Box.BorderLineStyle != Border.BorderStyle.NotSet &&
         m_dataObject.Borders.Box == null)
     {
         m_dataObject.Borders.Box = new Border();
     }
 }
Exemplo n.º 10
0
 public static void SetBorderProperties(BorderDefinition bordersSource, BorderDefinition bordersTarget)
 {
     if (bordersSource.Top != null &&
         bordersSource.Top.BorderLineStyle != Border.BorderStyle.NotSet && 
         bordersTarget.Top != null && 
         bordersTarget.Top.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Top, bordersTarget.Top);
     }
     if (bordersSource.Left != null &&
         bordersSource.Left.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.Left != null && 
         bordersTarget.Left.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Left, bordersTarget.Left);
     }
     if (bordersSource.Bottom != null &&
         bordersSource.Bottom.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.Bottom != null && 
         bordersTarget.Bottom.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Bottom, bordersTarget.Bottom);
     }
     if (bordersSource.Right != null &&
         bordersSource.Right.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.Right != null && 
         bordersTarget.Right.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Right, bordersTarget.Right);
     }
     if (bordersSource.VerticalInside != null &&
         bordersSource.VerticalInside.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.VerticalInside != null && 
         bordersTarget.VerticalInside.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.VerticalInside, bordersTarget.VerticalInside);
     }
     if (bordersSource.HorizontalInside != null &&
         bordersSource.HorizontalInside.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.HorizontalInside != null && 
         bordersTarget.HorizontalInside.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.HorizontalInside, bordersTarget.HorizontalInside);
     }
     if (bordersSource.Between != null &&
         bordersSource.Between.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.Between != null && 
         bordersTarget.Between.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Between, bordersTarget.Between);
     }
     if (bordersSource.BorderBar != null &&
         bordersSource.BorderBar.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.BorderBar != null && 
         bordersTarget.BorderBar.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.BorderBar, bordersTarget.BorderBar);
     }
     if (bordersSource.Box != null &&
         bordersSource.Box.BorderLineStyle != Border.BorderStyle.NotSet &&
         bordersTarget.Box != null &&
         bordersTarget.Box.BorderLineStyle == Border.BorderStyle.NotSet)
     {
         SetBorderProperties(bordersSource.Box, bordersSource.Box);
     }
     //these ones are on tableCells - at the moment there is nothing about applying styles
     //to these enable if we ever find we need to
     //if (bordersSource.TopRightToBottomLeft != null && 
     //    bordersTarget.TopRightToBottomLeft != null && 
     //    bordersTarget.TopRightToBottomLeft.BorderLineStyle == Border.BorderStyle.NotSet)
     //{
     //    SetBorderProperties(bordersSource.TopLeftToBottomRight, bordersSource.BottomLeftTopRight);
     //}
     //if (bordersSource.TopLeftToBottomRight != null && 
     //    bordersTarget.TopLeftToBottomRight != null && 
     //    bordersTarget.TopLeftToBottomRight.BorderLineStyle == Border.BorderStyle.NotSet)
     //{
     //    SetBorderProperties(bordersSource.DiagonalTopLeftBottomRight, bordersSource.DiagonalTopLeftBottomRight);
     //}
 }
Exemplo n.º 11
0
        public static void ResolveBorderColourProperties(ParsingContext context, BorderDefinition borders)
        {
            if (borders.Top != null &&
                borders.Top.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Top.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Top.ColorInfo, false); 
            }

            if (borders.Left != null &&
                borders.Left.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Left.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Left.ColorInfo, false);
            }

            if (borders.Bottom != null &&
                borders.Bottom.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Bottom.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Bottom.ColorInfo, false);
            }

            if (borders.Right != null &&
                borders.Right.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Right.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Right.ColorInfo, false);
            }

            if(borders.BorderBar != null &&
                borders.BorderBar.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.BorderBar.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.BorderBar.ColorInfo, false);
            }

            if (borders.Box != null &&
                borders.Box.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Box.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Box.ColorInfo, false);
            }

            if (borders.Between != null &&
                borders.Between.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.Between.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.Between.ColorInfo, false);
            }

            if (borders.VerticalInside != null &&
                borders.VerticalInside.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.VerticalInside.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.VerticalInside.ColorInfo, false);
            }

            if (borders.HorizontalInside != null &&
                borders.HorizontalInside.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.HorizontalInside.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.HorizontalInside.ColorInfo, false);
            }

            if (borders.TopLeftToBottomRight != null &&
                borders.TopLeftToBottomRight.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.TopLeftToBottomRight.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.TopLeftToBottomRight.ColorInfo, false);
            }

            if (borders.TopRightToBottomLeft != null &&
                borders.TopRightToBottomLeft.ColorInfo != null)
            {
                HandlerSupportUtilities.UpdateColorDefinitionRGB(borders.TopRightToBottomLeft.ColorInfo, true);
                HandlerSupportUtilities.ResolveThemeColorData(context, borders.TopRightToBottomLeft.ColorInfo, false);
            }

        }