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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Command.cs
- ReliableChannelBinder.cs
- figurelengthconverter.cs
- __Error.cs
- SignedXml.cs
- LZCodec.cs
- TextLineBreak.cs
- ScriptRegistrationManager.cs
- MediaPlayer.cs
- TreeNodeMouseHoverEvent.cs
- ByteStreamMessageEncoderFactory.cs
- DownloadProgressEventArgs.cs
- rsa.cs
- RelationshipConverter.cs
- ViewManager.cs
- Converter.cs
- SeparatorAutomationPeer.cs
- MenuAdapter.cs
- AssertHelper.cs
- Matrix3DStack.cs
- PolicyStatement.cs
- IntPtr.cs
- ObsoleteAttribute.cs
- GridViewSelectEventArgs.cs
- TextChangedEventArgs.cs
- SafeTimerHandle.cs
- PersistenceProviderDirectory.cs
- EmbossBitmapEffect.cs
- IISUnsafeMethods.cs
- SqlBuilder.cs
- ModelItemCollection.cs
- TextParentUndoUnit.cs
- DiagnosticsConfiguration.cs
- HealthMonitoringSectionHelper.cs
- CurrencyWrapper.cs
- Codec.cs
- DisplayInformation.cs
- ChannelSinkStacks.cs
- SimplePropertyEntry.cs
- EndpointInfo.cs
- DataSourceNameHandler.cs
- ReachBasicContext.cs
- NumberSubstitution.cs
- XamlRtfConverter.cs
- BufferedWebEventProvider.cs
- AppSecurityManager.cs
- precedingquery.cs
- ColorAnimationBase.cs
- VersionedStream.cs
- InternalControlCollection.cs
- ArgumentException.cs
- InterleavedZipPartStream.cs
- AutomationIdentifier.cs
- CanExecuteRoutedEventArgs.cs
- PerspectiveCamera.cs
- DocobjHost.cs
- CookieParameter.cs
- HwndProxyElementProvider.cs
- CountAggregationOperator.cs
- ExternalCalls.cs
- XmlSchemaImport.cs
- ListViewInsertionMark.cs
- DataRowChangeEvent.cs
- CapiSafeHandles.cs
- CodeGeneratorOptions.cs
- ControlPager.cs
- RoutedCommand.cs
- DataGridViewControlCollection.cs
- QilGeneratorEnv.cs
- ValidatorCompatibilityHelper.cs
- WindowCollection.cs
- AddInControllerImpl.cs
- ActionFrame.cs
- FaultContext.cs
- AddInControllerImpl.cs
- HandlerMappingMemo.cs
- AdornerDecorator.cs
- TreeViewDataItemAutomationPeer.cs
- BindingList.cs
- VScrollBar.cs
- WebPartActionVerb.cs
- XPathException.cs
- MruCache.cs
- NameNode.cs
- SqlEnums.cs
- JapaneseLunisolarCalendar.cs
- BoundColumn.cs
- ToolStrip.cs
- NativeMethods.cs
- Bidi.cs
- Int64Converter.cs
- DocumentApplicationState.cs
- TableColumn.cs
- SafeRegistryHandle.cs
- X509UI.cs
- CompatibleIComparer.cs
- TextBoxView.cs
- Subtract.cs
- BooleanExpr.cs
- ImageButton.cs