Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- HttpCacheVaryByContentEncodings.cs
- ToolBarPanel.cs
- WebPartDescription.cs
- SessionStateContainer.cs
- DbParameterHelper.cs
- SecurityKeyEntropyMode.cs
- RoutingChannelExtension.cs
- XmlProcessingInstruction.cs
- CompareValidator.cs
- Visual3DCollection.cs
- listitem.cs
- CustomErrorsSection.cs
- AddressUtility.cs
- NotSupportedException.cs
- EventToken.cs
- ReadOnlyNameValueCollection.cs
- HierarchicalDataBoundControl.cs
- WorkflowMarkupSerializerMapping.cs
- DocumentViewerConstants.cs
- TemplatedWizardStep.cs
- ScriptMethodAttribute.cs
- BinaryWriter.cs
- PersonalizationAdministration.cs
- XmlNodeChangedEventArgs.cs
- ContentPlaceHolder.cs
- CodeArgumentReferenceExpression.cs
- OleDbWrapper.cs
- Operand.cs
- StringArrayConverter.cs
- ILGenerator.cs
- GradientStopCollection.cs
- TreeBuilder.cs
- ImagingCache.cs
- SqlInternalConnectionSmi.cs
- XmlUtf8RawTextWriter.cs
- TextServicesCompartmentContext.cs
- ComEventsHelper.cs
- CollectionBase.cs
- ResourceManagerWrapper.cs
- FlowLayoutPanel.cs
- PopOutPanel.cs
- ElementMarkupObject.cs
- PlanCompiler.cs
- TextEmbeddedObject.cs
- AdRotator.cs
- SuppressIldasmAttribute.cs
- ResolveDuplex11AsyncResult.cs
- UndoEngine.cs
- WindowsPen.cs
- PlanCompiler.cs
- ListViewTableCell.cs
- SqlTrackingWorkflowInstance.cs
- TokenBasedSetEnumerator.cs
- TypeBuilderInstantiation.cs
- SafeEventLogWriteHandle.cs
- BufferBuilder.cs
- SqlDataRecord.cs
- EntryIndex.cs
- COM2FontConverter.cs
- recordstatescratchpad.cs
- SecurityPermission.cs
- AspNetHostingPermission.cs
- NumericExpr.cs
- BrowserCapabilitiesCompiler.cs
- XmlUtf8RawTextWriter.cs
- SqlTriggerAttribute.cs
- FormsAuthentication.cs
- JournalEntryStack.cs
- Point.cs
- Separator.cs
- BuildProvider.cs
- ThumbAutomationPeer.cs
- CombinedHttpChannel.cs
- ObfuscateAssemblyAttribute.cs
- ExpressionHelper.cs
- SystemWebExtensionsSectionGroup.cs
- PartialCachingControl.cs
- XmlSerializationReader.cs
- UniqueEventHelper.cs
- MobileControlPersister.cs
- RoutedPropertyChangedEventArgs.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SymDocumentType.cs
- _ScatterGatherBuffers.cs
- NotifyCollectionChangedEventArgs.cs
- Context.cs
- AsyncCompletedEventArgs.cs
- ProtocolsConfigurationHandler.cs
- PropertyPathWorker.cs
- PropertyCollection.cs
- CorrelationManager.cs
- DispatcherObject.cs
- XmlNamedNodeMap.cs
- RenderOptions.cs
- EditingCoordinator.cs
- GenericArgumentsUpdater.cs
- ObjectCloneHelper.cs
- Gdiplus.cs
- FixedPosition.cs
- TextEditorLists.cs