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
- PenThread.cs
- QueryOptionExpression.cs
- FrameworkElement.cs
- RegionInfo.cs
- SectionXmlInfo.cs
- GridItemProviderWrapper.cs
- LinqDataSourceSelectEventArgs.cs
- OletxResourceManager.cs
- BinaryObjectInfo.cs
- Parallel.cs
- EncryptedPackage.cs
- MissingMemberException.cs
- MarkedHighlightComponent.cs
- MethodBody.cs
- Model3D.cs
- ConditionValidator.cs
- MenuAdapter.cs
- TextServicesProperty.cs
- FatalException.cs
- ParserStreamGeometryContext.cs
- XmlSchemaComplexContent.cs
- PackWebRequestFactory.cs
- Label.cs
- CompositionAdorner.cs
- DesignerOptionService.cs
- ReferentialConstraint.cs
- Base64Stream.cs
- XmlException.cs
- EUCJPEncoding.cs
- GCHandleCookieTable.cs
- TypeLibConverter.cs
- ClientBuildManagerCallback.cs
- CaretElement.cs
- DBCommandBuilder.cs
- SharedHttpTransportManager.cs
- DESCryptoServiceProvider.cs
- SettingsSavedEventArgs.cs
- ClientTargetSection.cs
- PrimitiveSchema.cs
- NamespaceList.cs
- SubMenuStyle.cs
- XPathSelfQuery.cs
- ObjectQueryExecutionPlan.cs
- OutputCacheSettingsSection.cs
- XsdBuilder.cs
- SourceLocationProvider.cs
- ConsumerConnectionPointCollection.cs
- HtmlTableRowCollection.cs
- TraceHwndHost.cs
- HtmlAnchor.cs
- FastEncoderStatics.cs
- SqlCommand.cs
- ConfigurationManagerHelperFactory.cs
- ObjectDataSourceSelectingEventArgs.cs
- ColumnClickEvent.cs
- Utils.cs
- EllipseGeometry.cs
- StatusStrip.cs
- ScriptResourceMapping.cs
- ISAPIApplicationHost.cs
- AbsoluteQuery.cs
- Matrix3D.cs
- ScaleTransform.cs
- CompareValidator.cs
- PaintValueEventArgs.cs
- StreamGeometryContext.cs
- MergeFilterQuery.cs
- TransformationRules.cs
- ImportOptions.cs
- TableCellAutomationPeer.cs
- ResourceWriter.cs
- DirectoryObjectSecurity.cs
- ParallelTimeline.cs
- x509store.cs
- DataGridColumnCollection.cs
- ProfileInfo.cs
- ListViewEditEventArgs.cs
- ChildrenQuery.cs
- MethodBuilder.cs
- Flattener.cs
- SerializationIncompleteException.cs
- AndCondition.cs
- RegexMatchCollection.cs
- securitycriticaldata.cs
- SafeIUnknown.cs
- QilTargetType.cs
- Exceptions.cs
- SQLBinaryStorage.cs
- PerformanceCountersElement.cs
- Encoder.cs
- UnsafeNativeMethods.cs
- DataObjectFieldAttribute.cs
- CompareInfo.cs
- ReferenceAssemblyAttribute.cs
- QueryExpr.cs
- LoadWorkflowCommand.cs
- DbConnectionPool.cs
- FileBasedResourceGroveler.cs
- FindCriteriaApril2005.cs
- GraphicsContainer.cs