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
- MsmqAppDomainProtocolHandler.cs
- HierarchicalDataBoundControlAdapter.cs
- CacheSection.cs
- GridViewDeleteEventArgs.cs
- Brush.cs
- ModelServiceImpl.cs
- PenLineCapValidation.cs
- DirectionalAction.cs
- TimelineGroup.cs
- CfgArc.cs
- DataFormats.cs
- UriSection.cs
- TypeSemantics.cs
- CursorInteropHelper.cs
- DependencyPropertyKey.cs
- HttpProfileGroupBase.cs
- XmlSchemaGroup.cs
- StringStorage.cs
- Stack.cs
- SafeNativeMethodsMilCoreApi.cs
- GenericEnumerator.cs
- XmlEncodedRawTextWriter.cs
- ProvidersHelper.cs
- EntityClassGenerator.cs
- Rect3DValueSerializer.cs
- Attributes.cs
- ElementsClipboardData.cs
- XmlWrappingWriter.cs
- Buffer.cs
- SynchronousChannelMergeEnumerator.cs
- ImportedPolicyConversionContext.cs
- Visual3D.cs
- ScrollBarAutomationPeer.cs
- DataServiceQueryException.cs
- PlanCompiler.cs
- LinqDataSourceEditData.cs
- iisPickupDirectory.cs
- Binding.cs
- InstanceNameConverter.cs
- _ScatterGatherBuffers.cs
- OdbcFactory.cs
- MimeWriter.cs
- AnimationClock.cs
- PriorityQueue.cs
- UiaCoreApi.cs
- DecoderFallback.cs
- CircleEase.cs
- Page.cs
- RootBuilder.cs
- ValuePattern.cs
- RootAction.cs
- WebConvert.cs
- InternalConfigHost.cs
- Trace.cs
- CallSiteOps.cs
- WindowsFont.cs
- KernelTypeValidation.cs
- ContainerUtilities.cs
- DocumentOrderQuery.cs
- LoginDesignerUtil.cs
- ISO2022Encoding.cs
- SystemTcpStatistics.cs
- ParseHttpDate.cs
- WebPart.cs
- XmlSchemaProviderAttribute.cs
- NotImplementedException.cs
- DataGridViewCellCancelEventArgs.cs
- OdbcConnectionString.cs
- ConfigurationStrings.cs
- QueryReaderSettings.cs
- FixedPageStructure.cs
- SettingsPropertyIsReadOnlyException.cs
- VirtualPath.cs
- safePerfProviderHandle.cs
- StandardTransformFactory.cs
- SubstitutionList.cs
- RenderData.cs
- XMLSchema.cs
- DefaultTextStoreTextComposition.cs
- DesignerForm.cs
- DeviceContext2.cs
- SweepDirectionValidation.cs
- WithParamAction.cs
- StringConverter.cs
- LinqExpressionNormalizer.cs
- CheckBox.cs
- ModuleElement.cs
- DataColumnSelectionConverter.cs
- TabRenderer.cs
- CqlIdentifiers.cs
- IndexedDataBuffer.cs
- NullableDoubleMinMaxAggregationOperator.cs
- ProfileSettingsCollection.cs
- ThumbButtonInfo.cs
- PolicyException.cs
- ColorConverter.cs
- GeneralTransform2DTo3DTo2D.cs
- NewExpression.cs
- SimpleHandlerBuildProvider.cs
- HttpBrowserCapabilitiesBase.cs