Exemple #1
0
 public void Init()
 {
     this.fontStretch             = FontStretch.Normal;
     this.fontStyle               = Windows.UI.Text.FontStyle.Normal;
     this.fontWeight              = FontWeights.Normal;
     this.leftBorder              = null;
     this.topBorder               = null;
     this.rightBorder             = null;
     this.bottomBorder            = null;
     this.horizontalBorder        = null;
     this.verticalBorder          = null;
     this.background              = null;
     this.foreground              = null;
     this.backgroundThemeColor    = null;
     this.foregroundThemeColor    = null;
     this.fontStretchSet          = false;
     this.fontStyleSet            = false;
     this.fontWeightSet           = false;
     this.leftBorderSet           = false;
     this.topBorderSet            = false;
     this.rightBorderSet          = false;
     this.bottomBorderSet         = false;
     this.horizontalBorderSet     = false;
     this.verticalBorderSet       = false;
     this.backgroundSet           = false;
     this.foregroundSet           = false;
     this.backgroundThemeColorSet = false;
     this.foregroundThemeColorSet = false;
 }
Exemple #2
0
        static void Layout4TurnRoad(LineItem lineItem, int type, int breaker, ref double o1, ref double o3)
        {
            BorderLine objB     = GetBreaker(lineItem, type, breaker);
            BorderLine neighbor = GetNeighbor(lineItem, type);
            bool       flag     = IsDoubleLine(GetNeighbor(lineItem, type));

            if ((lineItem.Line > objB) || object.Equals(lineItem.Line, objB))
            {
                o3 -= type * 2;
            }
            else
            {
                o3 -= type * 3;
            }
            if (flag)
            {
                if (!object.Equals(lineItem.Line, neighbor) && (lineItem.Line <= neighbor))
                {
                    o1 -= type * 3;
                }
            }
            else if ((lineItem.Line <= objB) && !object.Equals(lineItem.Line, objB))
            {
                o1 -= type;
            }
        }
Exemple #3
0
 /// <summary>
 /// Gets the maximum line of two lines.
 /// </summary>
 /// <param name="line1">The first line.</param>
 /// <param name="line2">The second line.</param>
 /// <returns>The maximum of two lines.</returns>
 public static BorderLine Max(BorderLine line1, BorderLine line2)
 {
     if (line1 <= line2)
     {
         return(line2);
     }
     return(line1);
 }
