Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ListBoxItemWrapperAutomationPeer.cs
- ApplicationActivator.cs
- ComponentCollection.cs
- SpecularMaterial.cs
- TextEncodedRawTextWriter.cs
- DataGridViewAutoSizeModeEventArgs.cs
- DataBinding.cs
- StateMachineSubscription.cs
- SequentialOutput.cs
- ComponentEditorForm.cs
- GlyphCache.cs
- AtlasWeb.Designer.cs
- Button.cs
- TextServicesDisplayAttributePropertyRanges.cs
- QilLoop.cs
- DateTimeAutomationPeer.cs
- WriteableOnDemandPackagePart.cs
- UIPermission.cs
- CodeLabeledStatement.cs
- FileDialog.cs
- DiagnosticTrace.cs
- Trace.cs
- UserCancellationException.cs
- ConnectionPoolManager.cs
- PolyLineSegment.cs
- TreeWalker.cs
- EncoderExceptionFallback.cs
- PartialCachingAttribute.cs
- ControlPaint.cs
- SolidColorBrush.cs
- MenuItem.cs
- SoapDocumentServiceAttribute.cs
- COM2PropertyDescriptor.cs
- CellTreeNode.cs
- PackageRelationshipCollection.cs
- RoleManagerEventArgs.cs
- CqlErrorHelper.cs
- CodeThrowExceptionStatement.cs
- DeferredSelectedIndexReference.cs
- WebPartConnectionsCancelEventArgs.cs
- DataGridViewComponentPropertyGridSite.cs
- ExcCanonicalXml.cs
- CompositeControl.cs
- FilePresentation.cs
- SystemColors.cs
- CellRelation.cs
- CookieParameter.cs
- PersistChildrenAttribute.cs
- TagPrefixInfo.cs
- SecurityImpersonationBehavior.cs
- ServerValidateEventArgs.cs
- RuntimeConfigurationRecord.cs
- GeometryModel3D.cs
- Compiler.cs
- BindingBase.cs
- Int16KeyFrameCollection.cs
- HtmlHistory.cs
- NumericPagerField.cs
- ResolveNameEventArgs.cs
- ProxyManager.cs
- SourceInterpreter.cs
- WebPartEditVerb.cs
- BufferedGraphics.cs
- DesignTimeVisibleAttribute.cs
- ToolStripSystemRenderer.cs
- BamlResourceContent.cs
- Random.cs
- WebPartDisplayModeEventArgs.cs
- NamedPipeActivation.cs
- SqlUnionizer.cs
- ExpandCollapsePattern.cs
- DataGridViewRowsAddedEventArgs.cs
- EventWaitHandleSecurity.cs
- ContainerFilterService.cs
- DataGridRelationshipRow.cs
- DefaultTextStoreTextComposition.cs
- PathParser.cs
- Viewport2DVisual3D.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- DataGridViewSelectedColumnCollection.cs
- CellParaClient.cs
- JournalEntryStack.cs
- Qualifier.cs
- DbProviderConfigurationHandler.cs
- XMLSyntaxException.cs
- ListViewAutomationPeer.cs
- LocationReferenceValue.cs
- IsolatedStorageFilePermission.cs
- Directory.cs
- CriticalFinalizerObject.cs
- IItemProperties.cs
- FrameworkContentElementAutomationPeer.cs
- ColorConvertedBitmapExtension.cs
- ApplicationManager.cs
- ListViewGroup.cs
- SmtpCommands.cs
- BufferedWebEventProvider.cs
- XmlSchemaIdentityConstraint.cs
- TextPenaltyModule.cs
- IfAction.cs