Esempio n. 1
0
 // Token: 0x06006822 RID: 26658 RVA: 0x001D5468 File Offset: 0x001D3668
 internal override void UpdateBottomlessFloaterContent(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, IntPtr pfsFloatContent, out PTS.FSFMTRBL fsfmtrbl, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
 {
     fsfmtrbl        = PTS.FSFMTRBL.fmtrblGoalReached;
     durFloaterWidth = (dvrFloaterHeight = (cPolygons = (cVertices = 0)));
     fsbbox          = default(PTS.FSBBOX);
     Invariant.Assert(false, "No appropriate handling for update in attached object floater.");
 }
 // Token: 0x06006B60 RID: 27488 RVA: 0x001F0134 File Offset: 0x001EE334
 internal override void FormatFloaterContentFinite(FloaterBaseParaClient paraClient, IntPtr pbrkrecIn, int fBRFromPreviousPage, IntPtr footnoteRejector, int fEmptyOk, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out IntPtr pfsFloatContent, out IntPtr pbrkrecOut, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
 {
     Invariant.Assert(paraClient is UIElementParaClient);
     Invariant.Assert(base.Element is BlockUIContainer);
     if (fAtMaxWidth == 0 && fEmptyOk == 1)
     {
         durFloaterWidth = (dvrFloaterHeight = 0);
         cPolygons       = (cVertices = 0);
         fsfmtr          = default(PTS.FSFMTR);
         fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
         fsfmtr.fContainsItemThatStoppedBeforeFootnote = 0;
         fsfmtr.fForcedProgress = 0;
         fsbbox          = default(PTS.FSBBOX);
         fsbbox.fDefined = 0;
         pbrkrecOut      = IntPtr.Zero;
         pfsFloatContent = IntPtr.Zero;
         return;
     }
     cPolygons = (cVertices = 0);
     fsfmtr.fForcedProgress = PTS.FromBoolean(fAtMaxWidth == 0);
     if (((BlockUIContainer)base.Element).Child != null)
     {
         this.EnsureUIElementIsland();
         this.FormatUIElement(durAvailable, out fsbbox);
     }
     else
     {
         this.ClearUIElementIsland();
         MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);
         fsbbox.fsrc    = default(PTS.FSRECT);
         fsbbox.fsrc.du = durAvailable;
         fsbbox.fsrc.dv = mbpInfo.BPTop + mbpInfo.BPBottom;
     }
     durFloaterWidth  = fsbbox.fsrc.du;
     dvrFloaterHeight = fsbbox.fsrc.dv;
     if (dvrAvailable < dvrFloaterHeight && fEmptyOk == 1)
     {
         durFloaterWidth = (dvrFloaterHeight = 0);
         fsfmtr          = default(PTS.FSFMTR);
         fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
         fsbbox          = default(PTS.FSBBOX);
         fsbbox.fDefined = 0;
         pfsFloatContent = IntPtr.Zero;
     }
     else
     {
         fsbbox.fDefined = 1;
         pfsFloatContent = paraClient.Handle;
         if (dvrAvailable < dvrFloaterHeight)
         {
             Invariant.Assert(fEmptyOk == 0);
             fsfmtr.fForcedProgress = 1;
         }
         fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrGoalReached;
     }
     pbrkrecOut = IntPtr.Zero;
     fsfmtr.fContainsItemThatStoppedBeforeFootnote = 0;
 }
Esempio n. 3
0
 internal unsafe virtual void GetFloaterPolygons(
     FloaterBaseParaClient paraClient,   // IN:
     uint fswdirTrack,                   // IN:  direction of Track
     int ncVertices,                     // IN:  size of array of vertex counts (= number of polygons)
     int nfspt,                          // IN:  size of the array of all vertices
     int *rgcVertices,                   // OUT: array of vertex counts (array containing number of vertices for each polygon)
     out int ccVertices,                 // OUT: actual number of vertex counts
     PTS.FSPOINT *rgfspt,                // OUT: array of all vertices
     out int cfspt,                      // OUT: actual total number of vertices in all polygons
     out int fWrapThrough)               // OUT: fill text in empty areas within obstacles?
 {
     Debug.Assert(false, "Tight wrap is not currently supported.");
     ccVertices = cfspt = fWrapThrough = 0;
 }
Esempio n. 4
0
            out int cVertices);                 // OUT: total number of vertices in all polygons

        //-------------------------------------------------------------------
        // FormatFloaterContentBottomless
        //-------------------------------------------------------------------
        internal abstract void UpdateBottomlessFloaterContent(
            FloaterBaseParaClient paraClient,   // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            IntPtr pfsFloatContent,             // IN: floater content
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices);                 // OUT: total number of vertices in all polygons
Esempio n. 5
0
 //-------------------------------------------------------------------
 // UpdateBottomlessFloaterContent
 //-------------------------------------------------------------------
 internal override void UpdateBottomlessFloaterContent(
     FloaterBaseParaClient paraClient,   // IN:
     int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
     uint fswdir,                        // IN:  direction of track
     int fAtMaxWidth,                    // IN:  formating is at full width of column
     int durAvailable,                   // IN:  width of available space
     int dvrAvailable,                   // IN:  height of available space
     IntPtr pfsFloatContent,             // IN:  floater content (in UIElementParagraph, this is an alias to the paraClient)
     out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
     out int durFloaterWidth,            // OUT: floater width
     out int dvrFloaterHeight,           // OUT: floater height
     out PTS.FSBBOX fsbbox,              // OUT: floater bbox
     out int cPolygons,                  // OUT: number of polygons
     out int cVertices)                  // OUT: total number of vertices in all polygons
 {
     // This implementation simply calls into format floater content bottomless. As para has no real content, this is ok.
     FormatFloaterContentBottomless(paraClient, fSuppressTopSpace, fswdir, fAtMaxWidth, durAvailable, dvrAvailable, out fsfmtrbl, out pfsFloatContent,
                                    out durFloaterWidth, out dvrFloaterHeight, out fsbbox, out cPolygons, out cVertices);
 }
Esempio n. 6
0
        //-------------------------------------------------------------------
        // UpdateBottomlessFloaterContent
        //-------------------------------------------------------------------
        internal override void UpdateBottomlessFloaterContent(
            FloaterBaseParaClient paraClient,   // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            IntPtr pfsFloatContent,             // IN:  floater content (in UIElementParagraph, this is an alias to the paraClient)
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            fsfmtrbl        = default(PTS.FSFMTRBL);
            durFloaterWidth = dvrFloaterHeight = cPolygons = cVertices = 0; fsbbox = new PTS.FSBBOX();

            Invariant.Assert(false, "No appropriate handling for update in attached object floater.");
        }
