Exemple #1
0
        // Token: 0x060068A2 RID: 26786 RVA: 0x001D82D0 File Offset: 0x001D64D0
        internal static Thickness CalculatePadding(List list, double lineHeight, double pixelsPerDip)
        {
            FormattedText formattedMarker = ListMarkerSourceInfo.GetFormattedMarker(list, pixelsPerDip);
            double        num             = formattedMarker.Width + 1.5 * lineHeight;

            num = (double)((int)(num / lineHeight) + 1) * lineHeight;
            return(new Thickness(num, 0.0, 0.0, 0.0));
        }
Exemple #2
0
 // Token: 0x060068A5 RID: 26789 RVA: 0x001D8594 File Offset: 0x001D6794
 private static string GetStringForLargestRomanMarker(int startIndex, int highestIndex, bool uppercase)
 {
     if (highestIndex <= 3999)
     {
         int indexForLargestRomanMarker = ListMarkerSourceInfo.GetIndexForLargestRomanMarker(startIndex, highestIndex);
         return(ListMarkerSourceInfo.ConvertNumberToRomanString(indexForLargestRomanMarker, uppercase));
     }
     if (!uppercase)
     {
         return(ListMarkerSourceInfo.LargestRomanMarkerLower);
     }
     return(ListMarkerSourceInfo.LargestRomanMarkerUpper);
 }
Exemple #3
0
        // Token: 0x060068A7 RID: 26791 RVA: 0x001D86A4 File Offset: 0x001D68A4
        private static string ConvertNumberToRomanString(int number, bool uppercase)
        {
            Invariant.Assert(number <= 3999);
            StringBuilder stringBuilder = new StringBuilder();

            ListMarkerSourceInfo.AddRomanNumeric(stringBuilder, number / 1000, ListMarkerSourceInfo.RomanNumerics[uppercase ? 1 : 0][0]);
            number %= 1000;
            ListMarkerSourceInfo.AddRomanNumeric(stringBuilder, number / 100, ListMarkerSourceInfo.RomanNumerics[uppercase ? 1 : 0][1]);
            number %= 100;
            ListMarkerSourceInfo.AddRomanNumeric(stringBuilder, number / 10, ListMarkerSourceInfo.RomanNumerics[uppercase ? 1 : 0][2]);
            number %= 10;
            ListMarkerSourceInfo.AddRomanNumeric(stringBuilder, number, ListMarkerSourceInfo.RomanNumerics[uppercase ? 1 : 0][3]);
            stringBuilder.Append(ListMarkerSourceInfo.NumberSuffix);
            return(stringBuilder.ToString());
        }
Exemple #4
0
        // Token: 0x060068C1 RID: 26817 RVA: 0x001D9154 File Offset: 0x001D7354
        private static void ResolveAutoPadding(MbpInfo mbp, DependencyObject o, double lineHeight, double pixelsPerDip)
        {
            Thickness thickness;

            if (o is Figure || o is Floater)
            {
                thickness = new Thickness(0.5 * lineHeight);
            }
            else if (o is List)
            {
                thickness = ListMarkerSourceInfo.CalculatePadding((List)o, lineHeight, pixelsPerDip);
            }
            else
            {
                thickness = new Thickness(0.0);
            }
            mbp.Padding = new Thickness(double.IsNaN(mbp.Padding.Left) ? thickness.Left : mbp.Padding.Left, double.IsNaN(mbp.Padding.Top) ? thickness.Top : mbp.Padding.Top, double.IsNaN(mbp.Padding.Right) ? thickness.Right : mbp.Padding.Right, double.IsNaN(mbp.Padding.Bottom) ? thickness.Bottom : mbp.Padding.Bottom);
        }
