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 / 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
- SystemUdpStatistics.cs
- GlobalEventManager.cs
- ExtensibleClassFactory.cs
- SecurityTokenAuthenticator.cs
- EmptyControlCollection.cs
- GuidConverter.cs
- CannotUnloadAppDomainException.cs
- SpeakInfo.cs
- FlowDocumentPage.cs
- ConfigurationValidatorBase.cs
- HttpFileCollectionWrapper.cs
- NavigationEventArgs.cs
- XmlTypeAttribute.cs
- QueryRewriter.cs
- RouteTable.cs
- SchemaCollectionPreprocessor.cs
- HttpListener.cs
- DiscoveryServiceExtension.cs
- XmlAttributeAttribute.cs
- TiffBitmapDecoder.cs
- Vector3dCollection.cs
- TdsParameterSetter.cs
- securitymgrsite.cs
- Pool.cs
- Int16.cs
- returneventsaver.cs
- SchemaInfo.cs
- Lookup.cs
- CodeDOMUtility.cs
- XmlSchemaResource.cs
- webeventbuffer.cs
- DataRecordInfo.cs
- SqlConnectionHelper.cs
- XmlElement.cs
- OrthographicCamera.cs
- RichTextBoxAutomationPeer.cs
- SafeHandles.cs
- ControllableStoryboardAction.cs
- DetailsViewPageEventArgs.cs
- Expressions.cs
- ColorAnimationBase.cs
- SafeSecurityHandles.cs
- ProfileService.cs
- DBCSCodePageEncoding.cs
- BinaryReader.cs
- CookieProtection.cs
- Avt.cs
- TextBlock.cs
- DataBindingHandlerAttribute.cs
- WebResourceAttribute.cs
- Triangle.cs
- BitmapEffectInputData.cs
- Adorner.cs
- BamlLocalizableResourceKey.cs
- IISUnsafeMethods.cs
- StreamDocument.cs
- WebBrowserNavigatingEventHandler.cs
- FileInfo.cs
- MetadataItemEmitter.cs
- HttpContextBase.cs
- ParagraphVisual.cs
- TypeLibConverter.cs
- SqlMethodTransformer.cs
- CqlBlock.cs
- LocationUpdates.cs
- login.cs
- WindowsComboBox.cs
- Rotation3DAnimationBase.cs
- Msec.cs
- BuildManagerHost.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- TCEAdapterGenerator.cs
- ProxyAttribute.cs
- DropSource.cs
- CompilerTypeWithParams.cs
- BinaryUtilClasses.cs
- ThreadInterruptedException.cs
- UniqueIdentifierService.cs
- PersonalizationDictionary.cs
- ZipIOCentralDirectoryBlock.cs
- BitStack.cs
- EraserBehavior.cs
- WebColorConverter.cs
- CustomTypeDescriptor.cs
- Label.cs
- GridEntry.cs
- FillErrorEventArgs.cs
- XsltContext.cs
- TreeNodeBinding.cs
- PackagePartCollection.cs
- MultipleViewPattern.cs
- DocobjHost.cs
- DifferencingCollection.cs
- RequestResizeEvent.cs
- NativeWindow.cs
- DesignerDataParameter.cs
- AuthenticationModulesSection.cs
- _AutoWebProxyScriptWrapper.cs
- SemaphoreSecurity.cs
- FaultFormatter.cs