Esempio n. 1
0
        internal static void UpdateTrackVisuals(PtsContext ptsContext, VisualCollection visualCollection, PTS.FSKUPDATE fskupdInherited, ref PTS.FSTRACKDESCRIPTION trackDesc)
        {
            PTS.FSKUPDATE fskupdate = trackDesc.fsupdinf.fskupd;
            if (trackDesc.fsupdinf.fskupd == PTS.FSKUPDATE.fskupdInherited)
            {
                fskupdate = fskupdInherited;
            }
            if (fskupdate == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            ErrorHandler.Assert(fskupdate != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
            bool flag = trackDesc.pfstrack == IntPtr.Zero;

            if (!flag)
            {
                PTS.FSTRACKDETAILS fstrackdetails;
                PTS.Validate(PTS.FsQueryTrackDetails(ptsContext.Context, trackDesc.pfstrack, out fstrackdetails));
                flag = (fstrackdetails.cParas == 0);
                if (!flag)
                {
                    PTS.FSPARADESCRIPTION[] arrayParaDesc;
                    PtsHelper.ParaListFromTrack(ptsContext, trackDesc.pfstrack, ref fstrackdetails, out arrayParaDesc);
                    PtsHelper.UpdateParaListVisuals(ptsContext, visualCollection, fskupdate, arrayParaDesc);
                }
            }
            if (flag)
            {
                visualCollection.Clear();
            }
        }
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Query paragraph details
            PTS.FSSUBTRACKDETAILS subtrackDetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails));

            // Draw border and background info.

            // Adjust rectangle and offset to take into account MBPs
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element);

            if (ThisFlowDirection != PageFlowDirection)
            {
                mbp.MirrorBP();
            }

            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            _visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);

            // There might be possibility to get empty sub-track, skip the sub-track in such case.
            if (subtrackDetails.cParas != 0)
            {
                // Get list of paragraphs
                PTS.FSPARADESCRIPTION [] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                // Render list of paragraphs
                PtsHelper.UpdateParaListVisuals(PtsContext, _visual.Children, fskupdInherited, arrayParaDesc);
            }
            else
            {
                _visual.Children.Clear();
            }
        }
        // Token: 0x06006B6E RID: 27502 RVA: 0x001F0978 File Offset: 0x001EEB78
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            PtsHelper.UpdateMirroringTransform(base.PageFlowDirection, base.ThisFlowDirection, this._visual, TextDpi.FromTextDpi(2 * this._rect.u + this._rect.du));
            UIElementIsland uielementIsland = ((UIElementParagraph)base.Paragraph).UIElementIsland;

            if (uielementIsland != null)
            {
                if (this._visual.Children.Count != 1 || this._visual.Children[0] != uielementIsland)
                {
                    Visual visual = VisualTreeHelper.GetParent(uielementIsland) as Visual;
                    if (visual != null)
                    {
                        ContainerVisual containerVisual = visual as ContainerVisual;
                        Invariant.Assert(containerVisual != null, "Parent should always derives from ContainerVisual.");
                        containerVisual.Children.Remove(uielementIsland);
                    }
                    this._visual.Children.Clear();
                    this._visual.Children.Add(uielementIsland);
                }
                uielementIsland.Offset = new PTS.FSVECTOR(this._rect.u + mbpInfo.BPLeft, this._rect.v + mbpInfo.BPTop).FromTextDpi();
            }
            else
            {
                this._visual.Children.Clear();
            }
            Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            this._visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
        }
