Improved  VBA Support <ul><ul><li>Noel Power </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul>
Introduction <ul><li>About Me </li></ul><ul><ul><li>Working/hacking Openoffice.org ~ 4 years </li></ul></ul><ul><ul><li>wo...
Project Update <ul><li>Novell & Sun work together </li></ul><ul><ul><ul><li>http://blogs.sun.com/GullFOSS/entry/sun_and_no...
What does this cooperation mean for VBA interoperability <ul><li>Eventually we can have a single solution. </li></ul><ul><...
Where are we <ul><li>Architecture changes </li></ul><ul><ul><li>vba interoperability delivered either as  </li></ul></ul><...
<ul><li>UpStreaming </li></ul><ul><ul><li>many vba compatibility issues have been addressed in various abxxx and npowerxxx...
What's Next <ul><li>Object modules ( Sheet, Workbook, perhaps even support for 'simple' Form modules ) </li></ul><ul><li>C...
What can you do to help <ul><li>Get involved </li></ul><ul><ul><li>irc, #go-oo { me = noelp }, mail noel.power@novell.com ...
<ul><li>How have we done.... ( lets see how far we have got in relation to the issues identified in last years presentatio...
Upstreaming <ul><li>Not enough hacks upstreamed yet </li></ul><ul><li>Option VBASupport  </li></ul><ul><ul><li>provides a ...
What needs to be upstreamed <ul><li>Dim r1 as Range </li></ul><ul><li>Set and assignment for vba objects </li></ul><ul><li...
VBA exotics  <ul><li>set  r1  =  Range ( “a1” ) </li></ul><ul><li>r1  =   “foo”   ' value of cell A1 is set to “foo” </li>...
Whats Next <ul><li>Basic Support for Userforms & Controls </li></ul><ul><ul><li>tie Userform module to Dialog </li></ul></...
<ul><li>Andreas Bregas </li></ul><ul><ul><li>Software Engineer </li></ul></ul><ul><ul><ul><li>Sun Microsystems, Inc. </li>...
Introduction <ul><li>About me </li></ul><ul><ul><li>Working for Sun Microsystems (Star Division) for 12 years </li></ul></...
Extending OOo Basic functionality <ul><li>Original reference for OOo Basic was VB 4.0 </li></ul><ul><ul><li>VB(A) >4.0 fea...
Microsoft Office Macro Runtime Library (MORL) <ul><li>Emerged from Sun internal Macro Migration project </li></ul><ul><li>...
Microsoft Office Macro Runtime Library (MORL) <ul><li>VBA API is described as UNO API </li></ul><ul><li>VBA API is impleme...
MORL versus VBA Interoperability
Using MORL for VBA interoperability <ul><li>Use Java code as template to extend C++ </li></ul><ul><ul><li>Already started ...
Todos for using MORL for Word <ul><li>MORL: Get rid of source code migration step </li></ul><ul><ul><li>General  Applicati...
Improved VBA support <ul><li>Andreas Bregas </li></ul><ul><ul><li>[email_address] </li></ul></ul>
Upcoming SlideShare
Loading in …5
×

Improved VBA support

2,889 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,889
On SlideShare
0
From Embeds
0
Number of Embeds
36
Actions
Shares
0
Downloads
35
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Improved VBA support

  1. 1. Improved VBA Support <ul><ul><li>Noel Power </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul>
  2. 2. Introduction <ul><li>About Me </li></ul><ul><ul><li>Working/hacking Openoffice.org ~ 4 years </li></ul></ul><ul><ul><li>working on VBA interoperability </li></ul></ul><ul><li>A Bit of History </li></ul><ul><ul><li>Started in response to customer demand </li></ul></ul><ul><ul><li>Various people have stuck there hand in here and there </li></ul></ul><ul><ul><li>Releases </li></ul></ul><ul><ul><ul><li>SUSE 10.1 ( first appearance ) </li></ul></ul></ul><ul><ul><ul><li>SUSE SLED 10 ( first supported version ) </li></ul></ul></ul><ul><ul><li>Started VBA Interoperability incubator project </li></ul></ul><ul><ul><ul><li>http://vba.openoffice.org or </li></ul></ul></ul><ul><ul><ul><li>http://wiki.services.openoffice.org/wiki/VBA </li></ul></ul></ul>
  3. 3. Project Update <ul><li>Novell & Sun work together </li></ul><ul><ul><ul><li>http://blogs.sun.com/GullFOSS/entry/sun_and_novell_work_together </li></ul></ul></ul><ul><li>Sun opensources the Microsoft Office Macro Runtime Library ( MORL ) </li></ul><ul><ul><ul><li>thanks to Michael Meeks, Kai Ramme, Juergen Schmidt, Andreas Bregas </li></ul></ul></ul><ul><ul><ul><li>http://bonsai.go-oo.org/rview.cgi?cvsroot=/home/ooweb/cvsup&dir=api/helperapi&module=OpenOffice </li></ul></ul></ul><ul><li>Andreas Bregas joins the project as co-lead </li></ul>
  4. 4. What does this cooperation mean for VBA interoperability <ul><li>Eventually we can have a single solution. </li></ul><ul><li>Pluggability </li></ul><ul><li>MORL provides a Java uno implementation code that can be ported to C++. </li></ul><ul><li>MORL has some test documents and associated infrastructure ( logging support ) that we can reuse. </li></ul><ul><li>The promise of addressing Word macros in the future. </li></ul>
  5. 5. Where are we <ul><li>Architecture changes </li></ul><ul><ul><li>vba interoperability delivered either as </li></ul></ul><ul><ul><ul><li>a standalone extension </li></ul></ul></ul><ul><ul><ul><li>built into openoffice itself </li></ul></ul></ul><ul><ul><ul><li>key objects are services ( new style ) </li></ul></ul></ul><ul><ul><ul><li>internal namespace changes to allow extension for word support </li></ul></ul></ul><ul><li>Porting </li></ul><ul><ul><li>To aid porting from the helperapi ( MORL ) C++ code now provides a XHelperInterface ( we should perhaps provide an XUnoAccess interface... takers? ) </li></ul></ul><ul><ul><li>Constants are now generated from meta-data ( thanks to Jan Holesovsky (kendy) for perlification ) </li></ul></ul><ul><ul><li>A good few classes have been fully or partially ported from MORL </li></ul></ul>
  6. 6. <ul><li>UpStreaming </li></ul><ul><ul><li>many vba compatibility issues have been addressed in various abxxx and npowerxxx cws(s) like.. </li></ul></ul><ul><ul><li>Planned for OOo 2.4 </li></ul></ul><ul><ul><ul><li>npower7 – stack of vba compatibility issues resolved </li></ul></ul></ul><ul><ul><ul><li>npower8 – object module changes, sync with ooo-build, some MORL porting </li></ul></ul></ul>
  7. 7. What's Next <ul><li>Object modules ( Sheet, Workbook, perhaps even support for 'simple' Form modules ) </li></ul><ul><li>Change how compatibility is handled </li></ul><ul><ul><ul><li>aim for no more 'option VBASupport 1' type nonsense </li></ul></ul></ul><ul><ul><ul><li>compatibility from the 'document' basic manager down rather than the module level </li></ul></ul></ul><ul><li>Application specific Dialog/UserForm controls ( longer term goal ) </li></ul><ul><li>Event handling, faking compatible events for controls and controls on Userforms </li></ul><ul><li>support for Error Object, e.g. </li></ul><ul><ul><li>Error.raise “some descriptive text” </li></ul></ul>
  8. 8. What can you do to help <ul><li>Get involved </li></ul><ul><ul><li>irc, #go-oo { me = noelp }, mail noel.power@novell.com </li></ul></ul><ul><ul><li>http://wiki.services.openoffice.org/wiki/VBA </li></ul></ul><ul><li>Identify missing api & test existing api </li></ul><ul><ul><li>some basic tests at ooo-build/tests/macros </li></ul></ul><ul><ul><li>cws npower8 will include some test documents </li></ul></ul><ul><li>Help port MORL to c++ </li></ul><ul><ul><ul><li>http://wiki.services.openoffice.org/wiki/Porting_notes#Calc_Objects_to_port </li></ul></ul></ul><ul><ul><ul><li>http://wiki.services.openoffice.org/wiki/Porting_notes#Hints_for_porting_idl </li></ul></ul></ul>
  9. 9. <ul><li>How have we done.... ( lets see how far we have got in relation to the issues identified in last years presentation at OOCon ) </li></ul><ul><ul><li>http://marketing.openoffice.org/ooocon2006/presentations/tuesday_g1.odp </li></ul></ul>
  10. 10. Upstreaming <ul><li>Not enough hacks upstreamed yet </li></ul><ul><li>Option VBASupport </li></ul><ul><ul><li>provides a basic indicator that interoperability is 'on' </li></ul></ul><ul><ul><li>used a hook internally in the basic engine </li></ul></ul><ul><li>css::com::ArrayWrapper </li></ul><ul><ul><li>multi-dimensional array support for Objects </li></ul></ul><ul><ul><li>influence the base of the Array regardless of the Module 'Option Base' setting </li></ul></ul><ul><li>Array(...) function & Option Base </li></ul><ul><li>Support a 'default method' concept </li></ul>
  11. 11. What needs to be upstreamed <ul><li>Dim r1 as Range </li></ul><ul><li>Set and assignment for vba objects </li></ul><ul><li>Most vba constants are available ( maho ) </li></ul><ul><li>Default properties { LHS & RHS } </li></ul><ul><li>Global objects </li></ul><ul><ul><li>Application, Sheets... </li></ul></ul><ul><li>Compatibility API </li></ul><ul><ul><li>Range, Workbook, Worksheet... </li></ul></ul><ul><li>Better event support </li></ul><ul><ul><li>Excel toolbox controls, shapes, images, workbook, worksheet </li></ul></ul><ul><li>Larger basic module support </li></ul>
  12. 12. VBA exotics <ul><li>set r1 = Range ( “a1” ) </li></ul><ul><li>r1 = “foo” ' value of cell A1 is set to “foo” </li></ul><ul><li>dim aVar as String ' or variant </li></ul><ul><li>'aVar wil contain “foo” </li></ul><ul><li>aVar = r1 </li></ul><ul><li>'Collections </li></ul><ul><li>dSheets = Worksheets ' global </li></ul><ul><li>wrb = dSheets( 1 ) </li></ul><ul><li>wrb = dSheets.Item( 1 ) </li></ul><ul><li>wrb = dSheets.( &quot;Sheet1&quot; ) </li></ul><ul><li>wrb = dSheets.Item( &quot;Sheet1&quot; ) </li></ul>
  13. 13. Whats Next <ul><li>Basic Support for Userforms & Controls </li></ul><ul><ul><li>tie Userform module to Dialog </li></ul></ul><ul><ul><li>allow contols to be accessed from Worksheet </li></ul></ul><ul><ul><ul><li>Sheet(1).CommandButton1 </li></ul></ul></ul><ul><ul><ul><li>Sheet(1).MyComboxBox.AddItem( ListItem ) </li></ul></ul></ul><ul><li>Compatibile Array handling </li></ul><ul><ul><li>array of array syntax myarray(2)(3) </li></ul></ul><ul><ul><li>copy by value </li></ul></ul><ul><li>Import internal Collection class </li></ul><ul><ul><li>handle string key in Item & add methods </li></ul></ul><ul><li>Generally Improve API coverage </li></ul><ul><li>More document analysis </li></ul>
  14. 14. <ul><li>Andreas Bregas </li></ul><ul><ul><li>Software Engineer </li></ul></ul><ul><ul><ul><li>Sun Microsystems, Inc. </li></ul></ul></ul>Improved VBA support <ul><li>OOoCon 2007 Barcelona </li></ul>
  15. 15. Introduction <ul><li>About me </li></ul><ul><ul><li>Working for Sun Microsystems (Star Division) for 12 years </li></ul></ul><ul><ul><li>Responsible for </li></ul></ul><ul><ul><ul><li>OOo Basic core (compiler, runtime system) </li></ul></ul></ul><ul><ul><ul><li>OOo Basic IDE, Dialog Editor, Scripting Framework, ... </li></ul></ul></ul><ul><ul><li>Joined VBA Interoperability incubator project as co-lead in February 2007, focussing on </li></ul></ul><ul><ul><ul><li>Extending OOo Basic core to support missing VBA functionality </li></ul></ul></ul><ul><ul><ul><li>Fixing VBA compatibility related problems </li></ul></ul></ul><ul><ul><ul><li>Reviewing patches containing Basic core changes </li></ul></ul></ul>
  16. 16. Extending OOo Basic functionality <ul><li>Original reference for OOo Basic was VB 4.0 </li></ul><ul><ul><li>VB(A) >4.0 features are missing </li></ul></ul><ul><ul><li>Compatibility to VBA is not 100%, many small issues </li></ul></ul><ul><li>Examples for Basic core related issues </li></ul><ul><ul><li>Done: Class support feature, Modules > 64K </li></ul></ul><ul><ul><li>Done: Many new Runtime Functions </li></ul></ul><ul><ul><li>Done: Many fixes of Runtime Function behavior </li></ul></ul><ul><ul><li>Todo: Class support / event handling for Userforms </li></ul></ul><ul><ul><li>Todo: Support array of array syntax </li></ul></ul><ul><ul><li>Todo: Basic core support for “VBA exotics” </li></ul></ul>
  17. 17. Microsoft Office Macro Runtime Library (MORL) <ul><li>Emerged from Sun internal Macro Migration project </li></ul><ul><li>Developed for some years with much effort </li></ul><ul><li>With the start of the VBA interoperability project there were two parallel approaches </li></ul><ul><li>To support a single open solution Sun decided to join the VBA interoperability project </li></ul><ul><li>MORL was made open source </li></ul>
  18. 18. Microsoft Office Macro Runtime Library (MORL) <ul><li>VBA API is described as UNO API </li></ul><ul><li>VBA API is implemented in Java, ~3,5 MB of code </li></ul><ul><li>Covers about a big part of the Word and Excel API </li></ul><ul><ul><li>~1100/1500 Word symbols </li></ul></ul><ul><ul><li>~1000/1100 Excel symbols </li></ul></ul><ul><li>Needs Macro Migration Tool to adapt VBA sources </li></ul>
  19. 19. MORL versus VBA Interoperability
  20. 20. Using MORL for VBA interoperability <ul><li>Use Java code as template to extend C++ </li></ul><ul><ul><li>Already started for Excel </li></ul></ul><ul><li>Use both, taking some symbols from MORL, other symbols VBA interoperability solution </li></ul><ul><ul><li>Technically very difficult </li></ul></ul><ul><ul><li>Unfavorable mixture of different approaches </li></ul></ul><ul><li>Use MORL for Word only </li></ul><ul><ul><li>Could be reasonable as a temporary solution </li></ul></ul><ul><ul><li>Would require some changes, both in MORL as in VBA interoperability library </li></ul></ul>
  21. 21. Todos for using MORL for Word <ul><li>MORL: Get rid of source code migration step </li></ul><ul><ul><li>General Application object instead of Application.Writer </li></ul></ul><ul><ul><li>Support all other global objects like ActiveDocument , ActiveWindow , Documents without using a Basic library </li></ul></ul><ul><ul><li>Direct support for VBA constants, e.g. wdYellow instead of com.sun.star.helper.wdYellow </li></ul></ul><ul><ul><li>Get rid of Option Compatible , CompatibilityMode() </li></ul></ul><ul><li>VBA interoperability library </li></ul><ul><ul><li>Support intelligent Application object to distinguish between Word and Excel API according to the current document type </li></ul></ul>
  22. 22. Improved VBA support <ul><li>Andreas Bregas </li></ul><ul><ul><li>[email_address] </li></ul></ul>

×