Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- TimeManager.cs
- XsdBuilder.cs
- COM2Properties.cs
- RegexCompiler.cs
- ServicePointManager.cs
- XmlTextWriter.cs
- ModulesEntry.cs
- SerializerWriterEventHandlers.cs
- IntMinMaxAggregationOperator.cs
- BitmapEffectrendercontext.cs
- PanelDesigner.cs
- TextOutput.cs
- ExtensionFile.cs
- StatusBarItemAutomationPeer.cs
- ToolStrip.cs
- NetSectionGroup.cs
- SerializationSectionGroup.cs
- Attribute.cs
- SqlGatherConsumedAliases.cs
- NonParentingControl.cs
- ConsoleCancelEventArgs.cs
- MarkerProperties.cs
- Rijndael.cs
- GroupItem.cs
- DivideByZeroException.cs
- AutomationPropertyInfo.cs
- CustomTypeDescriptor.cs
- DbConnectionPoolOptions.cs
- TextRangeProviderWrapper.cs
- Container.cs
- FormattedText.cs
- CompModSwitches.cs
- BuildDependencySet.cs
- XPathItem.cs
- WebPartCloseVerb.cs
- FlowSwitchDesigner.xaml.cs
- PrimarySelectionAdorner.cs
- HttpListenerRequest.cs
- AttributeSetAction.cs
- DataTableMapping.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- _AutoWebProxyScriptHelper.cs
- CurrencyManager.cs
- Console.cs
- FactoryGenerator.cs
- CatalogPartChrome.cs
- SynchronizingStream.cs
- SHA256.cs
- PeerContact.cs
- DataReaderContainer.cs
- MetabaseServerConfig.cs
- SerializerDescriptor.cs
- SystemIcons.cs
- SessionStateItemCollection.cs
- SqlIdentifier.cs
- WindowsListViewItemCheckBox.cs
- ModifierKeysValueSerializer.cs
- ParameterInfo.cs
- FormatConvertedBitmap.cs
- BrowserCapabilitiesFactoryBase.cs
- ColorTransformHelper.cs
- AccessDataSource.cs
- SignatureTargetIdManager.cs
- IItemContainerGenerator.cs
- FactoryGenerator.cs
- LinqDataSourceDeleteEventArgs.cs
- XmlReaderSettings.cs
- TextLineBreak.cs
- TraceUtils.cs
- Converter.cs
- EventDescriptor.cs
- ChannelDispatcher.cs
- QilXmlReader.cs
- RemotingAttributes.cs
- GlobalDataBindingHandler.cs
- ScrollProviderWrapper.cs
- EditorPartCollection.cs
- Request.cs
- ModuleBuilder.cs
- RemoteAsymmetricSignatureFormatter.cs
- CorePropertiesFilter.cs
- LogExtent.cs
- ImageFormatConverter.cs
- CriticalHandle.cs
- OdbcHandle.cs
- WorkflowTransactionOptions.cs
- CodeTryCatchFinallyStatement.cs
- PauseStoryboard.cs
- FunctionImportElement.cs
- StylusPointPropertyUnit.cs
- ValidationHelpers.cs
- InputProcessorProfilesLoader.cs
- SymDocumentType.cs
- DataGridViewRowsRemovedEventArgs.cs
- SelectionHighlightInfo.cs
- SqlExpressionNullability.cs
- NonSerializedAttribute.cs
- XmlILStorageConverter.cs
- ExecutionEngineException.cs
- smtppermission.cs