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
- SymLanguageType.cs
- HttpWebRequestElement.cs
- CodeAssignStatement.cs
- TableCellCollection.cs
- UnionExpr.cs
- CodeDomDesignerLoader.cs
- SubstitutionResponseElement.cs
- ProxyHelper.cs
- HtmlElementCollection.cs
- DataGridColumn.cs
- OutputCacheProfile.cs
- SessionPageStatePersister.cs
- ListViewInsertedEventArgs.cs
- WindowsImpersonationContext.cs
- Imaging.cs
- WindowsHyperlink.cs
- SpellerStatusTable.cs
- MessageBox.cs
- LinearGradientBrush.cs
- PaperSize.cs
- Synchronization.cs
- SecurityUtils.cs
- AssemblyUtil.cs
- TemplateGroupCollection.cs
- ModelFactory.cs
- OleServicesContext.cs
- LineVisual.cs
- RelOps.cs
- DefaultIfEmptyQueryOperator.cs
- FileNameEditor.cs
- HtmlInputPassword.cs
- ConfigurationPropertyAttribute.cs
- TextWriter.cs
- MemberAccessException.cs
- Stylus.cs
- Parameter.cs
- PrtCap_Base.cs
- SecurityKeyType.cs
- SimpleHandlerFactory.cs
- LoginCancelEventArgs.cs
- XmlSchemaComplexContentRestriction.cs
- GeometryCombineModeValidation.cs
- Visual3DCollection.cs
- MutexSecurity.cs
- TextSelection.cs
- MemberRelationshipService.cs
- SecurityHelper.cs
- SpeechSynthesizer.cs
- Win32Exception.cs
- DataSourceXmlElementAttribute.cs
- ContractsBCL.cs
- ProcessHostConfigUtils.cs
- SafeSystemMetrics.cs
- HttpVersion.cs
- X509CertificateValidationMode.cs
- RelAssertionDirectKeyIdentifierClause.cs
- OpenTypeLayout.cs
- WizardPanel.cs
- FolderNameEditor.cs
- RegexCharClass.cs
- HijriCalendar.cs
- HashRepartitionEnumerator.cs
- TransactionInterop.cs
- EntityDataSourceStatementEditorForm.cs
- XmlSchemaAny.cs
- CodeSnippetExpression.cs
- Registry.cs
- FileDocument.cs
- ScriptingScriptResourceHandlerSection.cs
- DateTimeSerializationSection.cs
- SmtpReplyReader.cs
- Table.cs
- RangeContentEnumerator.cs
- TextEditorSpelling.cs
- _NetworkingPerfCounters.cs
- HtmlControlAdapter.cs
- StatusBarItem.cs
- ApplicationBuildProvider.cs
- NativeMethods.cs
- LookupNode.cs
- QilChoice.cs
- LogExtent.cs
- ProxySimple.cs
- ConfigXmlSignificantWhitespace.cs
- LocalizationComments.cs
- Line.cs
- HttpRuntimeSection.cs
- Matrix.cs
- Vector3DValueSerializer.cs
- StreamProxy.cs
- IntegerValidator.cs
- WorkflowCreationContext.cs
- PropertyGrid.cs
- XPathExpr.cs
- ModelEditingScope.cs
- GZipDecoder.cs
- WebSysDisplayNameAttribute.cs
- SettingsContext.cs
- SmtpDigestAuthenticationModule.cs
- DataGridColumnCollection.cs