Issue 120358 - Some properties of tab page model do not work
Summary: Some properties of tab page model do not work
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 3.4.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.1.0
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-24 15:13 UTC by hanya
Modified: 2016-04-02 21:56 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Document contains macro to reproduce the problem (12.41 KB, application/vnd.oasis.opendocument.text)
2012-07-24 15:13 UTC, hanya
no flags Details
Patch to fix by removing conflicted properties (3.39 KB, patch)
2012-07-25 13:07 UTC, hanya
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description hanya 2012-07-24 15:13:04 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.
Comment 1 hanya 2012-07-24 16:54:32 UTC
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.
Comment 2 hanya 2012-07-24 17:18:12 UTC
Very sorry, I have remembered that this problem is name conflict between properties and 
attributes on introspection based bridge.
Comment 3 hanya 2012-07-24 17:33:25 UTC
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?
Comment 4 hanya 2012-07-25 13:07:44 UTC
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.
Comment 5 jsc 2013-12-20 12:37:55 UTC
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
Comment 6 SVN Robot 2013-12-20 12:40:17 UTC
"jsc" committed SVN revision 1552621 into trunk:
#120358# apply patch to support properties from tab model
Comment 7 jsc 2013-12-20 12:41:09 UTC
patch reviewed, check locally and applied on trunk

Thanks for the patch
Comment 8 zhaoshzh 2014-04-09 03:10:47 UTC
if open the sample file, click on the button
a dialog opened ,but tab page 2 can not be activated.
Comment 9 zhaoshzh 2014-04-09 07:21:13 UTC
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
Comment 10 hanya 2014-12-31 02:33:45 UTC
(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.