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
- StickyNoteHelper.cs
- UseLicense.cs
- ToolStripSplitStackLayout.cs
- GrammarBuilderDictation.cs
- WebServiceClientProxyGenerator.cs
- DiagnosticStrings.cs
- FixedBufferAttribute.cs
- WindowsNonControl.cs
- AdapterDictionary.cs
- XamlSerializationHelper.cs
- MetadataCacheItem.cs
- SqlUserDefinedAggregateAttribute.cs
- DescendantQuery.cs
- DataStorage.cs
- CapiSafeHandles.cs
- HiddenField.cs
- LocalFileSettingsProvider.cs
- ValidationPropertyAttribute.cs
- UnmanagedMemoryStreamWrapper.cs
- UrlUtility.cs
- OleDbPropertySetGuid.cs
- SystemInformation.cs
- ModelVisual3D.cs
- GlyphRunDrawing.cs
- ElementHost.cs
- State.cs
- FormDesigner.cs
- SurrogateSelector.cs
- CloseCryptoHandleRequest.cs
- SuppressIldasmAttribute.cs
- UseLicense.cs
- HttpModule.cs
- DataGridAddNewRow.cs
- CustomErrorCollection.cs
- DataStreams.cs
- TablePattern.cs
- PagePropertiesChangingEventArgs.cs
- PropertyGridEditorPart.cs
- RouteParametersHelper.cs
- DoWorkEventArgs.cs
- GlobalAllocSafeHandle.cs
- Invariant.cs
- _RequestLifetimeSetter.cs
- ContractInferenceHelper.cs
- FixedBufferAttribute.cs
- PublisherMembershipCondition.cs
- CodeGroup.cs
- IfJoinedCondition.cs
- HtmlInputSubmit.cs
- XMLSyntaxException.cs
- SurrogateChar.cs
- TCPClient.cs
- ColumnPropertiesGroup.cs
- StateWorkerRequest.cs
- TextEditorTyping.cs
- SimpleNameService.cs
- DependencyPropertyAttribute.cs
- _BasicClient.cs
- ManagementException.cs
- ArgumentException.cs
- MethodToken.cs
- safesecurityhelperavalon.cs
- JournalEntry.cs
- EncodingTable.cs
- Triangle.cs
- PathHelper.cs
- TreeNodeSelectionProcessor.cs
- CodeExporter.cs
- InputLanguageManager.cs
- PkcsUtils.cs
- TripleDES.cs
- ComboBoxRenderer.cs
- WinFormsSecurity.cs
- DataRecord.cs
- UnsafeNativeMethodsMilCoreApi.cs
- ThreadInterruptedException.cs
- OneWayChannelFactory.cs
- StateWorkerRequest.cs
- SoapProtocolImporter.cs
- SessionEndedEventArgs.cs
- ToolStripGripRenderEventArgs.cs
- Point3DAnimationUsingKeyFrames.cs
- ConfigurationStrings.cs
- DataBoundControlAdapter.cs
- OpenTypeCommon.cs
- WindowsListViewItemStartMenu.cs
- DataMisalignedException.cs
- SoapAttributeOverrides.cs
- ConfigurationSectionGroup.cs
- SrgsGrammarCompiler.cs
- SamlAssertion.cs
- RegexInterpreter.cs
- MembershipUser.cs
- GeneralTransform3DGroup.cs
- XmlAggregates.cs
- Socket.cs
- AstNode.cs
- GeneralTransform3DGroup.cs
- TakeOrSkipWhileQueryOperator.cs
- FormViewDeletedEventArgs.cs