Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- PropertyCondition.cs
- AuthorizationRule.cs
- EventSinkHelperWriter.cs
- ApplicationServiceHelper.cs
- RectangleGeometry.cs
- TreeWalker.cs
- Token.cs
- AspCompat.cs
- TextTabProperties.cs
- PersonalizableAttribute.cs
- GACIdentityPermission.cs
- MessageBox.cs
- PositiveTimeSpanValidatorAttribute.cs
- RegisteredDisposeScript.cs
- DataShape.cs
- PreProcessor.cs
- SchemaHelper.cs
- FontSizeConverter.cs
- DecimalKeyFrameCollection.cs
- NullableBoolConverter.cs
- ToolStripButton.cs
- HttpWriter.cs
- Misc.cs
- UTF8Encoding.cs
- PrintDocument.cs
- StorageAssociationTypeMapping.cs
- SafeThemeHandle.cs
- PingReply.cs
- MetadataUtilsSmi.cs
- HijriCalendar.cs
- MobileControlsSectionHelper.cs
- SqlProviderManifest.cs
- DecimalAnimationBase.cs
- _DynamicWinsockMethods.cs
- PageWrapper.cs
- FrameworkReadOnlyPropertyMetadata.cs
- TreeViewBindingsEditorForm.cs
- PositiveTimeSpanValidatorAttribute.cs
- EventLogPermissionEntryCollection.cs
- DataGridViewCellParsingEventArgs.cs
- DataViewListener.cs
- _ListenerRequestStream.cs
- MarginsConverter.cs
- GenericTypeParameterBuilder.cs
- ClassGenerator.cs
- MobileListItem.cs
- Attributes.cs
- DBParameter.cs
- DataRowExtensions.cs
- infer.cs
- WindowManager.cs
- ObjectStorage.cs
- Converter.cs
- WindowsFormsLinkLabel.cs
- ToolStripComboBox.cs
- SrgsRuleRef.cs
- AutomationPatternInfo.cs
- KeyTimeConverter.cs
- PagedDataSource.cs
- StylusPointProperties.cs
- ClientSettingsProvider.cs
- COM2IDispatchConverter.cs
- TextPatternIdentifiers.cs
- ValidatorCollection.cs
- DBCommandBuilder.cs
- BitmapSource.cs
- JoinQueryOperator.cs
- MonitoringDescriptionAttribute.cs
- ByteArrayHelperWithString.cs
- ResXBuildProvider.cs
- Thickness.cs
- AppDomainUnloadedException.cs
- AnalyzedTree.cs
- LinkArea.cs
- DeclarativeExpressionConditionDeclaration.cs
- ReadOnlyPropertyMetadata.cs
- DropSource.cs
- ByteStreamGeometryContext.cs
- TreeViewImageIndexConverter.cs
- MarkupExtensionReturnTypeAttribute.cs
- SerialErrors.cs
- XmlDocument.cs
- ToolStripContainer.cs
- Timer.cs
- StrokeFIndices.cs
- MsmqBindingBase.cs
- ValueSerializer.cs
- RichTextBoxContextMenu.cs
- DataServiceQuery.cs
- XmlSerializerImportOptions.cs
- DataGridViewHitTestInfo.cs
- Evidence.cs
- RuntimeConfig.cs
- InheritanceContextChangedEventManager.cs
- SectionInformation.cs
- TextDecoration.cs
- AuthenticationManager.cs
- CancellationToken.cs
- RuleSet.cs
- CommandValueSerializer.cs