Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / PtsHost / EmbeddedObject.cs / 1 / EmbeddedObject.cs
// // Copyright (C) Microsoft Corporation. All rights reserved. // // File: EmbeddedObject.cs // // Description: Definition for embedded object inside a text paragraph. // // History: // 05/05/2003 : grzegorz - moving from Avalon branch. // //---------------------------------------------------------------------------- using System; using System.Windows; using MS.Internal.Documents; using MS.Internal.PtsHost.UnsafeNativeMethods; namespace MS.Internal.PtsHost { ////// EmbeddedObject class stores information about object embedded within /// a text paragraph. /// internal abstract class EmbeddedObject { ////// Constructor. /// /// /// Embedded object's character position. /// protected EmbeddedObject(int dcp) { Dcp = dcp; } ////// Dispose object. /// internal virtual void Dispose() { } ////// Update object using date from another embedded object of the same /// type. /// /// /// Source of updated data. /// internal abstract void Update(EmbeddedObject newObject); ////// Embedded object's owner. /// internal abstract DependencyObject Element { get; } ////// Position within a text paragraph (number of characters from the /// beginning of text paragraph). /// internal int Dcp; } ////// Stores information about attached object embedded within a text paragraph. /// internal class AttachedObject : EmbeddedObject { ////// Constructor. /// /// /// Attached object's character position. /// /// /// Paragraph associated with attached object. /// internal AttachedObject(int dcp, BaseParagraph para) : base(dcp) { Para = para; } ////// Dispose object. /// internal override void Dispose() { Para.Dispose(); Para = null; base.Dispose(); } ////// Update object using date from another attached object of the same /// type. /// /// /// Source of updated data. /// internal override void Update(EmbeddedObject newObject) { AttachedObject newAttachedObject = newObject as AttachedObject; ErrorHandler.Assert(newAttachedObject != null, ErrorHandler.EmbeddedObjectTypeMismatch); ErrorHandler.Assert(newAttachedObject.Element.Equals(Element), ErrorHandler.EmbeddedObjectOwnerMismatch); Dcp = newAttachedObject.Dcp; Para.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } ////// Attached object's owner. /// internal override DependencyObject Element { get { return Para.Element; } } ////// Paragraph associated with attached object. /// internal BaseParagraph Para; } ////// Stores information about inline object embedded within a text line. /// internal sealed class InlineObject : EmbeddedObject { ////// Constructor. /// /// /// Embedded object's character position. /// /// /// UIElementIsland associated with embedded object. /// /// /// TextParagraph associated with embedded object. /// internal InlineObject(int dcp, UIElementIsland uiElementIsland, TextParagraph para) : base(dcp) { _para = para; _uiElementIsland = uiElementIsland; _uiElementIsland.DesiredSizeChanged += new DesiredSizeChangedEventHandler(_para.OnUIElementDesiredSizeChanged); } ////// Dispose object. /// internal override void Dispose() { if (_uiElementIsland != null) { _uiElementIsland.DesiredSizeChanged -= new DesiredSizeChangedEventHandler(_para.OnUIElementDesiredSizeChanged); } base.Dispose(); } ////// Update object using date from another embedded object of the same /// type. /// /// /// Source of updated data. /// internal override void Update(EmbeddedObject newObject) { // These should definitely be the same InlineObject newInline = newObject as InlineObject; ErrorHandler.Assert(newInline != null, ErrorHandler.EmbeddedObjectTypeMismatch); ErrorHandler.Assert(newInline._uiElementIsland == _uiElementIsland, ErrorHandler.EmbeddedObjectOwnerMismatch); // We've ensured ownership is still with the old InlineObject, so we now null this out to prevent dispose from disconnecting. newInline._uiElementIsland = null; } ////// Embedded object's owner. /// internal override DependencyObject Element { get { return _uiElementIsland.Root; } } private UIElementIsland _uiElementIsland; private TextParagraph _para; } ////// Stores information about figure embedded within a text paragraph. /// internal sealed class FigureObject : AttachedObject { ////// Constructor. /// /// /// Figure object's character position. /// /// /// Paragraph associated with figure object. /// internal FigureObject(int dcp, FigureParagraph para) : base(dcp, para) { } } ////// Stores information about floater embedded within a text paragraph. /// internal sealed class FloaterObject : AttachedObject { ////// Constructor. /// /// /// Floater object's character position. /// /// /// Paragraph associated with floater object. /// internal FloaterObject(int dcp, FloaterParagraph para) : base(dcp, para) { } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: EmbeddedObject.cs // // Description: Definition for embedded object inside a text paragraph. // // History: // 05/05/2003 : grzegorz - moving from Avalon branch. // //---------------------------------------------------------------------------- using System; using System.Windows; using MS.Internal.Documents; using MS.Internal.PtsHost.UnsafeNativeMethods; namespace MS.Internal.PtsHost { ////// EmbeddedObject class stores information about object embedded within /// a text paragraph. /// internal abstract class EmbeddedObject { ////// Constructor. /// /// /// Embedded object's character position. /// protected EmbeddedObject(int dcp) { Dcp = dcp; } ////// Dispose object. /// internal virtual void Dispose() { } ////// Update object using date from another embedded object of the same /// type. /// /// /// Source of updated data. /// internal abstract void Update(EmbeddedObject newObject); ////// Embedded object's owner. /// internal abstract DependencyObject Element { get; } ////// Position within a text paragraph (number of characters from the /// beginning of text paragraph). /// internal int Dcp; } ////// Stores information about attached object embedded within a text paragraph. /// internal class AttachedObject : EmbeddedObject { ////// Constructor. /// /// /// Attached object's character position. /// /// /// Paragraph associated with attached object. /// internal AttachedObject(int dcp, BaseParagraph para) : base(dcp) { Para = para; } ////// Dispose object. /// internal override void Dispose() { Para.Dispose(); Para = null; base.Dispose(); } ////// Update object using date from another attached object of the same /// type. /// /// /// Source of updated data. /// internal override void Update(EmbeddedObject newObject) { AttachedObject newAttachedObject = newObject as AttachedObject; ErrorHandler.Assert(newAttachedObject != null, ErrorHandler.EmbeddedObjectTypeMismatch); ErrorHandler.Assert(newAttachedObject.Element.Equals(Element), ErrorHandler.EmbeddedObjectOwnerMismatch); Dcp = newAttachedObject.Dcp; Para.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } ////// Attached object's owner. /// internal override DependencyObject Element { get { return Para.Element; } } ////// Paragraph associated with attached object. /// internal BaseParagraph Para; } ////// Stores information about inline object embedded within a text line. /// internal sealed class InlineObject : EmbeddedObject { ////// Constructor. /// /// /// Embedded object's character position. /// /// /// UIElementIsland associated with embedded object. /// /// /// TextParagraph associated with embedded object. /// internal InlineObject(int dcp, UIElementIsland uiElementIsland, TextParagraph para) : base(dcp) { _para = para; _uiElementIsland = uiElementIsland; _uiElementIsland.DesiredSizeChanged += new DesiredSizeChangedEventHandler(_para.OnUIElementDesiredSizeChanged); } ////// Dispose object. /// internal override void Dispose() { if (_uiElementIsland != null) { _uiElementIsland.DesiredSizeChanged -= new DesiredSizeChangedEventHandler(_para.OnUIElementDesiredSizeChanged); } base.Dispose(); } ////// Update object using date from another embedded object of the same /// type. /// /// /// Source of updated data. /// internal override void Update(EmbeddedObject newObject) { // These should definitely be the same InlineObject newInline = newObject as InlineObject; ErrorHandler.Assert(newInline != null, ErrorHandler.EmbeddedObjectTypeMismatch); ErrorHandler.Assert(newInline._uiElementIsland == _uiElementIsland, ErrorHandler.EmbeddedObjectOwnerMismatch); // We've ensured ownership is still with the old InlineObject, so we now null this out to prevent dispose from disconnecting. newInline._uiElementIsland = null; } ////// Embedded object's owner. /// internal override DependencyObject Element { get { return _uiElementIsland.Root; } } private UIElementIsland _uiElementIsland; private TextParagraph _para; } ////// Stores information about figure embedded within a text paragraph. /// internal sealed class FigureObject : AttachedObject { ////// Constructor. /// /// /// Figure object's character position. /// /// /// Paragraph associated with figure object. /// internal FigureObject(int dcp, FigureParagraph para) : base(dcp, para) { } } ////// Stores information about floater embedded within a text paragraph. /// internal sealed class FloaterObject : AttachedObject { ////// Constructor. /// /// /// Floater object's character position. /// /// /// Paragraph associated with floater object. /// internal FloaterObject(int dcp, FloaterParagraph para) : base(dcp, para) { } } } // 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
- ConfigurationSchemaErrors.cs
- GlobalDataBindingHandler.cs
- XmlSchemaAttribute.cs
- AutomationElementCollection.cs
- ParagraphVisual.cs
- CommandManager.cs
- RegexBoyerMoore.cs
- GCHandleCookieTable.cs
- Sentence.cs
- OpCopier.cs
- View.cs
- GenericWebPart.cs
- ZipIOCentralDirectoryFileHeader.cs
- LambdaCompiler.Generated.cs
- Profiler.cs
- SourceFilter.cs
- ComponentConverter.cs
- TypeUsage.cs
- Or.cs
- IgnoreSection.cs
- DataBinding.cs
- RangeBaseAutomationPeer.cs
- WindowsTokenRoleProvider.cs
- SqlSelectStatement.cs
- DynamicMethod.cs
- DomNameTable.cs
- LayoutExceptionEventArgs.cs
- DashStyles.cs
- SafeReversePInvokeHandle.cs
- TextBox.cs
- CellQuery.cs
- PropertyGroupDescription.cs
- XPathCompileException.cs
- CheckBoxAutomationPeer.cs
- AppDomainProtocolHandler.cs
- XmlSubtreeReader.cs
- MultiViewDesigner.cs
- ImmutablePropertyDescriptorGridEntry.cs
- NTAccount.cs
- SoapExtensionTypeElementCollection.cs
- WbmpConverter.cs
- KeyBinding.cs
- WbemException.cs
- Rectangle.cs
- TextTreeObjectNode.cs
- CompositeCollection.cs
- Oid.cs
- StringSource.cs
- TagPrefixInfo.cs
- SqlTriggerAttribute.cs
- FaultPropagationQuery.cs
- ResourceDisplayNameAttribute.cs
- VisualBrush.cs
- Int32Storage.cs
- DataSourceXmlSubItemAttribute.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- SystemIPv6InterfaceProperties.cs
- ToolboxItemCollection.cs
- CodeSnippetStatement.cs
- MD5CryptoServiceProvider.cs
- WindowsFormsEditorServiceHelper.cs
- InputLangChangeEvent.cs
- CreateUserErrorEventArgs.cs
- ActiveXHost.cs
- SymmetricKey.cs
- ClickablePoint.cs
- XamlTemplateSerializer.cs
- BinHexDecoder.cs
- MetadataStore.cs
- FilterInvalidBodyAccessException.cs
- _ChunkParse.cs
- PropertyEmitterBase.cs
- ControlIdConverter.cs
- MediaSystem.cs
- StyleSheetComponentEditor.cs
- PackagePartCollection.cs
- LineSegment.cs
- WebException.cs
- Timeline.cs
- UnsafeNativeMethods.cs
- IPipelineRuntime.cs
- SqlClientMetaDataCollectionNames.cs
- TableCellAutomationPeer.cs
- sqlser.cs
- CheckBox.cs
- StrongNameUtility.cs
- DuplexChannel.cs
- StylusCaptureWithinProperty.cs
- KeyValueConfigurationElement.cs
- NullRuntimeConfig.cs
- NumberSubstitution.cs
- OleDbRowUpdatingEvent.cs
- Brushes.cs
- DataGridViewCell.cs
- MetadataArtifactLoaderCompositeFile.cs
- XslAstAnalyzer.cs
- RtfToken.cs
- ClosureBinding.cs
- IBuiltInEvidence.cs
- ErrorFormatterPage.cs