Esempio n. 4
0
        // ------------------------------------------------------------------
        // Update visuals for list of paragraphs.
        // ------------------------------------------------------------------
        internal static void UpdateParaListVisuals(
            PtsContext ptsContext,
            VisualCollection visualCollection,
            PTS.FSKUPDATE fskupdInherited,
            PTS.FSPARADESCRIPTION [] arrayParaDesc)
        {
            // For each paragraph, do following:
            // (1) Retrieve ParaClient object
            // (3) Update visual, if necessary
            for (int index = 0; index < arrayParaDesc.Length; index++)
            {
                // (1) Retrieve ParaClient object
                BaseParaClient paraClient = ptsContext.HandleToObject(arrayParaDesc[index].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(paraClient);

                // (2) Update visual, if necessary
                PTS.FSKUPDATE fskupd = arrayParaDesc[index].fsupdinf.fskupd;
                if (fskupd == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupd = fskupdInherited;
                }
                if (fskupd == PTS.FSKUPDATE.fskupdNew)
                {
                    // Disconnect visual from its old parent, if necessary.
                    Visual currentParent = VisualTreeHelper.GetParent(paraClient.Visual) as Visual;
                    if (currentParent != null)
                    {
                        ContainerVisual parent = currentParent as ContainerVisual;
                        Invariant.Assert(parent != null, "parent should always derives from ContainerVisual");
                        parent.Children.Remove(paraClient.Visual);
                    }

                    // New paragraph - insert new visual node
                    visualCollection.Insert(index, paraClient.Visual);

                    paraClient.ValidateVisual(fskupd);
                }
                else
                {
                    // Remove visuals for non-existing paragraphs
                    while (visualCollection[index] != paraClient.Visual)
                    {
                        visualCollection.RemoveAt(index);
                        Invariant.Assert(index < visualCollection.Count);
                    }

                    if (fskupd == PTS.FSKUPDATE.fskupdChangeInside || fskupd == PTS.FSKUPDATE.fskupdShifted)
                    {
                        paraClient.ValidateVisual(fskupd);
                    }
                }
            }
            // Remove obsolete visuals
            if (arrayParaDesc.Length < visualCollection.Count)
            {
                visualCollection.RemoveRange(arrayParaDesc.Length, visualCollection.Count - arrayParaDesc.Length);
            }
        }
        private void UpdateSectionVisuals(SectionVisual visual, PTS.FSKUPDATE fskupdInherited, ref PTS.FSSECTIONDESCRIPTION sectionDesc)
        {
            PTS.FSKUPDATE fskupdate = sectionDesc.fsupdinf.fskupd;
            if (fskupdate == PTS.FSKUPDATE.fskupdInherited)
            {
                fskupdate = fskupdInherited;
            }
            ErrorHandler.Assert(fskupdate != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
            if (fskupdate == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            PTS.FSSECTIONDETAILS fssectiondetails;
            PTS.Validate(PTS.FsQuerySectionDetails(this.PtsContext.Context, sectionDesc.pfssection, out fssectiondetails));
            bool flag;

            if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes))
            {
                ErrorHandler.Assert(fssectiondetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                flag = (fssectiondetails.u.withpagenotes.cBasicColumns == 0);
                if (!flag)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSection(this.PtsContext, sectionDesc.pfssection, ref fssectiondetails, out array);
                    flag = (array.Length == 0);
                    if (!flag)
                    {
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(this._section.Element);
                        visual.DrawColumnRules(ref array, TextDpi.FromTextDpi(sectionDesc.fsrc.v), TextDpi.FromTextDpi(sectionDesc.fsrc.dv), columnProperties);
                        VisualCollection children = visual.Children;
                        if (fskupdate == PTS.FSKUPDATE.fskupdNew)
                        {
                            children.Clear();
                            for (int i = 0; i < array.Length; i++)
                            {
                                children.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(children.Count == array.Length, ErrorHandler.ColumnVisualCountMismatch);
                        for (int j = 0; j < array.Length; j++)
                        {
                            ContainerVisual containerVisual = (ContainerVisual)children[j];
                            PtsHelper.UpdateTrackVisuals(this.PtsContext, containerVisual.Children, fskupdate, ref array[j]);
                        }
                    }
                }
            }
            else
            {
                ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
                flag = true;
            }
            if (flag)
            {
                visual.Children.Clear();
            }
        }
Esempio n. 6
0
        internal static void UpdateTrackVisuals(
            PtsContext ptsContext,
            VisualCollection visualCollection,
            PTS.FSKUPDATE fskupdInherited,
            ref PTS.FSTRACKDESCRIPTION trackDesc)
        {
            PTS.FSKUPDATE fskupd = trackDesc.fsupdinf.fskupd;
            if (trackDesc.fsupdinf.fskupd == PTS.FSKUPDATE.fskupdInherited)
            {
                fskupd = fskupdInherited;
            }

            // If there is no change, visual information is valid
            if (fskupd == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            ErrorHandler.Assert(fskupd != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);

            bool emptyTrack = (trackDesc.pfstrack == IntPtr.Zero);

            if (!emptyTrack)
            {
                // Get track details
                PTS.FSTRACKDETAILS trackDetails;
                PTS.Validate(PTS.FsQueryTrackDetails(ptsContext.Context, trackDesc.pfstrack, out trackDetails));

                emptyTrack = (trackDetails.cParas == 0);
                if (!emptyTrack)
                {
                    // Get list of paragraphs
                    PTS.FSPARADESCRIPTION[] arrayParaDesc;
                    ParaListFromTrack(ptsContext, trackDesc.pfstrack, ref trackDetails, out arrayParaDesc);

                    // Update visuals for list of paragraphs
                    UpdateParaListVisuals(ptsContext, visualCollection, fskupd, arrayParaDesc);
                }
            }

            // There is possibility to get empty track. (example: large figures)
            if (emptyTrack)
            {
                // There is no content, remove all existing children visuals.
                visualCollection.Clear();
            }
        }
Esempio n. 7
0
 // Token: 0x06006930 RID: 26928 RVA: 0x001DC5E0 File Offset: 0x001DA7E0
 internal static void UpdateParaListVisuals(PtsContext ptsContext, VisualCollection visualCollection, PTS.FSKUPDATE fskupdInherited, PTS.FSPARADESCRIPTION[] arrayParaDesc)
 {
     for (int i = 0; i < arrayParaDesc.Length; i++)
     {
         BaseParaClient baseParaClient = ptsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient;
         PTS.ValidateHandle(baseParaClient);
         PTS.FSKUPDATE fskupdate = arrayParaDesc[i].fsupdinf.fskupd;
         if (fskupdate == PTS.FSKUPDATE.fskupdInherited)
         {
             fskupdate = fskupdInherited;
         }
         if (fskupdate == PTS.FSKUPDATE.fskupdNew)
         {
             Visual visual = VisualTreeHelper.GetParent(baseParaClient.Visual) as Visual;
             if (visual != null)
             {
                 ContainerVisual containerVisual = visual as ContainerVisual;
                 Invariant.Assert(containerVisual != null, "parent should always derives from ContainerVisual");
                 containerVisual.Children.Remove(baseParaClient.Visual);
             }
             visualCollection.Insert(i, baseParaClient.Visual);
             baseParaClient.ValidateVisual(fskupdate);
         }
         else
         {
             while (visualCollection[i] != baseParaClient.Visual)
             {
                 visualCollection.RemoveAt(i);
                 Invariant.Assert(i < visualCollection.Count);
             }
             if (fskupdate == PTS.FSKUPDATE.fskupdChangeInside || fskupdate == PTS.FSKUPDATE.fskupdShifted)
             {
                 baseParaClient.ValidateVisual(fskupdate);
             }
         }
     }
     if (arrayParaDesc.Length < visualCollection.Count)
     {
         visualCollection.RemoveRange(arrayParaDesc.Length, visualCollection.Count - arrayParaDesc.Length);
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Validates visual node associated with paragraph.
        /// </summary>
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Obtain all mbd info
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            // MIRROR entire element to interface with underlying layout tree.
            // Border/Padding does not need to be mirrored, as it'll be mirrored with the content.
            PtsHelper.UpdateMirroringTransform(PageFlowDirection, ThisFlowDirection, _visual, TextDpi.FromTextDpi(2 * _rect.u + _rect.du));

            // Add UIElementIsland to visual tree and set appropiate offset.
            UIElementIsland uiElementIsland = ((UIElementParagraph)Paragraph).UIElementIsland;

            if (uiElementIsland != null)
            {
                if (_visual.Children.Count != 1 || _visual.Children[0] != uiElementIsland)
                {
                    // Disconnect UIElementIsland from its old parent.
                    Visual currentParent = VisualTreeHelper.GetParent(uiElementIsland) as Visual;
                    if (currentParent != null)
                    {
                        ContainerVisual parent = currentParent as ContainerVisual;
                        Invariant.Assert(parent != null, "Parent should always derives from ContainerVisual.");
                        parent.Children.Remove(uiElementIsland);
                    }

                    _visual.Children.Clear();
                    _visual.Children.Add(uiElementIsland);
                }
                uiElementIsland.Offset = new PTS.FSVECTOR(_rect.u + mbp.BPLeft, _rect.v + mbp.BPTop).FromTextDpi();
            }
            else
            {
                _visual.Children.Clear();
            }

            // Draw background and borders.
            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            _visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);
        }
Esempio n. 9
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            PTS.FSSUBTRACKDETAILS fssubtrackdetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails));
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (base.ThisFlowDirection != base.PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }
            Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            this._visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
            if (fssubtrackdetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION[] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out arrayParaDesc);
                PtsHelper.UpdateParaListVisuals(base.PtsContext, this._visual.Children, fskupdInherited, arrayParaDesc);
                return;
            }
            this._visual.Children.Clear();
        }
