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
- ImageClickEventArgs.cs
- ServiceProviders.cs
- XmlSchemaGroupRef.cs
- TableCell.cs
- DoubleLinkListEnumerator.cs
- KeyedCollection.cs
- ContainsRowNumberChecker.cs
- LocalTransaction.cs
- ObjectHandle.cs
- QilBinary.cs
- PropertyReference.cs
- ProviderBase.cs
- ListViewGroupConverter.cs
- ReferentialConstraint.cs
- DeploymentSectionCache.cs
- Stylesheet.cs
- OrderedDictionaryStateHelper.cs
- ToolStripSystemRenderer.cs
- DesignerListAdapter.cs
- ObjectDataSourceFilteringEventArgs.cs
- IConvertible.cs
- SettingsPropertyNotFoundException.cs
- DataSvcMapFileSerializer.cs
- SeverityFilter.cs
- XmlMapping.cs
- QueryStoreStatusRequest.cs
- MsmqHostedTransportManager.cs
- BaseDataListDesigner.cs
- PerspectiveCamera.cs
- Panel.cs
- CannotUnloadAppDomainException.cs
- StringUtil.cs
- LoginCancelEventArgs.cs
- precedingquery.cs
- DrawingContextWalker.cs
- sqlmetadatafactory.cs
- TargetInvocationException.cs
- CustomError.cs
- SerializableAttribute.cs
- AsymmetricKeyExchangeDeformatter.cs
- CatalogZoneBase.cs
- CodeExporter.cs
- LicenseContext.cs
- DetailsView.cs
- TextEditorCharacters.cs
- FontFaceLayoutInfo.cs
- CompoundFileIOPermission.cs
- SuppressMessageAttribute.cs
- RegexGroupCollection.cs
- GraphicsPathIterator.cs
- BaseValidatorDesigner.cs
- TrackPointCollection.cs
- NameObjectCollectionBase.cs
- OleDbPropertySetGuid.cs
- MailMessage.cs
- _PooledStream.cs
- CustomError.cs
- CodeBinaryOperatorExpression.cs
- DelegateSerializationHolder.cs
- TagPrefixAttribute.cs
- CompilerCollection.cs
- AssemblyAttributes.cs
- ImageInfo.cs
- InitialServerConnectionReader.cs
- DoubleUtil.cs
- basenumberconverter.cs
- sqlstateclientmanager.cs
- FrameworkContentElement.cs
- Domain.cs
- MissingSatelliteAssemblyException.cs
- TextTreeInsertUndoUnit.cs
- ProcessManager.cs
- TextBoxAutomationPeer.cs
- ShapeTypeface.cs
- WebPartConnection.cs
- MsmqInputSessionChannelListener.cs
- ProxyBuilder.cs
- FrameAutomationPeer.cs
- AnimatedTypeHelpers.cs
- metadatamappinghashervisitor.cs
- ContentTextAutomationPeer.cs
- SessionStateUtil.cs
- SignedInfo.cs
- OracleCommand.cs
- EmptyElement.cs
- ContentTypeSettingClientMessageFormatter.cs
- ToolStripOverflowButton.cs
- ComponentDispatcher.cs
- LinqDataSourceContextEventArgs.cs
- EventWaitHandleSecurity.cs
- updateconfighost.cs
- LineVisual.cs
- unsafeIndexingFilterStream.cs
- XmlSchemaInfo.cs
- GC.cs
- DropDownButton.cs
- HuffModule.cs
- SatelliteContractVersionAttribute.cs
- BitmapInitialize.cs
- ToolStripPanel.cs