Esempio n. 7
0
 //-------------------------------------------------------------------
 // FormatFloaterContentFinite
 //-------------------------------------------------------------------
 internal abstract void FormatFloaterContentFinite(
     FloaterBaseParaClient paraClient,   // IN:
     IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
     int fBRFromPreviousPage,            // IN:  break record was created on previous page
     IntPtr footnoteRejector,            // IN:
     int fEmptyOk,                       // IN:  is it OK not to add anything?
     int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
     uint fswdir,                        // IN:  direction of Track
     int fAtMaxWidth,                    // IN:  formating is at full width of column
     int durAvailable,                   // IN:  width of available space
     int dvrAvailable,                   // IN:  height of available space
     PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
     // IN: suppress breaks at track start?
     out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
     out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
     out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record
     out int durFloaterWidth,            // OUT: floater width
     out int dvrFloaterHeight,           // OUT: floater height
     out PTS.FSBBOX fsbbox,              // OUT: floater bbox
     out int cPolygons,                  // OUT: number of polygons
     out int cVertices);                 // OUT: total number of vertices in all polygons
        // Token: 0x06006B61 RID: 27489 RVA: 0x001F02F8 File Offset: 0x001EE4F8
        internal override void FormatFloaterContentBottomless(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, out PTS.FSFMTRBL fsfmtrbl, out IntPtr pfsFloatContent, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
        {
            Invariant.Assert(paraClient is UIElementParaClient);
            Invariant.Assert(base.Element is BlockUIContainer);
            if (fAtMaxWidth == 0)
            {
                durFloaterWidth  = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons        = (cVertices = 0);
                fsfmtrbl         = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox           = default(PTS.FSBBOX);
                fsbbox.fDefined  = 0;
                pfsFloatContent  = IntPtr.Zero;
                return;
            }
            cPolygons = (cVertices = 0);
            if (((BlockUIContainer)base.Element).Child != null)
            {
                this.EnsureUIElementIsland();
                this.FormatUIElement(durAvailable, out fsbbox);
                pfsFloatContent  = paraClient.Handle;
                fsfmtrbl         = PTS.FSFMTRBL.fmtrblGoalReached;
                fsbbox.fDefined  = 1;
                durFloaterWidth  = fsbbox.fsrc.du;
                dvrFloaterHeight = fsbbox.fsrc.dv;
                return;
            }
            this.ClearUIElementIsland();
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);

            fsbbox.fsrc      = default(PTS.FSRECT);
            fsbbox.fsrc.du   = durAvailable;
            fsbbox.fsrc.dv   = mbpInfo.BPTop + mbpInfo.BPBottom;
            fsbbox.fDefined  = 1;
            pfsFloatContent  = paraClient.Handle;
            fsfmtrbl         = PTS.FSFMTRBL.fmtrblGoalReached;
            durFloaterWidth  = fsbbox.fsrc.du;
            dvrFloaterHeight = fsbbox.fsrc.dv;
        }
        //-------------------------------------------------------------------
        // UpdateBottomlessFloaterContent
        //-------------------------------------------------------------------
        internal override void UpdateBottomlessFloaterContent(
            FloaterBaseParaClient paraClient,       // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            IntPtr pfsFloatContent,             // IN:  floater content (in UIElementParagraph, this is an alias to the paraClient)
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            fsfmtrbl = default(PTS.FSFMTRBL); 
            durFloaterWidth = dvrFloaterHeight = cPolygons = cVertices = 0; fsbbox = new PTS.FSBBOX();

            Invariant.Assert(false, "No appropriate handling for update in attached object floater.");
        }
        internal override void FormatFloaterContentBottomless(
            FloaterBaseParaClient paraClient,       // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            uint fswdirPara = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            Invariant.Assert(paraClient is FloaterParaClient);

            int subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin;
            int dvrTopSpace, fPageBecomesUninterruptable;
            int cColumns;
            PTS.FSCOLUMNINFO[] columnInfoCollection;
            IntPtr pmcsclientOut;
            MbpInfo mbp;
            double specifiedWidth;
            
            // If horizontal alignment is Stretch and we are not formatting at max width,
            // we cannot proceed.
            if (IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                // Set foater width, height to be greater than available values to signal to PTS that floater does not fit in the space
                durFloaterWidth = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons = cVertices = 0;
                fsfmtrbl = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                // Initialize the subpage size. PTS subpage margin is always set to 0 for Floaters.
                // If width on floater is specified, use the specified value.
                // Margin, border and padding of the floater is extracted from available subpage width.
                mbp = MbpInfo.FromElement(Element);

                specifiedWidth = CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                AdjustDurAvailable(specifiedWidth, ref durAvailable, out subpageWidth);
                durSubpageMargin = subpageWidth;
                urSubpageMargin = vrSubpageMargin = 0;

                // Initialize column info. Floater always has just 1 column.
                cColumns = 1;
                columnInfoCollection = new PTS.FSCOLUMNINFO[cColumns];
                columnInfoCollection[0].durBefore = 0;
                columnInfoCollection[0].durWidth = subpageWidth;

                // Create subpage
                InvalidateMainTextSegment();
                CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True,
                    fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin,
                    cColumns, columnInfoCollection,
                    out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, 
                    out dvrTopSpace, out fPageBecomesUninterruptable);

                if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision)
                {
                    // PTS subpage does not support autosizing, but Floater needs to autosize to its
                    // content. To workaround this problem, second format of subpage is performed, if 
                    // necessary. It means that if the width of bounding box is smaller than subpage's
                    // width, second formatting is performed.
                    // However, if HorizontalAlignment is set to Stretch we should not reformat because
                    // floater should be at full column width
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if(fsbbox.fsrc.du < subpageWidth && Double.IsNaN(specifiedWidth) && HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            // There is a need to reformat PTS subpage, so destroy any resourcces allocated by PTS
                            // during previous formatting.
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                            }
                            if (pmcsclientOut != IntPtr.Zero)
                            {
                                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                                PTS.ValidateHandle(mcs);
                                mcs.Dispose();
                                pmcsclientOut = IntPtr.Zero;
                            }
                            // Create subpage with new width.
                            subpageWidth = durSubpageMargin = fsbbox.fsrc.du + 1; // add 1/300px to avoid rounding errors
                            columnInfoCollection[0].durWidth = subpageWidth;
                            CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True,
                                fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin,
                                cColumns, columnInfoCollection,
                                out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut,
                                out dvrTopSpace, out fPageBecomesUninterruptable);
                        }
                    }
                    else
                    {
                        subpageWidth = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }

                    // Destroy objects created by PTS, but not used here.
                    if (pmcsclientOut != IntPtr.Zero)
                    {
                        MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                        PTS.ValidateHandle(mcs);
                        mcs.Dispose();
                        pmcsclientOut = IntPtr.Zero;
                    }

                    // Get the size of the floater. For height PTS already reports calculated value.
                    // But width is the same as subpage width. 
                    durFloaterWidth = subpageWidth + mbp.MBPLeft + mbp.MBPRight;

                    dvrFloaterHeight += mbp.MBPTop + mbp.MBPBottom;

                    // Check if floater width fits in available width. It may exceed available width because borders
                    // and padding are added.
                    if ( dvrFloaterHeight > dvrAvailable ||
                         (durFloaterWidth > durAvailable && !PTS.ToBoolean(fAtMaxWidth))
                       )
                    {
                        // Get rid of any previous formatting 
                        if (pfsFloatContent != IntPtr.Zero)
                        {
                            PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                        }

                        Debug.Assert(pmcsclientOut == IntPtr.Zero);
                        cPolygons = cVertices = 0;
                        pfsFloatContent = IntPtr.Zero;
                    }
                    else
                    {
                        // Width and height are OK, format floater
                        // Adjust bounding box to cover entire floater.
                        fsbbox.fsrc.u = 0;
                        fsbbox.fsrc.v = 0;
                        fsbbox.fsrc.du = durFloaterWidth;
                        fsbbox.fsrc.dv = dvrFloaterHeight;

                        // Tight wrap is disabled for now.
                        cPolygons = cVertices = 0;
                    }
                }
                else
                {
                    Debug.Assert(pmcsclientOut == IntPtr.Zero);
                    durFloaterWidth = dvrFloaterHeight = 0;
                    cPolygons = cVertices = 0;
                    pfsFloatContent = IntPtr.Zero;
                }
            }

            // Update handle to PTS subpage.
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
        internal override void FormatFloaterContentFinite(
            FloaterBaseParaClient paraClient,       // IN:
            IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
            int fBRFromPreviousPage,            // IN:  break record was created on previous page
            IntPtr footnoteRejector,            // IN: 
            int fEmptyOk,                       // IN:  is it OK not to add anything?
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of Track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
                                                // IN: suppress breaks at track start?
            out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            uint fswdirPara = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            int subpageWidth, subpageHeight;
            int dvrTopSpace;
            int cColumns;
            PTS.FSRECT fsrcSubpageMargin;
            PTS.FSCOLUMNINFO[] columnInfoCollection;
            IntPtr pmcsclientOut;
            double specifiedWidth;
            MbpInfo mbp;

            Invariant.Assert(paraClient is FloaterParaClient);

            // If horizontal alignment is Stretch and we are not formatting at max width,
            // we cannot proceed.
            if (IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                durFloaterWidth = dvrFloaterHeight = 0;
                cPolygons = cVertices = 0;
                fsfmtr = new PTS.FSFMTR();
                fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
                fsfmtr.fForcedProgress = PTS.False;
                fsbbox = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pbrkrecOut = IntPtr.Zero;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                // When formatting bottomless page, PTS may format paragraphs as finite. This happens
                // in case of multiple columns. In this case make sure that height is not too big.
                if (!StructuralCache.CurrentFormatContext.FinitePage)
                {
                    if (Double.IsInfinity(StructuralCache.CurrentFormatContext.PageHeight))
                    {
                        if (dvrAvailable > PTS.dvBottomUndefined / 2)
                        {
                            dvrAvailable = Math.Min(dvrAvailable, PTS.dvBottomUndefined / 2);
                            fEmptyOk = PTS.False;
                        }
                    }
                    else
                    {
                        dvrAvailable = Math.Min(dvrAvailable, TextDpi.ToTextDpi(StructuralCache.CurrentFormatContext.PageHeight));
                    }
                }

                // Initialize the subpage size. PTS subpage margin is always set to 0 for Floaters.
                // If width on floater is specified, use the specified value.
                // Margin, border and padding of the floater is extracted from available subpage height
                mbp = MbpInfo.FromElement(Element);
                
                // We do not mirror margin as it's used to dist text left and right, and is unnecessary.
                // Clip Floater.Width to available width
                specifiedWidth = CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                AdjustDurAvailable(specifiedWidth, ref durAvailable, out subpageWidth);
                subpageHeight = Math.Max(1, dvrAvailable - (mbp.MBPTop + mbp.MBPBottom));
                fsrcSubpageMargin = new PTS.FSRECT();
                fsrcSubpageMargin.du = subpageWidth;
                fsrcSubpageMargin.dv = subpageHeight;

                // Initialize column info. Floater always has just 1 column.
                cColumns = 1;
                columnInfoCollection = new PTS.FSCOLUMNINFO[cColumns];
                columnInfoCollection[0].durBefore = 0;
                columnInfoCollection[0].durWidth = subpageWidth;

                // Format subpage
                CreateSubpageFiniteHelper(PtsContext, pbrkrecIn, fBRFromPreviousPage, _mainTextSegment.Handle,
                    footnoteRejector, fEmptyOk, PTS.True, fswdir, subpageWidth, subpageHeight,
                    ref fsrcSubpageMargin, cColumns, columnInfoCollection, PTS.False, fsksuppresshardbreakbeforefirstparaIn,
                    out fsfmtr, out pfsFloatContent, 
                    out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace);

                // Initialize subpage metrics
                if (fsfmtr.kstop >= PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)   // No progress or collision
                {
                    Debug.Assert(pmcsclientOut == IntPtr.Zero);
                    durFloaterWidth = dvrFloaterHeight = 0;
                    cPolygons = cVertices = 0;
                    //pbrkrecpara = IntPtr.Zero;
                }
                else
                {
                    // PTS subpage does not support autosizing, but Floater needs to autosize to its
                    // content. To workaround this problem, second format of subpage is performed, if 
                    // necessary. It means that if the width of bounding box is smaller than subpage's
                    // width, second formatting is performed.
                    // However, if HorizontalAlignment is set to Stretch we should not reformat because floater
                    // should be at max width
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if(fsbbox.fsrc.du < subpageWidth && Double.IsNaN(specifiedWidth) && HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            // There is a need to reformat PTS subpage, so destroy any resourcces allocated by PTS
                            // during previous formatting.
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(PtsContext.Context, pbrkrecOut), PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            if (pmcsclientOut != IntPtr.Zero)
                            {
                                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                                PTS.ValidateHandle(mcs);
                                mcs.Dispose();
                                pmcsclientOut = IntPtr.Zero;
                            }
                            // Create subpage with new width.
                            subpageWidth = fsbbox.fsrc.du + 1; // add 1/300px to avoid rounding errors 
                            fsrcSubpageMargin.du = subpageWidth;
                            fsrcSubpageMargin.dv = subpageHeight;
                            columnInfoCollection[0].durWidth = subpageWidth;
                            CreateSubpageFiniteHelper(PtsContext, pbrkrecIn, fBRFromPreviousPage, _mainTextSegment.Handle,
                                 footnoteRejector, fEmptyOk, PTS.True, fswdir, subpageWidth, subpageHeight,
                                ref fsrcSubpageMargin, cColumns, columnInfoCollection, PTS.False, fsksuppresshardbreakbeforefirstparaIn,
                                out fsfmtr, out pfsFloatContent,
                                out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace);
                        }
                    }
                    else
                    {
                        subpageWidth = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }

                    // Destroy objects created by PTS, but not used here.
                    if (pmcsclientOut != IntPtr.Zero)
                    {
                        MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                        PTS.ValidateHandle(mcs);
                        mcs.Dispose();
                        pmcsclientOut = IntPtr.Zero;
                    }

                    // Get the size of the floater. For height PTS already reports calculated value.
                    // But width is the same as subpage width. Add margin values here since we do not use 
                    // distance to text anymore
                    durFloaterWidth = subpageWidth + mbp.MBPLeft + mbp.MBPRight;

                    // Add back all MBP values since we do not use dist to text
                    dvrFloaterHeight += mbp.MBPTop + mbp.MBPBottom;
                    // Check if floater width fits in available width. It may exceed available width because borders and
                    // padding are added.


                    fsbbox.fsrc.u = 0;
                    fsbbox.fsrc.v = 0;
                    fsbbox.fsrc.du = durFloaterWidth;
                    fsbbox.fsrc.dv = dvrFloaterHeight;
                    fsbbox.fDefined = PTS.True;

                    // Tight wrap is disabled for now.
                    cPolygons = cVertices = 0;

                    if(durFloaterWidth > durAvailable || dvrFloaterHeight > dvrAvailable)
                    {
                        if(PTS.ToBoolean(fEmptyOk))
                        {
                            // Get rid of any previous formatting 
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(PtsContext.Context, pbrkrecOut), PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            cPolygons = cVertices = 0;
                            fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                        }
                        else
                        {
                            fsfmtr.fForcedProgress = PTS.True;
                        }
                    }
                }
            }

            // Update handle to PTS subpage.
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
Esempio n. 12
0
 // Token: 0x06006801 RID: 26625
 internal abstract void UpdateBottomlessFloaterContent(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, IntPtr pfsFloatContent, out PTS.FSFMTRBL fsfmtrbl, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices);