Exemple #5
0
        // Token: 0x060068A6 RID: 26790 RVA: 0x001D85CC File Offset: 0x001D67CC
        private static int GetIndexForLargestRomanMarker(int startIndex, int highestIndex)
        {
            int num = 0;

            if (startIndex == 1)
            {
                int num2 = highestIndex / 1000;
                highestIndex %= 1000;
                for (int i = 0; i < ListMarkerSourceInfo.RomanNumericSizeIncrements.Length; i++)
                {
                    Invariant.Assert(highestIndex >= ListMarkerSourceInfo.RomanNumericSizeIncrements[i]);
                    if (highestIndex == ListMarkerSourceInfo.RomanNumericSizeIncrements[i])
                    {
                        num = highestIndex;
                        break;
                    }
                    Invariant.Assert(highestIndex > ListMarkerSourceInfo.RomanNumericSizeIncrements[i]);
                    if (i >= ListMarkerSourceInfo.RomanNumericSizeIncrements.Length - 1 || highestIndex < ListMarkerSourceInfo.RomanNumericSizeIncrements[i + 1])
                    {
                        num = ListMarkerSourceInfo.RomanNumericSizeIncrements[i];
                        break;
                    }
                }
                if (num2 > 0)
                {
                    num = num2 * 1000 + num;
                }
            }
            else
            {
                int num3 = 0;
                for (int j = startIndex; j <= highestIndex; j++)
                {
                    string text = ListMarkerSourceInfo.ConvertNumberToRomanString(j, true);
                    if (text.Length > num3)
                    {
                        num  = j;
                        num3 = text.Length;
                    }
                }
            }
            Invariant.Assert(num > 0);
            return(num);
        }
        /// <summary>
        /// Resolve Auto values for Padding.
        /// </summary>
        private static void ResolveAutoPadding(MbpInfo mbp, DependencyObject o, double lineHeight)
        {
            Thickness defaultPadding;

            if (o is Figure || o is Floater)
            {
                defaultPadding = new Thickness(0.5 * lineHeight);
            }
            else if (o is List)
            {
                defaultPadding = ListMarkerSourceInfo.CalculatePadding((List)o, lineHeight);
            }
            else
            {
                defaultPadding = new Thickness(0);
            }
            mbp.Padding = new Thickness(
                Double.IsNaN(mbp.Padding.Left) ? defaultPadding.Left : mbp.Padding.Left,
                Double.IsNaN(mbp.Padding.Top) ? defaultPadding.Top : mbp.Padding.Top,
                Double.IsNaN(mbp.Padding.Right) ? defaultPadding.Right : mbp.Padding.Right,
                Double.IsNaN(mbp.Padding.Bottom) ? defaultPadding.Bottom : mbp.Padding.Bottom);
        }
Exemple #7
0
        // Token: 0x060068A3 RID: 26787 RVA: 0x001D8324 File Offset: 0x001D6524
        private static FormattedText GetFormattedMarker(List list, double pixelsPerDip)
        {
            string        textToFormat = "";
            FormattedText result;

            if (ListMarkerSourceInfo.IsKnownSymbolMarkerStyle(list.MarkerStyle))
            {
                switch (list.MarkerStyle)
                {
                case TextMarkerStyle.Disc:
                    textToFormat = "\u009f";
                    break;

                case TextMarkerStyle.Circle:
                    textToFormat = "¡";
                    break;

                case TextMarkerStyle.Square:
                    textToFormat = "q";
                    break;

                case TextMarkerStyle.Box:
                    textToFormat = "§";
                    break;
                }
                Typeface modifiedTypeface = DynamicPropertyReader.GetModifiedTypeface(list, new FontFamily("Wingdings"));
                result = new FormattedText(textToFormat, DynamicPropertyReader.GetCultureInfo(list), list.FlowDirection, modifiedTypeface, list.FontSize, list.Foreground, pixelsPerDip);
            }
            else if (ListMarkerSourceInfo.IsKnownIndexMarkerStyle(list.MarkerStyle))
            {
                int startIndex = list.StartIndex;
                Invariant.Assert(startIndex > 0);
                int count = list.ListItems.Count;
                int num;
                if (2147483647 - count < startIndex)
                {
                    num = int.MaxValue;
                }
                else
                {
                    num = ((count == 0) ? startIndex : (startIndex + count - 1));
                }
                switch (list.MarkerStyle)
                {
                case TextMarkerStyle.LowerRoman:
                    textToFormat = ListMarkerSourceInfo.GetStringForLargestRomanMarker(startIndex, num, false);
                    break;

                case TextMarkerStyle.UpperRoman:
                    textToFormat = ListMarkerSourceInfo.GetStringForLargestRomanMarker(startIndex, num, true);
                    break;

                case TextMarkerStyle.LowerLatin:
                    textToFormat = ListMarkerSourceInfo.ConvertNumberToString(num, true, ListMarkerSourceInfo.LowerLatinNumerics);
                    break;

                case TextMarkerStyle.UpperLatin:
                    textToFormat = ListMarkerSourceInfo.ConvertNumberToString(num, true, ListMarkerSourceInfo.UpperLatinNumerics);
                    break;

                case TextMarkerStyle.Decimal:
                    textToFormat = ListMarkerSourceInfo.ConvertNumberToString(num, false, ListMarkerSourceInfo.DecimalNumerics);
                    break;
                }
                result = new FormattedText(textToFormat, DynamicPropertyReader.GetCultureInfo(list), list.FlowDirection, DynamicPropertyReader.GetTypeface(list), list.FontSize, list.Foreground, pixelsPerDip);
            }
            else
            {
                textToFormat = "\u009f";
                Typeface modifiedTypeface2 = DynamicPropertyReader.GetModifiedTypeface(list, new FontFamily("Wingdings"));
                result = new FormattedText(textToFormat, DynamicPropertyReader.GetCultureInfo(list), list.FlowDirection, modifiedTypeface2, list.FontSize, list.Foreground, pixelsPerDip);
            }
            return(result);
        }