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
- SerializationInfoEnumerator.cs
- ActivityIdHeader.cs
- ExtensionDataObject.cs
- PostBackOptions.cs
- TextOptions.cs
- PackagePart.cs
- SecurityPermission.cs
- XPathNodeHelper.cs
- CompilerState.cs
- CaseCqlBlock.cs
- XmlEventCache.cs
- FrameworkElement.cs
- ListBoxItemAutomationPeer.cs
- EventProxy.cs
- ImageListImage.cs
- DataControlFieldHeaderCell.cs
- ErrorRuntimeConfig.cs
- ConsoleTraceListener.cs
- Mapping.cs
- DataGridRowHeader.cs
- Accessible.cs
- FontConverter.cs
- ITreeGenerator.cs
- OpCodes.cs
- XpsFilter.cs
- InlineObject.cs
- MemberPathMap.cs
- DBDataPermission.cs
- SmiRecordBuffer.cs
- PrintEvent.cs
- ContactManager.cs
- CqlParser.cs
- CodeGeneratorOptions.cs
- ResponseStream.cs
- CopyCodeAction.cs
- DbConnectionPoolGroup.cs
- CodeDomConfigurationHandler.cs
- PeerToPeerException.cs
- RandomDelayQueuedSendsAsyncResult.cs
- DataGridViewToolTip.cs
- CodeCastExpression.cs
- basecomparevalidator.cs
- LoginView.cs
- SamlAdvice.cs
- _TimerThread.cs
- MasterPageCodeDomTreeGenerator.cs
- BitStream.cs
- BooleanExpr.cs
- ManagementScope.cs
- SplayTreeNode.cs
- GeometryCollection.cs
- MenuItem.cs
- ListView.cs
- ResolveResponse.cs
- BuilderPropertyEntry.cs
- DummyDataSource.cs
- UniqueIdentifierService.cs
- OutKeywords.cs
- ThicknessConverter.cs
- PageAdapter.cs
- SharedTcpTransportManager.cs
- ProfileManager.cs
- SmtpReplyReaderFactory.cs
- RelationshipSet.cs
- HelpKeywordAttribute.cs
- CardSpaceSelector.cs
- ExtensionQuery.cs
- CatalogPart.cs
- InputScopeAttribute.cs
- CompositeDataBoundControl.cs
- PointUtil.cs
- basevalidator.cs
- WinFormsSpinner.cs
- WebPartZoneCollection.cs
- ConfigXmlElement.cs
- PersonalizablePropertyEntry.cs
- XmlSequenceWriter.cs
- StylusPointProperty.cs
- ListViewGroupItemCollection.cs
- WindowsAltTab.cs
- NameScope.cs
- TreeNodeStyleCollection.cs
- StorageSetMapping.cs
- ParameterCollection.cs
- RadioButtonStandardAdapter.cs
- Enum.cs
- Permission.cs
- FunctionQuery.cs
- XmlNodeComparer.cs
- DateTimeFormat.cs
- DesignerSerializerAttribute.cs
- CLSCompliantAttribute.cs
- DispatchWrapper.cs
- wgx_commands.cs
- DataGridPagingPage.cs
- InlinedAggregationOperatorEnumerator.cs
- ReferencedAssembly.cs
- SoapMessage.cs
- RuntimeIdentifierPropertyAttribute.cs
- TextParentUndoUnit.cs