[Libreoffice] [EasyHack][#34697][MHST] How to get the current page number in Calc, Impress, Draw

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Aug 26 11:08:13 PDT 2011


Hi,

ScPrintFunc is the correct place but not nPageNo. So
http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/printfun.cxx#2670is
responsible for printing and you should have a closer look at it. I
think
that with the context of lines 2719 to 2778 the main idea should be clear:
-Get the range we need to print to one page
-call ScPrintFunc::Print with this range

Maybe the best idea is to set a breakpoint in ScPrintFunc::Print and look
where it is called and what are the parameters.

I'll translate the german comments in this section for you. If you still
have any questions feel free to write a mail or ask on #libreoffice-dev.

Regards,
Markus

2011/8/26 Ta Duc Tung <tatung2112 at gmail.com>

>  On 08/18/2011 01:19 AM, Markus Mohrhard wrote:
>
> Hello,
>
> 2011/8/17 Ta Duc Tung <tatung2112 at gmail.com>
>
>> Hi,
>>
>> I'm trying to fix the bug number #34697 in
>> https://bugs.freedesktop.org/show_bug.cgi?id=34697
>> (No option for printing current page).
>>
>> The bug was fixed in Writer. Now I'm trying to make it in Calc. The
>> problem is that I don't know how to get the current page number. If in
>> Writer, I can get the current cursor then get the page number from that
>> cursor, but in Calc, where should I start?
>>
>
> I think we have someting in this direction already in calc. You should have
> a closer look at ScPrintFunc, especially at ScPrintfunc::PrintPage.
>
>  Regards,
> Markus
>
> Hi,
>
> I've tried to look into ScPrintFunc. In PrintPage, I see a param named
> nPageNo but when I print it out, the value is always 0. This  is probably
> not the current page :D. But I cannot find any other hint closed to finding
> current page rather than the nPageNo one :|.
>
> I think I can somehow get it from ScDocShell or ScDocument but still no
> hope. I'm still losing my way here. Anyone please help!
>
> Thank and Best Regards,
> Ta Tung
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110826/aeff20d9/attachment.htm>


More information about the LibreOffice mailing list