Re: [Libreoffice] [EasyHack][Print current page] How to get the last active page number?

2011-03-30 Thread Jan Holesovsky
Hi Skyler,

On 2011-03-27 at 20:33 -0700, Skyler Hawthorne wrote:

 In PrintDialog::setupOptionalUI, it appears the default text for the 
 page range edit box is set on line 1507 ( 
 http://opengrok.libreoffice.org/xref/libs-gui/vcl/source/window/printdlg.cxx#1507
  
 ). As a test, I commented out line #1516, where it actually sets the 
 string value for the edit box, and added:
 
 rtl::OUString curActivePageNum( RTL_CONSTASCII_USTRINGPARAM(2) );
 pField-SetText( curActivePageNum );
 maPController-setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
 PageRange ) ), makeAny( curActivePageNum ) );
 
 And that sets the PrinterController's PageRange property to 2, and sets 
 it as the default value for the edit box.
 
 Now, I just need to be able to access the current document's page 
 number. However, I've been digging through this code all weekend, and I 
 cannot find anything that stores that value. Is it some other 
 PropertyValue stored in maPController? If so, what is the name? Is there 
 some static function that can access information about the current document?
 
 Any help is much appreciated.

The construction of the print range seems to happen here:

http://opengrok.libreoffice.org/xref/libs-gui/vcl/source/gdi/print3.cxx#345

I'd play with the PrintRange property, if I am not mistaken, it comes
from

http://opengrok.libreoffice.org/xref/writer/sw/source/core/view/printdata.cxx#305

For Writer, I'd pass the current page number to the SwPrintUIOptions's
constructor wherever it is being constructed, probably in SwDocShell.
If that is correct, in SwDocShell you have GetWrtShell(), and can do the
same as

http://opengrok.libreoffice.org/xref/writer/sw/source/ui/uno/unotxvw.cxx#1511

I think it will be something similar for the other apps too.

Regards,
Kendy

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [EasyHack][Print current page] How to get the last active page number?

2011-03-27 Thread Skyler Hawthorne

Hello all,

I am working on the EasyHack Print current page ( 
http://wiki.documentfoundation.org/Easy_Hacks#Print_current_page ), and 
I need a little help. I believe I've found out how to change the default 
value:


In PrintDialog::setupOptionalUI, it appears the default text for the 
page range edit box is set on line 1507 ( 
http://opengrok.libreoffice.org/xref/libs-gui/vcl/source/window/printdlg.cxx#1507 
). As a test, I commented out line #1516, where it actually sets the 
string value for the edit box, and added:


rtl::OUString curActivePageNum( RTL_CONSTASCII_USTRINGPARAM(2) );
pField-SetText( curActivePageNum );
maPController-setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
PageRange ) ), makeAny( curActivePageNum ) );


And that sets the PrinterController's PageRange property to 2, and sets 
it as the default value for the edit box.


Now, I just need to be able to access the current document's page 
number. However, I've been digging through this code all weekend, and I 
cannot find anything that stores that value. Is it some other 
PropertyValue stored in maPController? If so, what is the name? Is there 
some static function that can access information about the current document?


Any help is much appreciated.
--
Skyler Hawthorne
a.k.a. Cosmopolitan

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice