The macro below automatically prints the current page of an open Writer document. It worked in LibO 3.6.4 and earlier releases. now it has a different behaviour in LibO 4.0... (tested on Version 4.0.0.0.beta1+ (Build ID: 546faa79bf3b1e4b222f182d43a9839106a398d) if you launch the macro, the page is not printed directly (like it was expected) and the printer options dialog opens instead... maybe did you change something in the BASIC and the same code is now interpreted differently? Function PrintCurrentPage Dim oDoc,oVC,CurrentPage oDoc = ThisComponent oVC = oDoc.CurrentController.getViewCursor CurrentPage = Str(oVC.getPage) 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 = "Copies" args1(0).Value = 1 args1(1).Name = "RangeText" args1(1).Value = CurrentPage args1(2).Name = "Collate" args1(2).Value = false dispatcher.executeDispatch(document, ".uno:Print", "", 0, args1()) End Function
confirmed on WinXP 32bit, WinVista 64bit and Win7 64bit. tested on an earlier master release Version 3.7.0.0.alpha0+ (Build ID: 24761a6) the macro has the same behaviour ad 4.0 beta1. it seems a regression from 3.6.x branch. IMHO the same macro code should have the same behaviour in different LiBO releases. does anybody has news of other kind of macros working differently?
just had a quick look, to me looks like the framework code has screwed up somewhere, a breakpoint in sfx2/source/view/viewprn.cxx:656 and bApi seems to be false, ( resetting bApi to true which it should be and it works ) No idea where a sfx request is set to be Api
http://cgit.freedesktop.org/libreoffice/core/commit/?id=512b195910a7f73206c50a89ec5fc62cced49ace changed how bApi was determined. afaict you really can't depend on the accuracy of that IsAPI call ( I don't actually see anywhere in the code where api calls e.g. uno calls from basic are marked as such ) I think we should just revert those few lines to do with determining bApi
Noel Power committed a patch related to this issue. It has been pushed to "libreoffice-4-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=1e882f60013bae90b734a8f2ad90421550b39e83&g=libreoffice-4-0 fix fdo#58403 fix processing of arguments from ".uno:Print" request It will be available in LibreOffice 4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel Power committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c336f4e07835f3f7969531f5fc69c6ac153920a fix fdo#58403 fix processing of arguments from ".uno:Print" request The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
works again in Version 4.0.0.0.beta1+ (Build ID: 028fb7162b602d7cdcabac016bb54a7d14960fc) thanks Noel 4 that fix