Esempio n. 13
0
        internal override void FormatFloaterContentBottomless(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, out PTS.FSFMTRBL fsfmtrbl, out IntPtr pfsFloatContent, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
        {
            uint num = PTS.FlowDirectionToFswdir((FlowDirection)base.Element.GetValue(FrameworkElement.FlowDirectionProperty));

            Invariant.Assert(paraClient is FloaterParaClient);
            if (this.IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                durFloaterWidth  = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons        = (cVertices = 0);
                fsfmtrbl         = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox           = default(PTS.FSBBOX);
                fsbbox.fDefined  = 0;
                pfsFloatContent  = IntPtr.Zero;
            }
            else
            {
                MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);
                double  num2    = this.CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                int     num3;
                this.AdjustDurAvailable(num2, ref durAvailable, out num3);
                int durMargin = num3;
                int urMargin;
                int vrMargin             = urMargin = 0;
                int num4                 = 1;
                PTS.FSCOLUMNINFO[] array = new PTS.FSCOLUMNINFO[num4];
                array[0].durBefore = 0;
                array[0].durWidth  = num3;
                this.InvalidateMainTextSegment();
                IntPtr zero;
                int    num5;
                int    num6;
                this.CreateSubpageBottomlessHelper(base.PtsContext, this._mainTextSegment.Handle, 1, fswdir, num3, urMargin, durMargin, vrMargin, num4, array, out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out zero, out num5, out num6);
                if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision)
                {
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if (fsbbox.fsrc.du < num3 && double.IsNaN(num2) && this.HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(base.PtsContext.Context, pfsFloatContent), base.PtsContext);
                            }
                            if (zero != IntPtr.Zero)
                            {
                                MarginCollapsingState marginCollapsingState = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                                PTS.ValidateHandle(marginCollapsingState);
                                marginCollapsingState.Dispose();
                                zero = IntPtr.Zero;
                            }
                            durMargin         = (num3 = fsbbox.fsrc.du + 1);
                            array[0].durWidth = num3;
                            this.CreateSubpageBottomlessHelper(base.PtsContext, this._mainTextSegment.Handle, 1, fswdir, num3, urMargin, durMargin, vrMargin, num4, array, out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out zero, out num5, out num6);
                        }
                    }
                    else
                    {
                        num3 = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }
                    if (zero != IntPtr.Zero)
                    {
                        MarginCollapsingState marginCollapsingState2 = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                        PTS.ValidateHandle(marginCollapsingState2);
                        marginCollapsingState2.Dispose();
                        zero = IntPtr.Zero;
                    }
                    durFloaterWidth   = num3 + mbpInfo.MBPLeft + mbpInfo.MBPRight;
                    dvrFloaterHeight += mbpInfo.MBPTop + mbpInfo.MBPBottom;
                    if (dvrFloaterHeight > dvrAvailable || (durFloaterWidth > durAvailable && !PTS.ToBoolean(fAtMaxWidth)))
                    {
                        if (pfsFloatContent != IntPtr.Zero)
                        {
                            PTS.Validate(PTS.FsDestroySubpage(base.PtsContext.Context, pfsFloatContent), base.PtsContext);
                        }
                        cPolygons       = (cVertices = 0);
                        pfsFloatContent = IntPtr.Zero;
                    }
                    else
                    {
                        fsbbox.fsrc.u  = 0;
                        fsbbox.fsrc.v  = 0;
                        fsbbox.fsrc.du = durFloaterWidth;
                        fsbbox.fsrc.dv = dvrFloaterHeight;
                        cPolygons      = (cVertices = 0);
                    }
                }
                else
                {
                    durFloaterWidth = (dvrFloaterHeight = 0);
                    cPolygons       = (cVertices = 0);
                    pfsFloatContent = IntPtr.Zero;
                }
            }
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
Esempio n. 14
0
 //-------------------------------------------------------------------- 
 // FormatFloaterContentFinite
 //-------------------------------------------------------------------- 
 internal abstract void FormatFloaterContentFinite(
     FloaterBaseParaClient paraClient,       // IN:
     IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
     int fBRFromPreviousPage,            // IN:  break record was created on previous page 
     IntPtr footnoteRejector,            // IN:
     int fEmptyOk,                       // IN:  is it OK not to add anything? 
     int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page 
     uint fswdir,                        // IN:  direction of Track
     int fAtMaxWidth,                    // IN:  formating is at full width of column 
     int durAvailable,                   // IN:  width of available space
     int dvrAvailable,                   // IN:  height of available space
     PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
                                         // IN: suppress breaks at track start? 
     out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
     out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content 
     out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record 
     out int durFloaterWidth,            // OUT: floater width
     out int dvrFloaterHeight,           // OUT: floater height 
     out PTS.FSBBOX fsbbox,              // OUT: floater bbox
     out int cPolygons,                  // OUT: number of polygons
     out int cVertices);                 // OUT: total number of vertices in all polygons
