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 / TextTreeInsertElementUndoUnit.cs / 1 / TextTreeInsertElementUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeInsertElementUndoUnit.cs // // Description: Undo unit for TextContainer.InsertElement calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertElement calls. internal class TextTreeInsertElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. // symbolOffset should be just before the start edge of the TextElement to remove. // If deep is true, this unit will undo not only the scoping element // insert, but also all content scoped by the element. internal TextTreeInsertElementUndoUnit(TextContainer tree, int symbolOffset, bool deep) : base(tree, symbolOffset) { _deep = deep; } #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; TextElement element; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); Invariant.Assert(start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); element = start.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (_deep) { // Extract the element and its content. end = new TextPointer(this.TextContainer, element.TextElementNode, ElementEdge.AfterEnd); this.TextContainer.DeleteContentInternal(start, end); } else { // Just extract the element, not its content. this.TextContainer.ExtractElementInternal(element); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // If true, this unit tracks a TextElement and its scoped content. // Otherwise, this unit only tracks the TextElement. private readonly bool _deep; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: TextTreeInsertElementUndoUnit.cs // // Description: Undo unit for TextContainer.InsertElement calls. // // History: // 03/03/2004 : benwest - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.InsertElement calls. internal class TextTreeInsertElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. // symbolOffset should be just before the start edge of the TextElement to remove. // If deep is true, this unit will undo not only the scoping element // insert, but also all content scoped by the element. internal TextTreeInsertElementUndoUnit(TextContainer tree, int symbolOffset, bool deep) : base(tree, symbolOffset) { _deep = deep; } #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; TextElement element; VerifyTreeContentHashCode(); start = new TextPointer(this.TextContainer, this.SymbolOffset, LogicalDirection.Forward); Invariant.Assert(start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextTree undo unit out of [....] with TextTree."); element = start.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (_deep) { // Extract the element and its content. end = new TextPointer(this.TextContainer, element.TextElementNode, ElementEdge.AfterEnd); this.TextContainer.DeleteContentInternal(start, end); } else { // Just extract the element, not its content. this.TextContainer.ExtractElementInternal(element); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // If true, this unit tracks a TextElement and its scoped content. // Otherwise, this unit only tracks the TextElement. private readonly bool _deep; #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
- SqlRewriteScalarSubqueries.cs
- WsiProfilesElement.cs
- StoreAnnotationsMap.cs
- DesignerAutoFormat.cs
- CLRBindingWorker.cs
- SurrogateEncoder.cs
- OleCmdHelper.cs
- InternalSafeNativeMethods.cs
- XNodeValidator.cs
- Process.cs
- TextBoxView.cs
- TextTrailingCharacterEllipsis.cs
- ContextConfiguration.cs
- basenumberconverter.cs
- TagPrefixInfo.cs
- XmlSchemaComplexContentRestriction.cs
- Properties.cs
- ToolBarButtonClickEvent.cs
- NullableDecimalAverageAggregationOperator.cs
- _ProxyRegBlob.cs
- ItemCollection.cs
- MetaModel.cs
- EditorAttribute.cs
- CodeSnippetStatement.cs
- ChannelEndpointElementCollection.cs
- Stack.cs
- PresentationTraceSources.cs
- MetadataItemEmitter.cs
- MgmtResManager.cs
- SamlAdvice.cs
- DataKeyPropertyAttribute.cs
- TextClipboardData.cs
- Normalization.cs
- ThicknessAnimation.cs
- NumberFormatInfo.cs
- SchemaTableColumn.cs
- SupportsEventValidationAttribute.cs
- IItemContainerGenerator.cs
- StringWriter.cs
- MetadataSource.cs
- QueryOperator.cs
- BaseDataListPage.cs
- SqlException.cs
- DrawingContext.cs
- WebScriptMetadataFormatter.cs
- ScriptControlDescriptor.cs
- ScriptDescriptor.cs
- ExecutionPropertyManager.cs
- ImageFormatConverter.cs
- ListCollectionView.cs
- SamlSubject.cs
- BitmapInitialize.cs
- DataGridRow.cs
- contentDescriptor.cs
- DbConnectionStringBuilder.cs
- WebHttpBehavior.cs
- ObjectReferenceStack.cs
- PatternMatcher.cs
- DecoderExceptionFallback.cs
- WorkflowRuntime.cs
- ButtonBaseAdapter.cs
- SecurityPolicyVersion.cs
- ReflectionTypeLoadException.cs
- DocComment.cs
- ItemCollection.cs
- Debug.cs
- _WebProxyDataBuilder.cs
- SecurityRuntime.cs
- ISessionStateStore.cs
- BindingOperations.cs
- SqlParameterizer.cs
- ConvertEvent.cs
- QuaternionRotation3D.cs
- PropertyBuilder.cs
- QuaternionAnimationBase.cs
- SQLBoolean.cs
- EntityClientCacheEntry.cs
- DataGridViewCell.cs
- PageAdapter.cs
- securitycriticaldataformultiplegetandset.cs
- ControlPaint.cs
- XsltException.cs
- IdleTimeoutMonitor.cs
- PickBranch.cs
- SourceCollection.cs
- XmlSerializerSection.cs
- OutOfMemoryException.cs
- ToolboxBitmapAttribute.cs
- _MultipleConnectAsync.cs
- log.cs
- UserNameSecurityToken.cs
- ProfileModule.cs
- XmlnsCompatibleWithAttribute.cs
- SiteMapHierarchicalDataSourceView.cs
- InputBuffer.cs
- CfgParser.cs
- SoapMessage.cs
- DataServiceHost.cs
- XmlLinkedNode.cs
- IIS7UserPrincipal.cs