Exemple #4
0
        static void Layout4Connected(LineItem lineItem, int type, ref double o1, ref double o3)
        {
            BorderLine neighbor = GetNeighbor(lineItem, type);

            if (IsDoubleLine(neighbor))
            {
                double     thickness = 1.0;
                BorderLine line2     = BorderLine.Max(GetBreaker1(lineItem, type), GetBreaker2(lineItem, type));
                if (line2 != null)
                {
                    thickness = line2.StyleData.Thickness;
                }
                if ((lineItem.Line > neighbor) || object.Equals(neighbor, lineItem.Line))
                {
                    if (type == 1)
                    {
                        o1 -= type;
                        o3 -= type;
                    }
                    else if (thickness == 1.0)
                    {
                        o1 -= type;
                        o3 -= type;
                    }
                }
                else if (type == 1)
                {
                    if (thickness == 1.0)
                    {
                        o1 -= type * 2;
                        o3 -= type * 2;
                    }
                    else
                    {
                        o1 -= type * 3;
                        o3 -= type * 3;
                    }
                }
                else
                {
                    o1 -= type * 2;
                    o3 -= type * 2;
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Compares whether the border line is equal to the specified border line.
        /// </summary>
        /// <param name="obj">The compared border line.</param>
        /// <returns>
        /// <c>true</c> if the border line is less than the second line; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            BorderLine line = obj as BorderLine;

            if (line == null)
            {
                return(false);
            }
            if (this.Style != line.Style)
            {
                return(false);
            }
            if (this._color != line._color)
            {
                return(false);
            }
            if (this._themeColor != line._themeColor)
            {
                return(false);
            }
            return(true);
        }
Exemple #6
0
        static void Layout4TRoad(LineItem lineItem, int type, ref double o1, ref double o3)
        {
            BorderLine objB  = GetBreaker1(lineItem, type);
            BorderLine line2 = GetBreaker2(lineItem, type);

            if ((lineItem.Line > objB) || object.Equals(lineItem.Line, objB))
            {
                o1 -= type * 2;
            }
            else
            {
                o1 -= type * 3;
            }
            if ((lineItem.Line > line2) || object.Equals(lineItem.Line, line2))
            {
                o3 -= type * 2;
            }
            else
            {
                o3 -= type * 3;
            }
        }
Exemple #7
0
 public void ResetBorderTop()
 {
     this.topBorder    = null;
     this.topBorderSet = false;
     this.OnChanged(EventArgs.Empty);
 }
Exemple #8
0
 public void ResetBorderRight()
 {
     this.rightBorder    = null;
     this.rightBorderSet = false;
     this.OnChanged(EventArgs.Empty);
 }
Exemple #9
0
 public void ResetBorderHorizontal()
 {
     this.horizontalBorder    = null;
     this.horizontalBorderSet = false;
     this.OnChanged(EventArgs.Empty);
 }
Exemple #10
0
 public void ResetBorderBottom()
 {
     this.bottomBorder    = null;
     this.bottomBorderSet = false;
     this.OnChanged(EventArgs.Empty);
 }
Exemple #11
0
        /// <summary>
        /// Creates a border line element or gets a border line element from BorderLinesPool"/&gt;.
        /// </summary>
        /// <param name="linePool">The line pool.</param>
        /// <param name="borderLine">The border line.</param>
        /// <returns>The border line</returns>
        public static ComboLine Create(BorderLinesPool linePool, BorderLine borderLine)
        {
            ComboLine line;

            if (linePool != null)
            {
                line = linePool.Pop() as ComboLine;
            }
            else
            {
                line = new ComboLine();
            }

            if (borderLine != null)
            {
                if (borderLine.Style == BorderLineStyle.Double)
                {
                    line._line1.Visibility      = Visibility.Visible;
                    line._line2.Visibility      = Visibility.Collapsed;
                    line._line3.Visibility      = Visibility.Visible;
                    line._line1.StrokeThickness = 1.0;
                    line._line3.StrokeThickness = 1.0;
                    if (linePool == null)
                    {
                        line._line1.Stroke = new SolidColorBrush(borderLine.Color);
                        line._line3.Stroke = new SolidColorBrush(borderLine.Color);
                    }
                    else
                    {
                        line._line1.SetColor(linePool.GetSolidBrush(borderLine.Color), borderLine.Color);
                        line._line3.SetColor(linePool.GetSolidBrush(borderLine.Color), borderLine.Color);
                    }
                    ApplyDashArray(line._line1, borderLine.StyleData.FarDash, borderLine.StyleData.StrokeDashOffset);
                    ApplyDashArray(line._line3, borderLine.StyleData.NearDash, borderLine.StyleData.StrokeDashOffset);
                    return(line);
                }

                if (borderLine.Style == BorderLineStyle.SlantedDashDot)
                {
                    line._line1.Visibility      = Visibility.Visible;
                    line._line2.Visibility      = Visibility.Visible;
                    line._line3.Visibility      = Visibility.Collapsed;
                    line._line1.StrokeThickness = 1.0;
                    line._line2.StrokeThickness = 1.0;
                    if (linePool == null)
                    {
                        line._line1.Stroke = new SolidColorBrush(borderLine.Color);
                        line._line2.Stroke = new SolidColorBrush(borderLine.Color);
                    }
                    else
                    {
                        line._line1.SetColor(linePool.GetSolidBrush(borderLine.Color), borderLine.Color);
                        line._line2.SetColor(linePool.GetSolidBrush(borderLine.Color), borderLine.Color);
                    }
                    ApplyDashArray(line._line1, borderLine.StyleData.FarDash, borderLine.StyleData.StrokeDashOffset - 1);
                    ApplyDashArray(line._line2, borderLine.StyleData.MiddleDash, borderLine.StyleData.StrokeDashOffset);
                    return(line);
                }

                line._line1.Visibility      = Visibility.Collapsed;
                line._line2.Visibility      = Visibility.Visible;
                line._line3.Visibility      = Visibility.Collapsed;
                line._line2.StrokeThickness = borderLine.StyleData.DrawingThickness;
                if (linePool == null)
                {
                    line._line2.Stroke = new SolidColorBrush(borderLine.Color);
                }
                else
                {
                    line._line2.SetColor(linePool.GetSolidBrush(borderLine.Color), borderLine.Color);
                }
                ApplyDashArray(line._line2, borderLine.StyleData.MiddleDash, borderLine.StyleData.StrokeDashOffset);
            }
            return(line);
        }
Exemple #12
0
 /// <summary>
 /// Determines whether the specified line is a double line.
 /// </summary>
 /// <param name="line">The specified line.</param>
 /// <returns><c>true</c> if the specified line is a double line; otherwise, <c>false</c>.</returns>
 public static bool IsDoubleLine(BorderLine line)
 {
     return((line != null) && (line.Style == BorderLineStyle.Double));
 }
Exemple #13
0
 public static void SetSheetBorder(SheetArea sheetArea, Worksheet workSheet, SetBorderOptions option, BorderLine borderLine, SheetArea sheatarea, StyleInfo borderstyle)
 {
     if (option.HasFlag(SetBorderOptions.All))
     {
         borderstyle.BorderLeft   = borderLine.Clone() as BorderLine;
         borderstyle.BorderTop    = borderLine.Clone() as BorderLine;
         borderstyle.BorderRight  = borderLine.Clone() as BorderLine;
         borderstyle.BorderBottom = borderLine.Clone() as BorderLine;
     }
     else
     {
         if (option.HasFlag(SetBorderOptions.Left))
         {
             bool[] flags = new bool[4];
             flags[0] = true;
             BorderLine[] lines = new BorderLine[4];
             lines[0] = borderLine;
             SetAxisBorder(workSheet, sheetArea, 0, 1, flags, lines, false);
         }
         if (option.HasFlag(SetBorderOptions.Top))
         {
             bool[] flagArray2 = new bool[4];
             flagArray2[1] = true;
             BorderLine[] lineArray2 = new BorderLine[4];
             lineArray2[1] = borderLine;
             SetAxisBorder(workSheet, sheetArea, 0, 1, flagArray2, lineArray2, true);
         }
         if (option.HasFlag(SetBorderOptions.Right))
         {
             bool[] flagArray3 = new bool[4];
             flagArray3[2] = true;
             BorderLine[] lineArray3 = new BorderLine[4];
             lineArray3[2] = borderLine;
             SetAxisBorder(workSheet, sheetArea, workSheet.ColumnCount - 1, 1, flagArray3, lineArray3, false);
         }
         if (option.HasFlag(SetBorderOptions.Bottom))
         {
             bool[] flagArray4 = new bool[4];
             flagArray4[3] = true;
             BorderLine[] lineArray4 = new BorderLine[4];
             lineArray4[3] = borderLine;
             SetAxisBorder(workSheet, sheetArea, workSheet.RowCount - 1, 1, flagArray4, lineArray4, true);
         }
         if (option.HasFlag(SetBorderOptions.InnerHorizontal))
         {
             if (workSheet.RowCount > 1)
             {
                 bool[] flagArray5 = new bool[4];
                 flagArray5[1] = true;
                 BorderLine[] lineArray5 = new BorderLine[4];
                 SetAxisBorder(workSheet, sheetArea, 1, workSheet.RowCount - 1, flagArray5, lineArray5, true);
             }
             bool[] flagArray6 = new bool[4];
             flagArray6[3] = true;
             BorderLine[] lineArray6 = new BorderLine[4];
             lineArray6[3] = borderLine;
             SetAxisBorder(workSheet, sheetArea, 0, workSheet.RowCount - 1, flagArray6, lineArray6, true);
         }
         if (option.HasFlag(SetBorderOptions.InnerVertical))
         {
             if (workSheet.ColumnCount > 1)
             {
                 bool[] flagArray7 = new bool[4];
                 flagArray7[0] = true;
                 BorderLine[] lineArray7 = new BorderLine[4];
                 SetAxisBorder(workSheet, sheetArea, 1, workSheet.ColumnCount - 1, flagArray7, lineArray7, false);
             }
             bool[] flagArray8 = new bool[4];
             flagArray8[2] = true;
             BorderLine[] lineArray8 = new BorderLine[4];
             lineArray8[2] = borderLine;
             SetAxisBorder(workSheet, sheetArea, 0, workSheet.ColumnCount - 1, flagArray8, lineArray8, false);
         }
     }
 }
Exemple #14
0
 public static void SetRowsBorder(CellRange cellRange, SheetArea sheetArea, Worksheet workSheet, SetBorderOptions option, BorderLine borderLine)
 {
     if (option.HasFlag(SetBorderOptions.All))
     {
         if (cellRange.Row > 0)
         {
             bool[] flags = new bool[4];
             flags[3] = true;
             BorderLine[] lines = new BorderLine[4];
             SetAxisBorder(workSheet, sheetArea, cellRange.Row - 1, 1, flags, lines, true);
         }
         if ((cellRange.Row + cellRange.RowCount) < GetRowCount(workSheet, sheetArea))
         {
             bool[] flagArray2 = new bool[4];
             flagArray2[1] = true;
             BorderLine[] lineArray2 = new BorderLine[4];
             SetAxisBorder(workSheet, sheetArea, cellRange.Row + cellRange.RowCount, 1, flagArray2, lineArray2, true);
         }
         SetAxisBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, new bool[] { true, true, true, true }, new BorderLine[] { borderLine, borderLine, borderLine, borderLine }, true);
     }
     else
     {
         if (option.HasFlag(SetBorderOptions.Left))
         {
             bool[] flagArray3 = new bool[4];
             flagArray3[0] = true;
             BorderLine[] lineArray4 = new BorderLine[4];
             lineArray4[0] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, 0, 1, flagArray3, lineArray4, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Right))
         {
             bool[] flagArray4 = new bool[4];
             flagArray4[2] = true;
             BorderLine[] lineArray5 = new BorderLine[4];
             lineArray5[2] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, workSheet.ColumnCount - 1, 1, flagArray4, lineArray5, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Top))
         {
             if (cellRange.Row > 0)
             {
                 bool[] flagArray5 = new bool[4];
                 flagArray5[3] = true;
                 BorderLine[] lineArray6 = new BorderLine[4];
                 SetAxisBorder(workSheet, sheetArea, cellRange.Row - 1, 1, flagArray5, lineArray6, true);
             }
             bool[] flagArray6 = new bool[4];
             flagArray6[1] = true;
             BorderLine[] lineArray7 = new BorderLine[4];
             lineArray7[1] = borderLine;
             SetAxisBorder(workSheet, sheetArea, cellRange.Row, 1, flagArray6, lineArray7, true);
         }
         if (option.HasFlag(SetBorderOptions.Bottom))
         {
             if ((cellRange.Row + cellRange.RowCount) < GetRowCount(workSheet, sheetArea))
             {
                 bool[] flagArray7 = new bool[4];
                 flagArray7[1] = true;
                 BorderLine[] lineArray8 = new BorderLine[4];
                 SetAxisBorder(workSheet, sheetArea, cellRange.Row + cellRange.RowCount, 1, flagArray7, lineArray8, true);
             }
             bool[] flagArray8 = new bool[4];
             flagArray8[3] = true;
             BorderLine[] lineArray9 = new BorderLine[4];
             lineArray9[3] = borderLine;
             SetAxisBorder(workSheet, sheetArea, (cellRange.Row + cellRange.RowCount) - 1, 1, flagArray8, lineArray9, true);
         }
         if (option.HasFlag(SetBorderOptions.InnerHorizontal))
         {
             if (cellRange.RowCount > 1)
             {
                 bool[] flagArray9 = new bool[4];
                 flagArray9[1] = true;
                 BorderLine[] lineArray10 = new BorderLine[4];
                 SetAxisBorder(workSheet, sheetArea, cellRange.Row + 1, cellRange.RowCount - 1, flagArray9, lineArray10, true);
             }
             bool[] flagArray10 = new bool[4];
             flagArray10[3] = true;
             BorderLine[] lineArray11 = new BorderLine[4];
             lineArray11[3] = borderLine;
             SetAxisBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount - 1, flagArray10, lineArray11, true);
         }
         if (option.HasFlag(SetBorderOptions.InnerVertical))
         {
             if (workSheet.ColumnCount > 1)
             {
                 bool[] flagArray11 = new bool[4];
                 flagArray11[0] = true;
                 BorderLine[] lineArray12 = new BorderLine[4];
                 SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, 1, workSheet.ColumnCount - 1, flagArray11, lineArray12, false, false);
             }
             bool[] flagArray12 = new bool[4];
             flagArray12[2] = true;
             BorderLine[] lineArray13 = new BorderLine[4];
             lineArray13[2] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, 0, workSheet.ColumnCount - 1, flagArray12, lineArray13, false, false);
         }
     }
 }
