Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommandEventArgs.cs
- XmlDictionaryReader.cs
- InteropBitmapSource.cs
- ScriptReferenceBase.cs
- arclist.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- ZipPackagePart.cs
- GeneralTransform3D.cs
- ConfigurationSchemaErrors.cs
- Block.cs
- SimpleRecyclingCache.cs
- BindingExpressionUncommonField.cs
- TextDecoration.cs
- CompoundFileStorageReference.cs
- ProxyAssemblyNotLoadedException.cs
- TimeSpanSecondsConverter.cs
- GradientBrush.cs
- _DomainName.cs
- LingerOption.cs
- SortQueryOperator.cs
- BrushConverter.cs
- ConvertTextFrag.cs
- PropertyChangeTracker.cs
- IResourceProvider.cs
- OracleInfoMessageEventArgs.cs
- EntityDataSourceDesigner.cs
- Matrix3D.cs
- Util.cs
- ApplicationSettingsBase.cs
- MetafileHeaderEmf.cs
- BitmapSourceSafeMILHandle.cs
- RecognitionEventArgs.cs
- TemplatingOptionsDialog.cs
- HtmlElementEventArgs.cs
- XmlLanguage.cs
- StylusPointPropertyId.cs
- MenuCommand.cs
- ConnectionPoint.cs
- RijndaelManagedTransform.cs
- DataSourceSelectArguments.cs
- RoleGroupCollection.cs
- ParseHttpDate.cs
- ClientBuildManager.cs
- BatchParser.cs
- ImageKeyConverter.cs
- StringFormat.cs
- HttpChannelBindingToken.cs
- BlurEffect.cs
- XmlException.cs
- ButtonRenderer.cs
- TypeConverterHelper.cs
- AuthorizationRuleCollection.cs
- SequenceQuery.cs
- DataGridViewCell.cs
- ListViewGroupItemCollection.cs
- CodeCommentStatement.cs
- StackOverflowException.cs
- Rotation3DAnimation.cs
- XmlValidatingReaderImpl.cs
- AvTraceDetails.cs
- StringUtil.cs
- QueryCursorEventArgs.cs
- SevenBitStream.cs
- Wizard.cs
- TrueReadOnlyCollection.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- PartBasedPackageProperties.cs
- EasingKeyFrames.cs
- MembershipValidatePasswordEventArgs.cs
- CodeTypeReferenceExpression.cs
- COM2PropertyDescriptor.cs
- X509ScopedServiceCertificateElementCollection.cs
- StrokeNodeOperations2.cs
- ProgressBar.cs
- LoadGrammarCompletedEventArgs.cs
- ProjectionAnalyzer.cs
- SettingsPropertyValue.cs
- TextInfo.cs
- Rijndael.cs
- SystemWebExtensionsSectionGroup.cs
- GreenMethods.cs
- CodeCommentStatement.cs
- ParameterModifier.cs
- Control.cs
- ParallelActivityDesigner.cs
- ListViewHitTestInfo.cs
- Viewport3DAutomationPeer.cs
- LineUtil.cs
- StylusLogic.cs
- SByteConverter.cs
- EncoderNLS.cs
- TreeNodeEventArgs.cs
- UidManager.cs
- MenuItem.cs
- WorkflowElementDialog.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- HtmlTableCell.cs
- RepeaterCommandEventArgs.cs
- BitmapCacheBrush.cs
- GridEntryCollection.cs