Esempio n. 1
0
        // ------------------------------------------------------------------
        // Calculates a page margin adjustment to eliminate free space if column width is not flexible
        // ------------------------------------------------------------------
        internal static double CalculatePageMarginAdjustment(StructuralCache structuralCache, double pageMarginWidth)
        {
            double pageMarginAdjustment = 0.0;

            DependencyObject o = structuralCache.Section.Element;

            if (o is FlowDocument)
            {
                ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(o);

                if (!columnProperties.IsColumnWidthFlexible)
                {
                    double     lineHeight     = DynamicPropertyReader.GetLineHeightValue(o);
                    double     pageFontSize   = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
                    FontFamily pageFontFamily = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);

                    int ccol = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageMarginWidth, pageFontSize, pageFontFamily, true);

                    double columnWidth;
                    double freeSpace;
                    double gap;

                    GetColumnMetrics(columnProperties, pageMarginWidth,
                                     pageFontSize, pageFontFamily, true, ccol,
                                     ref lineHeight, out columnWidth, out freeSpace, out gap);

                    pageMarginAdjustment = freeSpace;
                }
            }

            return(pageMarginAdjustment);
        }
Esempio n. 2
0
        // ------------------------------------------------------------------
        // Table has been structurally altered
        // ------------------------------------------------------------------
        private void TableStructureChanged(object sender, EventArgs e)
        {
            // Disconnect obsolete paragraphs.
            BaseParagraph paraInvalid = _firstChild;

            while (paraInvalid != null)
            {
                paraInvalid.Dispose();
                paraInvalid = paraInvalid.Next;
            }
            _firstChild = null;

            //
            // Since whole table content is disposed, we need
            // - to create dirty text range corresponding to the Table content
            // - notify formatter that Table's content is changed.
            //
            int charCount = Table.SymbolCount - 2;// This is equivalent to (ContentEndOffset – ContentStartOffset) but is more performant.

            if (charCount > 0)
            {
                DirtyTextRange dtr = new DirtyTextRange(Table.ContentStartOffset, charCount, charCount);
                StructuralCache.AddDirtyTextRange(dtr);
            }
            if (StructuralCache.FormattingOwner.Formatter != null)
            {
                StructuralCache.FormattingOwner.Formatter.OnContentInvalidated(true, Table.ContentStart, Table.ContentEnd);
            }
        }
Esempio n. 3
0
        // ------------------------------------------------------------------
        // Returns calculated column information -  count, width, gap and rule.
        // ------------------------------------------------------------------
        internal static void GetColumnMetrics(StructuralCache structuralCache, out int cColumns, out double width, out double gap, out double rule)
        {
            ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(structuralCache.PropertyOwner);
            FontFamily            pageFontFamily   = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);
            double    lineHeight   = DynamicPropertyReader.GetLineHeightValue(structuralCache.PropertyOwner);
            double    pageFontSize = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
            Size      pageSize     = structuralCache.CurrentFormatContext.PageSize;
            Thickness pageMargin   = structuralCache.CurrentFormatContext.PageMargin;
            double    pageWidth    = pageSize.Width - (pageMargin.Left + pageMargin.Right);

            cColumns = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageWidth, pageFontSize, pageFontFamily, true);

            double freeSpace;

            rule = columnProperties.ColumnRuleWidth;
            PtsHelper.GetColumnMetrics(columnProperties, pageWidth,
                                       pageFontSize, pageFontFamily, true, cColumns,
                                       ref lineHeight, out width, out freeSpace, out gap);

            if (columnProperties.IsColumnWidthFlexible && columnProperties.ColumnSpaceDistribution == ColumnSpaceDistribution.Between)
            {
                width += freeSpace / cColumns;
            }

            width = Math.Min(width, pageWidth);
        }
 // Token: 0x06006742 RID: 26434 RVA: 0x001CDD66 File Offset: 0x001CBF66
 protected BaseParagraph(DependencyObject element, StructuralCache structuralCache) : base(structuralCache.PtsContext)
 {
     this._element         = element;
     this._structuralCache = structuralCache;
     this._changeType      = PTS.FSKCHANGE.fskchNone;
     this._stopAsking      = false;
     this.UpdateLastFormatPositions();
 }
        // Token: 0x060067D1 RID: 26577 RVA: 0x001D1984 File Offset: 0x001CFB84
        internal static double CalculateFigureHeight(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isHeightAuto)
        {
            double num;

            if (figureLength.IsPage)
            {
                num = structuralCache.CurrentFormatContext.PageHeight * figureLength.Value;
            }
            else if (figureLength.IsContent)
            {
                Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;
                num = (structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom) * figureLength.Value;
            }
            else if (figureLength.IsColumn)
            {
                int    num2;
                double num3;
                double num4;
                double num5;
                FigureHelper.GetColumnMetrics(structuralCache, out num2, out num3, out num4, out num5);
                double num6 = figureLength.Value;
                if (num6 > (double)num2)
                {
                    num6 = (double)num2;
                }
                int num7 = (int)num6;
                if ((double)num7 == num6 && num7 > 0)
                {
                    num7--;
                }
                num = num3 * num6 + num4 * (double)num7;
            }
            else
            {
                num = FigureHelper.CalculateFigureCommon(figureLength);
            }
            if (!DoubleUtil.IsNaN(num))
            {
                FigureVerticalAnchor verticalAnchor = figure.VerticalAnchor;
                if (FigureHelper.IsVerticalPageAnchor(verticalAnchor))
                {
                    num = Math.Max(1.0, Math.Min(num, structuralCache.CurrentFormatContext.PageHeight));
                }
                else
                {
                    Thickness pageMargin2 = structuralCache.CurrentFormatContext.PageMargin;
                    num = Math.Max(1.0, Math.Min(num, structuralCache.CurrentFormatContext.PageHeight - pageMargin2.Top - pageMargin2.Bottom));
                }
                TextDpi.EnsureValidPageWidth(ref num);
                isHeightAuto = false;
            }
            else
            {
                num          = structuralCache.CurrentFormatContext.PageHeight;
                isHeightAuto = true;
            }
            return(num);
        }
