Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / TextTreeExtractElementUndoUnit.cs / 1 / TextTreeExtractElementUndoUnit.cs
//---------------------------------------------------------------------------- // // File: TextTreeExtractElementUndoUnit.cs // // Description: Undo unit for TextContainer.ExtractElement calls. // // History: // 03/03/2004 : [....] - Created // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Documents { // Undo unit for TextContainer.ExtractElement calls. internal class TextTreeExtractElementUndoUnit : TextTreeUndoUnit { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors // Creates a new undo unit instance. internal TextTreeExtractElementUndoUnit(TextContainer tree, TextTreeTextElementNode elementNode) : base(tree, elementNode.GetSymbolOffset(tree.Generation)) { _symbolCount = elementNode.SymbolCount; _type = elementNode.TextElement.GetType(); _localValues = LocalValueEnumeratorToArray(elementNode.TextElement.GetLocalValueEnumerator()); _resources = elementNode.TextElement.Resources; // Table requires additional work for storing its Columns collection if (elementNode.TextElement is Table) { _columns = TextTreeDeleteContentUndoUnit.SaveColumns((Table)elementNode.TextElement); } } #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); end = new TextPointer(this.TextContainer, this.SymbolOffset + _symbolCount - 2, LogicalDirection.Forward); // Insert a new element. element = (TextElement)Activator.CreateInstance(_type); element.Reposition(start, end); // Restore local resources element.Resources = _resources; // Move end into the scope of the new element. end.MoveToNextContextPosition(LogicalDirection.Backward); // Then restore local property values. // this.TextContainer.SetValues(end, ArrayToLocalValueEnumerator(_localValues)); if (element is Table) { TextTreeDeleteContentUndoUnit.RestoreColumns((Table)element, _columns); } } #endregion Public Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields // Count of symbols covered by the extracted TextElement, including its 2 edges. private readonly int _symbolCount; // Type of the extracted TextElement. private readonly Type _type; // Collection of all local property values set on the extracted TextElement. private readonly PropertyRecord []_localValues; // Resources defined locally on the TextElement private readonly ResourceDictionary _resources; // TableColumns collection private readonly TableColumn[] _columns; #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
- DragDeltaEventArgs.cs
- CounterNameConverter.cs
- PassportAuthenticationEventArgs.cs
- DataObject.cs
- EventDriven.cs
- Model3D.cs
- Psha1DerivedKeyGenerator.cs
- StorageAssociationSetMapping.cs
- TCEAdapterGenerator.cs
- DocumentOrderQuery.cs
- ThreadInterruptedException.cs
- CodeMemberMethod.cs
- ThemeDirectoryCompiler.cs
- SqlMethodTransformer.cs
- DetailsViewInsertedEventArgs.cs
- BodyGlyph.cs
- sortedlist.cs
- TextControlDesigner.cs
- SafePEFileHandle.cs
- DataGridViewCellValueEventArgs.cs
- SqlDataSourceCache.cs
- PageHandlerFactory.cs
- RegexTree.cs
- ChangeConflicts.cs
- TrackingStringDictionary.cs
- SafeProcessHandle.cs
- WebServicesDescriptionAttribute.cs
- AppSecurityManager.cs
- MethodToken.cs
- ResourceProviderFactory.cs
- SecurityException.cs
- UniqueIdentifierService.cs
- xdrvalidator.cs
- Timer.cs
- IdnElement.cs
- SystemNetworkInterface.cs
- EmptyImpersonationContext.cs
- DragCompletedEventArgs.cs
- VectorAnimationBase.cs
- SqlUserDefinedAggregateAttribute.cs
- UnaryExpression.cs
- ExpressionConverter.cs
- TaiwanLunisolarCalendar.cs
- ItemsPanelTemplate.cs
- Repeater.cs
- DBAsyncResult.cs
- GraphicsPathIterator.cs
- ChangeBlockUndoRecord.cs
- ContractMapping.cs
- Dump.cs
- IBuiltInEvidence.cs
- LifetimeServices.cs
- WebServiceParameterData.cs
- FileDocument.cs
- ZipIOCentralDirectoryBlock.cs
- HGlobalSafeHandle.cs
- RSAProtectedConfigurationProvider.cs
- XmlSchemaExternal.cs
- XsltArgumentList.cs
- PtsContext.cs
- BinaryObjectWriter.cs
- RightNameExpirationInfoPair.cs
- ListDictionary.cs
- DesignDataSource.cs
- DynamicResourceExtension.cs
- FileUtil.cs
- TextWriter.cs
- MemoryPressure.cs
- SoapHeaderAttribute.cs
- Vector3DConverter.cs
- DbConnectionPoolCounters.cs
- SqlUserDefinedTypeAttribute.cs
- VariableAction.cs
- ControlParser.cs
- FormViewPageEventArgs.cs
- BigInt.cs
- MutexSecurity.cs
- DataGridViewCellStateChangedEventArgs.cs
- PropertyTabChangedEvent.cs
- JoinTreeSlot.cs
- ProfilePropertyNameValidator.cs
- WebPartTransformerCollection.cs
- _CookieModule.cs
- XmlDataDocument.cs
- CriticalHandle.cs
- ResourcePool.cs
- DBConcurrencyException.cs
- ParallelTimeline.cs
- QuestionEventArgs.cs
- initElementDictionary.cs
- Renderer.cs
- SqlCommandBuilder.cs
- LeftCellWrapper.cs
- CreateRefExpr.cs
- _AutoWebProxyScriptEngine.cs
- CustomErrorCollection.cs
- CodeIterationStatement.cs
- QilName.cs
- GridViewCellAutomationPeer.cs
- OleDbPropertySetGuid.cs