Exemple #15
0
 public static void SetCellsBorder(CellRange cellRange, SheetArea sheetArea, Worksheet workSheet, SetBorderOptions option, BorderLine borderLine)
 {
     if (option.HasFlag(SetBorderOptions.All))
     {
         if (cellRange.Column > 0)
         {
             bool[] flags = new bool[4];
             flags[2] = true;
             BorderLine[] lines = new BorderLine[4];
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column - 1, 1, flags, lines, false, false);
         }
         if (cellRange.Row > 0)
         {
             bool[] flagArray2 = new bool[4];
             flagArray2[3] = true;
             BorderLine[] lineArray2 = new BorderLine[4];
             SetCellBorder(workSheet, sheetArea, cellRange.Row - 1, 1, cellRange.Column, cellRange.ColumnCount, flagArray2, lineArray2, false, false);
         }
         if ((cellRange.Column + cellRange.ColumnCount) < GetColumnCount(workSheet, sheetArea))
         {
             bool[] flagArray3 = new bool[4];
             flagArray3[0] = true;
             BorderLine[] lineArray3 = new BorderLine[4];
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column + cellRange.ColumnCount, 1, flagArray3, lineArray3, false, false);
         }
         if ((cellRange.Row + cellRange.RowCount) < GetRowCount(workSheet, sheetArea))
         {
             bool[] flagArray4 = new bool[4];
             flagArray4[1] = true;
             BorderLine[] lineArray4 = new BorderLine[4];
             SetCellBorder(workSheet, sheetArea, cellRange.Row + cellRange.RowCount, 1, cellRange.Column, cellRange.ColumnCount, flagArray4, lineArray4, false, false);
         }
         SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column, cellRange.ColumnCount, new bool[] { true, true, true, true }, new BorderLine[] { borderLine, borderLine, borderLine, borderLine }, false, false);
     }
     else
     {
         if (option.HasFlag(SetBorderOptions.Left))
         {
             if (cellRange.Column > 0)
             {
                 bool[] flagArray5 = new bool[4];
                 flagArray5[2] = true;
                 BorderLine[] lineArray6 = new BorderLine[4];
                 SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column - 1, 1, flagArray5, lineArray6, false, false);
             }
             bool[] flagArray6 = new bool[4];
             flagArray6[0] = true;
             BorderLine[] lineArray7 = new BorderLine[4];
             lineArray7[0] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column, 1, flagArray6, lineArray7, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Top))
         {
             if (cellRange.Row > 0)
             {
                 bool[] flagArray7 = new bool[4];
                 flagArray7[3] = true;
                 BorderLine[] lineArray8 = new BorderLine[4];
                 SetCellBorder(workSheet, sheetArea, cellRange.Row - 1, 1, cellRange.Column, cellRange.ColumnCount, flagArray7, lineArray8, false, false);
             }
             bool[] flagArray8 = new bool[4];
             flagArray8[1] = true;
             BorderLine[] lineArray9 = new BorderLine[4];
             lineArray9[1] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, 1, cellRange.Column, cellRange.ColumnCount, flagArray8, lineArray9, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Right))
         {
             if ((cellRange.Column + cellRange.ColumnCount) < GetColumnCount(workSheet, sheetArea))
             {
                 bool[] flagArray9 = new bool[4];
                 flagArray9[0] = true;
                 BorderLine[] lineArray10 = new BorderLine[4];
                 SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column + cellRange.ColumnCount, 1, flagArray9, lineArray10, false, false);
             }
             bool[] flagArray10 = new bool[4];
             flagArray10[2] = true;
             BorderLine[] lineArray11 = new BorderLine[4];
             lineArray11[2] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, (cellRange.Column + cellRange.ColumnCount) - 1, 1, flagArray10, lineArray11, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Bottom))
         {
             if ((cellRange.Row + cellRange.RowCount) < GetRowCount(workSheet, sheetArea))
             {
                 bool[] flagArray11 = new bool[4];
                 flagArray11[1] = true;
                 BorderLine[] lineArray12 = new BorderLine[4];
                 SetCellBorder(workSheet, sheetArea, cellRange.Row + cellRange.RowCount, 1, cellRange.Column, cellRange.ColumnCount, flagArray11, lineArray12, false, false);
             }
             bool[] flagArray12 = new bool[4];
             flagArray12[3] = true;
             BorderLine[] lineArray13 = new BorderLine[4];
             lineArray13[3] = borderLine;
             SetCellBorder(workSheet, sheetArea, (cellRange.Row + cellRange.RowCount) - 1, 1, cellRange.Column, cellRange.ColumnCount, flagArray12, lineArray13, false, false);
         }
         if (option.HasFlag(SetBorderOptions.Inside))
         {
             bool[] flagArray13 = new bool[4];
             flagArray13[0] = true;
             flagArray13[1] = true;
             BorderLine[] lineArray14 = new BorderLine[4];
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column, cellRange.ColumnCount, flagArray13, lineArray14, true, true);
             bool[] flagArray14 = new bool[4];
             flagArray14[2] = true;
             flagArray14[3] = true;
             BorderLine[] lineArray15 = new BorderLine[4];
             lineArray15[2] = borderLine;
             lineArray15[3] = borderLine;
             SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column, cellRange.ColumnCount, flagArray14, lineArray15, true, false);
         }
         else
         {
             if (option.HasFlag(SetBorderOptions.InnerHorizontal))
             {
                 if (cellRange.RowCount > 1)
                 {
                     bool[] flagArray15 = new bool[4];
                     flagArray15[1] = true;
                     BorderLine[] lineArray16 = new BorderLine[4];
                     SetCellBorder(workSheet, sheetArea, cellRange.Row + 1, cellRange.RowCount - 1, cellRange.Column, cellRange.ColumnCount, flagArray15, lineArray16, false, false);
                 }
                 bool[] flagArray16 = new bool[4];
                 flagArray16[3] = true;
                 BorderLine[] lineArray17 = new BorderLine[4];
                 lineArray17[3] = borderLine;
                 SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount - 1, cellRange.Column, cellRange.ColumnCount, flagArray16, lineArray17, false, false);
             }
             if (option.HasFlag(SetBorderOptions.InnerVertical))
             {
                 if (cellRange.ColumnCount > 1)
                 {
                     bool[] flagArray17 = new bool[4];
                     flagArray17[0] = true;
                     BorderLine[] lineArray18 = new BorderLine[4];
                     SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column + 1, cellRange.ColumnCount - 1, flagArray17, lineArray18, false, false);
                 }
                 bool[] flagArray18 = new bool[4];
                 flagArray18[2] = true;
                 BorderLine[] lineArray19 = new BorderLine[4];
                 lineArray19[2] = borderLine;
                 SetCellBorder(workSheet, sheetArea, cellRange.Row, cellRange.RowCount, cellRange.Column, cellRange.ColumnCount - 1, flagArray18, lineArray19, false, false);
             }
         }
     }
 }
