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
- ArrangedElement.cs
- ObjectPropertyMapping.cs
- EntityDataSourceState.cs
- Base64WriteStateInfo.cs
- WS2007HttpBindingCollectionElement.cs
- AvTraceFormat.cs
- CornerRadiusConverter.cs
- RemoteDebugger.cs
- COM2ExtendedBrowsingHandler.cs
- TimeSpanValidatorAttribute.cs
- ZipArchive.cs
- ValidationErrorCollection.cs
- ButtonColumn.cs
- UserControlCodeDomTreeGenerator.cs
- ContextMenu.cs
- ELinqQueryState.cs
- DbReferenceCollection.cs
- StyleConverter.cs
- TrustManager.cs
- Focus.cs
- Column.cs
- ManagementEventArgs.cs
- SerializationHelper.cs
- ProgressBar.cs
- UpdateExpressionVisitor.cs
- SafeMILHandle.cs
- Trustee.cs
- ZipPackage.cs
- RTTypeWrapper.cs
- UpdateCompiler.cs
- SemanticKeyElement.cs
- FileDialog.cs
- StandardCommands.cs
- TableParagraph.cs
- TextSpanModifier.cs
- AnnotationAuthorChangedEventArgs.cs
- GenericAuthenticationEventArgs.cs
- TextBlockAutomationPeer.cs
- DataControlCommands.cs
- Point.cs
- Style.cs
- Messages.cs
- AdjustableArrowCap.cs
- TransformGroup.cs
- CreateUserWizardAutoFormat.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlIgnoreAttribute.cs
- DocumentPageTextView.cs
- contentDescriptor.cs
- BulletChrome.cs
- ZoneLinkButton.cs
- BinaryObjectWriter.cs
- CodeComment.cs
- XPathDocumentNavigator.cs
- MatchingStyle.cs
- HtmlInputButton.cs
- DetailsViewPagerRow.cs
- TemplatePagerField.cs
- Vector3DConverter.cs
- HitTestParameters.cs
- Point.cs
- RenderData.cs
- Pens.cs
- TextEditorDragDrop.cs
- OneOfConst.cs
- ElapsedEventArgs.cs
- TrueReadOnlyCollection.cs
- PageRouteHandler.cs
- AuthenticationServiceManager.cs
- InkPresenterAutomationPeer.cs
- UnknownBitmapEncoder.cs
- ImmutableCollection.cs
- LoginCancelEventArgs.cs
- MDIClient.cs
- DesignerActionVerbItem.cs
- TemplateInstanceAttribute.cs
- SimpleLine.cs
- Delegate.cs
- WindowsGraphics.cs
- ExecutedRoutedEventArgs.cs
- AudioSignalProblemOccurredEventArgs.cs
- NonClientArea.cs
- OpCopier.cs
- FileSecurity.cs
- SemanticValue.cs
- SqlBulkCopyColumnMappingCollection.cs
- FontDifferentiator.cs
- RelativeSource.cs
- WmlSelectionListAdapter.cs
- MarkupWriter.cs
- GlobalizationSection.cs
- Timeline.cs
- validationstate.cs
- SmtpNetworkElement.cs
- SqlProcedureAttribute.cs
- AdRotator.cs
- SkinIDTypeConverter.cs
- FaultDescriptionCollection.cs
- StrictModeSecurityHeaderElementInferenceEngine.cs
- DataConnectionHelper.cs