Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- KeyPullup.cs
- SqlInternalConnectionSmi.cs
- CommandHelper.cs
- KeyNotFoundException.cs
- DBSchemaRow.cs
- HandleValueEditor.cs
- SamlAuthorizationDecisionClaimResource.cs
- DataServiceKeyAttribute.cs
- SynchronizationLockException.cs
- FormatVersion.cs
- SecurityContext.cs
- Knowncolors.cs
- TextTreeFixupNode.cs
- SimpleTextLine.cs
- FaultDesigner.cs
- ExpressionLexer.cs
- WebConfigurationHost.cs
- GenericEnumConverter.cs
- ContentTextAutomationPeer.cs
- ProfileSettings.cs
- CopyAction.cs
- StringInfo.cs
- Debug.cs
- NamedPipeChannelListener.cs
- MultilineStringConverter.cs
- OracleDataAdapter.cs
- CodeObject.cs
- EmptyControlCollection.cs
- CharEnumerator.cs
- ImageIndexEditor.cs
- SharedStream.cs
- XslUrlEditor.cs
- ToolStripSeparator.cs
- Compilation.cs
- HttpModuleAction.cs
- ManipulationStartingEventArgs.cs
- KoreanLunisolarCalendar.cs
- DataGridViewLayoutData.cs
- ValidatedMobileControlConverter.cs
- SqlTriggerContext.cs
- SiteIdentityPermission.cs
- WindowsTitleBar.cs
- XPathItem.cs
- basenumberconverter.cs
- SmiMetaDataProperty.cs
- MainMenu.cs
- XmlSchemaComplexContent.cs
- LinkArea.cs
- XmlCustomFormatter.cs
- DispatcherExceptionFilterEventArgs.cs
- HttpListenerException.cs
- CrossAppDomainChannel.cs
- ConsoleTraceListener.cs
- PermissionSetEnumerator.cs
- MissingManifestResourceException.cs
- WebServiceClientProxyGenerator.cs
- MetadataCache.cs
- SiteMap.cs
- InputScopeManager.cs
- BamlBinaryWriter.cs
- DesignTimeParseData.cs
- FileRecordSequence.cs
- WindowPattern.cs
- FileClassifier.cs
- ClientCultureInfo.cs
- MapPathBasedVirtualPathProvider.cs
- ActivitiesCollection.cs
- MissingMemberException.cs
- PhonemeConverter.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- InvokeMethodActivityDesigner.cs
- BaseComponentEditor.cs
- ImageList.cs
- DesignOnlyAttribute.cs
- UnsafeMethods.cs
- XpsS0ValidatingLoader.cs
- CodeAttributeDeclarationCollection.cs
- TextTreeObjectNode.cs
- ScrollPatternIdentifiers.cs
- QueryOutputWriter.cs
- XPathQilFactory.cs
- ViewKeyConstraint.cs
- PlaceHolder.cs
- NamespaceMapping.cs
- ConfigXmlElement.cs
- FormsIdentity.cs
- SqlRowUpdatingEvent.cs
- StreamHelper.cs
- Setter.cs
- SourceFilter.cs
- NegotiateStream.cs
- CodeIdentifier.cs
- HandlerFactoryCache.cs
- COM2TypeInfoProcessor.cs
- FilterException.cs
- SemanticResultKey.cs
- HostedTransportConfigurationManager.cs
- LinqExpressionNormalizer.cs
- MdImport.cs
- SrgsDocumentParser.cs