On Mar 30, 12:25 am, Eli Friedman <[EMAIL PROTECTED]> wrote:
> krithika wrote:
> > I tried looking in to nsPrintEngine.cpp code and the routine you
> > mentioned.But Iam finding this quite complex.
>
> > preShell I get maps only to the document or frames of the document.Iam
> > unable to make any progress.
>
> > My experiments with nsDocumentViewer:PrintPreviewNavigate is also
> > failing to give me the preview page content.
>
> > Which is the point at which a document is split in to pages as in
> > Print Preview?I need to hook in at that point.
>
> Hmm, first off, are you using a trunk build? Some stuff has changed a
> bit there, so that you'll have to get the prescontext from the printengine.
>
> The place where the page splits actually get calculated is the call to
> InitialReflow in nsPrintEngine::ReflowPrintObject.
>
> If you have a debug build, the functions in nsIFrameDebug might be useful.
>
> Quick approximate summary of the frame tree for print preview: the root
> frame is the viewport. The only child of that is the root scroll frame.
> The only child of that is the page sequence frame. The children of
> that are the page frames. Each page frame has one child, an
> nsPageContentFrame. The page content frame contain the content on each
> page. The most common frames are nsBlockFrame, nsInlineFrame, and
> nsTextFrame, which get created for normal textual content.
>
> When a content element doesn't fit on one page, the frame gets split.
> Therefore, a content node can have frames on multiple pages. The
> splitting happens during reflow.
>
> The frame tree is a bit confusing to get used to, so try not to get
> frustrated.
>
> -Eli
Hi,
Thanks for the explanation.It clarified lot of things for me.I have
made some progress.
As you can see I obtained pageContentFrame .But now the problem is the
content is always that of the first page.
When I print all the objects I find that till firstPageElem they are
different but when it comes to content it is the same.
Is contentPage->GetFirstChild(nsnull) the right one to do to get Page
Content.
Hope Iam clear.
Thanks in Advance,
Krithika
================
for (nsIFrame* page = mFrames.FirstChild(); page; page = page-
>GetNextSibling())
{
nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, page);
nsIFrame* contentFrame = pf->GetFirstChild(nsnull);
nsPageContentFrame* contentPage =
NS_STATIC_CAST(nsPageContentFrame*, contentFrame);
nsIFrame* firstPageElem= contentPage-
>GetFirstChild(nsnull);
nsIContent* cont = firstPageElem->GetContent();
...
//process Content to get page start element and end element
details
}
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout