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
- ButtonRenderer.cs
- Geometry3D.cs
- FormsAuthenticationCredentials.cs
- OneToOneMappingSerializer.cs
- CellParagraph.cs
- RequestCacheValidator.cs
- KeyConverter.cs
- ErrorEventArgs.cs
- ProjectionPruner.cs
- IPAddress.cs
- PrincipalPermission.cs
- StrokeCollectionDefaultValueFactory.cs
- StringValueConverter.cs
- CompositeFontFamily.cs
- SiteMapDataSourceView.cs
- DetailsViewInsertEventArgs.cs
- SiteMapPath.cs
- ClientRolePrincipal.cs
- ComponentCommands.cs
- ListMarkerLine.cs
- HiddenFieldPageStatePersister.cs
- TextTreeFixupNode.cs
- TypefaceMetricsCache.cs
- PointCollection.cs
- ResumeStoryboard.cs
- PtsHost.cs
- ClientRuntimeConfig.cs
- CLSCompliantAttribute.cs
- ServiceOperation.cs
- ValueConversionAttribute.cs
- objectquery_tresulttype.cs
- DynamicRenderer.cs
- ZipIOExtraFieldZip64Element.cs
- SignatureDescription.cs
- ECDiffieHellmanCngPublicKey.cs
- Debug.cs
- ContentPresenter.cs
- PropertyGridEditorPart.cs
- XmlElementAttribute.cs
- ExtendedPropertyCollection.cs
- WorkflowServiceBehavior.cs
- SqlEnums.cs
- TypePropertyEditor.cs
- XmlDocumentSerializer.cs
- WebScriptEnablingElement.cs
- SoapAttributeOverrides.cs
- ProcessModelSection.cs
- HttpHandlerAction.cs
- ClientSponsor.cs
- ListViewSelectEventArgs.cs
- mediapermission.cs
- RoutedEventArgs.cs
- DataKeyCollection.cs
- dsa.cs
- SingleStorage.cs
- CfgParser.cs
- Baml2006ReaderContext.cs
- WindowsToolbarAsMenu.cs
- StylusLogic.cs
- Msec.cs
- ApplicationTrust.cs
- HttpListener.cs
- xmlsaver.cs
- Internal.cs
- BCryptSafeHandles.cs
- WebControlsSection.cs
- SqlConnectionPoolProviderInfo.cs
- Query.cs
- BufferModesCollection.cs
- TagMapCollection.cs
- DirectionalLight.cs
- DelegatingHeader.cs
- TypeDescriptor.cs
- XmlILStorageConverter.cs
- TreeIterator.cs
- Paragraph.cs
- unitconverter.cs
- StructuralObject.cs
- PropertyMapper.cs
- DateTimeFormatInfoScanner.cs
- TransformedBitmap.cs
- BitmapEffectrendercontext.cs
- BinaryConverter.cs
- RowVisual.cs
- NegotiationTokenProvider.cs
- VirtualDirectoryMapping.cs
- ModelMemberCollection.cs
- EventLogInformation.cs
- HtmlValidatorAdapter.cs
- SafePointer.cs
- RSAPKCS1SignatureDeformatter.cs
- RawUIStateInputReport.cs
- DataGridTextBox.cs
- XmlNullResolver.cs
- formatter.cs
- BinaryFormatter.cs
- ValidationError.cs
- DataSvcMapFileSerializer.cs
- DesignerPainter.cs
- NotifyCollectionChangedEventArgs.cs