Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / textformatting / TextModifierScope.cs / 1 / 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
- StylusPlugin.cs
- FormsAuthenticationCredentials.cs
- DecoderBestFitFallback.cs
- BamlTreeMap.cs
- QueryAccessibilityHelpEvent.cs
- SqlException.cs
- PngBitmapDecoder.cs
- DbProviderFactoriesConfigurationHandler.cs
- EventTrigger.cs
- ObjectAssociationEndMapping.cs
- FocusTracker.cs
- assemblycache.cs
- DataShape.cs
- Helper.cs
- DataGridColumnReorderingEventArgs.cs
- SafeHandles.cs
- HasActivatableWorkflowEvent.cs
- TextProperties.cs
- ListView.cs
- MulticastDelegate.cs
- InstanceKey.cs
- ComNativeDescriptor.cs
- MsmqIntegrationBindingElement.cs
- Int16KeyFrameCollection.cs
- ClientSettingsProvider.cs
- SurrogateDataContract.cs
- VisualTreeUtils.cs
- PrinterUnitConvert.cs
- X509ThumbprintKeyIdentifierClause.cs
- CacheDependency.cs
- SystemIPInterfaceStatistics.cs
- TemplateXamlParser.cs
- JavaScriptObjectDeserializer.cs
- MissingManifestResourceException.cs
- BitmapPalettes.cs
- TextRangeSerialization.cs
- EmptyStringExpandableObjectConverter.cs
- RawTextInputReport.cs
- ConditionValidator.cs
- ElementsClipboardData.cs
- Sequence.cs
- BasicHttpSecurityElement.cs
- SectionInput.cs
- DtrList.cs
- VarRemapper.cs
- BuildManager.cs
- AssociatedControlConverter.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- userdatakeys.cs
- StateDesigner.TransitionInfo.cs
- MultilineStringEditor.cs
- NativeMethods.cs
- StorageComplexTypeMapping.cs
- PropertiesTab.cs
- TextTreeTextElementNode.cs
- HeaderedContentControl.cs
- QuestionEventArgs.cs
- CompoundFileDeflateTransform.cs
- PropertyTab.cs
- TrackingRecord.cs
- Label.cs
- TdsParserHelperClasses.cs
- StringFunctions.cs
- VariantWrapper.cs
- HtmlEncodedRawTextWriter.cs
- PrintDocument.cs
- SystemFonts.cs
- WebPartManager.cs
- assertwrapper.cs
- SByte.cs
- AlignmentYValidation.cs
- PrefixQName.cs
- QilReplaceVisitor.cs
- TemplateGroupCollection.cs
- DataServiceClientException.cs
- SR.cs
- RadioButtonStandardAdapter.cs
- PageThemeParser.cs
- ProviderConnectionPoint.cs
- CanonicalFontFamilyReference.cs
- CodeGeneratorOptions.cs
- SafeRightsManagementHandle.cs
- ObjectAnimationUsingKeyFrames.cs
- MembershipSection.cs
- ActivatedMessageQueue.cs
- TextParentUndoUnit.cs
- ListSortDescriptionCollection.cs
- DataGridViewRowStateChangedEventArgs.cs
- SystemFonts.cs
- ToolStripItemTextRenderEventArgs.cs
- TextAutomationPeer.cs
- DrawingImage.cs
- TraceHwndHost.cs
- PersonalizationStateInfo.cs
- StreamWriter.cs
- RelationshipEnd.cs
- JsonDeserializer.cs
- FixUp.cs
- Partitioner.cs
- SecurityTokenReferenceStyle.cs