Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / TextFormatterHost.cs / 1305600 / 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, TextFormattingMode textFormattingMode) { if(textFormatter == null) { TextFormatter = TextFormatter.FromCurrentDispatcher(textFormattingMode); } 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 TextSpanGetPrecedingText(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. //---------------------------------------------------------------------------- // // 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, TextFormattingMode textFormattingMode) { if(textFormatter == null) { TextFormatter = TextFormatter.FromCurrentDispatcher(textFormattingMode); } 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 TextSpanGetPrecedingText(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
- GridViewColumnHeaderAutomationPeer.cs
- SpeechSeg.cs
- RandomNumberGenerator.cs
- DPTypeDescriptorContext.cs
- AttachedProperty.cs
- DomainUpDown.cs
- SqlNodeTypeOperators.cs
- WebDisplayNameAttribute.cs
- RegisteredHiddenField.cs
- PeerNameRegistration.cs
- CharEnumerator.cs
- Bitmap.cs
- StrongNameMembershipCondition.cs
- ToolboxDataAttribute.cs
- PerformanceCounterPermission.cs
- XmlSerializer.cs
- SqlCacheDependencySection.cs
- AxHostDesigner.cs
- ObjectFullSpanRewriter.cs
- EntityParameter.cs
- ExpressionServices.cs
- QueryOutputWriter.cs
- ScrollBarRenderer.cs
- ClientApiGenerator.cs
- WebControlAdapter.cs
- DeferredElementTreeState.cs
- DecryptRequest.cs
- PackageRelationship.cs
- FilterFactory.cs
- BinHexEncoder.cs
- Shared.cs
- DiscoveryInnerClientManaged11.cs
- TraceListeners.cs
- AdvancedBindingPropertyDescriptor.cs
- OutputCacheSection.cs
- MaterializeFromAtom.cs
- DataGridViewLinkColumn.cs
- DiscreteKeyFrames.cs
- ExtractedStateEntry.cs
- ErrorStyle.cs
- FileDetails.cs
- RankException.cs
- MarkupExtensionReturnTypeAttribute.cs
- OrderToken.cs
- LocatorBase.cs
- LocationUpdates.cs
- BatchWriter.cs
- MsmqTransportSecurityElement.cs
- CryptoProvider.cs
- MenuItemAutomationPeer.cs
- RadioButtonPopupAdapter.cs
- VSWCFServiceContractGenerator.cs
- Timer.cs
- GenericTypeParameterBuilder.cs
- DuplicateContext.cs
- XmlSerializationReader.cs
- ImageCodecInfoPrivate.cs
- DisplayMemberTemplateSelector.cs
- PersistChildrenAttribute.cs
- OleAutBinder.cs
- X500Name.cs
- HotSpotCollection.cs
- ServiceCredentialsElement.cs
- ConfigXmlCDataSection.cs
- NameObjectCollectionBase.cs
- ProcessThreadCollection.cs
- URLAttribute.cs
- SchemaInfo.cs
- StorageFunctionMapping.cs
- DocumentsTrace.cs
- ObjectViewListener.cs
- CultureInfoConverter.cs
- OleCmdHelper.cs
- SecurityChannelFaultConverter.cs
- HttpTransportElement.cs
- NotificationContext.cs
- SmiMetaData.cs
- CodeArrayCreateExpression.cs
- EdmFunction.cs
- AudienceUriMode.cs
- IsolatedStoragePermission.cs
- HttpCapabilitiesSectionHandler.cs
- WebSysDefaultValueAttribute.cs
- UserNameSecurityTokenAuthenticator.cs
- EntityDataSourceChangingEventArgs.cs
- ObjectNavigationPropertyMapping.cs
- StdValidatorsAndConverters.cs
- FilterQuery.cs
- OdbcDataReader.cs
- SmtpNegotiateAuthenticationModule.cs
- HttpClientCertificate.cs
- MediaElement.cs
- AssemblyFilter.cs
- DataGridTextColumn.cs
- TextSelectionHighlightLayer.cs
- EventEntry.cs
- ObjectCacheSettings.cs
- LogicalExpr.cs
- FunctionGenerator.cs
- GeneralTransform2DTo3DTo2D.cs