Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Documents / TextTreeInsertElementUndoUnit.cs / 1 / TextTreeInsertElementUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertElementUndoUnit.cs // // Description: Undo unit for TextContainer.InsertElement calls. // // History: // 03/03/2004 : benwest - 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 : benwest - 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
- CodeCommentStatement.cs
- ReceiveContent.cs
- LassoSelectionBehavior.cs
- CustomAttributeSerializer.cs
- AddressHeaderCollectionElement.cs
- SqlSelectStatement.cs
- Validator.cs
- CryptoStream.cs
- DbProviderFactory.cs
- SetterTriggerConditionValueConverter.cs
- DataBindingHandlerAttribute.cs
- WindowsRichEditRange.cs
- SimpleHandlerFactory.cs
- ChannelSinkStacks.cs
- WebPartsPersonalization.cs
- MDIWindowDialog.cs
- JournalEntryListConverter.cs
- ObjectHandle.cs
- ConnectionPoint.cs
- DataSourceGroupCollection.cs
- XPathNavigator.cs
- XmlSchemaInferenceException.cs
- LockCookie.cs
- sortedlist.cs
- DataGridViewComboBoxCell.cs
- SqlTransaction.cs
- UnmanagedHandle.cs
- DeploymentExceptionMapper.cs
- IsolatedStoragePermission.cs
- Matrix3DStack.cs
- SqlBulkCopyColumnMappingCollection.cs
- Calendar.cs
- SpecialTypeDataContract.cs
- HttpDateParse.cs
- ListDictionary.cs
- SessionEndedEventArgs.cs
- HTMLTextWriter.cs
- TrackingProfileCache.cs
- ProfileGroupSettingsCollection.cs
- LineSegment.cs
- DataTableClearEvent.cs
- DeclarativeExpressionConditionDeclaration.cs
- NetSectionGroup.cs
- HostingEnvironment.cs
- BaseTreeIterator.cs
- DtdParser.cs
- FactoryId.cs
- SQLDoubleStorage.cs
- AdapterUtil.cs
- ArrayElementGridEntry.cs
- DataGridLinkButton.cs
- BufferedGraphicsContext.cs
- ToolBarPanel.cs
- OutOfProcStateClientManager.cs
- ControlIdConverter.cs
- SettingsContext.cs
- PointHitTestParameters.cs
- Collection.cs
- DbDataAdapter.cs
- XPathNavigator.cs
- FileEnumerator.cs
- MimeBasePart.cs
- HotSpotCollection.cs
- xamlnodes.cs
- DataGridAutoFormatDialog.cs
- xml.cs
- SqlCaseSimplifier.cs
- TextUtf8RawTextWriter.cs
- XmlSubtreeReader.cs
- PersonalizationState.cs
- DataTemplate.cs
- WithParamAction.cs
- UnicodeEncoding.cs
- XmlAttributeCache.cs
- GlobalizationSection.cs
- ResourceReferenceExpressionConverter.cs
- TypeInitializationException.cs
- FormsAuthenticationModule.cs
- Size3D.cs
- HtmlLink.cs
- CallbackValidatorAttribute.cs
- sqlinternaltransaction.cs
- FileChangeNotifier.cs
- LightweightCodeGenerator.cs
- ComponentEvent.cs
- ValueUnavailableException.cs
- DragEvent.cs
- CreateParams.cs
- WindowsRebar.cs
- DrawingContextDrawingContextWalker.cs
- RoutingExtension.cs
- ConstraintConverter.cs
- WindowsProgressbar.cs
- QueryContinueDragEventArgs.cs
- TagPrefixAttribute.cs
- VerificationAttribute.cs
- DesignOnlyAttribute.cs
- SiteMapProvider.cs
- TokenBasedSet.cs
- XmlComment.cs