Ian Laurenson wrote:
> Here is an alternative bit of code, with the original code left as
> comments:
>
> sub Monday
> oCurController = ThisComponent.CurrentController
> oActiveSheet = oCurController.ActiveSheet
>
> ' Range("A47:AL126").Select
> oCurController.select(oActiveSheet.getCellRangeByName("A1:B3"))
>
> ' Selection.PrintOut Copies:=1, Collate:=True
> dim mPrintProperties(1) as new com.sun.star.beans.PropertyValue
> mPrintProperties(0).name = "Copies"
> mPrintProperties(0).value = 1
> mPrintProperties(0).name = "Collate"
> mPrintProperties(0).value = true
> oActiveSheet.setprintareas(ocurController.getSelection)
> thisComponent.print(mPrintProperties())
>
> ' ActiveWorkbook.Save
> thisComponent.store
> end sub
Thanks Ian, I think this slightly changed example clearly shows that the
level of complexity in the code is nearly the same, IMHO in its essence
it's even the same code. The most prominent difference is that handing
over the Print Properties uses a bit more code than in the VBA example.
I agree that the OOoBasic example needs some more lines here but it is
not more complex, just more code.
> By the way, I think your subject for this posting is wrong. The macro
> language BASIC is close to identical between OOo BASIC and VBA. The
> underlying object models (APIs) are very different.
Yes, the OOo object model is more complex, IMHO partially because it is
more sophisticated and powerful, but partially also because it was
indeed designed too "tech headed".
So one reason for the additional complexity in OOoBasic is (as you
mentioned) that the OOo object model often is more complex (to varying
extent).
But there is another reason: VBA offers more "sugar" that hides existing
API complexity, here it's the "Range" object that doesn't exist in the
"real" (COM based) API, but is "simulated" in the Basic runtime.
A comparable example in OOoBasic is the "ThisComponent" object that also
doesn't exist in the "real" (UNO) API. Also handing over parameters by
"Name=Value" instead of using the Sequence as in OOoBasic is easier.
These are examples for what we could do on the Basic level to make macro
programming easier. So there is a grain of truth in the subject. :-)
> In part I agree with a lot of your sentiments, and they have been
> acknowledged by the developers.
Yes, and concerning OOoBasic we have two ways to approach this: we can
either add new, easier to use API calls and we can make OOoBasic smarter
so that it hides the complexity from the macro developer better (as
described above).
And of course your own approach of creating wrappers and contribute them
to the community is also very helpful!
Best regards,
Mathias
--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]