Esempio n. 15
0
 // Token: 0x060067FF RID: 26623
 internal abstract void FormatFloaterContentFinite(FloaterBaseParaClient paraClient, IntPtr pbrkrecIn, int fBRFromPreviousPage, IntPtr footnoteRejector, int fEmptyOk, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out IntPtr pfsFloatContent, out IntPtr pbrkrecOut, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices);
Esempio n. 16
0
        internal override void FormatFloaterContentBottomless(
            FloaterBaseParaClient paraClient,   // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            uint fswdirPara = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            Invariant.Assert(paraClient is FloaterParaClient);

            int subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin;
            int dvrTopSpace, fPageBecomesUninterruptable;
            int cColumns;

            PTS.FSCOLUMNINFO[] columnInfoCollection;
            IntPtr             pmcsclientOut;
            MbpInfo            mbp;
            double             specifiedWidth;

            // If horizontal alignment is Stretch and we are not formatting at max width,
            // we cannot proceed.
            if (IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                // Set foater width, height to be greater than available values to signal to PTS that floater does not fit in the space
                durFloaterWidth  = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons        = cVertices = 0;
                fsfmtrbl         = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox           = new PTS.FSBBOX();
                fsbbox.fDefined  = PTS.False;
                pfsFloatContent  = IntPtr.Zero;
            }
            else
            {
                // Initialize the subpage size. PTS subpage margin is always set to 0 for Floaters.
                // If width on floater is specified, use the specified value.
                // Margin, border and padding of the floater is extracted from available subpage width.
                mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip);

                specifiedWidth = CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                AdjustDurAvailable(specifiedWidth, ref durAvailable, out subpageWidth);
                durSubpageMargin = subpageWidth;
                urSubpageMargin  = vrSubpageMargin = 0;

                // Initialize column info. Floater always has just 1 column.
                cColumns             = 1;
                columnInfoCollection = new PTS.FSCOLUMNINFO[cColumns];
                columnInfoCollection[0].durBefore = 0;
                columnInfoCollection[0].durWidth  = subpageWidth;

                // Create subpage
                InvalidateMainTextSegment();
                CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True,
                                              fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin,
                                              cColumns, columnInfoCollection,
                                              out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut,
                                              out dvrTopSpace, out fPageBecomesUninterruptable);

                if (fsfmtrbl != PTS.FSFMTRBL.fmtrblCollision)
                {
                    // PTS subpage does not support autosizing, but Floater needs to autosize to its
                    // content. To workaround this problem, second format of subpage is performed, if
                    // necessary. It means that if the width of bounding box is smaller than subpage's
                    // width, second formatting is performed.
                    // However, if HorizontalAlignment is set to Stretch we should not reformat because
                    // floater should be at full column width
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if (fsbbox.fsrc.du < subpageWidth && Double.IsNaN(specifiedWidth) && HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            // There is a need to reformat PTS subpage, so destroy any resourcces allocated by PTS
                            // during previous formatting.
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                            }
                            if (pmcsclientOut != IntPtr.Zero)
                            {
                                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                                PTS.ValidateHandle(mcs);
                                mcs.Dispose();
                                pmcsclientOut = IntPtr.Zero;
                            }
                            // Create subpage with new width.
                            subpageWidth = durSubpageMargin = fsbbox.fsrc.du + 1; // add 1/300px to avoid rounding errors
                            columnInfoCollection[0].durWidth = subpageWidth;
                            CreateSubpageBottomlessHelper(PtsContext, _mainTextSegment.Handle, PTS.True,
                                                          fswdir, subpageWidth, urSubpageMargin, durSubpageMargin, vrSubpageMargin,
                                                          cColumns, columnInfoCollection,
                                                          out fsfmtrbl, out pfsFloatContent, out dvrFloaterHeight, out fsbbox, out pmcsclientOut,
                                                          out dvrTopSpace, out fPageBecomesUninterruptable);
                        }
                    }
                    else
                    {
                        subpageWidth = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }

                    // Destroy objects created by PTS, but not used here.
                    if (pmcsclientOut != IntPtr.Zero)
                    {
                        MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                        PTS.ValidateHandle(mcs);
                        mcs.Dispose();
                        pmcsclientOut = IntPtr.Zero;
                    }

                    // Get the size of the floater. For height PTS already reports calculated value.
                    // But width is the same as subpage width.
                    durFloaterWidth = subpageWidth + mbp.MBPLeft + mbp.MBPRight;

                    dvrFloaterHeight += mbp.MBPTop + mbp.MBPBottom;

                    // Check if floater width fits in available width. It may exceed available width because borders
                    // and padding are added.
                    if (dvrFloaterHeight > dvrAvailable ||
                        (durFloaterWidth > durAvailable && !PTS.ToBoolean(fAtMaxWidth))
                        )
                    {
                        // Get rid of any previous formatting
                        if (pfsFloatContent != IntPtr.Zero)
                        {
                            PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                        }

                        Debug.Assert(pmcsclientOut == IntPtr.Zero);
                        cPolygons       = cVertices = 0;
                        pfsFloatContent = IntPtr.Zero;
                    }
                    else
                    {
                        // Width and height are OK, format floater
                        // Adjust bounding box to cover entire floater.
                        fsbbox.fsrc.u  = 0;
                        fsbbox.fsrc.v  = 0;
                        fsbbox.fsrc.du = durFloaterWidth;
                        fsbbox.fsrc.dv = dvrFloaterHeight;

                        // Tight wrap is disabled for now.
                        cPolygons = cVertices = 0;
                    }
                }
                else
                {
                    Debug.Assert(pmcsclientOut == IntPtr.Zero);
                    durFloaterWidth = dvrFloaterHeight = 0;
                    cPolygons       = cVertices = 0;
                    pfsFloatContent = IntPtr.Zero;
                }
            }

            // Update handle to PTS subpage.
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
Esempio n. 17
0
        internal override void FormatFloaterContentFinite(FloaterBaseParaClient paraClient, IntPtr pbrkrecIn, int fBRFromPreviousPage, IntPtr footnoteRejector, int fEmptyOk, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out IntPtr pfsFloatContent, out IntPtr pbrkrecOut, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
        {
            uint num = PTS.FlowDirectionToFswdir((FlowDirection)base.Element.GetValue(FrameworkElement.FlowDirectionProperty));

            Invariant.Assert(paraClient is FloaterParaClient);
            if (this.IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                durFloaterWidth = (dvrFloaterHeight = 0);
                cPolygons       = (cVertices = 0);
                fsfmtr          = default(PTS.FSFMTR);
                fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = 0;
                fsfmtr.fForcedProgress = 0;
                fsbbox          = default(PTS.FSBBOX);
                fsbbox.fDefined = 0;
                pbrkrecOut      = IntPtr.Zero;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                if (!base.StructuralCache.CurrentFormatContext.FinitePage)
                {
                    if (double.IsInfinity(base.StructuralCache.CurrentFormatContext.PageHeight))
                    {
                        if (dvrAvailable > 1073741823)
                        {
                            dvrAvailable = Math.Min(dvrAvailable, 1073741823);
                            fEmptyOk     = 0;
                        }
                    }
                    else
                    {
                        dvrAvailable = Math.Min(dvrAvailable, TextDpi.ToTextDpi(base.StructuralCache.CurrentFormatContext.PageHeight));
                    }
                }
                MbpInfo mbpInfo = MbpInfo.FromElement(base.Element, base.StructuralCache.TextFormatterHost.PixelsPerDip);
                double  num2    = this.CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                int     num3;
                this.AdjustDurAvailable(num2, ref durAvailable, out num3);
                int        num4   = Math.Max(1, dvrAvailable - (mbpInfo.MBPTop + mbpInfo.MBPBottom));
                PTS.FSRECT fsrect = default(PTS.FSRECT);
                fsrect.du = num3;
                fsrect.dv = num4;
                int num5 = 1;
                PTS.FSCOLUMNINFO[] array = new PTS.FSCOLUMNINFO[num5];
                array[0].durBefore = 0;
                array[0].durWidth  = num3;
                IntPtr zero;
                int    num6;
                this.CreateSubpageFiniteHelper(base.PtsContext, pbrkrecIn, fBRFromPreviousPage, this._mainTextSegment.Handle, footnoteRejector, fEmptyOk, 1, fswdir, num3, num4, ref fsrect, num5, array, 0, fsksuppresshardbreakbeforefirstparaIn, out fsfmtr, out pfsFloatContent, out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out zero, out num6);
                if (fsfmtr.kstop >= PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)
                {
                    durFloaterWidth = (dvrFloaterHeight = 0);
                    cPolygons       = (cVertices = 0);
                }
                else
                {
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if (fsbbox.fsrc.du < num3 && double.IsNaN(num2) && this.HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(base.PtsContext.Context, pfsFloatContent), base.PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(base.PtsContext.Context, pbrkrecOut), base.PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            if (zero != IntPtr.Zero)
                            {
                                MarginCollapsingState marginCollapsingState = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                                PTS.ValidateHandle(marginCollapsingState);
                                marginCollapsingState.Dispose();
                                zero = IntPtr.Zero;
                            }
                            num3              = fsbbox.fsrc.du + 1;
                            fsrect.du         = num3;
                            fsrect.dv         = num4;
                            array[0].durWidth = num3;
                            this.CreateSubpageFiniteHelper(base.PtsContext, pbrkrecIn, fBRFromPreviousPage, this._mainTextSegment.Handle, footnoteRejector, fEmptyOk, 1, fswdir, num3, num4, ref fsrect, num5, array, 0, fsksuppresshardbreakbeforefirstparaIn, out fsfmtr, out pfsFloatContent, out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out zero, out num6);
                        }
                    }
                    else
                    {
                        num3 = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }
                    if (zero != IntPtr.Zero)
                    {
                        MarginCollapsingState marginCollapsingState2 = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                        PTS.ValidateHandle(marginCollapsingState2);
                        marginCollapsingState2.Dispose();
                        zero = IntPtr.Zero;
                    }
                    durFloaterWidth   = num3 + mbpInfo.MBPLeft + mbpInfo.MBPRight;
                    dvrFloaterHeight += mbpInfo.MBPTop + mbpInfo.MBPBottom;
                    fsbbox.fsrc.u     = 0;
                    fsbbox.fsrc.v     = 0;
                    fsbbox.fsrc.du    = durFloaterWidth;
                    fsbbox.fsrc.dv    = dvrFloaterHeight;
                    fsbbox.fDefined   = 1;
                    cPolygons         = (cVertices = 0);
                    if (durFloaterWidth > durAvailable || dvrFloaterHeight > dvrAvailable)
                    {
                        if (PTS.ToBoolean(fEmptyOk))
                        {
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(base.PtsContext.Context, pfsFloatContent), base.PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(base.PtsContext.Context, pbrkrecOut), base.PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            cPolygons    = (cVertices = 0);
                            fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                        }
                        else
                        {
                            fsfmtr.fForcedProgress = 1;
                        }
                    }
                }
            }
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
 // Token: 0x06006B62 RID: 27490 RVA: 0x001F0448 File Offset: 0x001EE648
 internal override void UpdateBottomlessFloaterContent(FloaterBaseParaClient paraClient, int fSuppressTopSpace, uint fswdir, int fAtMaxWidth, int durAvailable, int dvrAvailable, IntPtr pfsFloatContent, out PTS.FSFMTRBL fsfmtrbl, out int durFloaterWidth, out int dvrFloaterHeight, out PTS.FSBBOX fsbbox, out int cPolygons, out int cVertices)
 {
     this.FormatFloaterContentBottomless(paraClient, fSuppressTopSpace, fswdir, fAtMaxWidth, durAvailable, dvrAvailable, out fsfmtrbl, out pfsFloatContent, out durFloaterWidth, out dvrFloaterHeight, out fsbbox, out cPolygons, out cVertices);
 }
Esempio n. 19
0
            out int cVertices);                 // OUT: total number of vertices in all polygons
 
        //-------------------------------------------------------------------
        // FormatFloaterContentBottomless 
        //------------------------------------------------------------------- 
        internal abstract void UpdateBottomlessFloaterContent(
            FloaterBaseParaClient paraClient,       // IN: 
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space 
            int dvrAvailable,                   // IN:  height of available space
            IntPtr pfsFloatContent,             // IN: floater content 
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting 
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height 
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices);                 // OUT: total number of vertices in all polygons
Esempio n. 20
0
        //-------------------------------------------------------------------
        // FormatFloaterContentFinite
        //-------------------------------------------------------------------
        internal override void FormatFloaterContentFinite(
            FloaterBaseParaClient paraClient,   // IN:
            IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
            int fBRFromPreviousPage,            // IN:  break record was created on previous page
            IntPtr footnoteRejector,            // IN:
            int fEmptyOk,                       // IN:  is it OK not to add anything?
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of Track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
            // IN: suppress breaks at track start?
            out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            Invariant.Assert(paraClient is UIElementParaClient);
            Invariant.Assert(Element is BlockUIContainer);

            if (fAtMaxWidth == PTS.False && fEmptyOk == PTS.True)
            {
                // Do not format if not at max width, and if fEmptyOk is true
                durFloaterWidth = dvrFloaterHeight = 0;
                cPolygons       = cVertices = 0;
                fsfmtr          = new PTS.FSFMTR();
                fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
                fsfmtr.fForcedProgress = PTS.False;
                fsbbox          = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pbrkrecOut      = IntPtr.Zero;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                cPolygons = cVertices = 0;
                // Formatting is not at max width but proceeds anyway because adding no content is not allowed
                fsfmtr.fForcedProgress = PTS.FromBoolean(fAtMaxWidth == PTS.False);

                // Format UIElement
                if (((BlockUIContainer)Element).Child != null)
                {
                    EnsureUIElementIsland();
                    FormatUIElement(durAvailable, out fsbbox);
                }
                else
                {
                    // Child elementis null. Create fsbbox only with border and padding info
                    ClearUIElementIsland();

                    MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip);
                    fsbbox.fsrc    = new PTS.FSRECT();
                    fsbbox.fsrc.du = durAvailable;
                    fsbbox.fsrc.dv = mbp.BPTop + mbp.BPBottom;
                }

                durFloaterWidth  = fsbbox.fsrc.du;
                dvrFloaterHeight = fsbbox.fsrc.dv;
                if (dvrAvailable < dvrFloaterHeight && fEmptyOk == PTS.True)
                {
                    // Will not fit in available space. Since fEmptyOk is true, we can return null floater
                    durFloaterWidth = dvrFloaterHeight = 0;
                    fsfmtr          = new PTS.FSFMTR();
                    fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                    fsbbox          = new PTS.FSBBOX();
                    fsbbox.fDefined = PTS.False;
                    pfsFloatContent = IntPtr.Zero;
                }
                else
                {
                    // Either floater fits in available space or it doesn't but we cannot return nothing.
                    // Use the space needed, and set formatter result to forced progress if BUC does not fit in available space.
                    fsbbox.fDefined = PTS.True;
                    pfsFloatContent = paraClient.Handle;
                    if (dvrAvailable < dvrFloaterHeight)
                    {
                        // Indicate that progress was forced
                        Invariant.Assert(fEmptyOk == PTS.False);
                        fsfmtr.fForcedProgress = PTS.True;
                    }
                    fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrGoalReached;
                }

                // Set output values for floater content
                pbrkrecOut = IntPtr.Zero;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
            }
        }
