Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / MS / Internal / PtsHost / CellParagraph.cs / 1 / CellParagraph.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: CellParagraph.cs
//
// Description: CellParagraph represents a single list item.
//
// History:
// 06/01/2004 : grzegorz - moving from Avalon branch.
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Security;
using System.Windows;
using System.Windows.Documents;
using MS.Internal.PtsHost;
using MS.Internal.Text;
using MS.Internal.PtsHost.UnsafeNativeMethods;
namespace MS.Internal.PtsHost
{
// ---------------------------------------------------------------------
// CellParagraph represents a single cell.
// ---------------------------------------------------------------------
internal sealed class CellParagraph : SubpageParagraph
{
// ------------------------------------------------------------------
// Constructor.
//
// element - Element associated with paragraph.
// structuralCache - Content's structural cache
// -----------------------------------------------------------------
internal CellParagraph(DependencyObject element, StructuralCache structuralCache)
: base(element, structuralCache)
{
_isInterruptible = false;
}
///
/// Table owner accessor
///
internal TableCell Cell { get { return (TableCell)Element; } }
///
/// FormatCellFinite
///
/// Table para client
/// Subpage break record - not NULL if cell broken from previous page/column
/// Footnote rejector
/// Allow empty cell
/// Table direction
/// Available vertical space
/// Formatting result
/// Cell para client
/// Break record for the current cell
/// Ised vertical space
///
/// Critical - as this calls Critical function CellParaClient.FormatCellFinite.
///
[SecurityCritical]
internal void FormatCellFinite(
TableParaClient tableParaClient, // IN:
IntPtr pfsbrkcellIn, // IN: not NULL if cell broken from previous page/column
IntPtr pfsFtnRejector, // IN:
int fEmptyOK, // IN:
uint fswdirTable, // IN:
int dvrAvailable, // IN:
out PTS.FSFMTR pfmtr, // OUT:
out IntPtr ppfscell, // OUT: cell object
out IntPtr pfsbrkcellOut, // OUT: break if cell does not fit in dvrAvailable
out int dvrUsed) // OUT: height -- min height required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
CellParaClient cellParaClient;
Size subpageSize;
Debug.Assert(Cell.Table != null);
cellParaClient = new CellParaClient(this, tableParaClient);
subpageSize = new Size(
cellParaClient.CalculateCellWidth(tableParaClient),
Math.Max(TextDpi.FromTextDpi(dvrAvailable), 0));
cellParaClient.FormatCellFinite(subpageSize,
pfsbrkcellIn,
PTS.ToBoolean(fEmptyOK),
fswdirTable,
PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA.fsksuppresshardbreakbeforefirstparaNone,
out pfmtr,
out dvrUsed,
out pfsbrkcellOut);
// initialize output parameters
ppfscell = cellParaClient.Handle;
if(pfmtr.kstop == PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)
{
cellParaClient.Dispose();
ppfscell = IntPtr.Zero;
dvrUsed = 0;
}
if (dvrAvailable < dvrUsed)
{
if (PTS.ToBoolean(fEmptyOK))
{
if (cellParaClient != null) { cellParaClient.Dispose(); }
if (pfsbrkcellOut != IntPtr.Zero)
{
PTS.Validate(PTS.FsDestroySubpageBreakRecord(cellParaClient.PtsContext.Context, pfsbrkcellOut), cellParaClient.PtsContext);
pfsbrkcellOut = IntPtr.Zero;
}
ppfscell = IntPtr.Zero;
pfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
dvrUsed = 0;
}
else
{
pfmtr.fForcedProgress = PTS.True;
}
}
}
///
/// FormatCellBottomless
///
/// Table para client
/// Flow direction
/// Formatting result
/// Cell para client
/// Height consumed
internal void FormatCellBottomless(
TableParaClient tableParaClient, // IN:
uint fswdirTable, // IN:
out PTS.FSFMTRBL fmtrbl, // OUT:
out IntPtr ppfscell, // OUT: cell object
out int dvrUsed) // OUT: height -- min height
// required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
Debug.Assert(Cell.Table != null);
CellParaClient cellParaClient = new CellParaClient(this, tableParaClient);
cellParaClient.FormatCellBottomless(fswdirTable, cellParaClient.CalculateCellWidth(tableParaClient), out fmtrbl, out dvrUsed);
// initialize output parameters
ppfscell = cellParaClient.Handle;
}
///
/// UpdateBottomlessCell
///
/// Current cell para client
/// Table para cleint
/// Flow direction
/// Formatting result
/// Height consumed
internal void UpdateBottomlessCell(
CellParaClient cellParaClient, // IN:
TableParaClient tableParaClient, // IN:
uint fswdirTable, // IN:
out PTS.FSFMTRBL fmtrbl, // OUT:
out int dvrUsed) // OUT: height -- min height required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
Debug.Assert(Cell.Table != null);
cellParaClient.UpdateBottomlessCell(fswdirTable, cellParaClient.CalculateCellWidth(tableParaClient), out fmtrbl, out dvrUsed);
}
///
/// SetCellHeight
///
/// Cell para client
/// Table para client
/// Break record if cell is broken
/// Cell broken on this page/column
/// Flow direction
/// Actual height
internal void SetCellHeight(
CellParaClient cellParaClient, // IN: cell object
TableParaClient tableParaClient, // table's para client
IntPtr subpageBreakRecord, // not NULL if cell broken from previous page/column
int fBrokenHere, // TRUE if cell broken on this page/column: no reformatting
uint fswdirTable,
int dvrActual)
{
cellParaClient.ArrangeHeight = TextDpi.FromTextDpi(dvrActual);
}
///
/// UpdGetCellChange
///
/// Indication that cell's width changed
///
/// Change kind. One of: None, New, Inside
///
internal void UpdGetCellChange(
out int fWidthChanged, // OUT:
out PTS.FSKCHANGE fskchCell) // OUT:
{
// calculate state change
fWidthChanged = PTS.True;
fskchCell = PTS.FSKCHANGE.fskchNew;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: CellParagraph.cs
//
// Description: CellParagraph represents a single list item.
//
// History:
// 06/01/2004 : grzegorz - moving from Avalon branch.
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Security;
using System.Windows;
using System.Windows.Documents;
using MS.Internal.PtsHost;
using MS.Internal.Text;
using MS.Internal.PtsHost.UnsafeNativeMethods;
namespace MS.Internal.PtsHost
{
// ---------------------------------------------------------------------
// CellParagraph represents a single cell.
// ---------------------------------------------------------------------
internal sealed class CellParagraph : SubpageParagraph
{
// ------------------------------------------------------------------
// Constructor.
//
// element - Element associated with paragraph.
// structuralCache - Content's structural cache
// -----------------------------------------------------------------
internal CellParagraph(DependencyObject element, StructuralCache structuralCache)
: base(element, structuralCache)
{
_isInterruptible = false;
}
///
/// Table owner accessor
///
internal TableCell Cell { get { return (TableCell)Element; } }
///
/// FormatCellFinite
///
/// Table para client
/// Subpage break record - not NULL if cell broken from previous page/column
/// Footnote rejector
/// Allow empty cell
/// Table direction
/// Available vertical space
/// Formatting result
/// Cell para client
/// Break record for the current cell
/// Ised vertical space
///
/// Critical - as this calls Critical function CellParaClient.FormatCellFinite.
///
[SecurityCritical]
internal void FormatCellFinite(
TableParaClient tableParaClient, // IN:
IntPtr pfsbrkcellIn, // IN: not NULL if cell broken from previous page/column
IntPtr pfsFtnRejector, // IN:
int fEmptyOK, // IN:
uint fswdirTable, // IN:
int dvrAvailable, // IN:
out PTS.FSFMTR pfmtr, // OUT:
out IntPtr ppfscell, // OUT: cell object
out IntPtr pfsbrkcellOut, // OUT: break if cell does not fit in dvrAvailable
out int dvrUsed) // OUT: height -- min height required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
CellParaClient cellParaClient;
Size subpageSize;
Debug.Assert(Cell.Table != null);
cellParaClient = new CellParaClient(this, tableParaClient);
subpageSize = new Size(
cellParaClient.CalculateCellWidth(tableParaClient),
Math.Max(TextDpi.FromTextDpi(dvrAvailable), 0));
cellParaClient.FormatCellFinite(subpageSize,
pfsbrkcellIn,
PTS.ToBoolean(fEmptyOK),
fswdirTable,
PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA.fsksuppresshardbreakbeforefirstparaNone,
out pfmtr,
out dvrUsed,
out pfsbrkcellOut);
// initialize output parameters
ppfscell = cellParaClient.Handle;
if(pfmtr.kstop == PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace)
{
cellParaClient.Dispose();
ppfscell = IntPtr.Zero;
dvrUsed = 0;
}
if (dvrAvailable < dvrUsed)
{
if (PTS.ToBoolean(fEmptyOK))
{
if (cellParaClient != null) { cellParaClient.Dispose(); }
if (pfsbrkcellOut != IntPtr.Zero)
{
PTS.Validate(PTS.FsDestroySubpageBreakRecord(cellParaClient.PtsContext.Context, pfsbrkcellOut), cellParaClient.PtsContext);
pfsbrkcellOut = IntPtr.Zero;
}
ppfscell = IntPtr.Zero;
pfmtr.kstop = PTS.FSFMTRKSTOP.fmtrNoProgressOutOfSpace;
dvrUsed = 0;
}
else
{
pfmtr.fForcedProgress = PTS.True;
}
}
}
///
/// FormatCellBottomless
///
/// Table para client
/// Flow direction
/// Formatting result
/// Cell para client
/// Height consumed
internal void FormatCellBottomless(
TableParaClient tableParaClient, // IN:
uint fswdirTable, // IN:
out PTS.FSFMTRBL fmtrbl, // OUT:
out IntPtr ppfscell, // OUT: cell object
out int dvrUsed) // OUT: height -- min height
// required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
Debug.Assert(Cell.Table != null);
CellParaClient cellParaClient = new CellParaClient(this, tableParaClient);
cellParaClient.FormatCellBottomless(fswdirTable, cellParaClient.CalculateCellWidth(tableParaClient), out fmtrbl, out dvrUsed);
// initialize output parameters
ppfscell = cellParaClient.Handle;
}
///
/// UpdateBottomlessCell
///
/// Current cell para client
/// Table para cleint
/// Flow direction
/// Formatting result
/// Height consumed
internal void UpdateBottomlessCell(
CellParaClient cellParaClient, // IN:
TableParaClient tableParaClient, // IN:
uint fswdirTable, // IN:
out PTS.FSFMTRBL fmtrbl, // OUT:
out int dvrUsed) // OUT: height -- min height required
{
Debug.Assert(Cell.Index != -1 && Cell.ColumnIndex != -1,
"Cell is not in a table");
Debug.Assert(Cell.Table != null);
cellParaClient.UpdateBottomlessCell(fswdirTable, cellParaClient.CalculateCellWidth(tableParaClient), out fmtrbl, out dvrUsed);
}
///
/// SetCellHeight
///
/// Cell para client
/// Table para client
/// Break record if cell is broken
/// Cell broken on this page/column
/// Flow direction
/// Actual height
internal void SetCellHeight(
CellParaClient cellParaClient, // IN: cell object
TableParaClient tableParaClient, // table's para client
IntPtr subpageBreakRecord, // not NULL if cell broken from previous page/column
int fBrokenHere, // TRUE if cell broken on this page/column: no reformatting
uint fswdirTable,
int dvrActual)
{
cellParaClient.ArrangeHeight = TextDpi.FromTextDpi(dvrActual);
}
///
/// UpdGetCellChange
///
/// Indication that cell's width changed
///
/// Change kind. One of: None, New, Inside
///
internal void UpdGetCellChange(
out int fWidthChanged, // OUT:
out PTS.FSKCHANGE fskchCell) // OUT:
{
// calculate state change
fWidthChanged = PTS.True;
fskchCell = PTS.FSKCHANGE.fskchNew;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OleDbPermission.cs
- TextEditorLists.cs
- MultiDataTrigger.cs
- FormattedTextSymbols.cs
- WebBrowsableAttribute.cs
- SplitterPanel.cs
- PeerIPHelper.cs
- LinqMaximalSubtreeNominator.cs
- NamedElement.cs
- HttpModuleCollection.cs
- SecurityDescriptor.cs
- DesignerCategoryAttribute.cs
- Win32Exception.cs
- SqlMethodCallConverter.cs
- ProtocolInformationReader.cs
- NullableConverter.cs
- FrugalMap.cs
- TransportOutputChannel.cs
- DrawingAttributeSerializer.cs
- TransformPattern.cs
- SvcMapFileSerializer.cs
- BrowserCapabilitiesFactoryBase.cs
- TagMapCollection.cs
- SystemUnicastIPAddressInformation.cs
- SqlCharStream.cs
- GatewayIPAddressInformationCollection.cs
- AssemblyBuilderData.cs
- EndpointPerformanceCounters.cs
- SessionStateSection.cs
- Expressions.cs
- ObjectView.cs
- GPPOINT.cs
- BindingOperations.cs
- HtmlControlPersistable.cs
- InvalidProgramException.cs
- RtfToXamlLexer.cs
- MediaEntryAttribute.cs
- DataGridViewCheckBoxColumn.cs
- Interlocked.cs
- ToolStripItemCollection.cs
- SchemaImporterExtension.cs
- CallContext.cs
- FontCacheLogic.cs
- SimpleParser.cs
- PointAnimation.cs
- WindowsFormsSynchronizationContext.cs
- DesignRelation.cs
- BaseProcessor.cs
- MulticastOption.cs
- PropertyEmitterBase.cs
- XmlMapping.cs
- XpsResource.cs
- TemplateBuilder.cs
- MulticastDelegate.cs
- ActiveXSite.cs
- BaseInfoTable.cs
- storagemappingitemcollection.viewdictionary.cs
- SQLInt64Storage.cs
- BaseTemplateCodeDomTreeGenerator.cs
- DataGridViewSelectedColumnCollection.cs
- ToolBar.cs
- PageStatePersister.cs
- QilParameter.cs
- CodeAccessPermission.cs
- localization.cs
- BuildResult.cs
- GlobalAllocSafeHandle.cs
- SQLMoney.cs
- OwnerDrawPropertyBag.cs
- ImageBrush.cs
- ReaderWriterLock.cs
- UmAlQuraCalendar.cs
- DesignerTransactionCloseEvent.cs
- DataGridItemEventArgs.cs
- ConfigurationElementCollection.cs
- ADConnectionHelper.cs
- LateBoundBitmapDecoder.cs
- Visual3D.cs
- ButtonStandardAdapter.cs
- SqlConnectionStringBuilder.cs
- BindingsCollection.cs
- DataBinding.cs
- Rule.cs
- sqlstateclientmanager.cs
- BuildProvider.cs
- StronglyTypedResourceBuilder.cs
- MSAAEventDispatcher.cs
- RequestCachePolicy.cs
- DialogBaseForm.cs
- TypeConstant.cs
- SQLBytesStorage.cs
- NavigationFailedEventArgs.cs
- EtwTrace.cs
- ToolboxDataAttribute.cs
- TimelineGroup.cs
- HttpHandlerActionCollection.cs
- ClientBuildManager.cs
- LinkUtilities.cs
- TemplateControlBuildProvider.cs
- SecurityVersion.cs