Esempio n. 6
0
        /// <summary>
        /// Invalidates main text segment for bottomless pages if DTR list for this para is non-null.
        /// </summary>
        private void InvalidateMainTextSegment()
        {
            DtrList dtrs = StructuralCache.DtrsFromRange(ParagraphStartCharacterPosition, LastFormatCch);

            if (dtrs != null && dtrs.Length > 0)
            {
                _mainTextSegment.InvalidateStructure(dtrs[0].StartIndex);
            }
        }
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor.    
        /// </summary>
        /// <param name="element">
        /// Element associated with paragraph.
        /// </param>
        /// <param name="structuralCache">
        /// Content's structural cache
        /// </param>
        protected BaseParagraph(DependencyObject element, StructuralCache structuralCache)
            : base(structuralCache.PtsContext)
        {
            _element = element;
            _structuralCache = structuralCache;
            _changeType = PTS.FSKCHANGE.fskchNone;
            _stopAsking = false;

            UpdateLastFormatPositions();
        }
Esempio n. 8
0
 // Token: 0x06008AB0 RID: 35504 RVA: 0x002576EC File Offset: 0x002558EC
 internal DocumentOperationContext(StructuralCache owner, FlowDocumentPage page)
 {
     Invariant.Assert(owner != null, "Invalid owner object.");
     Invariant.Assert(page != null, "Invalid page object.");
     Invariant.Assert(owner._currentPage == null, "Page formatting reentrancy detected. Trying to create second _DocumentPageContext for the same StructuralCache.");
     this._owner = owner;
     this._owner._currentPage = page;
     this._owner._illegalTreeChangeDetected = false;
     owner.PtsContext.Enter();
 }