Esempio n. 21
0
 //-------------------------------------------------------------------
 // UpdateBottomlessFloaterContent
 //-------------------------------------------------------------------
 internal override void UpdateBottomlessFloaterContent(
     FloaterBaseParaClient paraClient,       // IN:
     int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
     uint fswdir,                        // IN:  direction of track
     int fAtMaxWidth,                    // IN:  formating is at full width of column
     int durAvailable,                   // IN:  width of available space
     int dvrAvailable,                   // IN:  height of available space
     IntPtr pfsFloatContent,             // IN:  floater content (in UIElementParagraph, this is an alias to the paraClient)
     out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
     out int durFloaterWidth,            // OUT: floater width
     out int dvrFloaterHeight,           // OUT: floater height
     out PTS.FSBBOX fsbbox,              // OUT: floater bbox
     out int cPolygons,                  // OUT: number of polygons
     out int cVertices)                  // OUT: total number of vertices in all polygons
 {
     // This implementation simply calls into format floater content bottomless. As para has no real content, this is ok.
     FormatFloaterContentBottomless(paraClient, fSuppressTopSpace, fswdir, fAtMaxWidth, durAvailable, dvrAvailable, out fsfmtrbl, out pfsFloatContent,
                                    out durFloaterWidth, out dvrFloaterHeight, out fsbbox, out cPolygons, out cVertices);
 }
