Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / textformatting / TextModifierScope.cs / 1305600 / TextModifierScope.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2001 // // File: TextModifierScope.cs // // Contents: Text modification API // // Spec: http://avalon/text/DesignDocsAndSpecs/Text%20Formatting%20API.doc // // Created: 12-5-2004 Niklas Borson (niklasb) // //----------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Windows; using System.Windows.Media; namespace System.Windows.Media.TextFormatting { ////// Represents a single "frame" in the stack of text modifiers. The stack /// is represented not as an array, but as a linked structure in which each /// frame points to its parent. /// internal sealed class TextModifierScope { private TextModifierScope _parentScope; private TextModifier _modifier; private int _cp; ////// Constructs a new text modification state object. /// /// Parent scope, i.e., the previous top of the stack. /// Text modifier run fetched from the client. /// Text source character index of the run. internal TextModifierScope(TextModifierScope parentScope, TextModifier modifier, int cp) { _parentScope = parentScope; _modifier = modifier; _cp = cp; } ////// Next item in the stack of text modifiers. /// public TextModifierScope ParentScope { get { return _parentScope; } } ////// Text modifier run fetched from the client. /// public TextModifier TextModifier { get { return _modifier; } } ////// Character index of the text modifier run. /// public int TextSourceCharacterIndex { get { return _cp; } } ////// Modifies the specified text run properties by invoking the modifier at /// the current scope and all containing scopes. /// /// Properties to modify. ///Returns the text run properties after modification. internal TextRunProperties ModifyProperties(TextRunProperties properties) { for (TextModifierScope scope = this; scope != null; scope = scope._parentScope) { properties = scope._modifier.ModifyProperties(properties); } return properties; } ////// Performs a deep copy of the stack of TextModifierScope objects. /// ///Returns the top of the new stack. internal TextModifierScope CloneStack() { TextModifierScope top = new TextModifierScope(null, _modifier, _cp); TextModifierScope scope = top; for (TextModifierScope source = _parentScope; source != null; source = source._parentScope) { scope._parentScope = new TextModifierScope(null, source._modifier, source._cp); scope = scope._parentScope; } return top; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2001 // // File: TextModifierScope.cs // // Contents: Text modification API // // Spec: http://avalon/text/DesignDocsAndSpecs/Text%20Formatting%20API.doc // // Created: 12-5-2004 Niklas Borson (niklasb) // //----------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Windows; using System.Windows.Media; namespace System.Windows.Media.TextFormatting { ////// Represents a single "frame" in the stack of text modifiers. The stack /// is represented not as an array, but as a linked structure in which each /// frame points to its parent. /// internal sealed class TextModifierScope { private TextModifierScope _parentScope; private TextModifier _modifier; private int _cp; ////// Constructs a new text modification state object. /// /// Parent scope, i.e., the previous top of the stack. /// Text modifier run fetched from the client. /// Text source character index of the run. internal TextModifierScope(TextModifierScope parentScope, TextModifier modifier, int cp) { _parentScope = parentScope; _modifier = modifier; _cp = cp; } ////// Next item in the stack of text modifiers. /// public TextModifierScope ParentScope { get { return _parentScope; } } ////// Text modifier run fetched from the client. /// public TextModifier TextModifier { get { return _modifier; } } ////// Character index of the text modifier run. /// public int TextSourceCharacterIndex { get { return _cp; } } ////// Modifies the specified text run properties by invoking the modifier at /// the current scope and all containing scopes. /// /// Properties to modify. ///Returns the text run properties after modification. internal TextRunProperties ModifyProperties(TextRunProperties properties) { for (TextModifierScope scope = this; scope != null; scope = scope._parentScope) { properties = scope._modifier.ModifyProperties(properties); } return properties; } ////// Performs a deep copy of the stack of TextModifierScope objects. /// ///Returns the top of the new stack. internal TextModifierScope CloneStack() { TextModifierScope top = new TextModifierScope(null, _modifier, _cp); TextModifierScope scope = top; for (TextModifierScope source = _parentScope; source != null; source = source._parentScope) { scope._parentScope = new TextModifierScope(null, source._modifier, source._cp); scope = scope._parentScope; } return top; } } } // 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
- DataQuery.cs
- WebUtil.cs
- CodeExpressionCollection.cs
- ThaiBuddhistCalendar.cs
- DecimalAnimationUsingKeyFrames.cs
- HashHelper.cs
- ArcSegment.cs
- CharacterMetricsDictionary.cs
- XamlTypeMapperSchemaContext.cs
- EventWaitHandle.cs
- ColumnReorderedEventArgs.cs
- DataTableCollection.cs
- Token.cs
- MailHeaderInfo.cs
- TextRenderingModeValidation.cs
- QuaternionRotation3D.cs
- webproxy.cs
- SystemColors.cs
- BaseCAMarshaler.cs
- IRCollection.cs
- VisualStyleTypesAndProperties.cs
- SelectionWordBreaker.cs
- DbFunctionCommandTree.cs
- GetWinFXPath.cs
- ListBox.cs
- FrameworkElement.cs
- RegexWriter.cs
- LocationUpdates.cs
- ContentPlaceHolder.cs
- FactoryRecord.cs
- Misc.cs
- FormView.cs
- SimpleExpression.cs
- Command.cs
- DbConnectionPool.cs
- PrtCap_Base.cs
- activationcontext.cs
- IteratorFilter.cs
- CheckBoxRenderer.cs
- DataGridRow.cs
- ConfigurationElementCollection.cs
- InternalsVisibleToAttribute.cs
- ActivationServices.cs
- ConnectionProviderAttribute.cs
- TraceInternal.cs
- Transform.cs
- QilReference.cs
- CodeFieldReferenceExpression.cs
- VarRemapper.cs
- connectionpool.cs
- XmlObjectSerializer.cs
- RequestStatusBarUpdateEventArgs.cs
- AssociationEndMember.cs
- MarkupCompilePass2.cs
- EncodingConverter.cs
- _DomainName.cs
- FixedSOMLineCollection.cs
- FormatConvertedBitmap.cs
- SqlCharStream.cs
- DetailsViewRowCollection.cs
- DynamicQueryStringParameter.cs
- HttpSessionStateWrapper.cs
- Size3D.cs
- PeerCollaborationPermission.cs
- HttpProfileBase.cs
- CellIdBoolean.cs
- ResourceReferenceExpression.cs
- ObjectTag.cs
- AsyncResult.cs
- CultureInfoConverter.cs
- RtfToken.cs
- TouchesOverProperty.cs
- DateTimePicker.cs
- ConfigXmlText.cs
- CompleteWizardStep.cs
- CodeFieldReferenceExpression.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- NameValuePermission.cs
- DiscoveryClientOutputChannel.cs
- XPathDocumentNavigator.cs
- ResourceFallbackManager.cs
- ContextStack.cs
- RootBrowserWindow.cs
- SafeCertificateStore.cs
- SafeTokenHandle.cs
- ServiceBehaviorElement.cs
- ReadOnlyDictionary.cs
- MethodAccessException.cs
- SortableBindingList.cs
- TextFormatterHost.cs
- CodeNamespaceImportCollection.cs
- UrlRoutingHandler.cs
- LinearKeyFrames.cs
- ConstantSlot.cs
- DebugView.cs
- TransformerTypeCollection.cs
- ViewCellSlot.cs
- LOSFormatter.cs
- QueryTaskGroupState.cs
- TextSelection.cs