Esempio n. 9
0
        // ------------------------------------------------------------------
        // Width figure size calculation
        // ------------------------------------------------------------------
        internal static double CalculateFigureWidth(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isWidthAuto)
        {
            double value;

            isWidthAuto = figureLength.IsAuto ? true : false;

            // Check figure's horizontal anchor. If anchored to page, use page width to format

            FigureHorizontalAnchor horizontalAnchor = figure.HorizontalAnchor;

            if (figureLength.IsPage || (figureLength.IsAuto && IsHorizontalPageAnchor(horizontalAnchor)))
            {
                value = structuralCache.CurrentFormatContext.PageWidth * figureLength.Value;
            }
            else if (figureLength.IsAbsolute)
            {
                value = CalculateFigureCommon(figureLength);
            }
            else // figureLength.IsColumn || figureLength.IsContent || figureLength.IsAuto
            {
                double columnWidth, gap, rule;
                int    cColumns;

                GetColumnMetrics(structuralCache, out cColumns, out columnWidth, out gap, out rule);

                if (figureLength.IsContent || (figureLength.IsAuto && IsHorizontalContentAnchor(horizontalAnchor)))
                {
                    // Use content width for figure
                    value = (columnWidth * cColumns + gap * (cColumns - 1)) * figureLength.Value;
                }
                else // figureLength.IsColumn || figureLength.IsAuto
                {
                    // We do this to prevent a 2.0 columns from spanning 2.0 + gap, so we just check for edge
                    double lengthValue = figureLength.Value;

                    int columnGapsSpanned = (int)lengthValue;
                    if (columnGapsSpanned == lengthValue && columnGapsSpanned > 0)
                    {
                        columnGapsSpanned -= 1;
                    }

                    value = (columnWidth * lengthValue) + gap * columnGapsSpanned;
                }
            }

            Invariant.Assert(!double.IsNaN(value));

            return(value);
        }
Esempio n. 10
0
     // ------------------------------------------------------------------
     // Width figure size calculation
     // ------------------------------------------------------------------
     internal static double CalculateFigureWidth(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isWidthAuto)
     {
         double value;
 
         isWidthAuto = figureLength.IsAuto ? true : false;
 
         // Check figure's horizontal anchor. If anchored to page, use page width to format
 
         FigureHorizontalAnchor horizontalAnchor = figure.HorizontalAnchor;
 
         if(figureLength.IsPage || (figureLength.IsAuto && IsHorizontalPageAnchor(horizontalAnchor)))
         {
             value = structuralCache.CurrentFormatContext.PageWidth * figureLength.Value;
         }
         else if (figureLength.IsAbsolute)
         {
             value = CalculateFigureCommon(figureLength);
         }
         else // figureLength.IsColumn || figureLength.IsContent || figureLength.IsAuto 
         {
             double columnWidth, gap, rule;
             int cColumns;
 
             GetColumnMetrics(structuralCache, out cColumns, out columnWidth, out gap, out rule);
 
             if (figureLength.IsContent || (figureLength.IsAuto && IsHorizontalContentAnchor(horizontalAnchor)))
             {
                 // Use content width for figure
                 value = (columnWidth * cColumns + gap * (cColumns - 1)) * figureLength.Value;
             }
             else // figureLength.IsColumn || figureLength.IsAuto
             {
                 // We do this to prevent a 2.0 columns from spanning 2.0 + gap, so we just check for edge
                 double lengthValue = figureLength.Value;
 
                 int columnGapsSpanned = (int) lengthValue;
                 if(columnGapsSpanned == lengthValue && columnGapsSpanned > 0)
                 {
                     columnGapsSpanned -= 1;
                 }
 
                 value = (columnWidth * lengthValue) + gap * columnGapsSpanned;
             }
         }
 
         Invariant.Assert(!DoubleUtil.IsNaN(value));
 
         return value;
     }
        // 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);
        }
        internal void CreateFinitePage(PageBreakRecord breakRecord)
        {
            this.OnBeforeFormatPage(true, false);
            if (TracePageFormatting.IsEnabled)
            {
                TracePageFormatting.Trace(TraceEventType.Start, TracePageFormatting.FormatPage, this.PageContext, this.PtsContext);
            }
            IntPtr pfsBRPageStart = (breakRecord != null) ? breakRecord.BreakRecord : IntPtr.Zero;

            PTS.FSFMTR fsfmtr;
            IntPtr     value;
            IntPtr     zero;
            int        num = PTS.FsCreatePageFinite(this.PtsContext.Context, pfsBRPageStart, this._section.Handle, out fsfmtr, out value, out zero);

            if (num != 0)
            {
                this._ptsPage.Value = IntPtr.Zero;
                zero = IntPtr.Zero;
                PTS.ValidateAndTrace(num, this.PtsContext);
            }
            else
            {
                this._ptsPage.Value = value;
            }
            if (zero != IntPtr.Zero)
            {
                StructuralCache structuralCache = this._section.StructuralCache;
                if (structuralCache != null)
                {
                    this._breakRecord = new PageBreakRecord(this.PtsContext, new SecurityCriticalDataForSet <IntPtr>(zero), (breakRecord != null) ? (breakRecord.PageNumber + 1) : 1);
                }
            }
            if (TracePageFormatting.IsEnabled)
            {
                TracePageFormatting.Trace(TraceEventType.Stop, TracePageFormatting.FormatPage, this.PageContext, this.PtsContext);
            }
            this.OnAfterFormatPage(true, false);
        }
