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
- OLEDB_Util.cs
- QuaternionRotation3D.cs
- WindowsStartMenu.cs
- SqlDataSourceStatusEventArgs.cs
- DateTimeConstantAttribute.cs
- PictureBox.cs
- DataContractJsonSerializerOperationFormatter.cs
- EasingFunctionBase.cs
- XmlArrayItemAttribute.cs
- ServicesSection.cs
- ZipIOBlockManager.cs
- SettingsContext.cs
- GroupDescription.cs
- PropertyInformation.cs
- SingleQueryOperator.cs
- CodeRemoveEventStatement.cs
- WebBrowserUriTypeConverter.cs
- XmlSchemaAnnotation.cs
- WarningException.cs
- BamlReader.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- AssemblyName.cs
- SqlProcedureAttribute.cs
- OleCmdHelper.cs
- ServiceObjectContainer.cs
- CheckedListBox.cs
- EntityContainerRelationshipSetEnd.cs
- DetailsViewRowCollection.cs
- TopClause.cs
- ConsoleKeyInfo.cs
- Point.cs
- Propagator.Evaluator.cs
- ProgressBarRenderer.cs
- FixedPageProcessor.cs
- TextEditorTyping.cs
- DataGridViewRowPostPaintEventArgs.cs
- AuthorizationSection.cs
- HashHelpers.cs
- OwnerDrawPropertyBag.cs
- MsmqIntegrationReceiveParameters.cs
- LinkUtilities.cs
- SqlStatistics.cs
- ToolStripGrip.cs
- Configuration.cs
- DBSchemaTable.cs
- FunctionImportMapping.cs
- Site.cs
- PKCS1MaskGenerationMethod.cs
- TypeProvider.cs
- AmbiguousMatchException.cs
- TableDetailsCollection.cs
- EventLogStatus.cs
- UrlMapping.cs
- RepeatButton.cs
- CommentEmitter.cs
- PenThreadWorker.cs
- VisualStyleRenderer.cs
- CompoundFileDeflateTransform.cs
- ProfileProvider.cs
- PartialTrustHelpers.cs
- KnownTypesHelper.cs
- SchemaAttDef.cs
- PointCollection.cs
- PromptBuilder.cs
- ListSortDescriptionCollection.cs
- ResourceReferenceExpression.cs
- LinkedList.cs
- XpsResourceDictionary.cs
- EncoderFallback.cs
- Membership.cs
- Logging.cs
- WinOEToolBoxItem.cs
- ResolveNextArgumentWorkItem.cs
- StaticExtensionConverter.cs
- ComboBoxAutomationPeer.cs
- FontTypeConverter.cs
- PopOutPanel.cs
- Pair.cs
- SqlRowUpdatedEvent.cs
- GridViewEditEventArgs.cs
- CachedPathData.cs
- HttpCacheVaryByContentEncodings.cs
- CompositeControl.cs
- InstallerTypeAttribute.cs
- TextContainerChangeEventArgs.cs
- HtmlForm.cs
- ZipIOLocalFileBlock.cs
- SqlTrackingQuery.cs
- DataGridSortCommandEventArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- PeerName.cs
- CellTreeNode.cs
- ScriptComponentDescriptor.cs
- CompatibleComparer.cs
- AtomEntry.cs
- DrawingContextWalker.cs
- coordinator.cs
- wgx_sdk_version.cs
- ValueTable.cs
- CodeMemberMethod.cs