Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / TextTreeExtractElementUndoUnit.cs / 1 / TextTreeExtractElementUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeExtractElementUndoUnit.cs // // Description: Undo unit for TextContainer.ExtractElement calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.ExtractElement calls. internal class TextTreeExtractElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. internal TextTreeExtractElementUndoUnit(TextContainer tree, TextTreeTextElementNode elementNode) : base(tree, elementNode.GetSymbolOffset(tree.Generation)) { _symbolCount = elementNode.SymbolCount; _type = elementNode.TextElement.GetType(); _localValues = LocalValueEnumeratorToArray(elementNode.TextElement.GetLocalValueEnumerator()); _resources = elementNode.TextElement.Resources; // Table requires additional work for storing its Columns collection if (elementNode.TextElement is Table) { _columns = TextTreeDeleteContentUndoUnit.SaveColumns((Table)elementNode.TextElement); } } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- #region Public Methods // Called by the undo manager. Restores tree state to its condition // when the unit was created. Assumes the tree state matches conditions // just after the unit was created. public override void DoCore() { TextPointer start; TextPointer end; TextElement element; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount - 2, LogicalDirection.Forward); // Insert a new element. element = (TextElement)Activator.CreateInstance(_type); element.Reposition(start, end); // Restore local resources element.Resources = _resources; // Move end into the scope of the new element. end.MoveToNextContextPosition(LogicalDirection.Backward); // Then restore local property values. // this.TextContainer.SetValues(end, ArrayToLocalValueEnumerator(_localValues)); if (element is Table) { TextTreeDeleteContentUndoUnit.RestoreColumns((Table)element, _columns); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols covered by the extracted TextElement, including its 2 edges. private readonly int _symbolCount; // Type of the extracted TextElement. private readonly Type _type; // Collection of all local property values set on the extracted TextElement. private readonly PropertyRecord []_localValues; // Resources defined locally on the TextElement private readonly ResourceDictionary _resources; // TableColumns collection private readonly TableColumn[] _columns; #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
- PinnedBufferMemoryStream.cs
- Command.cs
- RegexTree.cs
- CustomSignedXml.cs
- Subtree.cs
- BinaryObjectReader.cs
- ToolboxItemImageConverter.cs
- ReadOnlyNameValueCollection.cs
- Vector3D.cs
- SchemaTypeEmitter.cs
- SettingsProperty.cs
- DependsOnAttribute.cs
- RC2CryptoServiceProvider.cs
- CurrentChangingEventManager.cs
- SpecularMaterial.cs
- SqlDataSourceView.cs
- FastPropertyAccessor.cs
- SafeUserTokenHandle.cs
- SourceLineInfo.cs
- ExpressionBuilder.cs
- DataGridTablesFactory.cs
- _UriSyntax.cs
- TypeLibConverter.cs
- WebSysDisplayNameAttribute.cs
- ExceptionHandlerDesigner.cs
- FilteredAttributeCollection.cs
- ProxyWebPartManager.cs
- Function.cs
- PassportAuthenticationModule.cs
- BasicViewGenerator.cs
- UpDownBase.cs
- XmlSchemaAttributeGroupRef.cs
- ObjectIDGenerator.cs
- MouseEvent.cs
- ImageFormat.cs
- WebBrowsableAttribute.cs
- RectAnimationUsingKeyFrames.cs
- SamlConditions.cs
- ListBindingHelper.cs
- LinkLabelLinkClickedEvent.cs
- XmlChildNodes.cs
- DependencyObject.cs
- DbDataRecord.cs
- Relationship.cs
- StringPropertyBuilder.cs
- DbSetClause.cs
- PrefixHandle.cs
- ArrayTypeMismatchException.cs
- BrowserTree.cs
- ZoneMembershipCondition.cs
- XmlUtilWriter.cs
- XmlKeywords.cs
- WebPartActionVerb.cs
- EntityProxyTypeInfo.cs
- DataControlFieldHeaderCell.cs
- _SslStream.cs
- DesignOnlyAttribute.cs
- ExtendedProtectionPolicy.cs
- ObjectAnimationBase.cs
- SettingsSavedEventArgs.cs
- RadioButtonRenderer.cs
- OleStrCAMarshaler.cs
- XmlAttribute.cs
- SafeNativeMethods.cs
- DataGridViewComboBoxColumn.cs
- CompoundFileStorageReference.cs
- odbcmetadatacolumnnames.cs
- BadImageFormatException.cs
- MarkupCompilePass1.cs
- BindingWorker.cs
- RadioButtonStandardAdapter.cs
- PasswordRecovery.cs
- ParseChildrenAsPropertiesAttribute.cs
- HostedBindingBehavior.cs
- AdRotatorDesigner.cs
- ToolStripDropDownClosingEventArgs.cs
- WebException.cs
- DateTimeFormatInfo.cs
- FileDialogCustomPlace.cs
- ListViewItemCollectionEditor.cs
- XamlVector3DCollectionSerializer.cs
- IntegerValidator.cs
- XmlDataImplementation.cs
- ToolStripDropDownItemDesigner.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- TransportSecurityHelpers.cs
- TableRowGroup.cs
- MouseEventArgs.cs
- Compilation.cs
- QilSortKey.cs
- COM2PictureConverter.cs
- PointLight.cs
- VectorAnimation.cs
- HitTestParameters3D.cs
- WebPartEventArgs.cs
- Soap12ServerProtocol.cs
- TabItemAutomationPeer.cs
- SelectionHighlightInfo.cs
- ExpressionPrefixAttribute.cs
- BitmapDownload.cs