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
- XmlValidatingReaderImpl.cs
- AlternationConverter.cs
- FixedSOMElement.cs
- FormView.cs
- DrawingVisualDrawingContext.cs
- GridViewCancelEditEventArgs.cs
- SplitterEvent.cs
- ObjectQueryExecutionPlan.cs
- SQLBytesStorage.cs
- ActivityPropertyReference.cs
- SqlHelper.cs
- SqlRecordBuffer.cs
- IntPtr.cs
- UInt16Storage.cs
- SecureUICommand.cs
- StructuralCache.cs
- ListenerChannelContext.cs
- SafeNativeMethods.cs
- ReadContentAsBinaryHelper.cs
- LogRestartAreaEnumerator.cs
- ExtendedPropertiesHandler.cs
- RenamedEventArgs.cs
- InstancePersistenceCommandException.cs
- OutputCacheModule.cs
- DbParameterHelper.cs
- PropagatorResult.cs
- ByValueEqualityComparer.cs
- SafeSecurityHandles.cs
- ComUdtElementCollection.cs
- WindowsBrush.cs
- SmiSettersStream.cs
- CallSiteBinder.cs
- ResourceSet.cs
- ColorBlend.cs
- RegisteredScript.cs
- Size3DValueSerializer.cs
- DateTimeParse.cs
- DotExpr.cs
- CodeTypeDeclaration.cs
- NonBatchDirectoryCompiler.cs
- QueueProcessor.cs
- XsltLibrary.cs
- Pool.cs
- InkPresenterAutomationPeer.cs
- CodeExporter.cs
- EventProviderWriter.cs
- ViewPort3D.cs
- XmlWrappingReader.cs
- CLSCompliantAttribute.cs
- WindowsSlider.cs
- RetrieveVirtualItemEventArgs.cs
- StringFormat.cs
- SelectionItemProviderWrapper.cs
- SHA1Managed.cs
- ThemeDirectoryCompiler.cs
- TransformerTypeCollection.cs
- StorageEntitySetMapping.cs
- Point3DConverter.cs
- ContainerParaClient.cs
- PassportAuthentication.cs
- GB18030Encoding.cs
- SystemException.cs
- HtmlMeta.cs
- WebPageTraceListener.cs
- CodeAssignStatement.cs
- StrongNamePublicKeyBlob.cs
- Enum.cs
- HttpRuntimeSection.cs
- ManagementObjectSearcher.cs
- TargetParameterCountException.cs
- ObjectListCommandsPage.cs
- SessionPageStateSection.cs
- MessageSecurityOverMsmq.cs
- XmlSchemaObjectTable.cs
- WebSysDefaultValueAttribute.cs
- TreeNodeConverter.cs
- FileSecurity.cs
- DataGridRowHeaderAutomationPeer.cs
- SiteMapNodeItemEventArgs.cs
- RequestSecurityTokenResponseCollection.cs
- DesignerActionGlyph.cs
- XmlAttributeAttribute.cs
- MembershipSection.cs
- UiaCoreTypesApi.cs
- UDPClient.cs
- ShaderRenderModeValidation.cs
- TemplateComponentConnector.cs
- RuleProcessor.cs
- DataTable.cs
- ToolStripSettings.cs
- TextRenderer.cs
- BasePattern.cs
- TransformValueSerializer.cs
- ObjectCloneHelper.cs
- DataColumnMappingCollection.cs
- XmlQueryCardinality.cs
- DataSourceSelectArguments.cs
- HtmlAnchor.cs
- DesignBindingConverter.cs
- PreviewPrintController.cs