Esempio n. 22
0
        //-------------------------------------------------------------------
        // FormatFloaterContentBottomless
        //-------------------------------------------------------------------
        internal override void FormatFloaterContentBottomless(
            FloaterBaseParaClient paraClient,   // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            Invariant.Assert(paraClient is UIElementParaClient);
            Invariant.Assert(Element is BlockUIContainer);

            if (fAtMaxWidth == PTS.False)
            {
                // BlockUIContainer is only formatted at full column width
                // Set foater width, height to be greater than available values to signal to PTS that floater does not fit in the space
                durFloaterWidth  = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons        = cVertices = 0;
                fsfmtrbl         = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox           = new PTS.FSBBOX();
                fsbbox.fDefined  = PTS.False;
                pfsFloatContent  = IntPtr.Zero;
            }
            else
            {
                cPolygons = cVertices = 0;

                // Format UIElement
                if (((BlockUIContainer)Element).Child != null)
                {
                    EnsureUIElementIsland();
                    FormatUIElement(durAvailable, out fsbbox);

                    // Set output values for floater content
                    pfsFloatContent  = paraClient.Handle;
                    fsfmtrbl         = PTS.FSFMTRBL.fmtrblGoalReached;
                    fsbbox.fDefined  = PTS.True;
                    durFloaterWidth  = fsbbox.fsrc.du;
                    dvrFloaterHeight = fsbbox.fsrc.dv;
                }
                else
                {
                    ClearUIElementIsland();

                    MbpInfo mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip);
                    fsbbox.fsrc      = new PTS.FSRECT();
                    fsbbox.fsrc.du   = durAvailable;
                    fsbbox.fsrc.dv   = mbp.BPTop + mbp.BPBottom;
                    fsbbox.fDefined  = PTS.True;
                    pfsFloatContent  = paraClient.Handle;
                    fsfmtrbl         = PTS.FSFMTRBL.fmtrblGoalReached;
                    durFloaterWidth  = fsbbox.fsrc.du;
                    dvrFloaterHeight = fsbbox.fsrc.dv;
                }
            }
        }
Esempio n. 23
0
 internal unsafe virtual void GetFloaterPolygons(
     FloaterBaseParaClient paraClient,       // IN:
     uint fswdirTrack,                   // IN:  direction of Track
     int ncVertices,                     // IN:  size of array of vertex counts (= number of polygons) 
     int nfspt,                          // IN:  size of the array of all vertices
     int* rgcVertices,                   // OUT: array of vertex counts (array containing number of vertices for each polygon) 
     out int ccVertices,                 // OUT: actual number of vertex counts 
     PTS.FSPOINT* rgfspt,                // OUT: array of all vertices
     out int cfspt,                      // OUT: actual total number of vertices in all polygons 
     out int fWrapThrough)               // OUT: fill text in empty areas within obstacles?
 {
     Debug.Assert(false, "Tight wrap is not currently supported.");
     ccVertices = cfspt = fWrapThrough = 0; 
 }
