Issue 80297

Summary: Cannot modify Chart title via Basic using old API because getTitle is ambiguous
Product: General Reporter: bjoern.milcke
Component: chartAssignee: chne
Status: CLOSED FIXED QA Contact: issues@graphics <issues>
Severity: Trivial    
Priority: P3 CC: eof1, IngridvdM, issues
Version: 3.3.0 or older (OOo)Keywords: regression
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Example document with macros for inserting a title with old and new API
none
Fixed version of the macro using getTitleObject for the new API none

Description bjoern.milcke 2007-08-02 17:01:08 UTC
In a Basic Macro where you have an XChartDocument in oDoc the call

oDoc.Title

may call css::chart2::XTitled::getTitle instead of
css::chart::XChartDocument::getTitle. So, the following fails:

oDoc.Title.CharHeight = 12
oDoc.Title.String = "My Title"

As a work-around, the following works:

Dim oFormattedString As Object
Dim oTitle As Object
Dim aStrings(0) As Object

Set oTitle = createUNOService( "com.sun.star.chart2.Title" )

Set oFormattedString = createUNOService( "com.sun.star.chart2.FormattedString" )
oFormattedString.String = "My Title"
oFormattedString.CharHeight = 12
Set aStrings(0) = oFormattedString

oTitle.Text = aStrings
oDoc.Title = oTitle

Although its is quite more complicated.

The cleanest fix would be to rename chart::XChartDocument::getTitle to
getMainTitle, that would be consistent to the "HasMainTitle" property and would
solve the ambiguity, however this is published API, so not possible.

The other getTitle() is a method from the interface XTitled, so the name of the
method cannot be renamed to getMainTitle(). Maybe it can be renamed to
getTitleContent or sth. like that?
Comment 1 bjoern.milcke 2007-08-02 17:26:15 UTC
Created attachment 47273 [details]
Example document with macros for inserting a title with old and new API
Comment 2 bjoern.milcke 2007-08-06 13:03:38 UTC
Created attachment 47333 [details]
Fixed version of the macro using getTitleObject for the new API
Comment 3 bjoern.milcke 2007-08-06 13:09:50 UTC
Fixed the new (unpublished) API methods XTitled::getTitle() and setTitle() to
getTitleObject() and set TitleObject(). The new attachment works with the fixed
version, there both macros work.

Note that the problem with not having this fix is: the old method no longer
works, as a work-around you have to change all places with the new API, but this
will change when this issue is fixed, so you have to change the place again
(either back to the old API or the changed name in the new API).

So, I think it would be good to have this in OOo 2.3.
Comment 4 oc 2007-08-07 14:25:34 UTC
changing target to 2.3
Comment 5 IngridvdM 2007-08-07 14:39:36 UTC
added keyword regression
Comment 6 bjoern.milcke 2007-08-07 22:03:43 UTC
->CN: Please verify.

The second attachment "TitleFixed" works with CWS chat12. There, for the old API
the expression oDoc.Title is used to access
css::chart::XChartDocument.getTitle(). The macro for the new API uses
oDoc.TitleObject which calls the renamed method
css::chart2::XTitled::getTitleObject.

Note, that this issue only appeared with Basic, as on other systems you usually
have direct access to the interface, i.e. in Java you have an XTitled object at
which the call to getTitle() was different from from the call to getTitle() at
an object of type XChartDocument.

Implementation note: I changed the following in XTitled:

getTitle() -> getTitleObject()
setTitle() -> setTitleObject()
Comment 7 chne 2007-08-14 09:01:29 UTC
ok in cws => verified
Comment 8 bjoern.milcke 2007-08-21 20:07:44 UTC
Found fixed in OOG680.m2
Comment 9 p9w.vu.31122010 2007-09-21 17:18:28 UTC
verified fixed in SRC680_m229; closing.