Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / ListParagraph.cs / 1305600 / ListParagraph.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: ListParagraph.cs // // Description: ListParagraph represents collection of list items. // // History: // 06/06/2003 : [....] - 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 : [....] - 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
- RequestTimeoutManager.cs
- X509SecurityTokenProvider.cs
- NetDataContractSerializer.cs
- XmlWriterDelegator.cs
- ExceptionNotification.cs
- BinaryReader.cs
- SqlGatherConsumedAliases.cs
- SecurityChannelListener.cs
- SmtpMail.cs
- BitmapEffectInput.cs
- CompilerWrapper.cs
- SoapReflectionImporter.cs
- C14NUtil.cs
- Underline.cs
- RoutedUICommand.cs
- MetadataArtifactLoaderComposite.cs
- DerivedKeySecurityTokenStub.cs
- SQLResource.cs
- X509Utils.cs
- FieldToken.cs
- WmlPanelAdapter.cs
- XmlDomTextWriter.cs
- DateTime.cs
- SHA384.cs
- XmlEntityReference.cs
- QilGeneratorEnv.cs
- Types.cs
- XNodeValidator.cs
- XmlAnyElementAttributes.cs
- XmlHierarchicalDataSourceView.cs
- CodeTypeReferenceCollection.cs
- OpenTypeLayout.cs
- StringHandle.cs
- HebrewNumber.cs
- DataBoundControlAdapter.cs
- UIElement.cs
- MatrixAnimationBase.cs
- XmlSchemaExternal.cs
- RoleBoolean.cs
- FixUp.cs
- SafeFileMappingHandle.cs
- CodeGotoStatement.cs
- ToolBarButton.cs
- FileLogRecordStream.cs
- FloaterBaseParagraph.cs
- OdbcTransaction.cs
- MdImport.cs
- ReaderWriterLockWrapper.cs
- ValidationHelper.cs
- Console.cs
- XmlSubtreeReader.cs
- DataListItemEventArgs.cs
- BackgroundWorker.cs
- ConfigsHelper.cs
- BatchServiceHost.cs
- Base64Encoding.cs
- PerfCounters.cs
- AtomServiceDocumentSerializer.cs
- XmlComplianceUtil.cs
- WebConfigurationHost.cs
- COM2IDispatchConverter.cs
- _Rfc2616CacheValidators.cs
- SqlError.cs
- Bitmap.cs
- PlacementWorkspace.cs
- ParameterCollection.cs
- PenLineCapValidation.cs
- ScopedKnownTypes.cs
- XmlNodeList.cs
- DbParameterCollectionHelper.cs
- StorageInfo.cs
- KerberosSecurityTokenProvider.cs
- LoginUtil.cs
- EntityDataSourceColumn.cs
- InvalidOleVariantTypeException.cs
- WindowsGraphics2.cs
- ToolStrip.cs
- DecoderFallbackWithFailureFlag.cs
- WebPartEditorApplyVerb.cs
- TransactionProtocol.cs
- EventLogException.cs
- OracleSqlParser.cs
- X509Certificate2Collection.cs
- dsa.cs
- XmlTextReaderImpl.cs
- SmtpLoginAuthenticationModule.cs
- Utils.cs
- EventLogSession.cs
- TransactionScopeDesigner.cs
- ApplyImportsAction.cs
- entitydatasourceentitysetnameconverter.cs
- ContentControl.cs
- WindowsButton.cs
- GeneralTransformCollection.cs
- WinEventTracker.cs
- iisPickupDirectory.cs
- CompilationUnit.cs
- RewritingSimplifier.cs
- EmptyEnumerable.cs
- PeerContact.cs