Esempio n. 24
0
        internal override void FormatFloaterContentFinite(
            FloaterBaseParaClient paraClient,   // IN:
            IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
            int fBRFromPreviousPage,            // IN:  break record was created on previous page
            IntPtr footnoteRejector,            // IN:
            int fEmptyOk,                       // IN:  is it OK not to add anything?
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of Track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
            // IN: suppress breaks at track start?
            out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            uint fswdirPara = PTS.FlowDirectionToFswdir(((FlowDirection)Element.GetValue(FrameworkElement.FlowDirectionProperty)));

            int subpageWidth, subpageHeight;
            int dvrTopSpace;
            int cColumns;

            PTS.FSRECT         fsrcSubpageMargin;
            PTS.FSCOLUMNINFO[] columnInfoCollection;
            IntPtr             pmcsclientOut;
            double             specifiedWidth;
            MbpInfo            mbp;

            Invariant.Assert(paraClient is FloaterParaClient);

            // If horizontal alignment is Stretch and we are not formatting at max width,
            // we cannot proceed.
            if (IsFloaterRejected(PTS.ToBoolean(fAtMaxWidth), TextDpi.FromTextDpi(durAvailable)))
            {
                durFloaterWidth = dvrFloaterHeight = 0;
                cPolygons       = cVertices = 0;
                fsfmtr          = new PTS.FSFMTR();
                fsfmtr.kstop    = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
                fsfmtr.fForcedProgress = PTS.False;
                fsbbox          = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pbrkrecOut      = IntPtr.Zero;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                // When formatting bottomless page, PTS may format paragraphs as finite. This happens
                // in case of multiple columns. In this case make sure that height is not too big.
                if (!StructuralCache.CurrentFormatContext.FinitePage)
                {
                    if (Double.IsInfinity(StructuralCache.CurrentFormatContext.PageHeight))
                    {
                        if (dvrAvailable > PTS.dvBottomUndefined / 2)
                        {
                            dvrAvailable = Math.Min(dvrAvailable, PTS.dvBottomUndefined / 2);
                            fEmptyOk     = PTS.False;
                        }
                    }
                    else
                    {
                        dvrAvailable = Math.Min(dvrAvailable, TextDpi.ToTextDpi(StructuralCache.CurrentFormatContext.PageHeight));
                    }
                }

                // Initialize the subpage size. PTS subpage margin is always set to 0 for Floaters.
                // If width on floater is specified, use the specified value.
                // Margin, border and padding of the floater is extracted from available subpage height
                mbp = MbpInfo.FromElement(Element, StructuralCache.TextFormatterHost.PixelsPerDip);

                // We do not mirror margin as it's used to dist text left and right, and is unnecessary.
                // Clip Floater.Width to available width
                specifiedWidth = CalculateWidth(TextDpi.FromTextDpi(durAvailable));
                AdjustDurAvailable(specifiedWidth, ref durAvailable, out subpageWidth);
                subpageHeight        = Math.Max(1, dvrAvailable - (mbp.MBPTop + mbp.MBPBottom));
                fsrcSubpageMargin    = new PTS.FSRECT();
                fsrcSubpageMargin.du = subpageWidth;
                fsrcSubpageMargin.dv = subpageHeight;

                // Initialize column info. Floater always has just 1 column.
                cColumns             = 1;
                columnInfoCollection = new PTS.FSCOLUMNINFO[cColumns];
                columnInfoCollection[0].durBefore = 0;
                columnInfoCollection[0].durWidth  = subpageWidth;

                // Format subpage
                CreateSubpageFiniteHelper(PtsContext, pbrkrecIn, fBRFromPreviousPage, _mainTextSegment.Handle,
                                          footnoteRejector, fEmptyOk, PTS.True, fswdir, subpageWidth, subpageHeight,
                                          ref fsrcSubpageMargin, cColumns, columnInfoCollection, PTS.False, fsksuppresshardbreakbeforefirstparaIn,
                                          out fsfmtr, out pfsFloatContent,
                                          out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace);

                // Initialize subpage metrics
                if (fsfmtr.kstop >= PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)   // No progress or collision
                {
                    Debug.Assert(pmcsclientOut == IntPtr.Zero);
                    durFloaterWidth = dvrFloaterHeight = 0;
                    cPolygons       = cVertices = 0;
                    //pbrkrecpara = IntPtr.Zero;
                }
                else
                {
                    // PTS subpage does not support autosizing, but Floater needs to autosize to its
                    // content. To workaround this problem, second format of subpage is performed, if
                    // necessary. It means that if the width of bounding box is smaller than subpage's
                    // width, second formatting is performed.
                    // However, if HorizontalAlignment is set to Stretch we should not reformat because floater
                    // should be at max width
                    if (PTS.ToBoolean(fsbbox.fDefined))
                    {
                        if (fsbbox.fsrc.du < subpageWidth && Double.IsNaN(specifiedWidth) && HorizontalAlignment != HorizontalAlignment.Stretch)
                        {
                            // There is a need to reformat PTS subpage, so destroy any resourcces allocated by PTS
                            // during previous formatting.
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(PtsContext.Context, pbrkrecOut), PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            if (pmcsclientOut != IntPtr.Zero)
                            {
                                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                                PTS.ValidateHandle(mcs);
                                mcs.Dispose();
                                pmcsclientOut = IntPtr.Zero;
                            }
                            // Create subpage with new width.
                            subpageWidth                     = fsbbox.fsrc.du + 1; // add 1/300px to avoid rounding errors
                            fsrcSubpageMargin.du             = subpageWidth;
                            fsrcSubpageMargin.dv             = subpageHeight;
                            columnInfoCollection[0].durWidth = subpageWidth;
                            CreateSubpageFiniteHelper(PtsContext, pbrkrecIn, fBRFromPreviousPage, _mainTextSegment.Handle,
                                                      footnoteRejector, fEmptyOk, PTS.True, fswdir, subpageWidth, subpageHeight,
                                                      ref fsrcSubpageMargin, cColumns, columnInfoCollection, PTS.False, fsksuppresshardbreakbeforefirstparaIn,
                                                      out fsfmtr, out pfsFloatContent,
                                                      out pbrkrecOut, out dvrFloaterHeight, out fsbbox, out pmcsclientOut, out dvrTopSpace);
                        }
                    }
                    else
                    {
                        subpageWidth = TextDpi.ToTextDpi(TextDpi.MinWidth);
                    }

                    // Destroy objects created by PTS, but not used here.
                    if (pmcsclientOut != IntPtr.Zero)
                    {
                        MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                        PTS.ValidateHandle(mcs);
                        mcs.Dispose();
                        pmcsclientOut = IntPtr.Zero;
                    }

                    // Get the size of the floater. For height PTS already reports calculated value.
                    // But width is the same as subpage width. Add margin values here since we do not use
                    // distance to text anymore
                    durFloaterWidth = subpageWidth + mbp.MBPLeft + mbp.MBPRight;

                    // Add back all MBP values since we do not use dist to text
                    dvrFloaterHeight += mbp.MBPTop + mbp.MBPBottom;
                    // Check if floater width fits in available width. It may exceed available width because borders and
                    // padding are added.


                    fsbbox.fsrc.u   = 0;
                    fsbbox.fsrc.v   = 0;
                    fsbbox.fsrc.du  = durFloaterWidth;
                    fsbbox.fsrc.dv  = dvrFloaterHeight;
                    fsbbox.fDefined = PTS.True;

                    // Tight wrap is disabled for now.
                    cPolygons = cVertices = 0;

                    if (durFloaterWidth > durAvailable || dvrFloaterHeight > dvrAvailable)
                    {
                        if (PTS.ToBoolean(fEmptyOk))
                        {
                            // Get rid of any previous formatting
                            if (pfsFloatContent != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpage(PtsContext.Context, pfsFloatContent), PtsContext);
                                pfsFloatContent = IntPtr.Zero;
                            }
                            if (pbrkrecOut != IntPtr.Zero)
                            {
                                PTS.Validate(PTS.FsDestroySubpageBreakRecord(PtsContext.Context, pbrkrecOut), PtsContext);
                                pbrkrecOut = IntPtr.Zero;
                            }
                            cPolygons    = cVertices = 0;
                            fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                        }
                        else
                        {
                            fsfmtr.fForcedProgress = PTS.True;
                        }
                    }
                }
            }

            // Update handle to PTS subpage.
            ((FloaterParaClient)paraClient).SubpageHandle = pfsFloatContent;
        }