Esempio n. 13
0
        // Token: 0x06006942 RID: 26946 RVA: 0x001DCDB0 File Offset: 0x001DAFB0
        internal static double CalculatePageMarginAdjustment(StructuralCache structuralCache, double pageMarginWidth)
        {
            double           result  = 0.0;
            DependencyObject element = structuralCache.Section.Element;

            if (element is FlowDocument)
            {
                ColumnPropertiesGroup columnPropertiesGroup = new ColumnPropertiesGroup(element);
                if (!columnPropertiesGroup.IsColumnWidthFlexible)
                {
                    double     lineHeightValue = DynamicPropertyReader.GetLineHeightValue(element);
                    double     pageFontSize    = (double)structuralCache.PropertyOwner.GetValue(TextElement.FontSizeProperty);
                    FontFamily pageFontFamily  = (FontFamily)structuralCache.PropertyOwner.GetValue(TextElement.FontFamilyProperty);
                    int        cColumns        = PtsHelper.CalculateColumnCount(columnPropertiesGroup, lineHeightValue, pageMarginWidth, pageFontSize, pageFontFamily, true);
                    double     num;
                    double     num2;
                    double     num3;
                    PtsHelper.GetColumnMetrics(columnPropertiesGroup, pageMarginWidth, pageFontSize, pageFontFamily, true, cColumns, ref lineHeightValue, out num, out num2, out num3);
                    result = num2;
                }
            }
            return(result);
        }
        internal void UpdateFinitePage(PageBreakRecord breakRecord)
        {
            if (this.IsEmpty)
            {
                return;
            }
            this.OnBeforeFormatPage(true, true);
            if (TracePageFormatting.IsEnabled)
            {
                TracePageFormatting.Trace(TraceEventType.Start, TracePageFormatting.FormatPage, this.PageContext, this.PtsContext);
            }
            IntPtr pfsBRPageStart = (breakRecord != null) ? breakRecord.BreakRecord : IntPtr.Zero;

            PTS.FSFMTR fsfmtr;
            IntPtr     intPtr;
            int        num = PTS.FsUpdateFinitePage(this.PtsContext.Context, this._ptsPage.Value, pfsBRPageStart, this._section.Handle, out fsfmtr, out intPtr);

            if (num != 0)
            {
                this.DestroyPage();
                PTS.ValidateAndTrace(num, this.PtsContext);
            }
            if (intPtr != IntPtr.Zero)
            {
                StructuralCache structuralCache = this._section.StructuralCache;
                if (structuralCache != null)
                {
                    this._breakRecord = new PageBreakRecord(this.PtsContext, new SecurityCriticalDataForSet <IntPtr>(intPtr), (breakRecord != null) ? (breakRecord.PageNumber + 1) : 1);
                }
            }
            if (TracePageFormatting.IsEnabled)
            {
                TracePageFormatting.Trace(TraceEventType.Stop, TracePageFormatting.FormatPage, this.PageContext, this.PtsContext);
            }
            this.OnAfterFormatPage(true, true);
        }
 // Token: 0x06006830 RID: 26672 RVA: 0x001D58E5 File Offset: 0x001D3AE5
 internal FlowDocumentPage(StructuralCache structuralCache) : base(null)
 {
     this._structuralCache = structuralCache;
     this._ptsPage         = new PtsPage(structuralCache.Section);
 }
Esempio n. 16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentArrangeContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
     _owner._documentArrangeContext = this;
 }
