本文整理汇总了C#中MS.Internal.PtsHost.UnsafeNativeMethods.PTS类的典型用法代码示例。如果您正苦于以下问题:C# PTS类的具体用法?C# PTS怎么用?C# PTS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PTS类属于MS.Internal.PtsHost.UnsafeNativeMethods命名空间,在下文中一共展示了PTS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdGetParaChange
//-------------------------------------------------------------------
//
// PTS callbacks
//
//-------------------------------------------------------------------
#region PTS callbacks
// -----------------------------------------------------------------
// UpdGetParaChange
// ------------------------------------------------------------------
internal override void UpdGetParaChange(
out PTS.FSKCHANGE fskch, // OUT: kind of change
out int fNoFurtherChanges) // OUT: no changes after?
{
fskch = PTS.FSKCHANGE.fskchNew;
fNoFurtherChanges = PTS.FromBoolean(_stopAsking);
}
示例2: UpdGetParaChange
// ------------------------------------------------------------------
// UpdGetParaChange - Floater paragraph is always new
// ------------------------------------------------------------------
internal override void UpdGetParaChange(
out PTS.FSKCHANGE fskch, // OUT: kind of change
out int fNoFurtherChanges) // OUT: no changes after?
{
base.UpdGetParaChange(out fskch, out fNoFurtherChanges);
fskch = PTS.FSKCHANGE.fskchNew;
}
示例3: GetParaProperties
//-------------------------------------------------------------------
//
// PTS callbacks
//
//-------------------------------------------------------------------
#region PTS callbacks
//-------------------------------------------------------------------
// GetParaProperties
//-------------------------------------------------------------------
internal override void GetParaProperties(
ref PTS.FSPAP fspap) // OUT: paragraph properties
{
GetParaProperties(ref fspap, false);
fspap.idobj = PtsHost.SubpageParagraphId;
// Create the main text segment
if (_mainTextSegment == null)
{
_mainTextSegment = new ContainerParagraph(_element, _structuralCache);
}
}
示例4: ColumnResult
internal ColumnResult(FlowDocumentPage page, ref PTS.FSTRACKDESCRIPTION trackDesc, Vector contentOffset)
{
_page = page;
_columnHandle = trackDesc.pfstrack;
_layoutBox = new Rect(
TextDpi.FromTextDpi(trackDesc.fsrc.u), TextDpi.FromTextDpi(trackDesc.fsrc.v),
TextDpi.FromTextDpi(trackDesc.fsrc.du), TextDpi.FromTextDpi(trackDesc.fsrc.dv));
_layoutBox.X += contentOffset.X;
_layoutBox.Y += contentOffset.Y;
_columnOffset = new Vector(TextDpi.FromTextDpi(trackDesc.fsrc.u), TextDpi.FromTextDpi(trackDesc.fsrc.v));
_hasTextContent = false;
}
示例5: UpdGetParaChange
// ------------------------------------------------------------------
//
// PTS callbacks
//
// ------------------------------------------------------------------
#region PTS callbacks
/// <summary>
/// UpdGetParaChange
/// </summary>
/// <param name="fskch">
/// OUT: kind of change
/// </param>
/// <param name="fNoFurtherChanges">
/// OUT: no changes after?
/// </param>
internal virtual void UpdGetParaChange(
out PTS.FSKCHANGE fskch,
out int fNoFurtherChanges)
{
fskch = _changeType;
fNoFurtherChanges = PTS.FromBoolean(_stopAsking);
#if TEXTPANELLAYOUTDEBUG
if (StructuralCache.CurrentFormatContext.IncrementalUpdate)
{
TextPanelDebug.Log("Para.UpdGetParaChange, Para=" + this.GetType().Name + " Change=" + _changeType.ToString(), TextPanelDebug.Category.ContentChange);
}
#endif
}
示例6: Arrange
internal void Arrange(IntPtr pfspara, PTS.FSRECT rcPara, int dvrTopSpace, uint fswdirParent)
{
// Make sure that paragraph handle (PFSPARA) is set. It is required to query paragraph content.
Debug.Assert(_paraHandle.Value == IntPtr.Zero || _paraHandle.Value == pfspara);
_paraHandle.Value = pfspara;
// Set paragraph rectangle (relative to the page)
_rect = rcPara;
// Cache dvrTopSpace
// Note: currently used only by tight geometry bound calculation code
_dvrTopSpace = dvrTopSpace;
// Current page context (used for mirroring and offsets)
_pageContext = Paragraph.StructuralCache.CurrentArrangeContext.PageContext;
// Cache flow directions
_flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent);
_flowDirection = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
// Do paragraph specifc arrange
OnArrange();
}
示例7: UpdateViewport
internal override void UpdateViewport(ref PTS.FSRECT viewport)
{
Debug.Assert( TableParagraph.Table != null
&& CalculatedColumns != null );
PTS.FSTABLEROWDESCRIPTION[] arrayTableRowDesc;
PTS.FSKUPDATE fskupdTable;
PTS.FSRECT rectTable;
if (QueryTableDetails(out arrayTableRowDesc, out fskupdTable, out rectTable))
{
for (int iR = 0; iR < arrayTableRowDesc.Length; ++iR)
{
PTS.FSKUPDATE[] arrayUpdate;
IntPtr[] arrayFsCell;
PTS.FSTABLEKCELLMERGE[] arrayTableCellMerge;
QueryRowDetails(
arrayTableRowDesc[iR].pfstablerow,
out arrayFsCell,
out arrayUpdate,
out arrayTableCellMerge);
for (int iC = 0; iC < arrayFsCell.Length; ++iC)
{
if (arrayFsCell[iC] == IntPtr.Zero)
{
// paginated case - cell may be null
continue;
}
CellParaClient cellParaClient = (CellParaClient)(PtsContext.HandleToObject(arrayFsCell[iC]));
cellParaClient.UpdateViewport(ref viewport);
}
}
}
}
示例8: ValidateVisual
internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
{
Invariant.Assert( fskupdInherited != PTS.FSKUPDATE.fskupdInherited );
Invariant.Assert( TableParagraph.Table != null && CalculatedColumns != null );
PTS.FSTABLEROWDESCRIPTION[] arrayTableRowDesc;
PTS.FSKUPDATE fskupdTable;
PTS.FSRECT rect;
Table table = TableParagraph.Table;
Visual.Clip = new RectangleGeometry(_columnRect.FromTextDpi());
if (!QueryTableDetails(out arrayTableRowDesc, out fskupdTable, out rect))
{
// table has no rows thus no cell to validate
_visual.Children.Clear();
return;
}
MbpInfo mbpInfo = MbpInfo.FromElement(TableParagraph.Element);
if (ThisFlowDirection != PageFlowDirection)
{
mbpInfo.MirrorBP();
}
if (fskupdTable == PTS.FSKUPDATE.fskupdInherited)
{
fskupdTable = fskupdInherited;
}
if (fskupdTable == PTS.FSKUPDATE.fskupdNoChange)
{
// no need to arrange because nothing changed
return;
}
if (fskupdTable == PTS.FSKUPDATE.fskupdShifted)
{
fskupdTable = PTS.FSKUPDATE.fskupdNew;
}
VisualCollection rowVisualsCollection = _visual.Children;
if (fskupdTable == PTS.FSKUPDATE.fskupdNew)
{
rowVisualsCollection.Clear();
}
// Draw border and background info.
Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);
using (DrawingContext dc = _visual.RenderOpen())
{
Rect tableContentRect = GetTableContentRect(mbpInfo).FromTextDpi();
_visual.DrawBackgroundAndBorderIntoContext(dc, backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);
DrawColumnBackgrounds(dc, tableContentRect);
DrawRowGroupBackgrounds(dc, arrayTableRowDesc, tableContentRect, mbpInfo);
DrawRowBackgrounds(dc, arrayTableRowDesc, tableContentRect, mbpInfo);
}
TableRow rowPrevious = null;
for (int iR = 0; iR < arrayTableRowDesc.Length; ++iR)
{
PTS.FSKUPDATE fskupdRow;
RowParagraph rowParagraph;
TableRow row;
fskupdRow = (arrayTableRowDesc[iR].fsupdinf.fskupd != PTS.FSKUPDATE.fskupdInherited)
? arrayTableRowDesc[iR].fsupdinf.fskupd
: fskupdTable;
rowParagraph = (RowParagraph)(PtsContext.HandleToObject(arrayTableRowDesc[iR].fsnmRow));
row = rowParagraph.Row;
//
// STEP 1 SYNCHRONIZATION
// ---------------------------------------------------------
// synchronize rowVisualCollection.
// for newly created rows visual is inserted;
// otherwise for removed rows (if any) corresponding visuals are removed
//
if (fskupdRow == PTS.FSKUPDATE.fskupdNew)
{
RowVisual rowVisual = new RowVisual(row);
rowVisualsCollection.Insert(iR, rowVisual);
}
else
{
SynchronizeRowVisualsCollection(rowVisualsCollection, iR, row);
}
Invariant.Assert(((RowVisual)rowVisualsCollection[iR]).Row == row);
//
// STEP 2 CELL VISUALS VALIDATION
// ---------------------------------------------------------
// for new or changed rows go inside and validate cells
//.........这里部分代码省略.........
示例9: GetActualRowHeight
/// <summary>
/// Calculates actual row height, subtracting what was previously reported as dvrBeforeTopRow and dvrAfterBottomRow
/// </summary>
private double GetActualRowHeight(PTS.FSTABLEROWDESCRIPTION[] arrayTableRowDesc, int rowIndex, MbpInfo mbpInfo)
{
int dvAdjustment = 0;
if(IsFirstChunk && rowIndex == 0)
{
dvAdjustment = -mbpInfo.BPTop;
}
if(IsLastChunk && rowIndex == arrayTableRowDesc.Length - 1)
{
dvAdjustment = -mbpInfo.BPBottom;
}
return TextDpi.FromTextDpi(arrayTableRowDesc[rowIndex].u.dvrRow + dvAdjustment);
}
示例10: ValidateRowVisualSimple
private void ValidateRowVisualSimple(
RowVisual rowVisual,
IntPtr pfstablerow,
PTS.FSKUPDATE fskupdRow,
CalculatedColumn[] calculatedColumns)
{
PTS.FSKUPDATE[] arrayUpdate;
IntPtr[] arrayFsCell;
PTS.FSTABLEKCELLMERGE[] arrayTableCellMerge;
VisualCollection cellVisualsCollection;
int sourceIndex;
QueryRowDetails(
pfstablerow,
out arrayFsCell,
out arrayUpdate,
out arrayTableCellMerge);
cellVisualsCollection = rowVisual.Children;
sourceIndex = 0;
for (int iC = 0; iC < arrayFsCell.Length; ++iC)
{
CellParaClient cellParaClient;
double urCellOffset;
PTS.FSKUPDATE fskupdCell;
if ( // paginated case - cell may be null
arrayFsCell[iC] == IntPtr.Zero
// exclude hanging cells
|| arrayTableCellMerge[iC] == PTS.FSTABLEKCELLMERGE.fskcellmergeMiddle
|| arrayTableCellMerge[iC] == PTS.FSTABLEKCELLMERGE.fskcellmergeLast )
{
continue;
}
fskupdCell = (arrayUpdate[iC] != PTS.FSKUPDATE.fskupdInherited)
? arrayUpdate[iC]
: fskupdRow;
if (fskupdCell != PTS.FSKUPDATE.fskupdNoChange)
{
cellParaClient = (CellParaClient)(PtsContext.HandleToObject(arrayFsCell[iC]));
urCellOffset = calculatedColumns[cellParaClient.ColumnIndex].UrOffset;
cellParaClient.ValidateVisual();
if ( fskupdCell == PTS.FSKUPDATE.fskupdNew
// PTS bug is a suspect here - this is a temp workaround:
|| VisualTreeHelper.GetParent(cellParaClient.Visual) == null )
{
Visual currentParent = VisualTreeHelper.GetParent(cellParaClient.Visual) as Visual;
if(currentParent != null)
{
ContainerVisual parent = currentParent as ContainerVisual;
Invariant.Assert(parent != null, "parent should always derives from ContainerVisual");
parent.Children.Remove(cellParaClient.Visual);
}
cellVisualsCollection.Insert(sourceIndex, cellParaClient.Visual);
}
else
{
Debug.Assert( cellParaClient.Visual != null
// If the check below fails, then PTS cheats by reporting "ChangInside" for
// a cell that in fact was re-Formatted.
&& VisualTreeHelper.GetParent(cellParaClient.Visual) != null );
SynchronizeCellVisualsCollection(cellVisualsCollection, sourceIndex, cellParaClient.Visual);
}
}
sourceIndex++;
}
if (cellVisualsCollection.Count > sourceIndex)
{
cellVisualsCollection.RemoveRange(
sourceIndex,
cellVisualsCollection.Count - sourceIndex);
}
#if DEBUGDEBUG
for (int iC = 0, sourceIndex = 0; iC < arrayFsCell.Length; ++iC)
{
if ( arrayFsCell[iC] != IntPtr.Zero
&& arrayTableCellMerge[iC] != PTS.FSTABLEKCELLMERGE.fskcellmergeMiddle
&& arrayTableCellMerge[iC] != PTS.FSTABLEKCELLMERGE.fskcellmergeLast )
{
CellParaClient cellParaClient = (CellParaClient)(PtsContext.HandleToObject(arrayFsCell[iC]));
Debug.Assert(rowVisual.Children.IndexOf(cellParaClient.Visual) == sourceIndex);
sourceIndex++;
}
}
#endif // DEBUGDEBUG
}
示例11: QueryTableDetails
private unsafe bool QueryTableDetails(
out PTS.FSTABLEROWDESCRIPTION[] arrayTableRowDesc,
out PTS.FSKUPDATE fskupdTable,
out PTS.FSRECT rect)
{
PTS.FSTABLEOBJDETAILS tableObjDetails;
PTS.FSTABLEDETAILS tableDetails;
PTS.Validate(PTS.FsQueryTableObjDetails(
PtsContext.Context,
_paraHandle.Value,
out tableObjDetails));
Debug.Assert(TableParagraph == (TableParagraph)(PtsContext.HandleToObject(tableObjDetails.fsnmTable)));
fskupdTable = tableObjDetails.fskupdTableProper;
rect = tableObjDetails.fsrcTableObj;
PTS.Validate(PTS.FsQueryTableObjTableProperDetails(
PtsContext.Context,
tableObjDetails.pfstableProper,
out tableDetails));
if (tableDetails.cRows == 0)
{
// table has no rows (thus no content)
arrayTableRowDesc = null;
return (false);
}
arrayTableRowDesc = new PTS.FSTABLEROWDESCRIPTION[tableDetails.cRows];
fixed (PTS.FSTABLEROWDESCRIPTION * rgTableRowDesc = arrayTableRowDesc)
{
int cRowsActual;
PTS.Validate(PTS.FsQueryTableObjRowList(
PtsContext.Context,
tableObjDetails.pfstableProper,
tableDetails.cRows,
rgTableRowDesc,
out cRowsActual));
Debug.Assert(tableDetails.cRows == cRowsActual);
}
return (true);
}
示例12: ArrangeSection
private void ArrangeSection(ref PTS.FSSECTIONDESCRIPTION sectionDesc)
{
// Get section details
PTS.FSSECTIONDETAILS sectionDetails;
PTS.Validate(PTS.FsQuerySectionDetails(PtsContext.Context, sectionDesc.pfssection, out sectionDetails));
// There are 2 types of sections:
// (1) with page notes - footnotes in section treated as endnotes
// (2) with column notes - footnotes in section treated as column notes
if (PTS.ToBoolean(sectionDetails.fFootnotesAsPagenotes))
{
// (1) with page notes - footnotes in section treated as endnotes
ErrorHandler.Assert(sectionDetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
//
Debug.Assert(sectionDetails.u.withpagenotes.cSegmentDefinedColumnSpanAreas == 0);
Debug.Assert(sectionDetails.u.withpagenotes.cHeightDefinedColumnSpanAreas == 0);
// cBasicColumns == 0, means that section content is empty.
// In such case there is nothing to render.
if (sectionDetails.u.withpagenotes.cBasicColumns != 0)
{
// Retrieve description for each column.
PTS.FSTRACKDESCRIPTION [] arrayColumnDesc;
PtsHelper.TrackListFromSection(PtsContext, sectionDesc.pfssection, ref sectionDetails, out arrayColumnDesc);
// Arrange each column
for (int index = 0; index < arrayColumnDesc.Length; index++)
{
// Exceptions don't need to pop, as the top level arrange context will be nulled out if thrown.
_section.StructuralCache.CurrentArrangeContext.PushNewPageData(_pageContextOfThisPage, arrayColumnDesc[index].fsrc, _finitePage);
PtsHelper.ArrangeTrack(PtsContext, ref arrayColumnDesc[index], sectionDetails.u.withpagenotes.fswdir);
_section.StructuralCache.CurrentArrangeContext.PopPageData();
}
}
}
else
{
// (2) with column notes - footnotes in section treated as column notes
ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
}
}
示例13: ArrangeFloater
// -----------------------------------------------------------------
// Arrange floater
//
// rcFloater - rectangle of the floater
// rcHostPara - rectangle of the host text paragraph.
// ------------------------------------------------------------------
internal override void ArrangeFloater(PTS.FSRECT rcFloater, PTS.FSRECT rcHostPara, uint fswdirParent, PageContext pageContext)
{
// If alignment is set to Stretch and floater width is less than para width, center it
if (IsFloaterHorizontallyCentered(rcFloater, rcHostPara))
{
rcFloater.u = rcHostPara.u + (rcHostPara.du - rcFloater.du) / 2;
}
// Set paragraph rectangle (relative to the page)
_rect = rcFloater;
// Adjust rect to account for margins
// Add margin values to rect offsets and subtract them from rect widths
MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element);
_rect.v += mbp.MarginTop;
_rect.dv -= mbp.MarginTop + mbp.MarginBottom;
_rect.u += mbp.MarginLeft;
_rect.du -= mbp.MarginLeft + mbp.MarginRight;
_flowDirectionParent = PTS.FswdirToFlowDirection(fswdirParent);
_flowDirection = (FlowDirection)Paragraph.Element.GetValue(FrameworkElement.FlowDirectionProperty);
_pageContext = pageContext;
if(ThisFlowDirection != PageFlowDirection)
{
mbp.MirrorBP();
}
_contentRect.u = _rect.u + mbp.BPLeft;
_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft);
_contentRect.v = _rect.v + mbp.BPTop;
_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop);
_paddingRect.u = _rect.u + mbp.BorderLeft;
_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft);
_paddingRect.v = _rect.v + mbp.BorderTop;
_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
// Do paragraph specifc arrange
OnArrange();
}
示例14: UpdateViewport
internal override void UpdateViewport(ref PTS.FSRECT viewport)
{
// Query subpage details
PTS.FSSUBPAGEDETAILS subpageDetails;
PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));
PTS.FSRECT viewportSubpage = new PTS.FSRECT();
viewportSubpage.u = viewport.u - ContentRect.u;
viewportSubpage.v = viewport.v - ContentRect.v;
viewportSubpage.du = viewport.du;
viewportSubpage.dv = viewport.dv;
// Subpage content may be simple or complex -
// depending of set of features used in the content of the subpage.
// (1) simple subpage (contains only one track)
// (2) complex subpage (contains columns)
if (PTS.ToBoolean(subpageDetails.fSimple))
{
PtsHelper.UpdateViewportTrack(PtsContext, ref subpageDetails.u.simple.trackdescr, ref viewportSubpage);
}
else
{
// (2) complex page (contains columns)
// cBasicColumns == 0, means that subpage content is empty
bool emptySubpage = (subpageDetails.u.complex.cBasicColumns == 0);
if (!emptySubpage)
{
// Retrieve description for each column.
PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc);
emptySubpage = (arrayColumnDesc.Length == 0);
if (!emptySubpage)
{
for (int index = 0; index < arrayColumnDesc.Length; index++)
{
PtsHelper.UpdateViewportTrack(PtsContext, ref arrayColumnDesc[index], ref viewportSubpage);
}
}
}
}
}
示例15: GetRectanglesInSection
private List<Rect> GetRectanglesInSection(
ContentElement e,
int start,
int length,
ref PTS.FSSECTIONDESCRIPTION sectionDesc)
{
// Get section details
PTS.FSSECTIONDETAILS sectionDetails;
PTS.Validate(PTS.FsQuerySectionDetails(PtsContext.Context, sectionDesc.pfssection, out sectionDetails));
// Declare ArrayList to be returned
List<Rect> rectangles = new List<Rect>();
// There are 2 types of sections:
// (1) with page notes - footnotes in section treated as endnotes
// (2) with column notes - footnotes in section treated as column notes
if (PTS.ToBoolean(sectionDetails.fFootnotesAsPagenotes))
{
// (1) with page notes - footnotes in section treated as endnotes
ErrorHandler.Assert(sectionDetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
//
Debug.Assert(sectionDetails.u.withpagenotes.cSegmentDefinedColumnSpanAreas == 0);
Debug.Assert(sectionDetails.u.withpagenotes.cHeightDefinedColumnSpanAreas == 0);
// cBasicColumns == 0, means that section content is empty.
// In such case there is nothing to hit-test.
if (sectionDetails.u.withpagenotes.cBasicColumns != 0)
{
// Retrieve description for each column.
PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
PtsHelper.TrackListFromSection(PtsContext, sectionDesc.pfssection, ref sectionDetails, out arrayColumnDesc);
// Check each column for element or part of element - element may span multiple
// columns/tracks
for (int index = 0; index < arrayColumnDesc.Length; index++)
{
// See if any rectangles for the element are found in this track
List<Rect> trackRectangles = PtsHelper.GetRectanglesInTrack(PtsContext, e, start, length, ref arrayColumnDesc[index]);
// For consistency, rectangles collection is never null, only empty
Invariant.Assert(trackRectangles != null);
if (trackRectangles.Count != 0)
{
// Add rectangles found in this track to rectangles for element
rectangles.AddRange(trackRectangles);
}
}
}
}
else
{
// (2) with column notes - footnotes in section treated as column notes
ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
}
return rectangles;
}