On 07/04/2012 03:23 PM, Noel Power wrote:
with
http://cgit.freedesktop.org/libreoffice/core/commit/?id=1720641bf36306fc296635925e571556ced8a302
a long standing wrinkle with modifying nested structs in basic should
be eliminated
before this change the following macro snippet would not work.
Dim b0 as new "com.sun.star.table.TableBorder"
MsgBox b0.HorizontalLine.OuterLineWidth 'HorizontalLine member is
itself a "com.sun.star.table.BorderLine" struct
b0.HorizontalLine.OuterLineWidth = 9
'the following line unexpectedly displays '0' because
'b0.HorizontalLine' returns a new but temporary copy of
"com.sun.star.table.BorderLine"
MsgBox b0.HorizontalLine.OuterLineWidth
the unfortunate non obvious workaround to modify the contents of
'b0.HorizontalLine.OuterLineWidth' is....
a) create a new "com.sun.star.table.BorderLine" instance
b) clone it with the contents of 'b0.HorizontalLine'
c) modify the 'OuterLineWidth' member of the new
"com.sun.star.table.BorderLine" instance
d) set the value b0.HorizontalLine' with the newly modified
"com.sun.star.table.BorderLine" instance
Although I have test this pretty well [*] ( and fixed lots of issues
already before committing ) changes to the basic runtime are always
perilous ;-) so.. please please be on the lookout for any strange
behaviour regarding handling of uno structs in basic
Noel
[*] have to admit I only tested one level of indirection. I didn't
find a suitable structure that contains a structure that contains a
structure to test, if you know of one off hand let me know :-) Also I
have yet to write some unit tests for this ( but will do )
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
The behavior change scares me a bit. I seem to remember some time back
that there was a reason for this behavior, but I was given that
information many years back..... I discussed it in Berlin
http://www.pitonyak.org/oooconf/OOoConf_2004_Macro_Presentation.sxi
Do you intend to change UNO so that structures return as a reference
(very dangerous, don't do it), or only when used in basic as
object.structure.property? This may be workable / safe, but may break
some existing code (although I can't think of any code that it would break).
I feel silly asking this, since if you know how to change the behavior,
then you likely know more about this than I (I don't know how to change
the behavior).
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.