// Token: 0x060067F6 RID: 26614 RVA: 0x001D3800 File Offset: 0x001D1A00
 private PTS.FSRECT CalculateSearchArea(FigureHorizontalAnchor horizAnchor, FigureVerticalAnchor vertAnchor, ref PTS.FSRECT fsrcPage, ref PTS.FSRECT fsrcMargin, ref PTS.FSRECT fsrcTrack, ref PTS.FSRECT fsrcFigurePreliminary)
 {
     PTS.FSRECT result;
     if (FigureHelper.IsHorizontalPageAnchor(horizAnchor))
     {
         result.u  = fsrcPage.u;
         result.du = fsrcPage.du;
     }
     else if (FigureHelper.IsHorizontalContentAnchor(horizAnchor))
     {
         result.u  = fsrcMargin.u;
         result.du = fsrcMargin.du;
     }
     else
     {
         result.u  = fsrcTrack.u;
         result.du = fsrcTrack.du;
     }
     if (FigureHelper.IsVerticalPageAnchor(vertAnchor))
     {
         result.v  = fsrcPage.v;
         result.dv = fsrcPage.dv;
     }
     else if (FigureHelper.IsVerticalContentAnchor(vertAnchor))
     {
         result.v  = fsrcMargin.v;
         result.dv = fsrcMargin.dv;
     }
     else
     {
         result.v  = fsrcFigurePreliminary.v;
         result.dv = fsrcTrack.v + fsrcTrack.dv - fsrcFigurePreliminary.v;
     }
     return(result);
 }
        // ------------------------------------------------------------------
        // Determines the max total width for this figure element, subtracts the element margins to determine the maximum size the
        // Subpage can be formatted at.
        // ------------------------------------------------------------------
        private double LimitTotalWidthFromAnchor(double width, double elementMarginWidth)
        {
            Figure element = (Figure)Element;
            FigureHorizontalAnchor horizAnchor = element.HorizontalAnchor;

            double maxTotalWidth = 0.0;

            // Value is in pixels. Now we limit value to max out depending on anchoring.
            if (FigureHelper.IsHorizontalPageAnchor(horizAnchor))
            {
                maxTotalWidth = StructuralCache.CurrentFormatContext.PageWidth;
            }
            else if (FigureHelper.IsHorizontalContentAnchor(horizAnchor))
            {
                Thickness pageMargin = StructuralCache.CurrentFormatContext.PageMargin;
                maxTotalWidth = StructuralCache.CurrentFormatContext.PageWidth - pageMargin.Left - pageMargin.Right;
            }
            else
            {
                double columnWidth, gap, rule;
                int    cColumns;

                FigureHelper.GetColumnMetrics(StructuralCache, out cColumns, out columnWidth, out gap, out rule);

                maxTotalWidth = columnWidth;
            }

            if ((width + elementMarginWidth) > maxTotalWidth)
            {
                width = Math.Max(TextDpi.MinWidth, maxTotalWidth - elementMarginWidth);
            }

            return(width);
        }
        // Token: 0x060067F4 RID: 26612 RVA: 0x001D36C0 File Offset: 0x001D18C0
        private double LimitTotalWidthFromAnchor(double width, double elementMarginWidth)
        {
            Figure figure = (Figure)base.Element;
            FigureHorizontalAnchor horizontalAnchor = figure.HorizontalAnchor;
            double num;

            if (FigureHelper.IsHorizontalPageAnchor(horizontalAnchor))
            {
                num = base.StructuralCache.CurrentFormatContext.PageWidth;
            }
            else if (FigureHelper.IsHorizontalContentAnchor(horizontalAnchor))
            {
                Thickness pageMargin = base.StructuralCache.CurrentFormatContext.PageMargin;
                num = base.StructuralCache.CurrentFormatContext.PageWidth - pageMargin.Left - pageMargin.Right;
            }
            else
            {
                int    num2;
                double num3;
                double num4;
                double num5;
                FigureHelper.GetColumnMetrics(base.StructuralCache, out num2, out num3, out num4, out num5);
                num = num3;
            }
            if (width + elementMarginWidth > num)
            {
                width = Math.Max(TextDpi.MinWidth, num - elementMarginWidth);
            }
            return(width);
        }
        // Token: 0x060067D0 RID: 26576 RVA: 0x001D18A4 File Offset: 0x001CFAA4
        internal static double CalculateFigureWidth(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isWidthAuto)
        {
            isWidthAuto = figureLength.IsAuto;
            FigureHorizontalAnchor horizontalAnchor = figure.HorizontalAnchor;
            double num;

            if (figureLength.IsPage || (figureLength.IsAuto && FigureHelper.IsHorizontalPageAnchor(horizontalAnchor)))
            {
                num = structuralCache.CurrentFormatContext.PageWidth * figureLength.Value;
            }
            else if (figureLength.IsAbsolute)
            {
                num = FigureHelper.CalculateFigureCommon(figureLength);
            }
            else
            {
                int    num2;
                double num3;
                double num4;
                double num5;
                FigureHelper.GetColumnMetrics(structuralCache, out num2, out num3, out num4, out num5);
                if (figureLength.IsContent || (figureLength.IsAuto && FigureHelper.IsHorizontalContentAnchor(horizontalAnchor)))
                {
                    num = (num3 * (double)num2 + num4 * (double)(num2 - 1)) * figureLength.Value;
                }
                else
                {
                    double value = figureLength.Value;
                    int    num6  = (int)value;
                    if ((double)num6 == value && num6 > 0)
                    {
                        num6--;
                    }
                    num = num3 * value + num4 * (double)num6;
                }
            }
            Invariant.Assert(!DoubleUtil.IsNaN(num));
            return(num);
        }