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
- Point4DValueSerializer.cs
- SqlClientMetaDataCollectionNames.cs
- ButtonBase.cs
- XPathCompileException.cs
- ISO2022Encoding.cs
- Menu.cs
- SpecialFolderEnumConverter.cs
- DataPagerField.cs
- ContextProperty.cs
- TagPrefixCollection.cs
- MailMessage.cs
- StylusPointProperties.cs
- AnnotationObservableCollection.cs
- IndependentAnimationStorage.cs
- ListViewTableCell.cs
- QueryableDataSource.cs
- ViewBase.cs
- GeneralTransform3DGroup.cs
- SecureUICommand.cs
- TableLayoutPanelCodeDomSerializer.cs
- FontFamily.cs
- XmlDocumentSerializer.cs
- CookieParameter.cs
- ArrowControl.xaml.cs
- AsyncPostBackErrorEventArgs.cs
- Encoder.cs
- RightsManagementPermission.cs
- IRCollection.cs
- WebSysDefaultValueAttribute.cs
- ViewDesigner.cs
- DbCommandTree.cs
- SerTrace.cs
- ToolStripStatusLabel.cs
- sqlmetadatafactory.cs
- ControlEvent.cs
- Freezable.cs
- Label.cs
- ObjectConverter.cs
- DesigntimeLicenseContext.cs
- DataGridPageChangedEventArgs.cs
- ClientUrlResolverWrapper.cs
- OleCmdHelper.cs
- TaiwanLunisolarCalendar.cs
- InvalidPropValue.cs
- DataServiceRequest.cs
- TypeElement.cs
- BinaryReader.cs
- Partitioner.cs
- Stream.cs
- ColumnTypeConverter.cs
- InputScope.cs
- PassportIdentity.cs
- ReplyChannelBinder.cs
- WindowsFormsSynchronizationContext.cs
- LongTypeConverter.cs
- GeometryModel3D.cs
- DbgUtil.cs
- SpStreamWrapper.cs
- GrammarBuilderRuleRef.cs
- MonitorWrapper.cs
- RectangleF.cs
- HierarchicalDataSourceControl.cs
- FixedSOMSemanticBox.cs
- ClientFormsIdentity.cs
- TransportContext.cs
- OdbcReferenceCollection.cs
- SingleTagSectionHandler.cs
- FunctionOverloadResolver.cs
- XDeferredAxisSource.cs
- XmlMembersMapping.cs
- GreaterThanOrEqual.cs
- WebPartMovingEventArgs.cs
- PerfProviderCollection.cs
- X509CertificateCollection.cs
- AnimationException.cs
- UrlPropertyAttribute.cs
- BuildManagerHost.cs
- WebBrowserEvent.cs
- Comparer.cs
- StorageFunctionMapping.cs
- SqlGatherProducedAliases.cs
- SqlDuplicator.cs
- TypeSystem.cs
- StoreItemCollection.Loader.cs
- CloudCollection.cs
- XmlSchemaInferenceException.cs
- SelectionEditingBehavior.cs
- DoubleAnimationBase.cs
- AnimatedTypeHelpers.cs
- mda.cs
- TreeWalkHelper.cs
- BamlTreeUpdater.cs
- AdapterUtil.cs
- ModelPropertyDescriptor.cs
- ArgIterator.cs
- KeyedByTypeCollection.cs
- RuleSettings.cs
- SvcFileManager.cs
- CounterCreationData.cs
- EntitySetRetriever.cs