Esempio n. 25
0
        //-------------------------------------------------------------------
        // FormatFloaterContentFinite
        //-------------------------------------------------------------------
        internal override void FormatFloaterContentFinite(
            FloaterBaseParaClient paraClient,   // IN:
            IntPtr pbrkrecIn,                   // IN:  break record---use if !IntPtr.Zero
            int fBRFromPreviousPage,            // IN:  break record was created on previous page
            IntPtr footnoteRejector,            // IN: 
            int fEmptyOk,                       // IN:  is it OK not to add anything?
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of Track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn,
                                                // IN: suppress breaks at track start?
            out PTS.FSFMTR fsfmtr,              // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out IntPtr pbrkrecOut,              // OUT: pointer to the floater content break record
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            Invariant.Assert(paraClient is UIElementParaClient);
            Invariant.Assert(Element is BlockUIContainer);

            if (fAtMaxWidth == PTS.False && fEmptyOk == PTS.True)
            {
                // Do not format if not at max width, and if fEmptyOk is true
                durFloaterWidth = dvrFloaterHeight = 0;
                cPolygons = cVertices = 0;
                fsfmtr = new PTS.FSFMTR();
                fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
                fsfmtr.fForcedProgress = PTS.False;
                fsbbox = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pbrkrecOut = IntPtr.Zero;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                cPolygons = cVertices = 0;
                // Formatting is not at max width but proceeds anyway because adding no content is not allowed
                fsfmtr.fForcedProgress = PTS.FromBoolean(fAtMaxWidth == PTS.False);

                // Format UIElement
                if (((BlockUIContainer)Element).Child != null)
                {
                    EnsureUIElementIsland();
                    FormatUIElement(durAvailable, out fsbbox);
                }
                else
                {
                    // Child elementis null. Create fsbbox only with border and padding info
                    ClearUIElementIsland();

                    MbpInfo mbp = MbpInfo.FromElement(Element);
                    fsbbox.fsrc = new PTS.FSRECT();
                    fsbbox.fsrc.du = durAvailable;
                    fsbbox.fsrc.dv = mbp.BPTop + mbp.BPBottom;
                }

                durFloaterWidth = fsbbox.fsrc.du;
                dvrFloaterHeight = fsbbox.fsrc.dv;
                if (dvrAvailable < dvrFloaterHeight && fEmptyOk == PTS.True)
                {
                    // Will not fit in available space. Since fEmptyOk is true, we can return null floater
                    durFloaterWidth = dvrFloaterHeight = 0;
                    fsfmtr = new PTS.FSFMTR();
                    fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
                    fsbbox = new PTS.FSBBOX();
                    fsbbox.fDefined = PTS.False;
                    pfsFloatContent = IntPtr.Zero;
                }
                else
                {
                    // Either floater fits in available space or it doesn't but we cannot return nothing. 
                    // Use the space needed, and set formatter result to forced progress if BUC does not fit in available space.
                    fsbbox.fDefined = PTS.True;
                    pfsFloatContent = paraClient.Handle;
                    if (dvrAvailable < dvrFloaterHeight)
                    {
                        // Indicate that progress was forced
                        Invariant.Assert(fEmptyOk == PTS.False);
                        fsfmtr.fForcedProgress = PTS.True;
                    }
                    fsfmtr.kstop = PTS.FSFMTRKSTOP.fmtrGoalReached;
                }

                // Set output values for floater content
                pbrkrecOut = IntPtr.Zero;
                fsfmtr.fContainsItemThatStoppedBeforeFootnote = PTS.False;
            }
        }
Esempio n. 26
0
        //-------------------------------------------------------------------
        // FormatFloaterContentBottomless
        //-------------------------------------------------------------------
        internal override void FormatFloaterContentBottomless(
            FloaterBaseParaClient paraClient,       // IN:
            int fSuppressTopSpace,              // IN:  suppress empty space at the top of the page
            uint fswdir,                        // IN:  direction of track
            int fAtMaxWidth,                    // IN:  formating is at full width of column
            int durAvailable,                   // IN:  width of available space
            int dvrAvailable,                   // IN:  height of available space
            out PTS.FSFMTRBL fsfmtrbl,          // OUT: result of formatting
            out IntPtr pfsFloatContent,         // OUT: opaque for PTS pointer pointer to formatted content
            out int durFloaterWidth,            // OUT: floater width
            out int dvrFloaterHeight,           // OUT: floater height
            out PTS.FSBBOX fsbbox,              // OUT: floater bbox
            out int cPolygons,                  // OUT: number of polygons
            out int cVertices)                  // OUT: total number of vertices in all polygons
        {
            Invariant.Assert(paraClient is UIElementParaClient);
            Invariant.Assert(Element is BlockUIContainer);

            if (fAtMaxWidth == PTS.False)
            {
                // BlockUIContainer is only formatted at full column width
                // Set foater width, height to be greater than available values to signal to PTS that floater does not fit in the space
                durFloaterWidth = durAvailable + 1;
                dvrFloaterHeight = dvrAvailable + 1;
                cPolygons = cVertices = 0;
                fsfmtrbl = PTS.FSFMTRBL.fmtrblInterrupted;
                fsbbox = new PTS.FSBBOX();
                fsbbox.fDefined = PTS.False;
                pfsFloatContent = IntPtr.Zero;
            }
            else
            {
                cPolygons = cVertices = 0;

                // Format UIElement
                if (((BlockUIContainer)Element).Child != null)
                {
                    EnsureUIElementIsland();
                    FormatUIElement(durAvailable, out fsbbox);

                    // Set output values for floater content
                    pfsFloatContent = paraClient.Handle;
                    fsfmtrbl = PTS.FSFMTRBL.fmtrblGoalReached;
                    fsbbox.fDefined = PTS.True;
                    durFloaterWidth = fsbbox.fsrc.du;
                    dvrFloaterHeight = fsbbox.fsrc.dv;
                }
                else
                {
                    ClearUIElementIsland();

                    MbpInfo mbp = MbpInfo.FromElement(Element);
                    fsbbox.fsrc = new PTS.FSRECT();
                    fsbbox.fsrc.du = durAvailable;
                    fsbbox.fsrc.dv = mbp.BPTop + mbp.BPBottom;
                    fsbbox.fDefined = PTS.True;
                    pfsFloatContent = paraClient.Handle;
                    fsfmtrbl = PTS.FSFMTRBL.fmtrblGoalReached;
                    durFloaterWidth = fsbbox.fsrc.du;
                    dvrFloaterHeight = fsbbox.fsrc.dv;
                }
            }
        }
Esempio n. 27
0
 internal unsafe virtual void GetFloaterPolygons(FloaterBaseParaClient paraClient, uint fswdirTrack, int ncVertices, int nfspt, int *rgcVertices, out int ccVertices, PTS.FSPOINT *rgfspt, out int cfspt, out int fWrapThrough)
 {
     ccVertices = (cfspt = (fWrapThrough = 0));
 }