Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / TextFormatterHost.cs / 1305600 / TextFormatterHost.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: ContainerParagraph.cs // // Description: TextFormatter host. // // History: // 05/05/2003 : [....] - 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, TextFormattingMode textFormattingMode) { if(textFormatter == null) { TextFormatter = TextFormatter.FromCurrentDispatcher(textFormattingMode); } 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 : [....] - 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, TextFormattingMode textFormattingMode) { if(textFormatter == null) { TextFormatter = TextFormatter.FromCurrentDispatcher(textFormattingMode); } 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
- Cursors.cs
- UriSection.cs
- CapabilitiesRule.cs
- Relationship.cs
- TagPrefixCollection.cs
- EventLogPermissionAttribute.cs
- EFColumnProvider.cs
- WebPartMenu.cs
- TrustManagerMoreInformation.cs
- SystemWebCachingSectionGroup.cs
- DataGridRow.cs
- Int32Rect.cs
- SafeThreadHandle.cs
- PropertyKey.cs
- HandleCollector.cs
- ByteStreamGeometryContext.cs
- SessionState.cs
- OleDbStruct.cs
- TabletDeviceInfo.cs
- LongMinMaxAggregationOperator.cs
- CompressEmulationStream.cs
- ControlIdConverter.cs
- ImplicitInputBrush.cs
- AttributeCollection.cs
- TabControlToolboxItem.cs
- KeyEventArgs.cs
- EastAsianLunisolarCalendar.cs
- XmlWriter.cs
- FacetDescription.cs
- ToolStripSystemRenderer.cs
- Drawing.cs
- ReadOnlyNameValueCollection.cs
- SettingsPropertyValueCollection.cs
- CursorInteropHelper.cs
- RelOps.cs
- TransactionScope.cs
- LicenseException.cs
- ConnectionStringsExpressionBuilder.cs
- HtmlElementCollection.cs
- HttpSessionStateWrapper.cs
- MenuStrip.cs
- DesignerSerializationOptionsAttribute.cs
- Win32MouseDevice.cs
- ObjectCloneHelper.cs
- FlowDocumentPage.cs
- FromRequest.cs
- UserControlBuildProvider.cs
- DataServiceRequestException.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- TableAutomationPeer.cs
- HttpWebRequest.cs
- KeyInfo.cs
- HttpRawResponse.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- FixedSOMLineRanges.cs
- PlainXmlSerializer.cs
- CipherData.cs
- DummyDataSource.cs
- SqlTransaction.cs
- Camera.cs
- ContainerVisual.cs
- URI.cs
- EntityModelBuildProvider.cs
- RtfFormatStack.cs
- ComboBoxDesigner.cs
- MetadataCollection.cs
- DBNull.cs
- SystemTcpConnection.cs
- CacheRequest.cs
- ServicePointManagerElement.cs
- ConstNode.cs
- ConfigurationStrings.cs
- ColumnCollection.cs
- HttpDigestClientCredential.cs
- PackageDigitalSignature.cs
- ElapsedEventArgs.cs
- DBConnectionString.cs
- ToolStripDesignerUtils.cs
- DataBindingExpressionBuilder.cs
- TypeConverterAttribute.cs
- ProcessHostConfigUtils.cs
- ErrorEventArgs.cs
- _NestedSingleAsyncResult.cs
- GlyphRun.cs
- FixedHighlight.cs
- SqlUserDefinedAggregateAttribute.cs
- SelectionProcessor.cs
- SapiGrammar.cs
- HtmlLabelAdapter.cs
- MetabaseSettings.cs
- IDictionary.cs
- CharAnimationUsingKeyFrames.cs
- DoubleConverter.cs
- SectionInformation.cs
- AnnotationStore.cs
- WebPageTraceListener.cs
- XmlSignatureProperties.cs
- infer.cs
- DesignerDataView.cs
- AssociationTypeEmitter.cs