Apache OpenOffice (AOO) Bugzilla – Issue 120358
Some properties of tab page model do not work
Last modified: 2016-04-02 21:56:25 UTC
Created attachment 78714 [details] Document contains macro to reproduce the problem Some properties of tab page model do not work on tab page model, Enabled, ImageURL and ToolTip properties are not work well. New tab model can be created as follows, this code piece is from attached document: DialogLibraries.loadLibrary("Standard") d = CreateUnoDialog(DialogLibraries.Standard.Dialog1) dm = d.getModel() tabs = dm.createInstance("com.sun.star.awt.tab.UnoControlTabPageContainerModel") tabs.setPropertyValues(_ Array("Height", "PositionX", "PositionY", "Width"), _ Array(100, 0, 0, 100)) dm.insertByName("tabs", tabs) tab1 = tabs.createTabPage(1) tab1.Title = "Page1" ' works tabs.insertByIndex(0, tab1) Tab page model created by createTabPage method is instance of UnoControlTabPageModel class defined in toolkit/inc/toolkit/controls/tabpagemodel.hxx. If it implemented according to IDL service css.awt.tree.UnoControlTabPageModel, it should implement css.awt.tree.XTabPageModel interface. But it does not implemented and it has several properties. When new tab page is inserted into the tab page container, VCLXTabPageContainer::elementInserted method is called and page values are taken through awt.tree.XTabPageModel interface. But they are not connected to above properties.
Sorry, above description is wrong. The problem is based on interface query of css.awt.tree.XTabPageModel on UnoControlTabPageModel class in Basic and other introspection based bridge. When I wrote the similar code with attached code in Java, setImageURL method of XTabPageModel interface worked. But Enabled and Tooltip are not work even set them through attributes.
Very sorry, I have remembered that this problem is name conflict between properties and attributes on introspection based bridge.
Here is workaround for Basic. cr = CreateUnoService("com.sun.star.reflection.CoreReflection") idl = cr.forName("com.sun.star.awt.tab.XTabPageModel") field = idl.getField("ImageURL") tab1 = tabs.createTabPage(1) tab1.Title = "Page1" ' works 'tab1.setImageURL("private:graphicrepository/res/harddisk_16.png") field.set(tab1, "private:graphicrepository/res/harddisk_16.png") tabs.insertByIndex(0, tab1) css.awt.tab.UnoControlTabPageModel service and css.awt.tab.XTabPageModel interface are now published and no properties related to tab model is defined in the service idl. But attributes are published API. To remove these un-documented properties from the implementation is collect solution?
Created attachment 78724 [details] Patch to fix by removing conflicted properties This patch contains fix by removing conflicted properties with attributes. - TabPageID: not influenced - Enabled: Property removed and set default value of attribute to sal_True - Title: Not touched. Current implementation uses both property and attribute. When attribute is accessed, the value is get/set from property. - ImageURL: Property removed. - ToolTip: Not influenced. This is shown when Shift + F1 is pushed. Many control models support enabled state by Enabled property. Should this be fixed by the same way with Title property and attribute? Runtime behavior to set these attributes is not touched in this patch. There is no connection between tab page model and tab container which keeps TabPage instance. It seems we need listener for that task.
the patch is definitely an improvement and I will integrate it. I think the Enable property could be fixed as you suggested. And the listener make also sense to connect the model with the container
"jsc" committed SVN revision 1552621 into trunk: #120358# apply patch to support properties from tab model
patch reviewed, check locally and applied on trunk Thanks for the patch
if open the sample file, click on the button a dialog opened ,but tab page 2 can not be activated.
let the cursor stays on the tab for a few seconds, ToolTip properties are not work well on tab page model AOO410m14(Build:9760) - Rev. 1585624
(In reply to zhaoshzh from comment #8) > a dialog opened ,but tab page 2 can not be activated. tab page 2 is disabled in the following line, so it should not be disabled after the patch. tab2.Enabled = False ' not work > ToolTip properties are not work well on tab page model ToolTip is shown when you push Shift + F1, What's This? mode is activated as written in Comment 4.