Esempio n. 17
0
        // ------------------------------------------------------------------
        // Height figure size calculation
        // ------------------------------------------------------------------
        internal static double CalculateFigureHeight(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isHeightAuto)
        {
            double value; 

            if(figureLength.IsPage) 
            { 
                value = (structuralCache.CurrentFormatContext.PageHeight) * figureLength.Value;
            }
            else if(figureLength.IsContent) // Column to be treated same as content
            {
                Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;

                value = (structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom) * figureLength.Value;
            }
            else if (figureLength.IsColumn)
            {
                // Height is calculated based on column width, since column height is the same as content. Per spec.
                // Retrieve all column metrics for current page
                int cColumns;
                double columnWidth;
                double gap;
                double rule;
                FigureHelper.GetColumnMetrics(structuralCache, out cColumns, out columnWidth, out gap, out rule);

                // We do this to prevent a 2.0 columns from spanning 2.0 + gap, so we just check for edge
                double lengthValue = figureLength.Value;
                if (lengthValue > cColumns)
                {
                    lengthValue = cColumns;
                }
                int columnGapsSpanned = (int)lengthValue;
                if (columnGapsSpanned == lengthValue && columnGapsSpanned > 0)
                {
                    columnGapsSpanned -= 1;
                }

                value = (columnWidth * lengthValue) + gap * columnGapsSpanned;
            }
            else
            {
                value = FigureHelper.CalculateFigureCommon(figureLength);
            }

            if(!DoubleUtil.IsNaN(value))
            {
                FigureVerticalAnchor verticalAnchor = figure.VerticalAnchor;

                // Value is in pixels. Now we limit value to max out depending on anchoring.
                if(FigureHelper.IsVerticalPageAnchor(verticalAnchor))
                {
                    value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight));
                }
                else // Column and paragraph anchoring still max out at content height
                {
                    Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;
                    value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom));
                }

                TextDpi.EnsureValidPageWidth(ref value);

                isHeightAuto = false;
            }
            else
            {
                value = structuralCache.CurrentFormatContext.PageHeight;
                isHeightAuto = true;
            }

            return value;
        }
Esempio n. 18
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        internal TableParagraph(DependencyObject element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
            Table.TableStructureChanged += new System.EventHandler(TableStructureChanged);
        }
Esempio n. 19
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="structuralCache">
        /// Content's structural cache
        /// </param>
        internal Section(StructuralCache structuralCache) : base(structuralCache.PtsContext)
        {
            _structuralCache = structuralCache;
        }
Esempio n. 20
0
        /// <summary>
        /// Initialize FlowDocument.
        /// </summary>
        /// <param name="textContainer"></param>
        private void Initialize(TextContainer textContainer)
        {
            if (textContainer == null)
            {
                // Create text tree that contains content of the element.
                textContainer = new TextContainer(this, false /* plainTextOnly */);
            }

            // Create structural cache object
            _structuralCache = new StructuralCache(this, textContainer);

            // Get rid of the current formatter.
            if (_formatter != null)
            {
                _formatter.Suspend();
                _formatter = null;
            }
        }
Esempio n. 21
0
        // ------------------------------------------------------------------
        // Calculates a page margin adjustment to eliminate free space if column width is not flexible
        // ------------------------------------------------------------------
        internal static double CalculatePageMarginAdjustment(StructuralCache structuralCache, double pageMarginWidth)
        {
            double pageMarginAdjustment = 0.0;

            DependencyObject o = structuralCache.Section.Element;

            if(o is FlowDocument)
            {
                ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(o);

                if(!columnProperties.IsColumnWidthFlexible)
                {                   
                    double lineHeight = DynamicPropertyReader.GetLineHeightValue(o);
                    double pageFontSize = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
                    FontFamily pageFontFamily = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);

                    int ccol = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageMarginWidth, pageFontSize, pageFontFamily, true);

                    double columnWidth;
                    double freeSpace;
                    double gap;

                    GetColumnMetrics(columnProperties, pageMarginWidth,
                                     pageFontSize, pageFontFamily, true, ccol, 
                                     ref lineHeight, out columnWidth, out freeSpace, out gap);

                    pageMarginAdjustment = freeSpace;
                }
            }

            return pageMarginAdjustment;
        }
 // Token: 0x06006AC6 RID: 27334 RVA: 0x001E8FFB File Offset: 0x001E71FB
 internal TableParagraph(DependencyObject element, StructuralCache structuralCache) : base(element, structuralCache)
 {
     this.Table.TableStructureChanged += this.TableStructureChanged;
 }
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        // ------------------------------------------------------------------
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache
        // ------------------------------------------------------------------
        internal FloaterParagraph(TextElement element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
        }
