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
- Transform3DGroup.cs
- XmlReader.cs
- SolidColorBrush.cs
- DrawItemEvent.cs
- RegionIterator.cs
- ContentPropertyAttribute.cs
- AncestorChangedEventArgs.cs
- RtfNavigator.cs
- newitemfactory.cs
- CheckBoxStandardAdapter.cs
- AnnouncementEndpoint.cs
- RecognizedAudio.cs
- PreProcessor.cs
- odbcmetadatacolumnnames.cs
- HttpWebResponse.cs
- BufferAllocator.cs
- NavigationService.cs
- DataGridViewRowStateChangedEventArgs.cs
- Vector3D.cs
- XmlDocumentFragment.cs
- hwndwrapper.cs
- _TransmitFileOverlappedAsyncResult.cs
- Point4D.cs
- WindowsSecurityToken.cs
- XmlChildNodes.cs
- ImageSourceValueSerializer.cs
- Empty.cs
- MouseButton.cs
- Pkcs7Signer.cs
- Funcletizer.cs
- ChannelToken.cs
- LinqDataSourceHelper.cs
- linebase.cs
- ExpandCollapseProviderWrapper.cs
- MdbDataFileEditor.cs
- NumberSubstitution.cs
- XmlSchemaElement.cs
- InstalledVoice.cs
- SmtpSection.cs
- EntityUtil.cs
- NameValuePermission.cs
- NativeWrapper.cs
- IncrementalReadDecoders.cs
- Errors.cs
- ProfileManager.cs
- TraceSection.cs
- DataContractSet.cs
- DirectionalLight.cs
- XPathMessageFilter.cs
- ComboBoxAutomationPeer.cs
- MimePart.cs
- OSFeature.cs
- FixedSOMLineCollection.cs
- KeyTimeConverter.cs
- FieldCollectionEditor.cs
- RemotingHelper.cs
- _CacheStreams.cs
- DtdParser.cs
- SizeChangedInfo.cs
- ToolStripPanelDesigner.cs
- CoreSwitches.cs
- ProgressBar.cs
- MenuCommandsChangedEventArgs.cs
- DynamicPropertyHolder.cs
- ObjectReferenceStack.cs
- RijndaelManagedTransform.cs
- ContractValidationHelper.cs
- CompilerState.cs
- BamlResourceContent.cs
- SiteMapProvider.cs
- JavaScriptSerializer.cs
- ProviderConnectionPointCollection.cs
- DataSpaceManager.cs
- DynamicILGenerator.cs
- ScriptReferenceEventArgs.cs
- UIElementIsland.cs
- XmlILStorageConverter.cs
- ImageListUtils.cs
- SynchronizationHandlesCodeDomSerializer.cs
- ListControlBuilder.cs
- UIElement3DAutomationPeer.cs
- ColorConverter.cs
- EntityCommand.cs
- ControlUtil.cs
- CompilerTypeWithParams.cs
- ActiveDocumentEvent.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- MultipleCopiesCollection.cs
- ObjectDisposedException.cs
- CuspData.cs
- SEHException.cs
- CalendarKeyboardHelper.cs
- NameSpaceExtractor.cs
- AdornerPresentationContext.cs
- ToolBarButton.cs
- KeyPullup.cs
- RandomNumberGenerator.cs
- FixedPosition.cs
- PrePostDescendentsWalker.cs
- X509Certificate2.cs