Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / 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 : grzegorz - 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 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 : grzegorz - 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 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
- CollectionType.cs
- XslAstAnalyzer.cs
- PageThemeBuildProvider.cs
- GeometryDrawing.cs
- DocumentOrderQuery.cs
- KeyFrames.cs
- ProtocolViolationException.cs
- SettingsSection.cs
- WhitespaceRuleReader.cs
- DynamicAttribute.cs
- XmlEntityReference.cs
- CodeCommentStatementCollection.cs
- WebPartVerbsEventArgs.cs
- StylusPlugin.cs
- DesignerLinkAdapter.cs
- OleDbException.cs
- UnicastIPAddressInformationCollection.cs
- WebBrowserSiteBase.cs
- FormViewModeEventArgs.cs
- TabItemWrapperAutomationPeer.cs
- FormViewRow.cs
- CheckPair.cs
- FamilyTypeface.cs
- UnionCodeGroup.cs
- AxHost.cs
- URIFormatException.cs
- TdsRecordBufferSetter.cs
- SimpleHandlerBuildProvider.cs
- DataControlButton.cs
- _StreamFramer.cs
- EventSinkHelperWriter.cs
- NonSerializedAttribute.cs
- FormViewInsertedEventArgs.cs
- CodeStatementCollection.cs
- PropertyIDSet.cs
- EdmSchemaAttribute.cs
- ValueTable.cs
- ReferencedAssembly.cs
- MsmqInputChannelBase.cs
- XmlDigitalSignatureProcessor.cs
- InternalBufferOverflowException.cs
- LineSegment.cs
- PropertyItemInternal.cs
- Assert.cs
- AnnotationStore.cs
- Int64AnimationUsingKeyFrames.cs
- TranslateTransform.cs
- WebConfigurationHostFileChange.cs
- WindowInteropHelper.cs
- PeerContact.cs
- ListCollectionView.cs
- BStrWrapper.cs
- LinkTarget.cs
- PingOptions.cs
- IndentedWriter.cs
- UnicodeEncoding.cs
- Assert.cs
- HttpRuntime.cs
- BitSet.cs
- ListViewGroupConverter.cs
- HashMembershipCondition.cs
- ValueChangedEventManager.cs
- ArraySegment.cs
- XamlPointCollectionSerializer.cs
- Msec.cs
- TableSectionStyle.cs
- CompilerTypeWithParams.cs
- InheritanceRules.cs
- HelpInfo.cs
- DesignerActionHeaderItem.cs
- PasswordRecoveryDesigner.cs
- LinkLabelLinkClickedEvent.cs
- DnsPermission.cs
- CompositeControl.cs
- IgnoreSection.cs
- CompilerLocalReference.cs
- Stacktrace.cs
- FormsAuthentication.cs
- ManifestResourceInfo.cs
- ServicePointManagerElement.cs
- BitmapFrameEncode.cs
- OuterGlowBitmapEffect.cs
- EntityDataSourceContextDisposingEventArgs.cs
- IdentitySection.cs
- ListItemCollection.cs
- DirectoryObjectSecurity.cs
- TemplateBindingExpressionConverter.cs
- EditCommandColumn.cs
- ObjectCache.cs
- IntMinMaxAggregationOperator.cs
- FixedStringLookup.cs
- BaseValidator.cs
- XsdBuildProvider.cs
- ViewEventArgs.cs
- InstanceDataCollection.cs
- LocalizationComments.cs
- ViewGenResults.cs
- DateTimeFormat.cs
- UriTemplateEquivalenceComparer.cs
- Stylesheet.cs