Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / TextTreeExtractElementUndoUnit.cs / 1305600 / 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 = GetPropertyRecordArray(elementNode.TextElement); _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
- BaseConfigurationRecord.cs
- MediaTimeline.cs
- ObfuscationAttribute.cs
- BulletedListEventArgs.cs
- TemplateApplicationHelper.cs
- XmlComment.cs
- WindowsFormsEditorServiceHelper.cs
- SqlBulkCopyColumnMapping.cs
- CodeConstructor.cs
- Rfc2898DeriveBytes.cs
- TextRangeBase.cs
- DataSourceCache.cs
- XDeferredAxisSource.cs
- WindowsFormsHelpers.cs
- ValidationHelpers.cs
- ListControlDataBindingHandler.cs
- Tokenizer.cs
- CollectionViewGroup.cs
- UIElementHelper.cs
- LayoutSettings.cs
- ServiceModelConfigurationSection.cs
- IntegerValidatorAttribute.cs
- EventMappingSettings.cs
- Registration.cs
- CompositeFontFamily.cs
- EntryPointNotFoundException.cs
- SqlVisitor.cs
- RenderingBiasValidation.cs
- DecimalConstantAttribute.cs
- ImageSourceConverter.cs
- AsyncPostBackErrorEventArgs.cs
- MatrixValueSerializer.cs
- SQLString.cs
- AudienceUriMode.cs
- FormatException.cs
- FormViewDeleteEventArgs.cs
- DateBoldEvent.cs
- SevenBitStream.cs
- DebugController.cs
- SQLChars.cs
- SuppressMessageAttribute.cs
- SizeAnimationUsingKeyFrames.cs
- AnimationStorage.cs
- COM2FontConverter.cs
- SoapTypeAttribute.cs
- odbcmetadatacollectionnames.cs
- AssociationType.cs
- Matrix.cs
- XmlSignatureManifest.cs
- CompilerGlobalScopeAttribute.cs
- EventHandlerList.cs
- BindableAttribute.cs
- SqlCacheDependency.cs
- ColumnResult.cs
- Selector.cs
- WebPartDisplayModeEventArgs.cs
- HttpCachePolicy.cs
- ActiveXSerializer.cs
- DependencyObjectProvider.cs
- ParentQuery.cs
- MailMessage.cs
- OracleDataReader.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- StorageInfo.cs
- UnsafeNativeMethods.cs
- BulletedList.cs
- DataGridViewAccessibleObject.cs
- ExpressionList.cs
- ClientScriptManager.cs
- UpdatePanelControlTrigger.cs
- BuildProviderAppliesToAttribute.cs
- XmlSerializationGeneratedCode.cs
- Table.cs
- ObjectContext.cs
- GCHandleCookieTable.cs
- NodeLabelEditEvent.cs
- ActivationArguments.cs
- RegisteredHiddenField.cs
- NameValueFileSectionHandler.cs
- IntAverageAggregationOperator.cs
- UnsafeNativeMethods.cs
- FolderBrowserDialog.cs
- DataBindingExpressionBuilder.cs
- BinaryObjectInfo.cs
- RelatedCurrencyManager.cs
- FontCollection.cs
- VisualTransition.cs
- DbReferenceCollection.cs
- StylusEditingBehavior.cs
- BuiltInPermissionSets.cs
- CharacterMetrics.cs
- SQLCharsStorage.cs
- BamlRecordReader.cs
- XPathConvert.cs
- RoleGroup.cs
- Matrix.cs
- XmlAttributeCache.cs
- ImmutableObjectAttribute.cs
- XmlReader.cs
- DataControlField.cs