Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / MS / Internal / PtsHost / TextFormatterHost.cs / 1 / TextFormatterHost.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// File: ContainerParagraph.cs
//
// Description: TextFormatter host.
//
// History:
// 05/05/2003 : [....] - moving from Avalon branch.
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
namespace MS.Internal.PtsHost
{
// ---------------------------------------------------------------------
// TextFormatter host.
// ---------------------------------------------------------------------
internal sealed class TextFormatterHost : TextSource
{
internal TextFormatterHost(TextFormatter textFormatter)
{
if(textFormatter == null)
{
TextFormatter = TextFormatter.FromCurrentDispatcher();
}
else
{
TextFormatter = textFormatter;
}
}
//--------------------------------------------------------------------
// GetTextRun
//-------------------------------------------------------------------
public override TextRun GetTextRun(int textSourceCharacterIndex)
{
Debug.Assert(Context != null, "TextFormatter host is not initialized.");
Debug.Assert(textSourceCharacterIndex >= 0, "Character index must be non-negative.");
return Context.GetTextRun(textSourceCharacterIndex);
}
//--------------------------------------------------------------------
// GetPrecedingText
//--------------------------------------------------------------------
public override TextSpan GetPrecedingText(int textSourceCharacterIndexLimit)
{
Debug.Assert(Context != null, "TextFormatter host is not initialized.");
Debug.Assert(textSourceCharacterIndexLimit >= 0, "Character index must be non-negative.");
return Context.GetPrecedingText(textSourceCharacterIndexLimit);
}
///
/// TextFormatter to map a text source character index to a text effect character index
///
/// text source character index
/// the text effect index corresponding to the text effect character index
public override int GetTextEffectCharacterIndexFromTextSourceCharacterIndex(
int textSourceCharacterIndex
)
{
Debug.Assert(Context != null, "TextFormatter host is not initialized.");
Debug.Assert(textSourceCharacterIndex>= 0, "Character index must be non-negative.");
return Context.GetTextEffectCharacterIndexFromTextSourceCharacterIndex(textSourceCharacterIndex);
}
//-------------------------------------------------------------------
// TextFormatterHost context, object responsible for providing
// formatting information.
//--------------------------------------------------------------------
internal LineBase Context;
//-------------------------------------------------------------------
// TextFormatter.
//-------------------------------------------------------------------
internal TextFormatter TextFormatter;
}
}
// 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
- AccessedThroughPropertyAttribute.cs
- Descriptor.cs
- TextEndOfLine.cs
- ToolStripDropDownClosingEventArgs.cs
- HttpResponseInternalWrapper.cs
- Literal.cs
- XPathArrayIterator.cs
- JobCollate.cs
- SolidColorBrush.cs
- EventKeyword.cs
- CalendarBlackoutDatesCollection.cs
- CompressionTransform.cs
- KeyValueInternalCollection.cs
- QueryActivatableWorkflowsCommand.cs
- FontWeights.cs
- XmlMembersMapping.cs
- MailWebEventProvider.cs
- DesignerActionUIService.cs
- ConfigurationStrings.cs
- TransferRequestHandler.cs
- PageEventArgs.cs
- XsltLibrary.cs
- InvalidDocumentContentsException.cs
- CheckBoxField.cs
- CultureInfoConverter.cs
- QueueProcessor.cs
- ReliabilityContractAttribute.cs
- SizeKeyFrameCollection.cs
- EntitySetDataBindingList.cs
- PageRequestManager.cs
- ApplicationManager.cs
- UriTemplateHelpers.cs
- PackUriHelper.cs
- Message.cs
- CheckBoxList.cs
- CookielessData.cs
- BStrWrapper.cs
- ObjectDataSourceDisposingEventArgs.cs
- DataSourceCacheDurationConverter.cs
- SRDisplayNameAttribute.cs
- InputElement.cs
- MailWebEventProvider.cs
- SafeNativeMethods.cs
- UserPersonalizationStateInfo.cs
- InvalidOleVariantTypeException.cs
- SoapElementAttribute.cs
- GridItem.cs
- followingsibling.cs
- RepeatButtonAutomationPeer.cs
- ResolveMatches11.cs
- SecurityTokenProviderContainer.cs
- InputBindingCollection.cs
- SafeSecurityHelper.cs
- FormatException.cs
- DrawingContext.cs
- SQLCharsStorage.cs
- CompressStream.cs
- AssertFilter.cs
- BmpBitmapDecoder.cs
- SurrogateEncoder.cs
- DataSourceControlBuilder.cs
- SimpleType.cs
- MessageBuilder.cs
- TableLayout.cs
- ZipIOExtraFieldZip64Element.cs
- UxThemeWrapper.cs
- DataListCommandEventArgs.cs
- Avt.cs
- OracleConnectionString.cs
- safex509handles.cs
- AuthenticationSection.cs
- PrintingPermission.cs
- MaskedTextBoxDesignerActionList.cs
- SyndicationPerson.cs
- SoapAttributeOverrides.cs
- SlipBehavior.cs
- Util.cs
- GZipStream.cs
- SerializationFieldInfo.cs
- Internal.cs
- SqlStream.cs
- sqlstateclientmanager.cs
- ListBindingHelper.cs
- CodeTypeMember.cs
- Geometry.cs
- BrowserCapabilitiesFactoryBase.cs
- ApplicationManager.cs
- SoapIgnoreAttribute.cs
- NameValuePair.cs
- Model3D.cs
- SqlConnection.cs
- EncodingDataItem.cs
- ParamArrayAttribute.cs
- PlainXmlWriter.cs
- LinqDataView.cs
- RenderData.cs
- MemberDescriptor.cs
- RecordBuilder.cs
- StylusTouchDevice.cs
- MsmqException.cs