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
- Metadata.cs
- BamlCollectionHolder.cs
- ToolStripCollectionEditor.cs
- JsonSerializer.cs
- EncodingNLS.cs
- CompensationDesigner.cs
- DataServiceRequest.cs
- ProtocolElementCollection.cs
- NameValueFileSectionHandler.cs
- CredentialCache.cs
- UITypeEditor.cs
- MemoryPressure.cs
- AutoResetEvent.cs
- FilterFactory.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- KeyTimeConverter.cs
- tooltip.cs
- UnsafeNativeMethods.cs
- TripleDESCryptoServiceProvider.cs
- BinaryMethodMessage.cs
- Binding.cs
- XmlSerializerNamespaces.cs
- NullToBooleanConverter.cs
- NonVisualControlAttribute.cs
- odbcmetadatacolumnnames.cs
- Encoder.cs
- TableDetailsCollection.cs
- TrackingQueryElement.cs
- BitmapSource.cs
- Select.cs
- PipelineModuleStepContainer.cs
- RuntimeResourceSet.cs
- Opcode.cs
- CounterSetInstanceCounterDataSet.cs
- XPathException.cs
- MessageBox.cs
- Perspective.cs
- LostFocusEventManager.cs
- ArraySegment.cs
- SaveFileDialog.cs
- XamlPoint3DCollectionSerializer.cs
- DesignerVerb.cs
- NTAccount.cs
- XPathDocument.cs
- InternalControlCollection.cs
- SiteMapHierarchicalDataSourceView.cs
- CompoundFileDeflateTransform.cs
- ScrollableControl.cs
- DataGridTableCollection.cs
- HandleCollector.cs
- TableAdapterManagerMethodGenerator.cs
- DynamicRendererThreadManager.cs
- RealProxy.cs
- ProfileSettingsCollection.cs
- WMICapabilities.cs
- GroupBox.cs
- XmlSchemaCompilationSettings.cs
- SystemFonts.cs
- SemaphoreFullException.cs
- ActivationServices.cs
- SerializationStore.cs
- PageRanges.cs
- ResXResourceSet.cs
- TrackingMemoryStream.cs
- _NetRes.cs
- FieldDescriptor.cs
- OdbcDataAdapter.cs
- FrugalMap.cs
- ListMarkerLine.cs
- BezierSegment.cs
- SubclassTypeValidatorAttribute.cs
- Size3DValueSerializer.cs
- ChtmlFormAdapter.cs
- ToolStripItemDesigner.cs
- BoundingRectTracker.cs
- HtmlFormParameterReader.cs
- RequestCacheManager.cs
- QueryTask.cs
- BitmapEffectOutputConnector.cs
- Trace.cs
- CellPartitioner.cs
- HScrollProperties.cs
- CodeAccessPermission.cs
- CustomTrackingRecord.cs
- LocatorGroup.cs
- SqlProvider.cs
- ExpressionCopier.cs
- ConfigUtil.cs
- GuidConverter.cs
- ClosableStream.cs
- FormViewDeletedEventArgs.cs
- DataGridViewDataConnection.cs
- MetafileHeader.cs
- TranslateTransform.cs
- SingletonInstanceContextProvider.cs
- LocalIdCollection.cs
- XmlSchemaInfo.cs
- LogConverter.cs
- WebPartManagerInternals.cs
- SizeFConverter.cs