Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ForEachAction.cs
- UnhandledExceptionEventArgs.cs
- ImageFormatConverter.cs
- XamlContextStack.cs
- DispatchWrapper.cs
- System.Data.OracleClient_BID.cs
- DependencyObjectValidator.cs
- ProcessHostFactoryHelper.cs
- COM2IDispatchConverter.cs
- EmptyReadOnlyDictionaryInternal.cs
- TypeDescriptionProviderAttribute.cs
- ReturnType.cs
- CFStream.cs
- SqlConnectionManager.cs
- CodeArrayIndexerExpression.cs
- WebScriptServiceHostFactory.cs
- ScriptManagerProxy.cs
- CaseStatementSlot.cs
- CompiledQueryCacheKey.cs
- DataListAutoFormat.cs
- SimpleMailWebEventProvider.cs
- SmiMetaDataProperty.cs
- SmtpDigestAuthenticationModule.cs
- FunctionDetailsReader.cs
- UnmanagedHandle.cs
- DrawingContextDrawingContextWalker.cs
- EntityDataSourceContextCreatingEventArgs.cs
- BrowserCapabilitiesCompiler.cs
- CodeVariableDeclarationStatement.cs
- HierarchicalDataSourceConverter.cs
- WebSysDisplayNameAttribute.cs
- ArcSegment.cs
- GridView.cs
- SpellerStatusTable.cs
- ScaleTransform3D.cs
- IntSumAggregationOperator.cs
- TrustDriver.cs
- ServiceDescriptions.cs
- MimeBasePart.cs
- SrgsElementFactory.cs
- DBSqlParserTableCollection.cs
- FontDriver.cs
- safex509handles.cs
- AssociatedControlConverter.cs
- MediaElementAutomationPeer.cs
- DataView.cs
- HttpProxyTransportBindingElement.cs
- ControlEvent.cs
- HMACSHA1.cs
- CompatibleComparer.cs
- Padding.cs
- XmlUtf8RawTextWriter.cs
- WebPartCancelEventArgs.cs
- ModelVisual3D.cs
- BindingContext.cs
- XmlNodeComparer.cs
- StatusStrip.cs
- LinkedDataMemberFieldEditor.cs
- OpenCollectionAsyncResult.cs
- ServiceManagerHandle.cs
- TextClipboardData.cs
- GridItemCollection.cs
- Comparer.cs
- SharedConnectionListener.cs
- ResourceAttributes.cs
- VisualTreeUtils.cs
- SamlAudienceRestrictionCondition.cs
- Compiler.cs
- CompressStream.cs
- VerificationAttribute.cs
- HtmlElementEventArgs.cs
- HostnameComparisonMode.cs
- PieceNameHelper.cs
- ComponentResourceManager.cs
- SharedPersonalizationStateInfo.cs
- DecimalConverter.cs
- Matrix.cs
- XmlSchemaInfo.cs
- XsltQilFactory.cs
- DataServiceEntityAttribute.cs
- UIElementAutomationPeer.cs
- DefaultAssemblyResolver.cs
- LeafCellTreeNode.cs
- SmtpReplyReader.cs
- Operator.cs
- StylusButtonEventArgs.cs
- HighContrastHelper.cs
- Int32AnimationBase.cs
- ObjectResult.cs
- DataTableClearEvent.cs
- XhtmlBasicPanelAdapter.cs
- InvalidOleVariantTypeException.cs
- EntityDataSourceView.cs
- VariableBinder.cs
- ClientSection.cs
- ContractsBCL.cs
- XmlArrayItemAttribute.cs
- StyleXamlParser.cs
- _TLSstream.cs
- TargetControlTypeCache.cs