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
- KeyPressEvent.cs
- QuestionEventArgs.cs
- StorageEndPropertyMapping.cs
- DataBindingCollection.cs
- WrappedIUnknown.cs
- PermissionRequestEvidence.cs
- CachedFontFamily.cs
- Run.cs
- Transform3DGroup.cs
- WarningException.cs
- _AutoWebProxyScriptEngine.cs
- PropertyContainer.cs
- ValueUtilsSmi.cs
- AsyncOperationManager.cs
- SecurityHeaderTokenResolver.cs
- RetrieveVirtualItemEventArgs.cs
- FlagsAttribute.cs
- BehaviorDragDropEventArgs.cs
- OleDbError.cs
- TextEditorParagraphs.cs
- DocumentXmlWriter.cs
- WebRequestModuleElement.cs
- TimeZone.cs
- XmlSchemaObject.cs
- Int16AnimationUsingKeyFrames.cs
- ProviderUtil.cs
- ToolBarButtonClickEvent.cs
- FormsAuthenticationUser.cs
- TimeSpanFormat.cs
- SerialErrors.cs
- ServiceMetadataPublishingElement.cs
- InputLangChangeRequestEvent.cs
- DataGridViewAddColumnDialog.cs
- DataSetUtil.cs
- AvTraceFormat.cs
- LinqDataSourceSelectEventArgs.cs
- StyleHelper.cs
- TimeSpanOrInfiniteValidator.cs
- SqlTrackingWorkflowInstance.cs
- DetailsViewUpdateEventArgs.cs
- WebHttpSecurityElement.cs
- CodeAttachEventStatement.cs
- ByteKeyFrameCollection.cs
- assertwrapper.cs
- ConvertersCollection.cs
- Privilege.cs
- AutomationIdentifier.cs
- Documentation.cs
- SizeChangedEventArgs.cs
- FacetDescription.cs
- AspProxy.cs
- TypeSystem.cs
- PeerNameRecord.cs
- RMEnrollmentPage2.cs
- RSAOAEPKeyExchangeFormatter.cs
- UnsafeCollabNativeMethods.cs
- DistributedTransactionPermission.cs
- FixedStringLookup.cs
- IntranetCredentialPolicy.cs
- HostAdapter.cs
- FormatterServices.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- DataTableClearEvent.cs
- Lease.cs
- AuthenticationService.cs
- StateBag.cs
- ButtonBase.cs
- TailCallAnalyzer.cs
- ArrayExtension.cs
- XmlIlVisitor.cs
- CheckBoxStandardAdapter.cs
- StyleTypedPropertyAttribute.cs
- OptimizedTemplateContentHelper.cs
- ReturnValue.cs
- ListItem.cs
- ColumnPropertiesGroup.cs
- OrderedDictionary.cs
- DrawListViewSubItemEventArgs.cs
- StickyNoteAnnotations.cs
- ServicesUtilities.cs
- PointAnimationUsingPath.cs
- XmlSchemaObjectCollection.cs
- WindowsTitleBar.cs
- MethodExpression.cs
- OperationContextScope.cs
- QueryCacheManager.cs
- RayHitTestParameters.cs
- PtsPage.cs
- ExpressionPrinter.cs
- TypeKeyValue.cs
- DesignerVerbCollection.cs
- LayoutUtils.cs
- ProviderBase.cs
- StrokeNodeOperations2.cs
- Deflater.cs
- SystemGatewayIPAddressInformation.cs
- DataBindingCollection.cs
- GifBitmapEncoder.cs
- TableSectionStyle.cs
- ApplicationManager.cs