Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- PropertyGridEditorPart.cs
- XmlSchemaSearchPattern.cs
- WpfMemberInvoker.cs
- OuterGlowBitmapEffect.cs
- Positioning.cs
- CachedBitmap.cs
- GrammarBuilderWildcard.cs
- GlyphElement.cs
- MarshalDirectiveException.cs
- ConnectionProviderAttribute.cs
- DataGridColumn.cs
- OleDbPropertySetGuid.cs
- BitmapEffectInputConnector.cs
- TrackingDataItemValue.cs
- RefExpr.cs
- MarginsConverter.cs
- SqlUDTStorage.cs
- ProfilePropertyMetadata.cs
- FontDifferentiator.cs
- TextMarkerSource.cs
- NativeRecognizer.cs
- LoginDesignerUtil.cs
- wgx_sdk_version.cs
- SqlAliasesReferenced.cs
- Emitter.cs
- FormsAuthenticationTicket.cs
- SqlUdtInfo.cs
- TriggerBase.cs
- CodeAttributeDeclaration.cs
- UseLicense.cs
- ServiceDesigner.cs
- ObjectKeyFrameCollection.cs
- RuntimeHelpers.cs
- ResourceReferenceKeyNotFoundException.cs
- MeasureItemEvent.cs
- IsolatedStorageFile.cs
- MarginsConverter.cs
- Exceptions.cs
- MenuEventArgs.cs
- ScriptResourceAttribute.cs
- CmsUtils.cs
- CollectionViewSource.cs
- OdbcParameterCollection.cs
- QilTernary.cs
- OrderedDictionaryStateHelper.cs
- TrackBarRenderer.cs
- SmtpAuthenticationManager.cs
- DynamicRendererThreadManager.cs
- CryptoProvider.cs
- ExpressionList.cs
- DecoderFallback.cs
- LineVisual.cs
- ObjectResult.cs
- OuterGlowBitmapEffect.cs
- DifferencingCollection.cs
- ConnectionInterfaceCollection.cs
- ToolBarOverflowPanel.cs
- NavigationWindow.cs
- storepermission.cs
- RepeaterCommandEventArgs.cs
- VisualBrush.cs
- BufferedGraphics.cs
- UITypeEditor.cs
- KeyValueConfigurationCollection.cs
- DelegatedStream.cs
- Page.cs
- DispatchProxy.cs
- XmlSchemaSimpleTypeUnion.cs
- Enumerable.cs
- RegexRunnerFactory.cs
- SiteMapNodeCollection.cs
- ProfileManager.cs
- InvalidOleVariantTypeException.cs
- PropertyTabAttribute.cs
- WebDescriptionAttribute.cs
- MailAddress.cs
- ReservationCollection.cs
- PaperSize.cs
- DesignerSerializerAttribute.cs
- ShowExpandedMultiValueConverter.cs
- XPathScanner.cs
- TransformerInfo.cs
- EntityModelSchemaGenerator.cs
- WebBrowserSiteBase.cs
- ConfigurationLockCollection.cs
- QueueProcessor.cs
- ACL.cs
- ShowExpandedMultiValueConverter.cs
- SystemThemeKey.cs
- CodeExporter.cs
- QueryCursorEventArgs.cs
- _LocalDataStoreMgr.cs
- XmlSchemaSimpleContentExtension.cs
- _ProxyRegBlob.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SimpleApplicationHost.cs
- NetworkAddressChange.cs
- ValidationSummary.cs
- ServerValidateEventArgs.cs
- XamlSerializer.cs