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
- PageAsyncTask.cs
- StylusDownEventArgs.cs
- EnumUnknown.cs
- RuntimeIdentifierPropertyAttribute.cs
- _ChunkParse.cs
- CommonDialog.cs
- MULTI_QI.cs
- ObjectPersistData.cs
- RangeValuePattern.cs
- ObjectPersistData.cs
- Dispatcher.cs
- WebPartEditorCancelVerb.cs
- WindowsGraphics2.cs
- TrackBarRenderer.cs
- RijndaelManaged.cs
- Literal.cs
- SQLDecimalStorage.cs
- ToolStripDropDownMenu.cs
- ISAPIWorkerRequest.cs
- DocumentViewer.cs
- Int64AnimationBase.cs
- WebConfigurationManager.cs
- ButtonField.cs
- SecurityCapabilities.cs
- XmlLangPropertyAttribute.cs
- IssuedTokensHeader.cs
- CellParaClient.cs
- DateTimeStorage.cs
- EventLogTraceListener.cs
- DataGridItem.cs
- SqlConnectionStringBuilder.cs
- ZipIOFileItemStream.cs
- FormatConvertedBitmap.cs
- WsatServiceAddress.cs
- InstancePersistenceException.cs
- EditingCommands.cs
- ValidatedControlConverter.cs
- FixUp.cs
- DataGridViewRowCollection.cs
- DesignerVerb.cs
- DeclarativeCatalogPartDesigner.cs
- SubtreeProcessor.cs
- LogEntrySerializer.cs
- TextEffectCollection.cs
- DeviceContexts.cs
- StatusStrip.cs
- XmlNamedNodeMap.cs
- BulletDecorator.cs
- CertificateManager.cs
- ProjectionQueryOptionExpression.cs
- COM2EnumConverter.cs
- ContentIterators.cs
- OciLobLocator.cs
- relpropertyhelper.cs
- IssuedTokensHeader.cs
- NegatedCellConstant.cs
- XmlTextReaderImpl.cs
- PackWebRequest.cs
- graph.cs
- DbConnectionPool.cs
- Int16Storage.cs
- EntityDesignerUtils.cs
- NTAccount.cs
- Rfc2898DeriveBytes.cs
- InternalPermissions.cs
- TraceUtility.cs
- Rect3DValueSerializer.cs
- CellTreeNode.cs
- DefaultMemberAttribute.cs
- NameValueSectionHandler.cs
- TypeConverterHelper.cs
- CodeMemberMethod.cs
- PolicyChain.cs
- BinaryReader.cs
- OleDbPropertySetGuid.cs
- AccessKeyManager.cs
- SmiEventSink.cs
- OracleRowUpdatingEventArgs.cs
- SolidColorBrush.cs
- KeyboardDevice.cs
- WorkflowPageSetupDialog.cs
- TabControlEvent.cs
- FixedSOMLineCollection.cs
- SystemKeyConverter.cs
- RemoteWebConfigurationHostServer.cs
- ProcessThread.cs
- CodeGenerator.cs
- UnmanagedMarshal.cs
- FocusTracker.cs
- HashCodeCombiner.cs
- CodeArgumentReferenceExpression.cs
- XmlSchemaProviderAttribute.cs
- NavigationPropertySingletonExpression.cs
- PointValueSerializer.cs
- XmlSchemaSimpleContent.cs
- UpdateExpressionVisitor.cs
- HostingPreferredMapPath.cs
- ListBindingHelper.cs
- TabletDevice.cs
- TextSerializer.cs