Esempio n. 24
0
 // ------------------------------------------------------------------
 // Constructor.
 //
 //      element - Element associated with paragraph.
 //      structuralCache - Content's structural cache
 // ------------------------------------------------------------------
 internal CellParagraph(DependencyObject element, StructuralCache structuralCache)
     : base(element, structuralCache)
 {
     _isInterruptible = false;
 }
Esempio n. 25
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        // ------------------------------------------------------------------
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache
        // ------------------------------------------------------------------
        protected FloaterBaseParagraph(TextElement element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
        }
Esempio n. 26
0
 // ------------------------------------------------------------------
 // Constructor.
 // 
 //      element - Element associated with paragraph.
 //      structuralCache - Content's structural cache 
 // ----------------------------------------------------------------- 
 internal CellParagraph(DependencyObject element, StructuralCache structuralCache)
     : base(element, structuralCache) 
 {
     _isInterruptible = false;
 }
Esempio n. 27
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="structuralCache">
        /// Content's structural cache
        /// </param>
        internal Section(StructuralCache structuralCache) : base(structuralCache.PtsContext)
        {
            _structuralCache = structuralCache;
        }
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        // ------------------------------------------------------------------
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache
        // ------------------------------------------------------------------
        internal ContainerParagraph(DependencyObject element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        internal TableParagraph(DependencyObject element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
            Table.TableStructureChanged += new System.EventHandler(TableStructureChanged);
        }
Esempio n. 30
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        //-------------------------------------------------------------------
        // Constructor.
        //
        //      structuralCache - context representing data
        //-------------------------------------------------------------------
        internal FlowDocumentPage(StructuralCache structuralCache) : base(null)
        {
            _structuralCache = structuralCache;
            _ptsPage = new PtsPage(structuralCache.Section);
        }
Esempio n. 31
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Structural Cache contructor
        /// </summary>
        internal BackgroundFormatInfo(StructuralCache structuralCache)
        {
            _structuralCache = structuralCache;
        }
Esempio n. 32
0
 // Token: 0x06008AB4 RID: 35508 RVA: 0x002577D0 File Offset: 0x002559D0
 internal DocumentFormatContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
     this._owner._documentFormatContext = this;
 }
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Structural Cache contructor
        /// </summary>
        internal BackgroundFormatInfo(StructuralCache structuralCache) 
        { 
            _structuralCache = structuralCache;
        }
Esempio n. 34
0
        // ------------------------------------------------------------------
        // Height figure size calculation
        // ------------------------------------------------------------------
        internal static double CalculateFigureHeight(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isHeightAuto)
        {
            double value;

            if (figureLength.IsPage)
            {
                value = (structuralCache.CurrentFormatContext.PageHeight) * figureLength.Value;
            }
            else if (figureLength.IsContent) // Column to be treated same as content
            {
                Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;

                value = (structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom) * figureLength.Value;
            }
            else if (figureLength.IsColumn)
            {
                // Height is calculated based on column width, since column height is the same as content. Per spec.
                // Retrieve all column metrics for current page
                int    cColumns;
                double columnWidth;
                double gap;
                double rule;
                FigureHelper.GetColumnMetrics(structuralCache, out cColumns, out columnWidth, out gap, out rule);

                // We do this to prevent a 2.0 columns from spanning 2.0 + gap, so we just check for edge
                double lengthValue = figureLength.Value;
                if (lengthValue > cColumns)
                {
                    lengthValue = cColumns;
                }
                int columnGapsSpanned = (int)lengthValue;
                if (columnGapsSpanned == lengthValue && columnGapsSpanned > 0)
                {
                    columnGapsSpanned -= 1;
                }

                value = (columnWidth * lengthValue) + gap * columnGapsSpanned;
            }
            else
            {
                value = FigureHelper.CalculateFigureCommon(figureLength);
            }

            if (!double.IsNaN(value))
            {
                FigureVerticalAnchor verticalAnchor = figure.VerticalAnchor;

                // Value is in pixels. Now we limit value to max out depending on anchoring.
                if (FigureHelper.IsVerticalPageAnchor(verticalAnchor))
                {
                    value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight));
                }
                else // Column and paragraph anchoring still max out at content height
                {
                    Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;
                    value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom));
                }

                TextDpi.EnsureValidPageWidth(ref value);

                isHeightAuto = false;
            }
            else
            {
                value        = structuralCache.CurrentFormatContext.PageHeight;
                isHeightAuto = true;
            }

            return(value);
        }