Esempio n. 10
0
        private unsafe void QueryRowDetails(
            IntPtr pfstablerow,
            out IntPtr[] arrayFsCell,
            out PTS.FSKUPDATE[] arrayUpdate,
            out PTS.FSTABLEKCELLMERGE[] arrayTableCellMerge)
        {
            PTS.FSTABLEROWDETAILS tableRowDetails;

            PTS.Validate(PTS.FsQueryTableObjRowDetails(
                PtsContext.Context,
                pfstablerow,
                out tableRowDetails));

            arrayUpdate = new PTS.FSKUPDATE[tableRowDetails.cCells];
            arrayFsCell = new IntPtr[tableRowDetails.cCells];
            arrayTableCellMerge = new PTS.FSTABLEKCELLMERGE[tableRowDetails.cCells];

            if (tableRowDetails.cCells > 0)
            {
                fixed (PTS.FSKUPDATE * rgUpdate = arrayUpdate)
                {
                    fixed (IntPtr * rgFsCell = arrayFsCell)
                    {
                        fixed (PTS.FSTABLEKCELLMERGE * rgTableCellMerge = arrayTableCellMerge)
                        {
                            int cCellsActual;

                            PTS.Validate(PTS.FsQueryTableObjCellList(
                                PtsContext.Context,
                                pfstablerow,
                                tableRowDetails.cCells,
                                rgUpdate,
                                rgFsCell,
                                rgTableCellMerge,
                                out cCellsActual));

                            Debug.Assert(tableRowDetails.cCells == cCellsActual);
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Floater is always reported as NEW. Override PTS inherited value.
            fskupdInherited = PTS.FSKUPDATE.fskupdNew;

            // Query subpage details
            PTS.FSSUBPAGEDETAILS subpageDetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

            // Obtain all mbd info
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (ThisFlowDirection != PageFlowDirection)
            {
                mbp.MirrorBP();
            }

            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            Visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);


            ContainerVisual pageContentVisual;
            ContainerVisual floatingElementsVisual;

            if (_visual.Children.Count != 2)
            {
                _visual.Children.Clear();
                _visual.Children.Add(new ContainerVisual());
                _visual.Children.Add(new ContainerVisual());
            }

            pageContentVisual      = (ContainerVisual)_visual.Children[0];
            floatingElementsVisual = (ContainerVisual)_visual.Children[1];

            // Subpage content may be simple or complex -
            // depending of set of features used in the content of the subpage.
            // (1) simple subpage (contains only one track)
            // (2) complex subpage (contains columns)
            if (PTS.ToBoolean(subpageDetails.fSimple))
            {
                // (1) simple subpage (contains only one track)
                PTS.FSKUPDATE fskupd = subpageDetails.u.simple.trackdescr.fsupdinf.fskupd;
                if (fskupd == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupd = fskupdInherited;
                }
                VisualCollection visualChildren = pageContentVisual.Children;
                if (fskupd == PTS.FSKUPDATE.fskupdNew)
                {
                    visualChildren.Clear();
                    visualChildren.Add(new ContainerVisual());
                }
                // For complex subpage SectionVisual is added. So, when morphing
                // complex subpage to simple one, remove SectionVisual.
                else if (visualChildren.Count == 1 && !(visualChildren[0] is ContainerVisual))
                {
                    visualChildren.Clear();
                    visualChildren.Add(new ContainerVisual());
                }
                Debug.Assert(visualChildren.Count == 1 && visualChildren[0] is ContainerVisual);
                ContainerVisual trackVisual = (ContainerVisual)visualChildren[0];

                PtsHelper.UpdateTrackVisuals(PtsContext, trackVisual.Children, fskupdInherited, ref subpageDetails.u.simple.trackdescr);
            }
            else
            {
                // (2) complex page (contains columns)
                // cBasicColumns == 0, means that subpage content is empty
                bool emptySubpage = (subpageDetails.u.complex.cBasicColumns == 0);
                if (!emptySubpage)
                {
                    // Retrieve description for each column.
                    PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
                    PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc);

                    emptySubpage = (arrayColumnDesc.Length == 0);
                    if (!emptySubpage)
                    {
                        PTS.FSKUPDATE fskupd = fskupdInherited;
                        ErrorHandler.Assert(fskupd != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
                        Debug.Assert(fskupd != PTS.FSKUPDATE.fskupdNoChange);

                        // For complex subpage SectionVisual is added. So, when morphing
                        // simple subpage to complex one, remove ParagraphVisual.
                        VisualCollection visualChildren = pageContentVisual.Children;
                        if (visualChildren.Count == 0)
                        {
                            visualChildren.Add(new SectionVisual());
                        }
                        else if (!(visualChildren[0] is SectionVisual))
                        {
                            visualChildren.Clear();
                            visualChildren.Add(new SectionVisual());
                        }
                        Debug.Assert(visualChildren.Count == 1 && visualChildren[0] is SectionVisual);
                        SectionVisual sectionVisual = (SectionVisual)visualChildren[0];

                        // Draw column rules.
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(Paragraph.Element);
                        sectionVisual.DrawColumnRules(ref arrayColumnDesc, TextDpi.FromTextDpi(subpageDetails.u.complex.fsrc.v), TextDpi.FromTextDpi(subpageDetails.u.complex.fsrc.dv), columnProperties);

                        visualChildren = sectionVisual.Children;
                        if (fskupd == PTS.FSKUPDATE.fskupdNew)
                        {
                            visualChildren.Clear();
                            for (int index = 0; index < arrayColumnDesc.Length; index++)
                            {
                                visualChildren.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(visualChildren.Count == arrayColumnDesc.Length, ErrorHandler.ColumnVisualCountMismatch);

                        for (int index = 0; index < arrayColumnDesc.Length; index++)
                        {
                            ContainerVisual trackVisual = (ContainerVisual)visualChildren[index];

                            PtsHelper.UpdateTrackVisuals(PtsContext, trackVisual.Children, fskupdInherited, ref arrayColumnDesc[index]);
                        }
                    }
                }
                if (emptySubpage)
                {
                    // There is no content, remove all existing visuals.
                    _visual.Children.Clear();
                }
            }

            pageContentVisual.Offset      = new PTS.FSVECTOR(ContentRect.u, ContentRect.v).FromTextDpi();
            floatingElementsVisual.Offset = new PTS.FSVECTOR(ContentRect.u, ContentRect.v).FromTextDpi();

            PTS.FSRECT clipRect = new PTS.FSRECT(_paddingRect.u - _contentRect.u, _paddingRect.v - _contentRect.v, _paddingRect.du, _paddingRect.dv);
            PtsHelper.ClipChildrenToRect(_visual, clipRect.FromTextDpi());

            PtsHelper.UpdateFloatingElementVisuals(floatingElementsVisual, _pageContextOfThisPage.FloatingElementList);
        }
Esempio n. 12
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Query paragraph details
            PTS.FSSUBTRACKDETAILS subtrackDetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails));

            // Draw border and background info.
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (ThisFlowDirection != PageFlowDirection)
            {
                mbp.MirrorBP();
            }

            uint fswdir = PTS.FlowDirectionToFswdir((FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty));

            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            // This textProperties object is eventually used in creation of LineProperties, which leads to creation of a TextMarkerSource. TextMarkerSource relies on PixelsPerDip
            // from TextProperties, therefore it must be set here properly.
            TextProperties textProperties = new TextProperties(Paragraph.Element, StaticTextPointer.Null, false /* inline objects */, false /* get background */,
                                                               Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            // There might be possibility to get empty sub-track, skip the sub-track in such case.
            if (subtrackDetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION [] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                using (DrawingContext ctx = _visual.RenderOpen())
                {
                    _visual.DrawBackgroundAndBorderIntoContext(ctx, backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);

                    // Get list of paragraphs
                    ListMarkerLine listMarkerLine           = new ListMarkerLine(Paragraph.StructuralCache.TextFormatterHost, this);
                    int            indexFirstParaInSubtrack = 0;

                    for (int index = 0; index < subtrackDetails.cParas; index++)
                    {
                        List list = Paragraph.Element as List;

                        BaseParaClient listItemParaClient = PtsContext.HandleToObject(arrayParaDesc[index].pfsparaclient) as BaseParaClient;
                        PTS.ValidateHandle(listItemParaClient);

                        if (index == 0)
                        {
                            indexFirstParaInSubtrack = list.GetListItemIndex(listItemParaClient.Paragraph.Element as ListItem);
                        }

                        if (listItemParaClient.IsFirstChunk)
                        {
                            int dvBaseline = listItemParaClient.GetFirstTextLineBaseline();

                            if (PageFlowDirection != ThisFlowDirection)
                            {
                                ctx.PushTransform(new MatrixTransform(-1.0, 0.0, 0.0, 1.0, TextDpi.FromTextDpi(2 * listItemParaClient.Rect.u + listItemParaClient.Rect.du), 0.0));
                            }

                            int adjustedIndex;
                            if (int.MaxValue - index < indexFirstParaInSubtrack)
                            {
                                adjustedIndex = int.MaxValue;
                            }
                            else
                            {
                                adjustedIndex = indexFirstParaInSubtrack + index;
                            }
                            LineProperties lineProps = new LineProperties(Paragraph.Element, Paragraph.StructuralCache.FormattingOwner, textProperties, new MarkerProperties(list, adjustedIndex));
                            listMarkerLine.FormatAndDrawVisual(ctx, lineProps, listItemParaClient.Rect.u, dvBaseline);

                            if (PageFlowDirection != ThisFlowDirection)
                            {
                                ctx.Pop();
                            }
                        }
                    }


                    listMarkerLine.Dispose();
                }

                // Render list of paragraphs
                PtsHelper.UpdateParaListVisuals(PtsContext, _visual.Children, fskupdInherited, arrayParaDesc);
            }
            else
            {
                _visual.Children.Clear();
            }
        }
Esempio n. 13
0
 // Token: 0x06006735 RID: 26421 RVA: 0x00002137 File Offset: 0x00000337
 internal virtual void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
 {
 }
Esempio n. 14
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            PTS.FSSUBPAGEDETAILS fssubpagedetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (base.ThisFlowDirection != base.PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }
            Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            this.Visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
            if (this._visual.Children.Count != 2)
            {
                this._visual.Children.Clear();
                this._visual.Children.Add(new ContainerVisual());
                this._visual.Children.Add(new ContainerVisual());
            }
            ContainerVisual containerVisual  = (ContainerVisual)this._visual.Children[0];
            ContainerVisual containerVisual2 = (ContainerVisual)this._visual.Children[1];

            if (PTS.ToBoolean(fssubpagedetails.fSimple))
            {
                PTS.FSKUPDATE fskupdate = fssubpagedetails.u.simple.trackdescr.fsupdinf.fskupd;
                if (fskupdate == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupdate = fskupdInherited;
                }
                VisualCollection children = containerVisual.Children;
                if (fskupdate == PTS.FSKUPDATE.fskupdNew)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                else if (children.Count == 1 && children[0] is SectionVisual)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                ContainerVisual containerVisual3 = (ContainerVisual)children[0];
                PtsHelper.UpdateTrackVisuals(base.PtsContext, containerVisual3.Children, fskupdInherited, ref fssubpagedetails.u.simple.trackdescr);
            }
            else
            {
                bool flag = fssubpagedetails.u.complex.cBasicColumns == 0;
                if (!flag)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array);
                    flag = (array.Length == 0);
                    if (!flag)
                    {
                        ErrorHandler.Assert(fskupdInherited != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
                        VisualCollection children2 = containerVisual.Children;
                        if (children2.Count == 0)
                        {
                            children2.Add(new SectionVisual());
                        }
                        else if (!(children2[0] is SectionVisual))
                        {
                            children2.Clear();
                            children2.Add(new SectionVisual());
                        }
                        SectionVisual         sectionVisual    = (SectionVisual)children2[0];
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(base.Paragraph.Element);
                        sectionVisual.DrawColumnRules(ref array, TextDpi.FromTextDpi(fssubpagedetails.u.complex.fsrc.v), TextDpi.FromTextDpi(fssubpagedetails.u.complex.fsrc.dv), columnProperties);
                        children2 = sectionVisual.Children;
                        if (fskupdInherited == PTS.FSKUPDATE.fskupdNew)
                        {
                            children2.Clear();
                            for (int i = 0; i < array.Length; i++)
                            {
                                children2.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(children2.Count == array.Length, ErrorHandler.ColumnVisualCountMismatch);
                        for (int j = 0; j < array.Length; j++)
                        {
                            ContainerVisual containerVisual4 = (ContainerVisual)children2[j];
                            PtsHelper.UpdateTrackVisuals(base.PtsContext, containerVisual4.Children, fskupdInherited, ref array[j]);
                        }
                    }
                }
                if (flag)
                {
                    this._visual.Children.Clear();
                }
            }
            containerVisual.Offset  = new PTS.FSVECTOR(this.ContentRect.u, this.ContentRect.v).FromTextDpi();
            containerVisual2.Offset = new PTS.FSVECTOR(this.ContentRect.u, this.ContentRect.v).FromTextDpi();
            PTS.FSRECT fsrect = new PTS.FSRECT(this._paddingRect.u - this._contentRect.u, this._paddingRect.v - this._contentRect.v, this._paddingRect.du, this._paddingRect.dv);
            PtsHelper.ClipChildrenToRect(this._visual, fsrect.FromTextDpi());
            PtsHelper.UpdateFloatingElementVisuals(containerVisual2, this._pageContextOfThisPage.FloatingElementList);
        }
        private void UpdatePageVisuals(Size arrangeSize)
        {
            Invariant.Assert(!this.IsEmpty);
            PTS.FSPAGEDETAILS fspagedetails;
            PTS.Validate(PTS.FsQueryPageDetails(this.PtsContext.Context, this._ptsPage.Value, out fspagedetails));
            if (fspagedetails.fskupd == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            ErrorHandler.Assert(fspagedetails.fskupd != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
            if (this._visual.Children.Count != 2)
            {
                this._visual.Children.Clear();
                this._visual.Children.Add(new ContainerVisual());
                this._visual.Children.Add(new ContainerVisual());
            }
            ContainerVisual containerVisual = (ContainerVisual)this._visual.Children[0];
            ContainerVisual visual          = (ContainerVisual)this._visual.Children[1];

            if (PTS.ToBoolean(fspagedetails.fSimple))
            {
                PTS.FSKUPDATE fskupd = fspagedetails.u.simple.trackdescr.fsupdinf.fskupd;
                if (fskupd == PTS.FSKUPDATE.fskupdInherited)
                {
                    fskupd = fspagedetails.fskupd;
                }
                VisualCollection children = containerVisual.Children;
                if (fskupd == PTS.FSKUPDATE.fskupdNew)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                else if (children.Count == 1 && children[0] is SectionVisual)
                {
                    children.Clear();
                    children.Add(new ContainerVisual());
                }
                ContainerVisual containerVisual2 = (ContainerVisual)children[0];
                PtsHelper.UpdateTrackVisuals(this.PtsContext, containerVisual2.Children, fspagedetails.fskupd, ref fspagedetails.u.simple.trackdescr);
            }
            else
            {
                ErrorHandler.Assert(fspagedetails.u.complex.cFootnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                bool flag = fspagedetails.u.complex.cSections == 0;
                if (!flag)
                {
                    PTS.FSSECTIONDESCRIPTION[] array;
                    PtsHelper.SectionListFromPage(this.PtsContext, this._ptsPage.Value, ref fspagedetails, out array);
                    flag = (array.Length == 0);
                    if (!flag)
                    {
                        ErrorHandler.Assert(array.Length == 1, ErrorHandler.NotSupportedMultiSection);
                        VisualCollection children = containerVisual.Children;
                        if (children.Count == 0)
                        {
                            children.Add(new SectionVisual());
                        }
                        else if (!(children[0] is SectionVisual))
                        {
                            children.Clear();
                            children.Add(new SectionVisual());
                        }
                        this.UpdateSectionVisuals((SectionVisual)children[0], fspagedetails.fskupd, ref array[0]);
                    }
                }
                if (flag)
                {
                    containerVisual.Children.Clear();
                }
            }
            PtsHelper.UpdateFloatingElementVisuals(visual, this._pageContextOfThisPage.FloatingElementList);
        }
Esempio n. 16
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            PTS.FSSUBTRACKDETAILS fssubtrackdetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails));
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (base.ThisFlowDirection != base.PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }
            uint           num                   = PTS.FlowDirectionToFswdir((FlowDirection)base.Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty));
            Brush          backgroundBrush       = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);
            TextProperties defaultTextProperties = new TextProperties(base.Paragraph.Element, StaticTextPointer.Null, false, false, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            if (fssubtrackdetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION[] array;
                PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out array);
                using (DrawingContext drawingContext = this._visual.RenderOpen())
                {
                    this._visual.DrawBackgroundAndBorderIntoContext(drawingContext, backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
                    ListMarkerLine listMarkerLine = new ListMarkerLine(base.Paragraph.StructuralCache.TextFormatterHost, this);
                    int            num2           = 0;
                    for (int i = 0; i < fssubtrackdetails.cParas; i++)
                    {
                        List           list           = base.Paragraph.Element as List;
                        BaseParaClient baseParaClient = base.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                        PTS.ValidateHandle(baseParaClient);
                        if (i == 0)
                        {
                            num2 = list.GetListItemIndex(baseParaClient.Paragraph.Element as ListItem);
                        }
                        if (baseParaClient.IsFirstChunk)
                        {
                            int firstTextLineBaseline = baseParaClient.GetFirstTextLineBaseline();
                            if (base.PageFlowDirection != base.ThisFlowDirection)
                            {
                                drawingContext.PushTransform(new MatrixTransform(-1.0, 0.0, 0.0, 1.0, TextDpi.FromTextDpi(2 * baseParaClient.Rect.u + baseParaClient.Rect.du), 0.0));
                            }
                            int index;
                            if (2147483647 - i < num2)
                            {
                                index = int.MaxValue;
                            }
                            else
                            {
                                index = num2 + i;
                            }
                            LineProperties lineProps = new LineProperties(base.Paragraph.Element, base.Paragraph.StructuralCache.FormattingOwner, defaultTextProperties, new MarkerProperties(list, index));
                            listMarkerLine.FormatAndDrawVisual(drawingContext, lineProps, baseParaClient.Rect.u, firstTextLineBaseline);
                            if (base.PageFlowDirection != base.ThisFlowDirection)
                            {
                                drawingContext.Pop();
                            }
                        }
                    }
                    listMarkerLine.Dispose();
                }
                PtsHelper.UpdateParaListVisuals(base.PtsContext, this._visual.Children, fskupdInherited, array);
                return;
            }
            this._visual.Children.Clear();
        }