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
- BitVec.cs
- ColorKeyFrameCollection.cs
- LocalizationParserHooks.cs
- DebuggerAttributes.cs
- CallbackValidator.cs
- Transform3D.cs
- NonSerializedAttribute.cs
- FileCodeGroup.cs
- RotateTransform3D.cs
- AnnotationService.cs
- GeneralTransformGroup.cs
- DataSvcMapFile.cs
- Shape.cs
- DataColumnChangeEvent.cs
- ConfigXmlSignificantWhitespace.cs
- ResolveNameEventArgs.cs
- AudioSignalProblemOccurredEventArgs.cs
- UTF8Encoding.cs
- SByteConverter.cs
- HtmlElementErrorEventArgs.cs
- SourceFileBuildProvider.cs
- ColumnClickEvent.cs
- NamespaceInfo.cs
- ResourceManager.cs
- StringToken.cs
- ExpressionBinding.cs
- NameScopePropertyAttribute.cs
- PropertyItemInternal.cs
- VectorAnimation.cs
- PieceDirectory.cs
- UntrustedRecipientException.cs
- WorkflowServiceOperationListItem.cs
- DataGridViewCellCollection.cs
- ConfigXmlWhitespace.cs
- PolyBezierSegmentFigureLogic.cs
- SecureUICommand.cs
- altserialization.cs
- UnsafeNativeMethods.cs
- VectorKeyFrameCollection.cs
- BitmapPalette.cs
- CommandBindingCollection.cs
- MessageFilterTable.cs
- SqlUDTStorage.cs
- QueryAccessibilityHelpEvent.cs
- RegularExpressionValidator.cs
- TableDesigner.cs
- PhysicalOps.cs
- ListBase.cs
- WebEvents.cs
- XamlTreeBuilderBamlRecordWriter.cs
- ReservationNotFoundException.cs
- AutomationPropertyInfo.cs
- NotifyParentPropertyAttribute.cs
- SettingsBindableAttribute.cs
- Invariant.cs
- SafeNativeMethods.cs
- RoleManagerSection.cs
- _ListenerRequestStream.cs
- TextRunTypographyProperties.cs
- SoapRpcMethodAttribute.cs
- DataSetMappper.cs
- TextCompositionManager.cs
- EncryptedPackage.cs
- PersonalizableAttribute.cs
- ProfileProvider.cs
- DataGridViewIntLinkedList.cs
- QueryAccessibilityHelpEvent.cs
- BindingsCollection.cs
- Transform3DGroup.cs
- ManualResetEvent.cs
- Win32Exception.cs
- TemplateKey.cs
- AssociationProvider.cs
- InkSerializer.cs
- SQLDateTime.cs
- ToolStripItemEventArgs.cs
- ConsumerConnectionPoint.cs
- SafeRightsManagementHandle.cs
- VisualStyleInformation.cs
- CheckBoxPopupAdapter.cs
- XPathPatternBuilder.cs
- SqlWorkflowInstanceStore.cs
- ConnectionStringSettingsCollection.cs
- AutoFocusStyle.xaml.cs
- ConfigXmlSignificantWhitespace.cs
- Missing.cs
- PopupEventArgs.cs
- EditorBrowsableAttribute.cs
- BindableAttribute.cs
- Registry.cs
- AutomationPatternInfo.cs
- VirtualPathUtility.cs
- FilterableData.cs
- QueryGeneratorBase.cs
- AvTraceDetails.cs
- MultiPageTextView.cs
- ExpressionBuilder.cs
- SqlExpressionNullability.cs
- MembershipSection.cs
- PlacementWorkspace.cs