Bug 58403 - print current page macro has different behaviour in 4.0 beta
Summary: print current page macro has different behaviour in 4.0 beta
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.0.0.1 target:4.1.0
Keywords: regression
Depends on:
Blocks:
 
Reported: 2012-12-17 10:26 UTC by tommy27
Modified: 2013-01-02 07:29 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tommy27 2012-12-17 10:26:42 UTC
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
Comment 1 tommy27 2012-12-19 14:07:47 UTC
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?
Comment 2 Noel Power 2012-12-20 18:17:59 UTC
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
Comment 3 Noel Power 2012-12-20 19:24:38 UTC
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
Comment 4 Not Assigned 2012-12-20 19:38:10 UTC
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.
Comment 5 Not Assigned 2012-12-20 19:38:28 UTC
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.
Comment 6 tommy27 2012-12-21 07:01:39 UTC
works again in Version 4.0.0.0.beta1+ (Build ID: 028fb7162b602d7cdcabac016bb54a7d14960fc)

thanks Noel 4 that fix