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
- DispatcherEventArgs.cs
- TdsParserStaticMethods.cs
- FormsAuthenticationUserCollection.cs
- DataSourceControlBuilder.cs
- DataException.cs
- Main.cs
- InvalidProgramException.cs
- AspNetPartialTrustHelpers.cs
- XamlDesignerSerializationManager.cs
- AnimationStorage.cs
- DataGridViewComboBoxCell.cs
- InnerItemCollectionView.cs
- AccessDataSourceView.cs
- DataGridViewCellPaintingEventArgs.cs
- DynamicMethod.cs
- DynamicScriptObject.cs
- WindowsIPAddress.cs
- TraversalRequest.cs
- XamlStyleSerializer.cs
- XPathNavigator.cs
- NamespaceDisplay.xaml.cs
- unsafeIndexingFilterStream.cs
- FieldNameLookup.cs
- StylusShape.cs
- _HeaderInfoTable.cs
- FixedStringLookup.cs
- altserialization.cs
- WsatServiceAddress.cs
- CharacterBuffer.cs
- Literal.cs
- WebPageTraceListener.cs
- RecordConverter.cs
- Page.cs
- TextBoxRenderer.cs
- ApplicationException.cs
- CodeValidator.cs
- PublisherMembershipCondition.cs
- SamlAuthenticationClaimResource.cs
- WebPageTraceListener.cs
- InputProcessorProfilesLoader.cs
- ApplicationHost.cs
- CharStorage.cs
- DeviceContext2.cs
- LinearKeyFrames.cs
- TableRowGroup.cs
- ProfilePropertySettings.cs
- ListViewItemSelectionChangedEvent.cs
- AutomationEvent.cs
- SamlAuthenticationStatement.cs
- QuaternionValueSerializer.cs
- IndexedEnumerable.cs
- UnsafeNativeMethods.cs
- JsonMessageEncoderFactory.cs
- VisualTransition.cs
- TextOnlyOutput.cs
- MultiBindingExpression.cs
- SynchronizationContextHelper.cs
- SkipStoryboardToFill.cs
- ListDictionary.cs
- BulletedList.cs
- shaperfactory.cs
- XLinq.cs
- SecurityKeyEntropyMode.cs
- WmlPageAdapter.cs
- UserControl.cs
- TypeContext.cs
- HebrewNumber.cs
- UpdatePanelTriggerCollection.cs
- ImageAutomationPeer.cs
- Material.cs
- MergablePropertyAttribute.cs
- CommandLibraryHelper.cs
- ScriptingJsonSerializationSection.cs
- FullTextState.cs
- SslStream.cs
- HttpConfigurationSystem.cs
- TagMapInfo.cs
- FileDialog_Vista.cs
- Accessible.cs
- ClonableStack.cs
- DocComment.cs
- NotCondition.cs
- ExportException.cs
- LocalFileSettingsProvider.cs
- PathFigure.cs
- SerializeAbsoluteContext.cs
- FixedPage.cs
- datacache.cs
- WindowsTokenRoleProvider.cs
- ElementFactory.cs
- FigureParagraph.cs
- EditorZoneBase.cs
- WindowsListViewGroup.cs
- EndOfStreamException.cs
- ResourceReader.cs
- EntryPointNotFoundException.cs
- DataBoundControl.cs
- XPathArrayIterator.cs
- AddInAttribute.cs
- EntityDataSourceDesigner.cs