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
- SystemResources.cs
- Menu.cs
- ScheduleChanges.cs
- LayeredChannelListener.cs
- XmlQueryType.cs
- errorpatternmatcher.cs
- Win32Exception.cs
- MdImport.cs
- SimpleBitVector32.cs
- Block.cs
- CellPartitioner.cs
- EventlogProvider.cs
- DataListItemCollection.cs
- SettingsBase.cs
- DllHostInitializer.cs
- ExpressionBuilder.cs
- PathFigureCollectionConverter.cs
- ToolStripControlHost.cs
- RootBrowserWindow.cs
- Group.cs
- OdbcError.cs
- SR.cs
- ProvidersHelper.cs
- SignatureToken.cs
- HandlerWithFactory.cs
- DataSourceView.cs
- CustomBinding.cs
- ListViewItemCollectionEditor.cs
- ProgramPublisher.cs
- FileAuthorizationModule.cs
- HttpApplicationFactory.cs
- CodeFieldReferenceExpression.cs
- Constants.cs
- DateTimeFormatInfo.cs
- WindowsListViewSubItem.cs
- XamlSerializer.cs
- Int32RectConverter.cs
- AssemblyUtil.cs
- Blend.cs
- DmlSqlGenerator.cs
- Int32AnimationUsingKeyFrames.cs
- ValuePatternIdentifiers.cs
- DataGridViewCellMouseEventArgs.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ListView.cs
- ActivityWithResult.cs
- XmlSchemaDatatype.cs
- VarInfo.cs
- PageAction.cs
- ExtendedPropertyCollection.cs
- XmlSchemaChoice.cs
- Config.cs
- TraceListener.cs
- DES.cs
- XsdDateTime.cs
- HandlerWithFactory.cs
- HttpCapabilitiesBase.cs
- PointLight.cs
- ListItemParagraph.cs
- ComponentEvent.cs
- OrderingQueryOperator.cs
- ResourceAssociationTypeEnd.cs
- WebPartMovingEventArgs.cs
- XmlDictionaryReader.cs
- BackoffTimeoutHelper.cs
- XmlSchemaAttribute.cs
- UInt16Converter.cs
- Int32.cs
- CalendarKeyboardHelper.cs
- PagerSettings.cs
- PopOutPanel.cs
- LocalizabilityAttribute.cs
- StylusButton.cs
- NativeWindow.cs
- Comparer.cs
- DetailsViewRow.cs
- DocumentXmlWriter.cs
- StylusPointPropertyUnit.cs
- ObjectReaderCompiler.cs
- TargetConverter.cs
- SineEase.cs
- EventTrigger.cs
- Utils.cs
- InspectionWorker.cs
- SqlClientWrapperSmiStreamChars.cs
- DataKey.cs
- SubpageParagraph.cs
- AsyncPostBackErrorEventArgs.cs
- Part.cs
- GridViewColumnHeader.cs
- PageHandlerFactory.cs
- ZipIOExtraField.cs
- CalendarDay.cs
- DecimalConstantAttribute.cs
- EmptyStringExpandableObjectConverter.cs
- SqlMultiplexer.cs
- FamilyTypefaceCollection.cs
- PictureBoxDesigner.cs
- IgnoreSection.cs
- DetailsViewCommandEventArgs.cs