Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / TextTreeRootNode.cs / 1 / TextTreeRootNode.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: The root node of a TextContainer. // // History: // 02/18/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; using System.Collections; using System.Windows.Threading; namespace System.Windows.Documents { // All TextContainers contain a single TextTreeRootNode, which contains all other // nodes. The root node is special because it contains tree-global data, // and TextPositions may never reference its BeforeStart/AfterEnd edges. // Because of the restrictions on TextPointer, the root node may never // be removed from the tree. internal class TextTreeRootNode : TextTreeNode { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a TextTreeRootNode instance. internal TextTreeRootNode(TextContainer tree) { _tree = tree; #if REFCOUNT_DEAD_TEXTPOINTERS _deadPositionList = new ArrayList(0); #endif // REFCOUNT_DEAD_TEXTPOINTERS // Root node has two imaginary element edges to match TextElementNode semantics. _symbolCount = 2; // CaretUnitBoundaryCache always starts unset. _caretUnitBoundaryCacheOffset = -1; } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- #region Public Methods #if DEBUG // Debug-only ToString override. public override string ToString() { return ("RootNode Id=" + this.DebugId + " SymbolCount=" + _symbolCount); } #endif // DEBUG #endregion Public Methods //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Returns a shallow copy of this node. // This should never be called for the root node, since it is never // involved in delete operations. internal override TextTreeNode Clone() { Invariant.Assert(false, "Unexpected call to TextTreeRootNode.Clone!"); return null; } // Returns the TextPointerContext of the node. // If node is TextTreeTextElementNode, this method returns ElementStart // if direction == Forward, otherwise ElementEnd if direction == Backward. internal override TextPointerContext GetPointerContext(LogicalDirection direction) { // End-of-tree is "None". return TextPointerContext.None; } #endregion Internal methods //----------------------------------------------------- // // Internal Properties // //------------------------------------------------------ #region Internal Properties // The root node never has a parent node. internal override SplayTreeNode ParentNode { get { return null; } set { Invariant.Assert(false, "Can't set ParentNode on TextContainer root!"); } } // Root node of a contained tree, if any. internal override SplayTreeNode ContainedNode { get { return _containedNode; } set { _containedNode = (TextTreeNode)value; } } // The root node never has sibling nodes, so the LeftSymbolCount is a // constant zero. internal override int LeftSymbolCount { get { return 0; } set { Invariant.Assert(false, "TextContainer root is never a sibling!"); } } // The root node never has sibling nodes, so the LeftCharCount is a // constant zero. internal override int LeftCharCount { get { return 0; } set { Invariant.Assert(false, "TextContainer root is never a sibling!"); } } // The root node never has siblings, so it never has child nodes. internal override SplayTreeNode LeftChildNode { get { return null; } set { Invariant.Assert(false, "TextContainer root never has sibling nodes!"); } } // The root node never has siblings, so it never has child nodes. internal override SplayTreeNode RightChildNode { get { return null; } set { Invariant.Assert(false, "TextContainer root never has sibling nodes!"); } } // The tree generation. Incremented whenever the tree content changes. internal override uint Generation { get { return _generation; } set { _generation = value; } } // Like the Generation property, but this counter is only updated when // an edit that might affect TextPositions occurs. In practice, inserts // do not bother TextPositions, but deletions do. internal uint PositionGeneration { get { return _positionGeneration; } set { _positionGeneration = value; } } // Incremeneted whenever a layout property value changes on a TextElement. internal uint LayoutGeneration { get { return _layoutGeneration; } set { _layoutGeneration = value; // Invalidate the caret unit boundary cache on layout update. _caretUnitBoundaryCacheOffset = -1; } } // Cached symbol offset. The root node is always at offset zero. internal override int SymbolOffsetCache { get { return 0; } set { Invariant.Assert(value == 0, "Bad SymbolOffsetCache on TextContainer root!"); } } // The count of all symbols in the tree, including two edge symbols for // the root node itself. internal override int SymbolCount { get { return _symbolCount; } set { Invariant.Assert(value >= 2, "Bad _symbolCount on TextContainer root!"); _symbolCount = value; } } // The count of all chars in the tree. internal override int IMECharCount { get { return _imeCharCount; } set { Invariant.Assert(value >= 0, "IMECharCount may never be negative!"); _imeCharCount = value; } } // Count of TextPositions referencing the node's BeforeStart // edge. We don't bother to actually track this for the root node // since it is only useful in delete operations and the root node // is never deleted. internal override bool BeforeStartReferenceCount { get { return false; } set { Invariant.Assert(!value, "Root node BeforeStart edge can never be referenced!"); } } // Count of TextPositions referencing the node's AfterStart // edge. We don't bother to actually track this for the root node // since it is only useful in delete operations and the root node // is never deleted. internal override bool AfterStartReferenceCount { get { return false; } set { // We can ignore the value because the TextContainer root is never removed. } } // Count of TextPositions referencing the node's BeforeEnd // edge. We don't bother to actually track this for the root node // since it is only useful in delete operations and the root node // is never deleted. internal override bool BeforeEndReferenceCount { get { return false; } set { // We can ignore the value because the TextContainer root is never removed. } } // Count of TextPositions referencing the node's AfterEnd // edge. We don't bother to actually track this for the root node // since it is only useful in delete operations and the root node // is never deleted. internal override bool AfterEndReferenceCount { get { return false; } set { Invariant.Assert(!value, "Root node AfterEnd edge can never be referenced!"); } } // The owning TextContainer. internal TextContainer TextContainer { get { return _tree; } } // A tree of TextTreeTextBlocks, used to store raw text for the entire // tree. internal TextTreeRootTextBlock RootTextBlock { get { return _rootTextBlock; } set { _rootTextBlock = value; } } #if REFCOUNT_DEAD_TEXTPOINTERS // A list of positions ready to be garbage collected. The TextPointer // finalizer adds positions to this list. internal ArrayList DeadPositionList { get { return _deadPositionList; } set { _deadPositionList = value; } } #endif // REFCOUNT_DEAD_TEXTPOINTERS // Structure that allows for dispatcher processing to be // enabled after a call to Dispatcher.DisableProcessing. internal DispatcherProcessingDisabled DispatcherProcessingDisabled { get { return _processingDisabled; } set { _processingDisabled = value; } } // Cached TextView.IsAtCaretUnitBoundary calculation for CaretUnitBoundaryCacheOffset. internal bool CaretUnitBoundaryCache { get { return _caretUnitBoundaryCache; } set { _caretUnitBoundaryCache = value; } } // Symbol offset of CaretUnitBoundaryCache, or -1 if the cache is empty. internal int CaretUnitBoundaryCacheOffset { get { return _caretUnitBoundaryCacheOffset; } set { _caretUnitBoundaryCacheOffset = value; } } #endregion Internal Properties //----------------------------------------------------- // // Private Fields // //----------------------------------------------------- #region Private Fields // The owning TextContainer. private readonly TextContainer _tree; // Root node of a contained tree, if any. private TextTreeNode _containedNode; // The count of all symbols in the tree, including two edge symbols for // the root node itself. private int _symbolCount; // The count of all chars in the tree. private int _imeCharCount; // The tree generation. Incremented whenever the tree content changes. private uint _generation; // Like _generation, but only updated when a change could affect positions. private uint _positionGeneration; // Like _generation, but only updated when on a TextElement layout property change. private uint _layoutGeneration; // A tree of TextTreeTextBlocks, used to store raw text for the entire TextContainer. private TextTreeRootTextBlock _rootTextBlock; #if REFCOUNT_DEAD_TEXTPOINTERS // A list of positions ready to be garbage collected. The TextPointer // finalizer adds positions to this list. private ArrayList _deadPositionList; #endif // REFCOUNT_DEAD_TEXTPOINTERS // Cached TextView.IsAtCaretUnitBoundary calculation for _caretUnitBoundaryCacheOffset. private bool _caretUnitBoundaryCache; // Symbol offset of _caretUnitBoundaryCache, or -1 if the cache is empty. private int _caretUnitBoundaryCacheOffset; // Structure that allows for dispatcher processing to be // enabled after a call to Dispatcher.DisableProcessing. private DispatcherProcessingDisabled _processingDisabled; #endregion Private Fields } } // 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
- Timeline.cs
- PassportAuthentication.cs
- DefaultTextStore.cs
- RoutedEventConverter.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- XmlValueConverter.cs
- WaitHandleCannotBeOpenedException.cs
- CultureTable.cs
- ValueTable.cs
- IERequestCache.cs
- TransformerInfoCollection.cs
- RuntimeConfigurationRecord.cs
- HandlerWithFactory.cs
- FtpWebRequest.cs
- XmlSignatureProperties.cs
- DataSourceCacheDurationConverter.cs
- AdRotator.cs
- ToolConsole.cs
- XmlSchemaSimpleTypeRestriction.cs
- PropertyGridEditorPart.cs
- ScrollEvent.cs
- DebugView.cs
- ReflectionTypeLoadException.cs
- CodeTypeParameter.cs
- _TLSstream.cs
- RectAnimationUsingKeyFrames.cs
- Content.cs
- DataGridViewRowStateChangedEventArgs.cs
- BindingCompleteEventArgs.cs
- DataGridItem.cs
- JsonFormatReaderGenerator.cs
- SettingsPropertyWrongTypeException.cs
- SqlDataReaderSmi.cs
- GridViewPageEventArgs.cs
- DataMisalignedException.cs
- CounterCreationData.cs
- CodeDOMProvider.cs
- CryptoConfig.cs
- XamlSerializerUtil.cs
- StateWorkerRequest.cs
- PermissionAttributes.cs
- RangeValidator.cs
- PEFileReader.cs
- ApplicationServiceHelper.cs
- BitmapEffectrendercontext.cs
- BlobPersonalizationState.cs
- DetailsViewDeletedEventArgs.cs
- XmlSerializableReader.cs
- NetTcpSecurity.cs
- WrapPanel.cs
- uribuilder.cs
- XmlReflectionMember.cs
- TextDecoration.cs
- HttpDebugHandler.cs
- VariableAction.cs
- User.cs
- HttpListener.cs
- PropertyItemInternal.cs
- XmlName.cs
- ByteAnimation.cs
- XslTransform.cs
- RefType.cs
- ModelTreeEnumerator.cs
- ConfigurationManager.cs
- WindowsRegion.cs
- ActivationArguments.cs
- ServerProtocol.cs
- FormDesigner.cs
- DataBoundControlHelper.cs
- TemplateNameScope.cs
- InstanceDataCollection.cs
- HandlerBase.cs
- WindowsFont.cs
- SyntaxCheck.cs
- AttachedPropertyMethodSelector.cs
- CacheDependency.cs
- ManagementObjectCollection.cs
- SpotLight.cs
- SetterBase.cs
- FixedSOMLineRanges.cs
- assemblycache.cs
- HelpKeywordAttribute.cs
- GPPOINT.cs
- SmtpNegotiateAuthenticationModule.cs
- PasswordTextContainer.cs
- AppDomainManager.cs
- SQLDecimalStorage.cs
- HttpServerUtilityWrapper.cs
- SplitContainer.cs
- ModelFactory.cs
- unsafeIndexingFilterStream.cs
- Model3D.cs
- ToolStripDropTargetManager.cs
- XmlDataImplementation.cs
- RequestResizeEvent.cs
- Panel.cs
- ApplicationDirectory.cs
- DesignerProperties.cs
- ConfigurationManagerHelper.cs
- XDeferredAxisSource.cs