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: 0x0600680B RID: 26635 RVA: 0x001D3C64 File Offset: 0x001D1E64
        internal override void ArrangeFloater(PTS.FSRECT rcFloater, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext)
        {
            if (this.IsFloaterHorizontallyCentered(rcFloater, rcHostPara))
            {
                rcFloater.u = rcHostPara.u + (rcHostPara.du - rcFloater.du) / 2;
            }
            this._rect = rcFloater;
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            this._rect.v              = this._rect.v + mbpInfo.MarginTop;
            this._rect.dv             = this._rect.dv - (mbpInfo.MarginTop + mbpInfo.MarginBottom);
            this._rect.u              = this._rect.u + mbpInfo.MarginLeft;
            this._rect.du             = this._rect.du - (mbpInfo.MarginLeft + mbpInfo.MarginRight);
            this._flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent);
            this._flowDirection       = (FlowDirection)base.Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
            this._pageContext         = pageContext;
            if (base.ThisFlowDirection != base.PageFlowDirection)
            {
                mbpInfo.MirrorBP();
            }
            this._contentRect.u  = this._rect.u + mbpInfo.BPLeft;
            this._contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BPRight - mbpInfo.BPLeft);
            this._contentRect.v  = this._rect.v + mbpInfo.BPTop;
            this._contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BPBottom - mbpInfo.BPTop);
            this._paddingRect.u  = this._rect.u + mbpInfo.BorderLeft;
            this._paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BorderRight - mbpInfo.BorderLeft);
            this._paddingRect.v  = this._rect.v + mbpInfo.BorderTop;
            this._paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BorderBottom - mbpInfo.BorderTop);
            this.OnArrange();
        }
Esempio n. 3
0
        protected override void OnArrange()
        {
            base.OnArrange();
            ((SubpageParagraph)base.Paragraph).UpdateSegmentLastFormatPositions();
            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();
            }
            if (!this.IsFirstChunk)
            {
                mbpInfo.Border  = new Thickness(mbpInfo.Border.Left, 0.0, mbpInfo.Border.Right, mbpInfo.Border.Bottom);
                mbpInfo.Padding = new Thickness(mbpInfo.Padding.Left, 0.0, mbpInfo.Padding.Right, mbpInfo.Padding.Bottom);
            }
            if (!this.IsLastChunk)
            {
                mbpInfo.Border  = new Thickness(mbpInfo.Border.Left, mbpInfo.Border.Top, mbpInfo.Border.Right, 0.0);
                mbpInfo.Padding = new Thickness(mbpInfo.Padding.Left, mbpInfo.Padding.Top, mbpInfo.Padding.Right, 0.0);
            }
            this._contentRect.u  = this._rect.u + mbpInfo.BPLeft;
            this._contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BPRight - mbpInfo.BPLeft);
            this._contentRect.v  = this._rect.v + mbpInfo.BPTop;
            this._contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BPBottom - mbpInfo.BPTop);
            this._paddingRect.u  = this._rect.u + mbpInfo.BorderLeft;
            this._paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.du - mbpInfo.BorderRight - mbpInfo.BorderLeft);
            this._paddingRect.v  = this._rect.v + mbpInfo.BorderTop;
            this._paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), this._rect.dv - mbpInfo.BorderBottom - mbpInfo.BorderTop);
            if (PTS.ToBoolean(fssubpagedetails.fSimple))
            {
                this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.simple.trackdescr.fsrc);
                base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, fssubpagedetails.u.simple.trackdescr.fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);
                PtsHelper.ArrangeTrack(base.PtsContext, ref fssubpagedetails.u.simple.trackdescr, fssubpagedetails.u.simple.fswdir);
                base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
                return;
            }
            this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.complex.fsrc);
            if (fssubpagedetails.u.complex.cBasicColumns != 0)
            {
                PTS.FSTRACKDESCRIPTION[] array;
                PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array);
                for (int i = 0; i < array.Length; i++)
                {
                    base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, array[i].fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);
                    PtsHelper.ArrangeTrack(base.PtsContext, ref array[i], fssubpagedetails.u.complex.fswdir);
                    base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
                }
            }
        }
Esempio n. 4
0
        // ------------------------------------------------------------------
        // Arrange floater
        //
        //      rcFloater - rectangle of the floater
        //      rcHostPara - rectangle of the host text paragraph.
        // ------------------------------------------------------------------
        internal override void ArrangeFloater(PTS.FSRECT rcFloater, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext)
        {
            // If alignment is set to Stretch and floater width is less than para width, center it
            if (IsFloaterHorizontallyCentered(rcFloater, rcHostPara))
            {
                rcFloater.u = rcHostPara.u + (rcHostPara.du - rcFloater.du) / 2;
            }

            // Set paragraph rectangle (relative to the page)
            _rect = rcFloater;

            // Adjust rect to account for margins
            // Add margin values to rect offsets and subtract them from rect widths
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element, Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            _rect.v  += mbp.MarginTop;
            _rect.dv -= mbp.MarginTop + mbp.MarginBottom;
            _rect.u  += mbp.MarginLeft;
            _rect.du -= mbp.MarginLeft + mbp.MarginRight;

            _flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent);
            _flowDirection       = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
            _pageContext         = pageContext;

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

            _contentRect.u  = _rect.u + mbp.BPLeft;
            _contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft);
            _contentRect.v  = _rect.v + mbp.BPTop;
            _contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop);

            _paddingRect.u  = _rect.u + mbp.BorderLeft;
            _paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft);
            _paddingRect.v  = _rect.v + mbp.BorderTop;
            _paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);

            // Do paragraph specifc arrange
            OnArrange();
        }
Esempio n. 5
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. 6
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);
        }
        protected override void OnArrange()
        {
            base.OnArrange();

            ((FigureParagraph)Paragraph).UpdateSegmentLastFormatPositions();

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

            _pageContext.AddFloatingParaClient(this);

            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element);

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

            _contentRect.u  = _rect.u + mbp.BPLeft;
            _contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft);
            _contentRect.v  = _rect.v + mbp.BPTop;
            _contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop);

            _paddingRect.u  = _rect.u + mbp.BorderLeft;
            _paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft);
            _paddingRect.v  = _rect.v + mbp.BorderTop;
            _paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);


            // Arrange subpage content. 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))
            {
                _pageContextOfThisPage.PageRect = new PTS.FSRECT(subpageDetails.u.simple.trackdescr.fsrc);

                // (1) simple subpage (contains only one track)
                // Exceptions don't need to pop, as the top level arrange context will be nulled out if thrown.
                Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(_pageContextOfThisPage, subpageDetails.u.simple.trackdescr.fsrc,
                                                                                Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);

                PtsHelper.ArrangeTrack(PtsContext, ref subpageDetails.u.simple.trackdescr, subpageDetails.u.simple.fswdir);

                Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
            }
            else
            {
                _pageContextOfThisPage.PageRect = new PTS.FSRECT(subpageDetails.u.complex.fsrc);

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

                    // Arrange each track
                    for (int index = 0; index < arrayColumnDesc.Length; index++)
                    {
                        // Exceptions don't need to pop, as the top level arrange context will be nulled out if thrown.
                        Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(_pageContextOfThisPage, arrayColumnDesc[index].fsrc,
                                                                                        Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);

                        PtsHelper.ArrangeTrack(PtsContext, ref arrayColumnDesc[index], subpageDetails.u.complex.fswdir);

                        Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
                    }
                }
            }
        }
Esempio n. 8
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. 9
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);
        }
Esempio n. 10
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();
        }