Exemple #16
0
 public void ResetBorderVertical()
 {
     this.verticalBorder    = null;
     this.verticalBorderSet = false;
     this.OnChanged(EventArgs.Empty);
 }
Exemple #17
0
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            Serializer.InitReader(reader);
            while (reader.Read())
            {
                if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.Element)))
                {
                    switch (reader.Name)
                    {
                    case "FontStretch":
                    {
                        FontStretch?stretch = null;
                        string      str     = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object      obj2    = Serializer.DeserializeEnum(this.FontStretch.GetType(), str);
                        if (obj2 != null)
                        {
                            stretch = new FontStretch?((FontStretch)obj2);
                        }
                        if (stretch.HasValue)
                        {
                            this.fontStretch    = stretch.Value;
                            this.fontStretchSet = true;
                        }
                        break;
                    }

                    case "FontStyle":
                    {
                        Windows.UI.Text.FontStyle?style = null;
                        string str  = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object obj2 = Serializer.DeserializeEnum(this.FontStyle.GetType(), str);
                        if (obj2 != null)
                        {
                            style = new Windows.UI.Text.FontStyle?((Windows.UI.Text.FontStyle)obj2);
                        }
                        if (style.HasValue)
                        {
                            this.fontStyle    = style.Value;
                            this.fontStyleSet = true;
                        }
                        break;
                    }

                    case "FontWeight":
                        goto Label_0214;

                    case "LeftBorder":
                        this.leftBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.leftBorderSet = true;
                        break;

                    case "TopBorder":
                        this.topBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.topBorderSet = true;
                        break;

                    case "RightBorder":
                        this.rightBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.rightBorderSet = true;
                        break;

                    case "BottomBorder":
                        this.bottomBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.bottomBorderSet = true;
                        break;

                    case "HorizontalBorder":
                        this.horizontalBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.horizontalBorderSet = true;
                        break;

                    case "VerticalBorder":
                        this.verticalBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.verticalBorderSet = true;
                        break;

                    case "Background":
                        goto Label_033E;

                    case "Foreground":
                        goto Label_035E;

                    case "BackgroundTheme":
                        this.backgroundThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this.backgroundThemeColorSet = true;
                        break;

                    case "ForegroundTheme":
                        this.foregroundThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this.foregroundThemeColorSet = true;
                        break;
                    }
                }
                continue;
