Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- InputQueue.cs
- TakeOrSkipQueryOperator.cs
- SQLDecimal.cs
- DbMetaDataFactory.cs
- PlanCompiler.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- OciEnlistContext.cs
- PropertyBuilder.cs
- GradientSpreadMethodValidation.cs
- AnimationException.cs
- OracleConnectionFactory.cs
- EUCJPEncoding.cs
- XmlnsDictionary.cs
- ManagementNamedValueCollection.cs
- GridItem.cs
- SeekStoryboard.cs
- Deflater.cs
- CheckedListBox.cs
- RuntimeIdentifierPropertyAttribute.cs
- ServiceInstanceProvider.cs
- ListSortDescriptionCollection.cs
- ResourceReferenceExpression.cs
- SoapIgnoreAttribute.cs
- __TransparentProxy.cs
- DataGridViewComponentPropertyGridSite.cs
- LayoutSettings.cs
- SqlConnectionPoolProviderInfo.cs
- OciEnlistContext.cs
- ListBindingHelper.cs
- ChoiceConverter.cs
- CodeTypeReferenceExpression.cs
- MetafileHeader.cs
- TextViewSelectionProcessor.cs
- RadioButtonAutomationPeer.cs
- PointUtil.cs
- WebServiceAttribute.cs
- CodeTypeReferenceCollection.cs
- ConfigurationErrorsException.cs
- prompt.cs
- AutomationPropertyInfo.cs
- RelationalExpressions.cs
- CodeTypeMemberCollection.cs
- SchemaEntity.cs
- SafeNativeMethods.cs
- DataGridSortingEventArgs.cs
- ParameterToken.cs
- XPathCompileException.cs
- XmlLanguage.cs
- AuthenticationService.cs
- TabControl.cs
- Convert.cs
- SecurityPolicySection.cs
- TextDecorationCollectionConverter.cs
- GridItemProviderWrapper.cs
- LayoutEngine.cs
- ScriptIgnoreAttribute.cs
- TargetConverter.cs
- StylusPlugInCollection.cs
- SerializationInfoEnumerator.cs
- InstanceKeyCompleteException.cs
- WebPartConnection.cs
- EventNotify.cs
- EntityDataSourceWrapper.cs
- LookupNode.cs
- TreeNode.cs
- DataList.cs
- FileDataSourceCache.cs
- LZCodec.cs
- SafeFreeMibTable.cs
- MediaElementAutomationPeer.cs
- ObjectViewEntityCollectionData.cs
- CharAnimationUsingKeyFrames.cs
- RegexMatchCollection.cs
- AdapterDictionary.cs
- ApplicationHost.cs
- ProviderConnectionPointCollection.cs
- EntityDataSource.cs
- ScaleTransform3D.cs
- ImportCatalogPart.cs
- XmlText.cs
- PropertyKey.cs
- HierarchicalDataSourceDesigner.cs
- TemplateControlCodeDomTreeGenerator.cs
- DataMisalignedException.cs
- InputProviderSite.cs
- DataTableNewRowEvent.cs
- ConsoleTraceListener.cs
- RegistrySecurity.cs
- XmlBindingWorker.cs
- KernelTypeValidation.cs
- PathStreamGeometryContext.cs
- ScrollItemPatternIdentifiers.cs
- Tool.cs
- ExpressionConverter.cs
- ComponentResourceManager.cs
- GenerateScriptTypeAttribute.cs
- MaskInputRejectedEventArgs.cs
- connectionpool.cs
- HttpProfileBase.cs
- FixedPosition.cs