[api-dev] Questions ad XPrintable.print(properties) ...
Hi there, so far I have been under the assumptions that the list of properties that one is able to supply to the XPrintable.print(...) method matches the options that can be given in the GUI of the respective component type. This way each document type would have a common set of properties, but also additional print properties it would honor. Then, that's what I was expecting, the task would be to find the documentation of the print properties of the respective document type. Now, trying to print a presentation and taking advantage of its GUI defined print properties programmatically (i.e. print the presentation in form of handouts, where each page would depict a programmatically defined number of slides per printed page) seems to not be possible. At least I cannot find any documentation or working examples for this. So, two questions: * Is it intended that the print properties for XPrintable.print(...) allow for defining all print options that the document type's GUI allows for? * How can one exploit the GUI print options for presentations (simpress components) such, that one can programmatically print handouts with multiple slides per printed page? ---rony
Re: [api-dev] How to set Writer Multiple page view with the API
Hallo Bernard, so the ViewData are useless to locate the viewcursor on a page. the Viewcursor.Position change its position depending on the ViewLayout I had firts to locate the postion of the StartofPage to have some stable results I use now this routine for cursors who are not in a Table or Frame Sub Main VC = thiscomponent.currentcontroller.viewcursor xHere = VC.position.X yHere = VC.position.Y C = VC.text.createTextCursorByRange(VC,false) VC.jumpToStartOfPage xStart = VC.position.X yStart = VC.position.Y VC.gotorange(C,false) print X-Y CursorPosition in mm ( iif(xHere 0,(xHere-xStart)/100,0) - iif(yHere 0,(yHere-yStart)/100,0)) end sub Greetz Fernand Anoying because this new feature has his influence on the Viewcursor position , two page gives a X an Y who are different depending on the used ViewLayout. I normaly calculate the cursor postition by using the page number and the vieuwcursor.position. X and Y Now it becomes more complicated and i need to know the actual Viewlayout. or to force a known ViewLayout using your routines. I supose i have to look a bit closer to the ViewData property who is probably :-) a array of with the positions depending on the actual ViewLayout ? I comback with the hard figures. Thanks for the routines Fernand Message de Fernand Vanrie date 2010-07-13 12:15 : Hello, I tried to change the multiple pageview (2 page side by side) and the according zoom factor with the apI. I tried Thiscomponent.currentController.ViewSettings, I Found a property to change the zoom factor , but nothing to show 2 page side by side on the screen Hi Fernand, It seems API was forgotten when designing the new feature :-( But the dispatcher can do it, I wrote some routines based on the macro recorder. You have to set the zoom factor to a value suitable to the number of columns to display. There are two examples : reset to one column, and set to 2 columns. REM * BASIC * Option Explicit sub View1Column setViewColumns(1) setZoom(100) end sub sub View2Columns setViewColumns(2) setZoom(50) end sub ' dispatcher routines ( slightly modified ) sub setViewColumns(colNbr As Long) dim document as object dim dispatcher as object document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = ViewLayout.Columns args1(0).Value = colNbr args1(1).Name = ViewLayout.BookMode args1(1).Value = false dispatcher.executeDispatch(document, .uno:ViewLayout, , 0, args1()) end sub sub setZoom(zoomValue As Long) dim document as object dim dispatcher as object document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) dim args1(2) as new com.sun.star.beans.PropertyValue args1(0).Name = Zoom.Value args1(0).Value = zoomValue args1(1).Name = Zoom.ValueSet ' args1(1).Value = 28703 args1(2).Name = Zoom.Type args1(2).Value = 0 dispatcher.executeDispatch(document, .uno:Zoom, , 0, args1()) end sub Regards Bernard - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] Perl Bindings - Can't get Desktop object
Hi, I'm not sure if this question is appropriate for this list, but I'm hoping someone here might be able to offer some advice. I've been trying to get the perl bindings OpenOffice::UNO to work, and it seems really really close to working - it connects to the ServiceManager but fails to obtain the Desktop object. I obtained the package from here: http://search.cpan.org/~mbarbon/OpenOffice-UNO-0.07/UNO.pm As a comparison I installed the py-uno package and got a test script working fine in python, so I think the environment is ok. I'm using ubuntu packages on two different machines, with 3.2.0 on one and and 3.1.0 on the other. Results are the same. I have tried 3 different variation of the statement to create the desktop object, but they all fail with the error: terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException' my $desktop = $smgr-createInstance( com.sun.star.frame.Desktop); #my $desktop = $smgr-createInstanceWithContext( com.sun.star.frame.Desktop, $rc); #my $desktop = $smgr-createInstanceWithContext( com.sun.star.frame.Desktop, $remoteContext); Any advice would be much appreciated. The python version of the script uses the same method calls and works perfectly, and goes on to happily modify a spreadsheet document. All 3 method variations work in the python version. Here's the output of the script: begin m...@nova:~/OpenOffice_UNO$ ./perl_uno_test.pl Created Local Context at ./perl_uno_test.pl line 20. Got resolver at ./perl_uno_test.pl line 27. Got Remote ServiceManager at ./perl_uno_test.pl line 36. terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException' end and here's the source: begin #!/usr/bin/perl use strict; use OpenOffice::UNO; use Cwd; use Data::Dumper; our $SMGR_URL = uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager; # connect to the OpenOffice.org server #$uno = OpenOffice::UNO-new; my $uno = new OpenOffice::UNO(); my $localContext = get_context($uno); warn Created Local Context; # create the UnoUrlResolver my $resolver = $localContext-getServiceManager-createInstanceWithContext( com.sun.star.bridge.UnoUrlResolver, $localContext ); warn Got resolver; # connect to the running office my $remoteContext = $resolver-resolve( uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext ); warn Got remoteContext: . Dumper($remoteContext); my $smgr = $remoteContext-getServiceManager(); warn Got Remote ServiceManager; my $rc = $smgr-getPropertyValue(DefaultContext); # get the central desktop object my $desktop = $smgr-createInstance( com.sun.star.frame.Desktop); #my $desktop = $smgr-createInstanceWithContext( com.sun.star.frame.Desktop, $rc); #my $desktop = $smgr-createInstanceWithContext( com.sun.star.frame.Desktop, $remoteContext); warn Got desktop; exit; sub get_context { my ($pu) = @_; # can't make initialization with path work on Win32 if ($^O eq 'MSWin32' || $ENV{URE_BOOTSTRAP}) { return $pu-createInitialComponentContext(); } else { return $pu-createInitialComponentContext(get_file('perluno_paths.txt')); } } sub get_file { my ($file) = @_; my ($dir) = getcwd(); if ($^O eq 'MSWin32') { # getcwd returns forward slashes, which is OK in this case return 'file:///' . $dir . '/' . $file; } else { return 'file://' . $dir . '/' . $file; } } end Regards, Mike Tonks - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org