Esempio n. 35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="element">
 /// Element associated with paragraph.
 /// </param>
 /// <param name="structuralCache">
 /// Content's structural cache
 /// </param>
 internal ListItemParagraph(DependencyObject element, StructuralCache structuralCache)
     : base(element, structuralCache)
 {
 }
Esempio n. 36
0
 /// <summary> 
 /// Constructor
 /// </summary> 
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentArrangeContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 { 
     _owner._documentArrangeContext = this;
 } 
Esempio n. 37
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentVisualValidationContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
 }
Esempio n. 38
0
            /// <summary>
            /// Constructor 
            /// </summary> 
            /// <param name="owner">Associated structural cache instance</param>
            /// <param name="page">Document page to set</param> 
            internal DocumentOperationContext(StructuralCache owner, FlowDocumentPage page)
            {
                Invariant.Assert(owner != null, "Invalid owner object.");
                Invariant.Assert(page != null, "Invalid page object."); 
                Invariant.Assert(owner._currentPage == null, "Page formatting reentrancy detected. Trying to create second _DocumentPageContext for the same StructuralCache.");
 
                _owner = owner; 
                _owner._currentPage = page;
                _owner._illegalTreeChangeDetected = false; 
                owner.PtsContext.Enter();
            }
Esempio n. 39
0
     // ------------------------------------------------------------------
     // Returns calculated column information -  count, width, gap and rule.
     // ------------------------------------------------------------------
     internal static void GetColumnMetrics(StructuralCache structuralCache, out int cColumns, out double width, out double gap, out double rule)
     {
         ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(structuralCache.PropertyOwner);
         FontFamily pageFontFamily = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);
         double lineHeight = DynamicPropertyReader.GetLineHeightValue(structuralCache.PropertyOwner);
         double pageFontSize = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
         Size pageSize = structuralCache.CurrentFormatContext.PageSize;
         Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;
         double pageWidth = pageSize.Width - (pageMargin.Left + pageMargin.Right);
 
         cColumns = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageWidth, pageFontSize, pageFontFamily, true);
 
         double freeSpace;
         rule = columnProperties.ColumnRuleWidth;
         PtsHelper.GetColumnMetrics(columnProperties, pageWidth,
                                    pageFontSize, pageFontFamily, true, cColumns,
                                    ref lineHeight, out width, out freeSpace, out gap);
 
         if (columnProperties.IsColumnWidthFlexible && columnProperties.ColumnSpaceDistribution == ColumnSpaceDistribution.Between)
         {
             width += freeSpace / cColumns;
         }
 
         width = Math.Min(width, pageWidth);
     }
Esempio n. 40
0
        //--------------------------------------------------------------------
        //
        //  Constructors
        // 
        //-------------------------------------------------------------------
 
        #region Constructors 

        // ------------------------------------------------------------------ 
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache 
        // ------------------------------------------------------------------
        protected FloaterBaseParagraph(TextElement element, StructuralCache structuralCache) 
            : base(element, structuralCache) 
        {
        } 
Esempio n. 41
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        // ------------------------------------------------------------------
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache
        // ------------------------------------------------------------------
        internal FloaterParagraph(TextElement element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
        }
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        // ------------------------------------------------------------------
        // Constructor.
        //
        //      element - Element associated with paragraph.
        //      structuralCache - Content's structural cache
        // ------------------------------------------------------------------
        internal FigureParagraph(DependencyObject element, StructuralCache structuralCache)
            : base(element, structuralCache)
        {
        }
 // Token: 0x06006A1B RID: 27163 RVA: 0x001CF787 File Offset: 0x001CD987
 internal RowParagraph(DependencyObject element, StructuralCache structuralCache) : base(element, structuralCache)
 {
 }
Esempio n. 44
0
 /// <summary> 
 /// Constructor
 /// </summary> 
 /// <param name="owner">Associated structural cache instance</param> 
 /// <param name="page">Document page to set</param>
 internal DocumentVisualValidationContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page) { }