Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- RowToFieldTransformer.cs
- EntityClassGenerator.cs
- Tile.cs
- KeyConstraint.cs
- SpoolingTask.cs
- TagMapCollection.cs
- EntityClientCacheEntry.cs
- SystemWebCachingSectionGroup.cs
- DesignUtil.cs
- UpdateException.cs
- TextEndOfParagraph.cs
- BuildProviderCollection.cs
- FixedSOMElement.cs
- ParameterElementCollection.cs
- StoreUtilities.cs
- PictureBox.cs
- QilStrConcat.cs
- UserNamePasswordValidator.cs
- MimeWriter.cs
- ConfigurationException.cs
- GridViewUpdatedEventArgs.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- SQLBytes.cs
- sapiproxy.cs
- ProfileServiceManager.cs
- Graph.cs
- BaseCodePageEncoding.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DocumentViewer.cs
- MetabaseSettings.cs
- BinHexEncoder.cs
- Panel.cs
- IisTraceListener.cs
- Util.cs
- DeliveryRequirementsAttribute.cs
- RegexWorker.cs
- CreateRefExpr.cs
- Color.cs
- ToolStripItem.cs
- DefaultPrintController.cs
- CharacterHit.cs
- PreservationFileWriter.cs
- WindowsStreamSecurityElement.cs
- XmlReturnReader.cs
- ErrorStyle.cs
- Rect3DValueSerializer.cs
- SystemThemeKey.cs
- NativeRightsManagementAPIsStructures.cs
- HttpConfigurationSystem.cs
- LineServicesRun.cs
- QueueAccessMode.cs
- ValidatingCollection.cs
- ToolZoneDesigner.cs
- InstanceCreationEditor.cs
- BaseValidator.cs
- FloaterBaseParaClient.cs
- UnitySerializationHolder.cs
- EntityViewGenerationAttribute.cs
- ReturnType.cs
- TemplateBuilder.cs
- ContentValidator.cs
- JoinTreeNode.cs
- ScriptRef.cs
- DataObjectAttribute.cs
- PolyLineSegment.cs
- WebPartZoneBase.cs
- TableCellCollection.cs
- HitTestParameters3D.cs
- TraceHandler.cs
- AnimationTimeline.cs
- ExpressionEvaluator.cs
- SequentialActivityDesigner.cs
- WindowsFormsEditorServiceHelper.cs
- DataGridViewDataConnection.cs
- DesignerAttribute.cs
- SqlReorderer.cs
- ElementFactory.cs
- ShapingWorkspace.cs
- LayoutUtils.cs
- DocumentOrderQuery.cs
- LongValidatorAttribute.cs
- RelationshipType.cs
- SchemaType.cs
- ClientUtils.cs
- WindowsRegion.cs
- CultureTableRecord.cs
- IntegerCollectionEditor.cs
- FixedSOMElement.cs
- SQLMoneyStorage.cs
- StylusSystemGestureEventArgs.cs
- JsonClassDataContract.cs
- LockRecoveryTask.cs
- FragmentQuery.cs
- ParallelTimeline.cs
- ScalarType.cs
- AssemblyName.cs
- WinFormsSecurity.cs
- MasterPage.cs
- StateElement.cs
- WebControlsSection.cs