Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / OptimalBreakSession.cs / 1305600 / OptimalBreakSession.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: OptimalBreakSession
//
// Description: OptimalBreakSession is unmanaged resouce handle to TextParagraphCache
//
// History:
// 06/07/2005 : ghermann - created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Windows;
using System.Security; // SecurityCritical
using System.Windows.Documents;
using MS.Internal.Text;
using MS.Internal.PtsHost.UnsafeNativeMethods;
using System.Windows.Media.TextFormatting;
namespace MS.Internal.PtsHost
{
// ---------------------------------------------------------------------
// Break record for line - holds decoration information
// ---------------------------------------------------------------------
internal sealed class OptimalBreakSession : UnmanagedHandle
{
// ------------------------------------------------------------------
// Constructor.
//
// PtsContext - Context
// TextParagraphCache - Contained line break
// -----------------------------------------------------------------
internal OptimalBreakSession(TextParagraph textParagraph, TextParaClient textParaClient, TextParagraphCache TextParagraphCache, OptimalTextSource optimalTextSource) : base(textParagraph.PtsContext)
{
_textParagraph = textParagraph;
_textParaClient = textParaClient;
_textParagraphCache = TextParagraphCache;
_optimalTextSource = optimalTextSource;
}
///
/// Dispose the break session / paragraph cache
///
public override void Dispose()
{
try
{
if(_textParagraphCache != null)
{
_textParagraphCache.Dispose();
}
if(_optimalTextSource != null)
{
_optimalTextSource.Dispose();
}
}
finally
{
_textParagraphCache = null;
_optimalTextSource = null;
}
base.Dispose();
}
#region Internal Properties
internal TextParagraphCache TextParagraphCache { get { return _textParagraphCache; } }
internal TextParagraph TextParagraph { get { return _textParagraph; } }
internal TextParaClient TextParaClient { get { return _textParaClient; } }
internal OptimalTextSource OptimalTextSource { get { return _optimalTextSource; } }
#endregion Internal Properties
#region Private Fields
private TextParagraphCache _textParagraphCache;
private TextParagraph _textParagraph;
private TextParaClient _textParaClient;
private OptimalTextSource _optimalTextSource;
#endregion Private Fields
}
// ----------------------------------------------------------------------
// LineBreakpoint - Unmanaged handle for TextBreakpoint / optimal break session
// ----------------------------------------------------------------------
internal sealed class LineBreakpoint : UnmanagedHandle
{
// -----------------------------------------------------------------
// Constructor.
//
// PtsContext - Context
// TextBreakpoint - Contained breakpoint
// ------------------------------------------------------------------
internal LineBreakpoint(OptimalBreakSession optimalBreakSession, TextBreakpoint textBreakpoint) : base(optimalBreakSession.PtsContext)
{
_textBreakpoint = textBreakpoint;
_optimalBreakSession = optimalBreakSession;
}
///
/// Dispose the text breakpoint
///
public override void Dispose()
{
if(_textBreakpoint != null)
{
_textBreakpoint.Dispose();
}
base.Dispose();
}
#region Internal Properties
internal OptimalBreakSession OptimalBreakSession { get { return _optimalBreakSession; } }
#endregion Internal Properties
#region Private Fields
private TextBreakpoint _textBreakpoint;
private OptimalBreakSession _optimalBreakSession;
#endregion Private Fields
}
}
// 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: OptimalBreakSession
//
// Description: OptimalBreakSession is unmanaged resouce handle to TextParagraphCache
//
// History:
// 06/07/2005 : ghermann - created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Windows;
using System.Security; // SecurityCritical
using System.Windows.Documents;
using MS.Internal.Text;
using MS.Internal.PtsHost.UnsafeNativeMethods;
using System.Windows.Media.TextFormatting;
namespace MS.Internal.PtsHost
{
// ---------------------------------------------------------------------
// Break record for line - holds decoration information
// ---------------------------------------------------------------------
internal sealed class OptimalBreakSession : UnmanagedHandle
{
// ------------------------------------------------------------------
// Constructor.
//
// PtsContext - Context
// TextParagraphCache - Contained line break
// -----------------------------------------------------------------
internal OptimalBreakSession(TextParagraph textParagraph, TextParaClient textParaClient, TextParagraphCache TextParagraphCache, OptimalTextSource optimalTextSource) : base(textParagraph.PtsContext)
{
_textParagraph = textParagraph;
_textParaClient = textParaClient;
_textParagraphCache = TextParagraphCache;
_optimalTextSource = optimalTextSource;
}
///
/// Dispose the break session / paragraph cache
///
public override void Dispose()
{
try
{
if(_textParagraphCache != null)
{
_textParagraphCache.Dispose();
}
if(_optimalTextSource != null)
{
_optimalTextSource.Dispose();
}
}
finally
{
_textParagraphCache = null;
_optimalTextSource = null;
}
base.Dispose();
}
#region Internal Properties
internal TextParagraphCache TextParagraphCache { get { return _textParagraphCache; } }
internal TextParagraph TextParagraph { get { return _textParagraph; } }
internal TextParaClient TextParaClient { get { return _textParaClient; } }
internal OptimalTextSource OptimalTextSource { get { return _optimalTextSource; } }
#endregion Internal Properties
#region Private Fields
private TextParagraphCache _textParagraphCache;
private TextParagraph _textParagraph;
private TextParaClient _textParaClient;
private OptimalTextSource _optimalTextSource;
#endregion Private Fields
}
// ----------------------------------------------------------------------
// LineBreakpoint - Unmanaged handle for TextBreakpoint / optimal break session
// ----------------------------------------------------------------------
internal sealed class LineBreakpoint : UnmanagedHandle
{
// -----------------------------------------------------------------
// Constructor.
//
// PtsContext - Context
// TextBreakpoint - Contained breakpoint
// ------------------------------------------------------------------
internal LineBreakpoint(OptimalBreakSession optimalBreakSession, TextBreakpoint textBreakpoint) : base(optimalBreakSession.PtsContext)
{
_textBreakpoint = textBreakpoint;
_optimalBreakSession = optimalBreakSession;
}
///
/// Dispose the text breakpoint
///
public override void Dispose()
{
if(_textBreakpoint != null)
{
_textBreakpoint.Dispose();
}
base.Dispose();
}
#region Internal Properties
internal OptimalBreakSession OptimalBreakSession { get { return _optimalBreakSession; } }
#endregion Internal Properties
#region Private Fields
private TextBreakpoint _textBreakpoint;
private OptimalBreakSession _optimalBreakSession;
#endregion Private Fields
}
}
// 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
- StylusCollection.cs
- BitSet.cs
- Point4D.cs
- LinqDataSourceSelectEventArgs.cs
- XmlSchemaGroupRef.cs
- x509utils.cs
- CodeTypeReferenceCollection.cs
- _SafeNetHandles.cs
- EraserBehavior.cs
- Ray3DHitTestResult.cs
- MatrixAnimationUsingKeyFrames.cs
- ContentPresenter.cs
- FontWeight.cs
- DataGridViewAccessibleObject.cs
- UIntPtr.cs
- MetadataPropertyCollection.cs
- ScrollChrome.cs
- WebPartZoneBase.cs
- BoolExpr.cs
- PositiveTimeSpanValidatorAttribute.cs
- Activity.cs
- RuleElement.cs
- WebPartVerbsEventArgs.cs
- AppDomain.cs
- LayoutTableCell.cs
- AncestorChangedEventArgs.cs
- PreservationFileReader.cs
- BamlRecordHelper.cs
- ListManagerBindingsCollection.cs
- ButtonColumn.cs
- ServiceActivationException.cs
- DataViewSetting.cs
- UniformGrid.cs
- PowerModeChangedEventArgs.cs
- BitmapCodecInfo.cs
- XmlValueConverter.cs
- RelationshipSet.cs
- DashStyle.cs
- EditBehavior.cs
- XmlSerializationReader.cs
- ListView.cs
- ICspAsymmetricAlgorithm.cs
- BeginStoryboard.cs
- ValueConversionAttribute.cs
- DbgCompiler.cs
- PriorityQueue.cs
- _ProxyRegBlob.cs
- ObjectSpanRewriter.cs
- followingsibling.cs
- ServiceMetadataBehavior.cs
- RuntimeResourceSet.cs
- Monitor.cs
- PointLightBase.cs
- DoWorkEventArgs.cs
- ProxyElement.cs
- TableParaClient.cs
- MouseEvent.cs
- Pair.cs
- ReadOnlyCollectionBase.cs
- VarInfo.cs
- GridViewItemAutomationPeer.cs
- EntityContainer.cs
- PostBackOptions.cs
- StatusBarItemAutomationPeer.cs
- TemplatePropertyEntry.cs
- EncoderParameters.cs
- PersonalizationEntry.cs
- TimeSpanValidatorAttribute.cs
- User.cs
- ControlBindingsConverter.cs
- StringUtil.cs
- SimpleType.cs
- EdmProviderManifest.cs
- ModuleConfigurationInfo.cs
- SoapFault.cs
- FrameworkTemplate.cs
- UnsafeNativeMethods.cs
- AnnotationComponentManager.cs
- EnumConverter.cs
- BooleanExpr.cs
- TryLoadRunnableWorkflowCommand.cs
- RuleValidation.cs
- Viewport3DVisual.cs
- LicenseException.cs
- HuffmanTree.cs
- MetadataUtilsSmi.cs
- TimeIntervalCollection.cs
- SoapExtensionTypeElement.cs
- LoginCancelEventArgs.cs
- ParameterCollection.cs
- InfoCardListRequest.cs
- Decoder.cs
- SettingsPropertyValueCollection.cs
- XPathDocumentNavigator.cs
- ComponentEvent.cs
- Deflater.cs
- XPathConvert.cs
- XmlAttributeAttribute.cs
- TypeElement.cs
- UnsafeNativeMethods.cs