* Update early, try to make vba for word work. dump the vbaapi.db and the Global interface is included in this db too. Compared the implementation of XGlobal between word and excel, find that SwVbaGlobals::getGlobalsImpl is missing. Add this function and build again. Success to run Application.Name(). Congratuation!!
* Update to dev300-m36
* Start to have a look at where to add an option for word macro import for Tools|Options|Load Save|VBA Properties| Executable code ( currently the patch just hard codes executeable code ). Like an option for excel macro import. ( Supposed it is a copy&paste task :-) )
2008年12月8日星期一
A Simple Word VBA Macro
We Novell OOo team start to work on VBA for word support. Our first simple Word macro is running.
We also add a UI option in Tools -> Options -> Load/Save -> VBA Properties -> Executable code, to indicate whether the VBA macros are imported without comments to be executable.
Definitely, we have many things need to do. The first thing, I think, is about how to share the code with VBA for Excel.
We also add a UI option in Tools -> Options -> Load/Save -> VBA Properties -> Executable code, to indicate whether the VBA macros are imported without comments to be executable.
Definitely, we have many things need to do. The first thing, I think, is about how to share the code with VBA for Excel.
2008年12月3日星期三
2008-12-03
* update the ooo-build to dev300-m36. I started to build dev300-m36 last night. When I came back this morning, found that some package were missing. For I just updated my system to SLED11 beta5, it seems these packages are removed when the system is updated. I had to install the missing packages again. It took me about 1hours to make the new build continue.
* Great to hear that Redflag 2000 guy Wanglibing wanted to start port new vba api. Answer his mail. Hope he can warm up quickly.
* Accept Noel's suggestion to start a new build based on dev300-m35 in another system for it is verified to use well.
* Overview the commandbar stuff. I am annoyed by the codes, ( seems not much better to port it from helperapi directly. had better to re-invent the wheel :-). Anyway, after some modification, some common issuees are fixed. and more common apis are added too.
Current existing problems:
1) Regarding commandbar stuff, the main difference between MS Office and OOo is that MS Office treats commandbar as toolbar ( main menu is a toolbar named "Worksheet Menu Bar" in Excell ), while OOo treats commandbar as menu and toolbar. The url of menu is "private:resource/menubar/menubar" for build-in menus or "vnd.openoffice.org:CustomMenu" for customize menus. The url of toolbar is "private:resource/toolbar/" for build-in toolbars or is "private:resource/toolbar/custom_toolbar_***" for customize toolbars. In MSO, you can create customize toolbars in "tools->customize". In OOo, you can create customize menu/toolbar in "Tools->Customize". The related codes of the customize dialog is located in svx/source/dialog/cfg.cxx.
2) Confused with CommandBars("File") & CommandBars(1).Controls("File")
* CommandBars("File") returns a CommandBar object which type is msoBarTypePopup.
* CommandBars(1).Controls("File") returns a CommandBarControl object which type is msoControlPopup.
It seems they are referenced to the menu "File"
Note they are not supported in OOo VBA yet.
3) Currently OOo VBA only supports CommandBarControl, and doesn't support CommandBarPopup and CommandBarButton. In MSO both CommandBarPopup and CommandBarButton are common used. It is better to support them in OOo VBA. Both CommandBarPopup and CommandBarButton are based on CommandBarControl, So the following macro is OK in MSO
dim cbc1 as CommandBarControl
dim cbc2 as CommandBarControl
dim cbb as CommandBarButton
dim cbp as CommandBarPopup
set cbp = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbp.Caption = "Popup Menu 1"
set cbc1 = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbc1.Caption = "Popup Menu 2"
set cbb = cbp.Controls.Add( Type:= msoControlButton )
set cbc2 = cbp.Controls.Add( Type:= msoControlButton )
4) I think CommandBarControl.OnAction is an important api which is to set the name of a vb procedure that will run when the user clicks the menu/toolbar. Most of the reasons you create a customize menu/toolbar is to let user to run a vb procedure by clicking the menu/toolbar.
when OnAction is set, it needs to map the name os a vb procedure to a working command url of OOo. e.g.
myControl.OnAction = "Macro1"
The name "Macro1" needs to convert to a working command url like: vnd.sun.star.script:Standard.Module1.Macro1?language=Basic&location=document
* Meet a couple of breaks when building dev300-m36. To saving time, abandon to build it. and focus to build dev300-m35.
* Start to have a look at the patch of vba for word.
* Team meeting
* Great to hear that Redflag 2000 guy Wanglibing wanted to start port new vba api. Answer his mail. Hope he can warm up quickly.
* Accept Noel's suggestion to start a new build based on dev300-m35 in another system for it is verified to use well.
* Overview the commandbar stuff. I am annoyed by the codes, ( seems not much better to port it from helperapi directly. had better to re-invent the wheel :-). Anyway, after some modification, some common issuees are fixed. and more common apis are added too.
Current existing problems:
1) Regarding commandbar stuff, the main difference between MS Office and OOo is that MS Office treats commandbar as toolbar ( main menu is a toolbar named "Worksheet Menu Bar" in Excell ), while OOo treats commandbar as menu and toolbar. The url of menu is "private:resource/menubar/menubar" for build-in menus or "vnd.openoffice.org:CustomMenu" for customize menus. The url of toolbar is "private:resource/toolbar/" for build-in toolbars or is "private:resource/toolbar/custom_toolbar_***" for customize toolbars. In MSO, you can create customize toolbars in "tools->customize". In OOo, you can create customize menu/toolbar in "Tools->Customize". The related codes of the customize dialog is located in svx/source/dialog/cfg.cxx.
2) Confused with CommandBars("File") & CommandBars(1).Controls("File")
* CommandBars("File") returns a CommandBar object which type is msoBarTypePopup.
* CommandBars(1).Controls("File") returns a CommandBarControl object which type is msoControlPopup.
It seems they are referenced to the menu "File"
Note they are not supported in OOo VBA yet.
3) Currently OOo VBA only supports CommandBarControl, and doesn't support CommandBarPopup and CommandBarButton. In MSO both CommandBarPopup and CommandBarButton are common used. It is better to support them in OOo VBA. Both CommandBarPopup and CommandBarButton are based on CommandBarControl, So the following macro is OK in MSO
dim cbc1 as CommandBarControl
dim cbc2 as CommandBarControl
dim cbb as CommandBarButton
dim cbp as CommandBarPopup
set cbp = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbp.Caption = "Popup Menu 1"
set cbc1 = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbc1.Caption = "Popup Menu 2"
set cbb = cbp.Controls.Add( Type:= msoControlButton )
set cbc2 = cbp.Controls.Add( Type:= msoControlButton )
4) I think CommandBarControl.OnAction is an important api which is to set the name of a vb procedure that will run when the user clicks the menu/toolbar. Most of the reasons you create a customize menu/toolbar is to let user to run a vb procedure by clicking the menu/toolbar.
when OnAction is set, it needs to map the name os a vb procedure to a working command url of OOo. e.g.
myControl.OnAction = "Macro1"
The name "Macro1" needs to convert to a working command url like: vnd.sun.star.script:Standard.Module1.Macro1?language=Basic&location=document
* Meet a couple of breaks when building dev300-m36. To saving time, abandon to build it. and focus to build dev300-m35.
* Start to have a look at the patch of vba for word.
* Team meeting
订阅:
博文 (Atom)