Label_0214:
                string result = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                FontWeight?weight = Serializer.FindStaticDefinationStruct <FontWeight>(typeof(FontWeights), result);
                if (weight.HasValue)
                {
                    this.fontWeight    = weight.Value;
                    this.fontWeightSet = true;
                }
                continue;
Label_033E:
                background         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this.backgroundSet = true;
                continue;
Label_035E:
                foreground         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this.foregroundSet = true;
            }
            this.OnChanged(EventArgs.Empty);
        }
Exemple #18
0
        static void CalcLayoutVertical(LineItem lineItem, double hOffset, double vOffset, out double x1, out double x2, out double y1, out double y2)
        {
            y1 = lineItem.Bounds[0].Top;
            y2 = lineItem.Bounds[lineItem.Bounds.Count - 1].Bottom;
            if (lineItem.Line.StyleData.DrawingThickness == 2)
            {
                x1 = lineItem.Bounds[0].Right - 1.0;
                x2 = lineItem.Bounds[0].Right - 1.0;
            }
            else
            {
                x1 = lineItem.Bounds[0].Right - 0.5;
                x2 = lineItem.Bounds[0].Right - 0.5;
            }
            BorderLine objA = BorderLine.Max(lineItem.PreviousBreaker1, lineItem.PreviousBreaker2);

            if (!IsAllowExtend(lineItem, -1))
            {
                y1++;
            }
            else if (IsDoubleLine(lineItem.Line) && ((IsDoubleLine(lineItem.PreviousBreaker1) || IsDoubleLine(lineItem.PreviousBreaker2)) || IsDoubleLine(lineItem.PreviousLine)))
            {
                y1 -= 2.0;
            }
            else if (objA > lineItem.Line)
            {
                if (objA != null)
                {
                    if (objA.StyleData.Thickness == 3)
                    {
                        y1++;
                    }
                    else if (objA.StyleData.Thickness == 2)
                    {
                        y1 += 0.0;
                    }
                    else if (objA.StyleData.Thickness == 1)
                    {
                        y1 += 0.0;
                    }
                }
            }
            else if (lineItem.Line > objA)
            {
                if (lineItem.Line > lineItem.PreviousLine)
                {
                    if (objA != null)
                    {
                        if (objA.StyleData.Thickness == 3)
                        {
                            y1 -= 2.0;
                        }
                        else if (objA.StyleData.Thickness == 2)
                        {
                            y1 -= 2.0;
                        }
                        else if (objA.StyleData.Thickness == 1)
                        {
                            y1--;
                        }
                    }
                }
                else if (!object.Equals(lineItem.Line, lineItem.PreviousLine))
                {
                    if (lineItem.PreviousLine > objA)
                    {
                        if (objA != null)
                        {
                            if (objA.StyleData.Thickness == 3)
                            {
                                y1++;
                            }
                            else if (objA.StyleData.Thickness == 2)
                            {
                                y1 += 0.0;
                            }
                            else if (objA.StyleData.Thickness == 1)
                            {
                                y1 += 0.0;
                            }
                        }
                    }
                    else
                    {
                        y1 -= 0.0;
                    }
                }
            }
            else if (object.Equals(objA, lineItem.Line) && (lineItem.Line > lineItem.PreviousLine))
            {
                if (objA.StyleData.Thickness == 3)
                {
                    y1 -= 2.0;
                }
                else if (objA.StyleData.Thickness == 2)
                {
                    y1 -= 2.0;
                }
                else if (objA.StyleData.Thickness == 1)
                {
                    y1--;
                }
            }
            BorderLine line2 = BorderLine.Max(lineItem.NextBreaker1, lineItem.NextBreaker2);

            if (!IsAllowExtend(lineItem, 1))
            {
                y2 -= 2.0;
            }
            else if (IsDoubleLine(lineItem.Line) && ((IsDoubleLine(lineItem.NextBreaker1) || IsDoubleLine(lineItem.NextBreaker2)) || IsDoubleLine(lineItem.NextLine)))
            {
                y2++;
            }
            else if (line2 > lineItem.Line)
            {
                if (line2 != null)
                {
                    if (line2.StyleData.Thickness == 3)
                    {
                        y2 -= 2.0;
                    }
                    else if (line2.StyleData.Thickness == 2)
                    {
                        y2 -= 2.0;
                    }
                    else if (line2.StyleData.Thickness == 1)
                    {
                        y2--;
                    }
                }
            }
            else if ((line2 != null) && (lineItem.Line > line2))
            {
                if (lineItem.Line > lineItem.NextLine)
                {
                    if (line2 != null)
                    {
                        if (line2.StyleData.Thickness == 3)
                        {
                            y2++;
                        }
                        if (line2.StyleData.Thickness == 2)
                        {
                            y2 += 0.0;
                        }
                        if (line2.StyleData.Thickness == 1)
                        {
                            y2 += 0.0;
                        }
                    }
                }
                else if (!object.Equals(lineItem.Line, lineItem.NextLine))
                {
                    y2--;
                }
            }
            else if (object.Equals(line2, lineItem.Line))
            {
                if (lineItem.Line > lineItem.NextLine)
                {
                    if (line2.StyleData.Thickness == 3)
                    {
                        y2++;
                    }
                    if (line2.StyleData.Thickness == 2)
                    {
                        y2 += 0.0;
                    }
                    if (line2.StyleData.Thickness == 1)
                    {
                        y2 += 0.0;
                    }
                }
                else if (!object.Equals(lineItem.Line, lineItem.NextLine))
                {
                    y2--;
                }
            }
            x1 -= hOffset;
            x2 -= hOffset;
            y1 -= vOffset;
            y2 -= vOffset;
        }