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
- RawStylusSystemGestureInputReport.cs
- EntityContainerEmitter.cs
- RepeaterItemCollection.cs
- FormsAuthenticationTicket.cs
- TableCellCollection.cs
- BasicHttpMessageSecurity.cs
- DockingAttribute.cs
- Vector3D.cs
- StrokeDescriptor.cs
- DiscoveryClientProtocol.cs
- SecurityException.cs
- DesignerHelpers.cs
- PropertyValidationContext.cs
- TrackingLocationCollection.cs
- COM2ExtendedBrowsingHandler.cs
- DomNameTable.cs
- CompiledQuery.cs
- StateMachineSubscriptionManager.cs
- ButtonChrome.cs
- HttpConfigurationSystem.cs
- SimpleExpression.cs
- Buffer.cs
- ReflectEventDescriptor.cs
- CodeArrayIndexerExpression.cs
- RelationHandler.cs
- prefixendpointaddressmessagefiltertable.cs
- DataGridPagerStyle.cs
- LogWriteRestartAreaState.cs
- Monitor.cs
- AutoGeneratedFieldProperties.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Validator.cs
- XmlHierarchicalDataSourceView.cs
- MenuItemBindingCollection.cs
- TextEditorTyping.cs
- NamedPipeProcessProtocolHandler.cs
- LinkConverter.cs
- ByteKeyFrameCollection.cs
- Executor.cs
- OperatorExpressions.cs
- BaseAppDomainProtocolHandler.cs
- Panel.cs
- Msec.cs
- DtdParser.cs
- Rect3DConverter.cs
- DBCommandBuilder.cs
- ObjectDataSourceSelectingEventArgs.cs
- BindUriHelper.cs
- TextEditorContextMenu.cs
- XmlAttributeHolder.cs
- SqlXmlStorage.cs
- ListControl.cs
- DirtyTextRange.cs
- UInt64Storage.cs
- DoubleLinkListEnumerator.cs
- Vector3D.cs
- BuildProviderAppliesToAttribute.cs
- TypeExtension.cs
- BaseTemplateCodeDomTreeGenerator.cs
- HttpPostedFile.cs
- dbdatarecord.cs
- TemplatePartAttribute.cs
- _SpnDictionary.cs
- HttpPostedFile.cs
- RegistryConfigurationProvider.cs
- TabPage.cs
- Stopwatch.cs
- DataGridTextBox.cs
- SamlAdvice.cs
- SqlStream.cs
- ToolboxComponentsCreatedEventArgs.cs
- ExtentKey.cs
- WindowsIPAddress.cs
- GeneratedView.cs
- Utils.cs
- DesigntimeLicenseContext.cs
- DllNotFoundException.cs
- TextServicesContext.cs
- Merger.cs
- SimpleApplicationHost.cs
- CompatibleComparer.cs
- SqlCacheDependencyDatabase.cs
- ParameterCollection.cs
- BinaryFormatterWriter.cs
- StringResourceManager.cs
- Function.cs
- DataPointer.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- HealthMonitoringSection.cs
- MouseGesture.cs
- SequenceFullException.cs
- WithStatement.cs
- QilScopedVisitor.cs
- DbDataSourceEnumerator.cs
- MissingMethodException.cs
- GridViewColumn.cs
- BitmapEffectDrawingContextState.cs
- DataGridViewHeaderCell.cs
- EncoderFallback.cs
- XamlInt32CollectionSerializer.cs