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
- ICspAsymmetricAlgorithm.cs
- TargetConverter.cs
- PriorityQueue.cs
- xmlfixedPageInfo.cs
- WindowsButton.cs
- TextServicesHost.cs
- BindingListCollectionView.cs
- GeneralTransform3DGroup.cs
- mediaeventshelper.cs
- UInt16Storage.cs
- LicenseException.cs
- MembershipUser.cs
- PassportAuthentication.cs
- XmlSchemaCollection.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- InputMethodStateTypeInfo.cs
- SessionState.cs
- WebPartsSection.cs
- QilCloneVisitor.cs
- ApplicationContext.cs
- WindowPattern.cs
- XPathPatternParser.cs
- TypeBuilder.cs
- WebAdminConfigurationHelper.cs
- ConfigXmlComment.cs
- SiteMapDesignerDataSourceView.cs
- CornerRadius.cs
- ADConnectionHelper.cs
- GlyphRunDrawing.cs
- ConnectionProviderAttribute.cs
- StateWorkerRequest.cs
- TreeWalkHelper.cs
- PerSessionInstanceContextProvider.cs
- ServicePointManager.cs
- XmlNamespaceMapping.cs
- DataGridViewColumnConverter.cs
- PreservationFileWriter.cs
- QueryCacheKey.cs
- DebugView.cs
- EvidenceBase.cs
- PackagePartCollection.cs
- NotFiniteNumberException.cs
- FixedBufferAttribute.cs
- CodeTypeOfExpression.cs
- PersonalizationProvider.cs
- RuleConditionDialog.Designer.cs
- UIElementAutomationPeer.cs
- BitmapSourceSafeMILHandle.cs
- DesignBindingConverter.cs
- MultiByteCodec.cs
- ProvideValueServiceProvider.cs
- mediaclock.cs
- TemplateComponentConnector.cs
- MaskedTextBox.cs
- Attachment.cs
- RelatedPropertyManager.cs
- MemoryFailPoint.cs
- XmlRawWriterWrapper.cs
- ToolboxItemCollection.cs
- RegisteredArrayDeclaration.cs
- DefaultBinder.cs
- CmsInterop.cs
- XmlUtil.cs
- WebPartMenuStyle.cs
- DefaultBinder.cs
- CodeMemberProperty.cs
- WebZone.cs
- cryptoapiTransform.cs
- StrongNamePublicKeyBlob.cs
- XmlSchemaProviderAttribute.cs
- GridSplitterAutomationPeer.cs
- RankException.cs
- HandledEventArgs.cs
- RefreshPropertiesAttribute.cs
- GridViewUpdatedEventArgs.cs
- SimpleWebHandlerParser.cs
- CustomAttributeSerializer.cs
- Point3DAnimationBase.cs
- DetailsViewDeletedEventArgs.cs
- ExceptionRoutedEventArgs.cs
- SvcMapFileSerializer.cs
- ParseNumbers.cs
- MetaTableHelper.cs
- WebPartDisplayModeEventArgs.cs
- MultiDataTrigger.cs
- BinaryFormatterWriter.cs
- ActivationArguments.cs
- PrimitiveCodeDomSerializer.cs
- ConfigurationValues.cs
- UnicodeEncoding.cs
- UrlAuthFailedErrorFormatter.cs
- MailHeaderInfo.cs
- DeviceContext.cs
- ContentType.cs
- StatusBar.cs
- SQLChars.cs
- NavigationProperty.cs
- LongMinMaxAggregationOperator.cs
- FullTextBreakpoint.cs
- OledbConnectionStringbuilder.cs