Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / MS / Internal / PtsHost / ListParagraph.cs / 1 / ListParagraph.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: ListParagraph.cs // // Description: ListParagraph represents collection of list items. // // History: // 06/06/2003 : grzegorz - moving from Avalon branch. // //--------------------------------------------------------------------------- #pragma warning disable 1634, 1691 // avoid generating warnings about unknown // message numbers and unknown pragmas for PRESharp contol using System; using System.Diagnostics; using System.Windows; using System.Windows.Documents; using MS.Internal.Text; namespace MS.Internal.PtsHost { ////// ListParagraph represents collection of list items. /// internal sealed class ListParagraph : ContainerParagraph { ////// Constructor. /// /// /// Element associated with paragraph. /// /// /// Content's structural cache /// internal ListParagraph(DependencyObject element, StructuralCache structuralCache) : base(element, structuralCache) { } ////// CreateParaclient /// /// /// OUT: opaque to PTS paragraph client /// internal override void CreateParaclient( out IntPtr paraClientHandle) { #pragma warning disable 6518 // Disable PRESharp warning 6518. ListParaClient is an UnmamangedHandle, that adds itself // to HandleMapper that holds a reference to it. PTS manages lifetime of this object, and // calls DestroyParaclient to get rid of it. DestroyParaclient will call Dispose() on the object // and remove it from HandleMapper. ListParaClient paraClient = new ListParaClient(this); paraClientHandle = paraClient.Handle; #pragma warning restore 6518 } ////// Determine paragraph type at the current TextPointer and /// create it. Only ListItem elements are considered. Any other /// content is skipped. /// /// /// TextPointer at which paragraph is to be created /// /// /// True if empty paragraph is acceptable /// ////// BaseParagraph that was created /// protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk) { Invariant.Assert(textPointer is TextPointer); BaseParagraph paragraph = null; while (paragraph == null) { TextPointerContext runType = textPointer.GetPointerContext(LogicalDirection.Forward); if (runType == TextPointerContext.ElementStart) { TextElement element = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (element is ListItem) { // paragraph = new ListItemParagraph(element, StructuralCache); break; } else if (element is List) { // paragraph = new ListParagraph(element, StructuralCache); break; } // Skip all elements, which are not valid list item children if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToPosition(element.ElementEnd); } else if (runType == TextPointerContext.ElementEnd) { // End of list, if the same as Owner of associated element // Skip content otherwise if (Element == ((TextPointer)textPointer).Parent) { break; } if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } else { // Skip content if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } } if (paragraph != null) { StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; } return paragraph; } } } #pragma warning enable 1634, 1691 // 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: ListParagraph.cs // // Description: ListParagraph represents collection of list items. // // History: // 06/06/2003 : grzegorz - moving from Avalon branch. // //--------------------------------------------------------------------------- #pragma warning disable 1634, 1691 // avoid generating warnings about unknown // message numbers and unknown pragmas for PRESharp contol using System; using System.Diagnostics; using System.Windows; using System.Windows.Documents; using MS.Internal.Text; namespace MS.Internal.PtsHost { ////// ListParagraph represents collection of list items. /// internal sealed class ListParagraph : ContainerParagraph { ////// Constructor. /// /// /// Element associated with paragraph. /// /// /// Content's structural cache /// internal ListParagraph(DependencyObject element, StructuralCache structuralCache) : base(element, structuralCache) { } ////// CreateParaclient /// /// /// OUT: opaque to PTS paragraph client /// internal override void CreateParaclient( out IntPtr paraClientHandle) { #pragma warning disable 6518 // Disable PRESharp warning 6518. ListParaClient is an UnmamangedHandle, that adds itself // to HandleMapper that holds a reference to it. PTS manages lifetime of this object, and // calls DestroyParaclient to get rid of it. DestroyParaclient will call Dispose() on the object // and remove it from HandleMapper. ListParaClient paraClient = new ListParaClient(this); paraClientHandle = paraClient.Handle; #pragma warning restore 6518 } ////// Determine paragraph type at the current TextPointer and /// create it. Only ListItem elements are considered. Any other /// content is skipped. /// /// /// TextPointer at which paragraph is to be created /// /// /// True if empty paragraph is acceptable /// ////// BaseParagraph that was created /// protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk) { Invariant.Assert(textPointer is TextPointer); BaseParagraph paragraph = null; while (paragraph == null) { TextPointerContext runType = textPointer.GetPointerContext(LogicalDirection.Forward); if (runType == TextPointerContext.ElementStart) { TextElement element = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (element is ListItem) { // paragraph = new ListItemParagraph(element, StructuralCache); break; } else if (element is List) { // paragraph = new ListParagraph(element, StructuralCache); break; } // Skip all elements, which are not valid list item children if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToPosition(element.ElementEnd); } else if (runType == TextPointerContext.ElementEnd) { // End of list, if the same as Owner of associated element // Skip content otherwise if (Element == ((TextPointer)textPointer).Parent) { break; } if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } else { // Skip content if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } } if (paragraph != null) { StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; } return paragraph; } } } #pragma warning enable 1634, 1691 // 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
- LogicalExpressionTypeConverter.cs
- SecurityManager.cs
- SoapInteropTypes.cs
- BasicHttpSecurity.cs
- Margins.cs
- AnnotationComponentManager.cs
- ProfileBuildProvider.cs
- DrawItemEvent.cs
- ToolStripDropDownItemDesigner.cs
- PartialArray.cs
- Hex.cs
- COM2ICategorizePropertiesHandler.cs
- OperatingSystemVersionCheck.cs
- MemberNameValidator.cs
- NamespaceMapping.cs
- ProcessInputEventArgs.cs
- RunClient.cs
- SystemFonts.cs
- DetailsViewPageEventArgs.cs
- XmlSchemaAppInfo.cs
- NonSerializedAttribute.cs
- DiscreteKeyFrames.cs
- FillRuleValidation.cs
- ForwardPositionQuery.cs
- ContainerFilterService.cs
- PersistenceParticipant.cs
- ToolStripMenuItemDesigner.cs
- NamedObject.cs
- BreakRecordTable.cs
- TextRenderingModeValidation.cs
- AsymmetricSignatureDeformatter.cs
- ListControl.cs
- EncryptedKeyIdentifierClause.cs
- DbBuffer.cs
- GlyphTypeface.cs
- TimeSpan.cs
- PieceDirectory.cs
- WebPart.cs
- ResXResourceReader.cs
- DrawingGroup.cs
- XmlSchemaSimpleType.cs
- securitycriticaldataformultiplegetandset.cs
- ValidationException.cs
- SoapAttributeOverrides.cs
- InstanceCompleteException.cs
- MaterialGroup.cs
- ScrollBar.cs
- MembershipSection.cs
- SecurityUniqueId.cs
- DirectionalLight.cs
- PingReply.cs
- Binding.cs
- ComponentSerializationService.cs
- PtsCache.cs
- SqlDataSourceStatusEventArgs.cs
- InternalCache.cs
- CodeMethodInvokeExpression.cs
- MappingMetadataHelper.cs
- ToolStrip.cs
- RemoteWebConfigurationHostStream.cs
- HandleRef.cs
- ModelVisual3D.cs
- AxParameterData.cs
- _ConnectOverlappedAsyncResult.cs
- assertwrapper.cs
- WindowsSecurityTokenAuthenticator.cs
- AesManaged.cs
- Crypto.cs
- NetworkAddressChange.cs
- ActionFrame.cs
- PropertyStore.cs
- ConfigXmlElement.cs
- dtdvalidator.cs
- WmlObjectListAdapter.cs
- Rotation3D.cs
- HttpStreamMessage.cs
- CredentialCache.cs
- CollaborationHelperFunctions.cs
- Zone.cs
- PackageRelationshipCollection.cs
- DropShadowEffect.cs
- SvcMapFile.cs
- HistoryEventArgs.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- SortedList.cs
- EntityContainer.cs
- StylusEventArgs.cs
- DataGridViewColumnStateChangedEventArgs.cs
- XmlFileEditor.cs
- ValueCollectionParameterReader.cs
- TagElement.cs
- MinimizableAttributeTypeConverter.cs
- WizardForm.cs
- XmlProcessingInstruction.cs
- ScriptingProfileServiceSection.cs
- BinaryExpression.cs
- CodeDOMProvider.cs
- BoundColumn.cs
- GreenMethods.cs
- WebPartChrome.cs