Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / TextTreeInsertUndoUnit.cs / 1305600 / TextTreeInsertUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertUndoUnit.cs // // Description: Undo unit for TextContainer.InsertText and InsertEmbeddedObject calls. // // History: // 03/03/2004 : [....] - 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 : [....] - 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
- TranslateTransform3D.cs
- UpdateException.cs
- TextureBrush.cs
- VBIdentifierTrimConverter.cs
- OdbcConnectionFactory.cs
- DbParameterCollection.cs
- UnsupportedPolicyOptionsException.cs
- TimeZoneNotFoundException.cs
- OrthographicCamera.cs
- StateMachineHistory.cs
- GregorianCalendar.cs
- CorrelationTokenInvalidatedHandler.cs
- ColorConverter.cs
- Compilation.cs
- InstanceContext.cs
- configsystem.cs
- MultiBindingExpression.cs
- TypeUsageBuilder.cs
- ProcessInputEventArgs.cs
- DetailsViewUpdateEventArgs.cs
- SqlFacetAttribute.cs
- GlyphRun.cs
- TextPointer.cs
- BulletedListEventArgs.cs
- DropShadowBitmapEffect.cs
- PowerStatus.cs
- CellTreeSimplifier.cs
- ICspAsymmetricAlgorithm.cs
- ContentPosition.cs
- AudioException.cs
- StringResourceManager.cs
- NameSpaceEvent.cs
- FilteredAttributeCollection.cs
- StringToken.cs
- XmlReflectionImporter.cs
- ToolStripLabel.cs
- TranslateTransform.cs
- Geometry3D.cs
- WebPartDeleteVerb.cs
- ALinqExpressionVisitor.cs
- DiscoveryCallbackBehavior.cs
- ProgressBarHighlightConverter.cs
- InkSerializer.cs
- SqlDataSource.cs
- DbTransaction.cs
- FixedPageProcessor.cs
- SqlTopReducer.cs
- MappingModelBuildProvider.cs
- SplitterCancelEvent.cs
- GACIdentityPermission.cs
- ProgramPublisher.cs
- SecurityStandardsManager.cs
- Tracking.cs
- DesignerCommandAdapter.cs
- TextSelection.cs
- DataGridTablesFactory.cs
- TimelineGroup.cs
- AdapterUtil.cs
- TogglePattern.cs
- RootAction.cs
- SingleKeyFrameCollection.cs
- SoapMessage.cs
- _ConnectOverlappedAsyncResult.cs
- XmlDataSourceDesigner.cs
- DbConnectionPoolOptions.cs
- TypeDescriptor.cs
- DesignerDataColumn.cs
- SkinIDTypeConverter.cs
- EntityKey.cs
- PerformanceCounter.cs
- HwndSourceParameters.cs
- PriorityChain.cs
- TemplateNodeContextMenu.cs
- FormViewModeEventArgs.cs
- DoubleCollection.cs
- InstanceCreationEditor.cs
- TimeSpanMinutesConverter.cs
- RegisteredArrayDeclaration.cs
- WebBrowserNavigatedEventHandler.cs
- DetailsViewUpdateEventArgs.cs
- ZoneButton.cs
- PersonalizationProviderHelper.cs
- MessageQueueConverter.cs
- SqlInternalConnectionTds.cs
- StreamWithDictionary.cs
- SRDisplayNameAttribute.cs
- CatalogZoneBase.cs
- KeyEventArgs.cs
- InvariantComparer.cs
- XmlAnyElementAttributes.cs
- SiteMapHierarchicalDataSourceView.cs
- StackBuilderSink.cs
- ProcessModule.cs
- HuffmanTree.cs
- StyleSheetDesigner.cs
- ColumnCollection.cs
- Rect3DConverter.cs
- DataBinder.cs
- SqlBuilder.cs
- XmlSchemaSimpleContentExtension.cs