internal ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent) { #if TEXTPANELLAYOUTDEBUG TextPanelDebug.IncrementCounter("ContainerPara.GetParagraphs", TextPanelDebug.Category.TextView); #endif // Query paragraph details PTS.FSSUBTRACKDETAILS subtrackDetails; PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails)); // hasTextContent is set to true if any of the children paragraphs has text content, not just attached objects hasTextContent = false; if (subtrackDetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } // Get list of paragraphs PTS.FSPARADESCRIPTION [] arrayParaDesc; PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc); List <ParagraphResult> paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length); for (int i = 0; i < arrayParaDesc.Length; i++) { BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(paraClient); ParagraphResult paragraphResult = paraClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } paragraphResults.Add(paragraphResult); } return(new ReadOnlyCollection <ParagraphResult>(paragraphResults)); }
// ------------------------------------------------------------------ // Returns a collection of ParagraphResults for the column's paragraphs. // // pfstrack - Pointer to PTS track representing a column. // parentOffset - Parent offset from the top of the page. // hasTextContent - true if any of the children paras has text content // ------------------------------------------------------------------ internal ReadOnlyCollection <ParagraphResult> GetParagraphResultsFromColumn(IntPtr pfstrack, Vector parentOffset, out bool hasTextContent) { // Get track details PTS.FSTRACKDETAILS trackDetails; PTS.Validate(PTS.FsQueryTrackDetails(PtsContext.Context, pfstrack, out trackDetails)); hasTextContent = false; if (trackDetails.cParas == 0) { return(null); } PTS.FSPARADESCRIPTION[] arrayParaDesc; PtsHelper.ParaListFromTrack(PtsContext, pfstrack, ref trackDetails, out arrayParaDesc); List <ParagraphResult> paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length); for (int i = 0; i < arrayParaDesc.Length; i++) { BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(paraClient); ParagraphResult paragraphResult = paraClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } paragraphResults.Add(paragraphResult); } return(new ReadOnlyCollection <ParagraphResult>(paragraphResults)); }
internal ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent) { PTS.FSSUBTRACKDETAILS fssubtrackdetails; PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails)); hasTextContent = false; if (fssubtrackdetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } PTS.FSPARADESCRIPTION[] array; PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out array); List <ParagraphResult> list = new List <ParagraphResult>(array.Length); for (int i = 0; i < array.Length; i++) { BaseParaClient baseParaClient = base.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(baseParaClient); ParagraphResult paragraphResult = baseParaClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } list.Add(paragraphResult); } return(new ReadOnlyCollection <ParagraphResult>(list)); }
internal ReadOnlyCollection <ParagraphResult> GetParagraphResultsFromColumn(IntPtr pfstrack, Vector parentOffset, out bool hasTextContent) { Invariant.Assert(!this.IsDisposed); PTS.FSTRACKDETAILS fstrackdetails; PTS.Validate(PTS.FsQueryTrackDetails(this.StructuralCache.PtsContext.Context, pfstrack, out fstrackdetails)); hasTextContent = false; if (fstrackdetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } PTS.FSPARADESCRIPTION[] array; PtsHelper.ParaListFromTrack(this.StructuralCache.PtsContext, pfstrack, ref fstrackdetails, out array); List <ParagraphResult> list = new List <ParagraphResult>(array.Length); for (int i = 0; i < array.Length; i++) { BaseParaClient baseParaClient = this.StructuralCache.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(baseParaClient); ParagraphResult paragraphResult = baseParaClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } list.Add(paragraphResult); } return(new ReadOnlyCollection <ParagraphResult>(list)); }
private ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent) { List <ParagraphResult> paragraphResults; // Query subpage details PTS.FSSUBPAGEDETAILS subpageDetails; PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails)); // hasTextContent is set to true if any of the children paragraphs has text content, not just attached objects hasTextContent = false; // Subpage content may be simple or complex - // depending of set of features used in the content of the page. // (1) simple subpage (contains only one track) // (2) complex subpage (contains columns) if (PTS.ToBoolean(subpageDetails.fSimple)) { // (1) simple subpage (contains only one track) // Get track details PTS.FSTRACKDETAILS trackDetails; PTS.Validate(PTS.FsQueryTrackDetails(PtsContext.Context, subpageDetails.u.simple.trackdescr.pfstrack, out trackDetails)); hasTextContent = true; if (trackDetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } // Get list of paragraphs PTS.FSPARADESCRIPTION[] arrayParaDesc; PtsHelper.ParaListFromTrack(PtsContext, subpageDetails.u.simple.trackdescr.pfstrack, ref trackDetails, out arrayParaDesc); paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length); for (int i = 0; i < arrayParaDesc.Length; i++) { BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(paraClient); ParagraphResult paragraphResult = paraClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } paragraphResults.Add(paragraphResult); } } else { // (2) complex page (contains columns) // cBasicColumns == 0, means that subpage content is empty if (subpageDetails.u.complex.cBasicColumns == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } // Retrieve description for each column. PTS.FSTRACKDESCRIPTION[] arrayColumnDesc; PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc); Debug.Assert(arrayColumnDesc.Length == 1); // Get track details PTS.FSTRACKDETAILS trackDetails; PTS.Validate(PTS.FsQueryTrackDetails(PtsContext.Context, arrayColumnDesc[0].pfstrack, out trackDetails)); if (trackDetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } // Get list of paragraphs PTS.FSPARADESCRIPTION[] arrayParaDesc; PtsHelper.ParaListFromTrack(PtsContext, arrayColumnDesc[0].pfstrack, ref trackDetails, out arrayParaDesc); paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length); for (int i = 0; i < arrayParaDesc.Length; i++) { BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(paraClient); ParagraphResult paragraphResult = paraClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } paragraphResults.Add(paragraphResult); } } return(new ReadOnlyCollection <ParagraphResult>(paragraphResults)); }
private ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent) { PTS.FSSUBPAGEDETAILS fssubpagedetails; PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails)); hasTextContent = false; List <ParagraphResult> list; if (PTS.ToBoolean(fssubpagedetails.fSimple)) { PTS.FSTRACKDETAILS fstrackdetails; PTS.Validate(PTS.FsQueryTrackDetails(base.PtsContext.Context, fssubpagedetails.u.simple.trackdescr.pfstrack, out fstrackdetails)); hasTextContent = true; if (fstrackdetails.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } PTS.FSPARADESCRIPTION[] array; PtsHelper.ParaListFromTrack(base.PtsContext, fssubpagedetails.u.simple.trackdescr.pfstrack, ref fstrackdetails, out array); list = new List <ParagraphResult>(array.Length); for (int i = 0; i < array.Length; i++) { BaseParaClient baseParaClient = base.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(baseParaClient); ParagraphResult paragraphResult = baseParaClient.CreateParagraphResult(); if (paragraphResult.HasTextContent) { hasTextContent = true; } list.Add(paragraphResult); } } else { if (fssubpagedetails.u.complex.cBasicColumns == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } PTS.FSTRACKDESCRIPTION[] array2; PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array2); PTS.FSTRACKDETAILS fstrackdetails2; PTS.Validate(PTS.FsQueryTrackDetails(base.PtsContext.Context, array2[0].pfstrack, out fstrackdetails2)); if (fstrackdetails2.cParas == 0) { return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0))); } PTS.FSPARADESCRIPTION[] array3; PtsHelper.ParaListFromTrack(base.PtsContext, array2[0].pfstrack, ref fstrackdetails2, out array3); list = new List <ParagraphResult>(array3.Length); for (int j = 0; j < array3.Length; j++) { BaseParaClient baseParaClient2 = base.PtsContext.HandleToObject(array3[j].pfsparaclient) as BaseParaClient; PTS.ValidateHandle(baseParaClient2); ParagraphResult paragraphResult2 = baseParaClient2.CreateParagraphResult(); if (paragraphResult2.HasTextContent) { hasTextContent = true; } list.Add(paragraphResult2); } } return(new ReadOnlyCollection <ParagraphResult>(list)); }