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
- DelimitedListTraceListener.cs
- NextPreviousPagerField.cs
- PropertyDescriptorGridEntry.cs
- AutoResetEvent.cs
- AsnEncodedData.cs
- ConnectionPointConverter.cs
- InplaceBitmapMetadataWriter.cs
- MarkupExtensionParser.cs
- ListControlDesigner.cs
- AppliedDeviceFiltersEditor.cs
- DataServiceHost.cs
- AssemblyAttributesGoHere.cs
- NamespaceEmitter.cs
- TwoPhaseCommit.cs
- FastEncoderWindow.cs
- ToolboxSnapDragDropEventArgs.cs
- basenumberconverter.cs
- Item.cs
- SamlAuthorizationDecisionStatement.cs
- DataListItemCollection.cs
- DataGridViewElement.cs
- XmlSchemaParticle.cs
- XamlVector3DCollectionSerializer.cs
- ValidatorUtils.cs
- NamedPipeWorkerProcess.cs
- ClientOptions.cs
- ItemCheckedEvent.cs
- Parsers.cs
- MouseWheelEventArgs.cs
- ToolStripPanelRenderEventArgs.cs
- WebPartPersonalization.cs
- XmlSchema.cs
- InfoCardXmlSerializer.cs
- SecurityDocument.cs
- KerberosRequestorSecurityToken.cs
- wgx_sdk_version.cs
- HttpBrowserCapabilitiesWrapper.cs
- Span.cs
- HttpEncoderUtility.cs
- InputBinding.cs
- XmlSchemas.cs
- Util.cs
- TimeZone.cs
- TypeBuilderInstantiation.cs
- QueryResult.cs
- PlaceHolder.cs
- DateRangeEvent.cs
- Int16AnimationUsingKeyFrames.cs
- ToolStripStatusLabel.cs
- ForeignKeyFactory.cs
- ActivityWithResultWrapper.cs
- AssemblyName.cs
- XmlTextReaderImpl.cs
- HighlightVisual.cs
- DiscardableAttribute.cs
- OdbcRowUpdatingEvent.cs
- InstanceDataCollection.cs
- PathFigureCollectionConverter.cs
- ModelVisual3D.cs
- HtmlInputSubmit.cs
- DesignerRegion.cs
- BindingNavigator.cs
- SharedStatics.cs
- TextContainerHelper.cs
- DocumentsTrace.cs
- SpStreamWrapper.cs
- CommonXSendMessage.cs
- CrossContextChannel.cs
- SynchronizedCollection.cs
- XmlSchemaAnnotated.cs
- Configuration.cs
- Calendar.cs
- RangeValuePattern.cs
- RSAPKCS1SignatureDeformatter.cs
- CalculatedColumn.cs
- RelatedView.cs
- TdsParserStateObject.cs
- ControlBuilderAttribute.cs
- XmlUtf8RawTextWriter.cs
- SymmetricAlgorithm.cs
- EmptyStringExpandableObjectConverter.cs
- OdbcParameter.cs
- FunctionUpdateCommand.cs
- HtmlToClrEventProxy.cs
- PermissionSetTriple.cs
- IDReferencePropertyAttribute.cs
- DataGridPageChangedEventArgs.cs
- SiteMapSection.cs
- KeyValueConfigurationElement.cs
- newinstructionaction.cs
- HttpListenerPrefixCollection.cs
- WorkflowInstanceTerminatedRecord.cs
- DataGridViewRowCollection.cs
- Page.cs
- ChangePassword.cs
- BooleanProjectedSlot.cs
- WebRequestModuleElementCollection.cs
- ProbeMatchesApril2005.cs
- RepeatInfo.cs
- RawAppCommandInputReport.cs