Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Documents / TextTreeInsertUndoUnit.cs / 1 / TextTreeInsertUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertUndoUnit.cs // // Description: Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. internal class TextTreeInsertUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset and symbolCount track the offset of the inserted content // and its symbol count, respectively. internal TextTreeInsertUndoUnit(TextContainer tree, int symbolOffset, int symbolCount) : base(tree, symbolOffset) { Invariant.Assert(symbolCount > 0, "Creating no-op insert undo unit!"); _symbolCount = symbolCount; } #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; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount, LogicalDirection.Forward); this.TextContainer.DeleteContentInternal(start, end); } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols to remove. private readonly int _symbolCount; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: TextTreeInsertUndoUnit.cs // // Description: Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. internal class TextTreeInsertUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Create a new undo unit instance. // symbolOffset and symbolCount track the offset of the inserted content // and its symbol count, respectively. internal TextTreeInsertUndoUnit(TextContainer tree, int symbolOffset, int symbolCount) : base(tree, symbolOffset) { Invariant.Assert(symbolCount > 0, "Creating no-op insert undo unit!"); _symbolCount = symbolCount; } #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; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount, LogicalDirection.Forward); this.TextContainer.DeleteContentInternal(start, end); } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols to remove. private readonly int _symbolCount; #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
- SessionState.cs
- XmlSortKey.cs
- MailMessage.cs
- ClrPerspective.cs
- AttachedPropertyBrowsableAttribute.cs
- SelectionChangedEventArgs.cs
- Literal.cs
- ListManagerBindingsCollection.cs
- TileBrush.cs
- OleDbWrapper.cs
- QueryReaderSettings.cs
- AccessDataSourceView.cs
- BinaryReader.cs
- ColorTransformHelper.cs
- WebPartConnectionCollection.cs
- CodeConditionStatement.cs
- CqlGenerator.cs
- MultiPropertyDescriptorGridEntry.cs
- CodeFieldReferenceExpression.cs
- DataGridTextBox.cs
- Help.cs
- CryptoConfig.cs
- ResourceContainer.cs
- DynamicRenderer.cs
- LogAppendAsyncResult.cs
- DesignerOptions.cs
- CompareInfo.cs
- UrlPath.cs
- RuntimeHandles.cs
- Substitution.cs
- SqlTrackingWorkflowInstance.cs
- SocketInformation.cs
- TypeInitializationException.cs
- MethodRental.cs
- RsaSecurityToken.cs
- SponsorHelper.cs
- CommonServiceBehaviorElement.cs
- EntityDataSourceContainerNameConverter.cs
- DependencyProperty.cs
- MemberDescriptor.cs
- TemplatedMailWebEventProvider.cs
- HttpAsyncResult.cs
- IconEditor.cs
- OperandQuery.cs
- SqlCommandBuilder.cs
- MethodBody.cs
- TextTreeObjectNode.cs
- MethodBuilder.cs
- DataGridViewControlCollection.cs
- RegexCode.cs
- RoleManagerModule.cs
- ExtractedStateEntry.cs
- ButtonBase.cs
- OleDbParameterCollection.cs
- LocatorPart.cs
- Attributes.cs
- TextCompositionManager.cs
- StringAttributeCollection.cs
- OleDbException.cs
- TextServicesDisplayAttribute.cs
- WinFormsSecurity.cs
- SystemIPInterfaceStatistics.cs
- HttpWrapper.cs
- XmlnsCache.cs
- ManagedIStream.cs
- MediaScriptCommandRoutedEventArgs.cs
- StyleHelper.cs
- HitTestWithPointDrawingContextWalker.cs
- TogglePattern.cs
- UpdateRecord.cs
- WebPartDescription.cs
- VirtualStackFrame.cs
- GeometryModel3D.cs
- TreeNodeEventArgs.cs
- DelayDesigner.cs
- TextServicesContext.cs
- ObjectSet.cs
- AVElementHelper.cs
- ObjectIDGenerator.cs
- CodeIterationStatement.cs
- SettingsPropertyIsReadOnlyException.cs
- PersonalizableTypeEntry.cs
- MessageProtectionOrder.cs
- BinaryObjectWriter.cs
- DrawingVisual.cs
- GeneralTransformGroup.cs
- BooleanConverter.cs
- PresentationAppDomainManager.cs
- UniqueConstraint.cs
- WebBaseEventKeyComparer.cs
- ReliableOutputSessionChannel.cs
- DecoderReplacementFallback.cs
- ChangePassword.cs
- ModelFunctionTypeElement.cs
- EventSinkHelperWriter.cs
- HiddenFieldPageStatePersister.cs
- WebServicesSection.cs
- OdbcPermission.cs
- OdbcErrorCollection.cs
- WebProxyScriptElement.cs