Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / TextTreeInsertElementUndoUnit.cs / 1305600 / TextTreeInsertElementUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertElementUndoUnit.cs // // Description: Undo unit for TextContainer.InsertElement calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertElement calls. internal class TextTreeInsertElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. // symbolOffset should be just before the start edge of the TextElement to remove. // If deep is true, this unit will undo not only the scoping element // insert, but also all content scoped by the element. internal TextTreeInsertElementUndoUnit(TextContainer tree, int symbolOffset, bool deep) : base(tree, symbolOffset) { _deep = deep; } #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); Invariant.Assert(start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); element = start.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (_deep) { // Extract the element and its content. end = new TextPointer(this.TextContainer, element.TextElementNode, ElementEdge.AfterEnd); this.TextContainer.DeleteContentInternal(start, end); } else { // Just extract the element, not its content. this.TextContainer.ExtractElementInternal(element); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // If true, this unit tracks a TextElement and its scoped content. // Otherwise, this unit only tracks the TextElement. private readonly bool _deep; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: TextTreeInsertElementUndoUnit.cs // // Description: Undo unit for TextContainer.InsertElement calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertElement calls. internal class TextTreeInsertElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. // symbolOffset should be just before the start edge of the TextElement to remove. // If deep is true, this unit will undo not only the scoping element // insert, but also all content scoped by the element. internal TextTreeInsertElementUndoUnit(TextContainer tree, int symbolOffset, bool deep) : base(tree, symbolOffset) { _deep = deep; } #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); Invariant.Assert(start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); element = start.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (_deep) { // Extract the element and its content. end = new TextPointer(this.TextContainer, element.TextElementNode, ElementEdge.AfterEnd); this.TextContainer.DeleteContentInternal(start, end); } else { // Just extract the element, not its content. this.TextContainer.ExtractElementInternal(element); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // If true, this unit tracks a TextElement and its scoped content. // Otherwise, this unit only tracks the TextElement. private readonly bool _deep; #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
- SqlClientWrapperSmiStream.cs
- contentDescriptor.cs
- CompoundFileStreamReference.cs
- ThreadStaticAttribute.cs
- XsdBuilder.cs
- Baml2006ReaderFrame.cs
- MetadataUtilsSmi.cs
- MetadataItemCollectionFactory.cs
- ListBox.cs
- TableLayoutPanelBehavior.cs
- Adorner.cs
- SchemaComplexType.cs
- EventLogPermission.cs
- OutOfProcStateClientManager.cs
- StringArrayConverter.cs
- SettingsBindableAttribute.cs
- XmlAutoDetectWriter.cs
- WindowsRichEdit.cs
- DefaultAsyncDataDispatcher.cs
- BoolExpression.cs
- TextSelection.cs
- DataControlPagerLinkButton.cs
- GridView.cs
- DesignerDataRelationship.cs
- IncrementalHitTester.cs
- RootProfilePropertySettingsCollection.cs
- WebPartManagerInternals.cs
- GenericTypeParameterBuilder.cs
- XpsSerializationException.cs
- FlatButtonAppearance.cs
- LocalizationParserHooks.cs
- ClientSession.cs
- PaginationProgressEventArgs.cs
- XmlNavigatorFilter.cs
- MsmqDecodeHelper.cs
- GrammarBuilderBase.cs
- RepeatBehaviorConverter.cs
- DesignerActionVerbItem.cs
- ScriptReferenceEventArgs.cs
- IdentifierService.cs
- Int64Storage.cs
- BaseTemplateCodeDomTreeGenerator.cs
- MetadataArtifactLoader.cs
- SerializationHelper.cs
- WindowsSecurityToken.cs
- DataControlFieldCell.cs
- SQLBoolean.cs
- Decorator.cs
- ResourcePool.cs
- UrlMapping.cs
- TreeNodeEventArgs.cs
- Profiler.cs
- CharStorage.cs
- ListArgumentProvider.cs
- ToolStripDropDownItem.cs
- AspNetSynchronizationContext.cs
- PassportIdentity.cs
- ObjectListFieldCollection.cs
- EllipseGeometry.cs
- LinkGrep.cs
- JpegBitmapDecoder.cs
- MarkupCompilePass2.cs
- CompositeControlDesigner.cs
- ObjectAnimationUsingKeyFrames.cs
- SmiEventStream.cs
- Classification.cs
- EntityDataSourceContainerNameItem.cs
- BufferAllocator.cs
- XmlAttributeCollection.cs
- OleDbConnectionInternal.cs
- ConditionalBranch.cs
- ParallelTimeline.cs
- SqlDataSourceAdvancedOptionsForm.cs
- XamlLoadErrorInfo.cs
- DataContract.cs
- SynchronizationLockException.cs
- ConnectionStringsExpressionBuilder.cs
- Soap.cs
- DataViewManager.cs
- Compilation.cs
- EllipticalNodeOperations.cs
- KeyGesture.cs
- TabControlEvent.cs
- LogSwitch.cs
- ProxyGenerationError.cs
- DataGridViewCellStateChangedEventArgs.cs
- PopupRoot.cs
- DbMetaDataCollectionNames.cs
- PageRanges.cs
- Reference.cs
- StyleSelector.cs
- EventLog.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- TransactedBatchContext.cs
- ObjectTypeMapping.cs
- ComboBox.cs
- ClientConfigPaths.cs
- ImageMap.cs
- BigInt.cs
- OrthographicCamera.cs