Difference between revisions of "FAQ about Chart API Compatibility"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Title)
 
(The new API is not published yet)
Line 1: Line 1:
 
If you have written StarBasic Macros or other Code that uses the API in com.sun.star.chart and want to be able to still run it with the new chart here is some help in case you encounter problems. If you have problems not listed here feel free to add them here.
 
If you have written StarBasic Macros or other Code that uses the API in com.sun.star.chart and want to be able to still run it with the new chart here is some help in case you encounter problems. If you have problems not listed here feel free to add them here.
 +
 +
Note, that the new API is not published yet, so you should not use the new API extensively before it is published!
  
 
= Using StarBasic Macros =
 
= Using StarBasic Macros =
Line 10: Line 12:
 
</code>
 
</code>
  
<b>Answer:</b> The old API has methods getTitle()/setTitle() as well as the new API. So, you have to switch to the new API here. This solution is not final, as there shouldn't be two methods with the same name in one object.
+
<b>Answer:</b> The old API has methods getTitle()/setTitle() as well as the new API. So, you have to switch to the new API here. Note, that the new API is not published yet. You should wait until we have resolved this ambiguity! We have to fix this ambiguity, as there are two methods with the same name and different return types at one object.
  
 
<code>
 
<code>
 +
  ' using unpublished new API
 
   Dim oTitle As Object ' com.sun.star.chart2.XTitle
 
   Dim oTitle As Object ' com.sun.star.chart2.XTitle
 
   Dim aStrings() As Object ' com.sun.star.chart2.XFormattedString
 
   Dim aStrings() As Object ' com.sun.star.chart2.XFormattedString

Revision as of 15:37, 16 August 2006

If you have written StarBasic Macros or other Code that uses the API in com.sun.star.chart and want to be able to still run it with the new chart here is some help in case you encounter problems. If you have problems not listed here feel free to add them here.

Note, that the new API is not published yet, so you should not use the new API extensively before it is published!

Using StarBasic Macros

Question: I can no longer set the main title using the Title property.

 ' oMyChart is the XChartDocument (XModel)
 oMyChart.Title = "My Title"

Answer: The old API has methods getTitle()/setTitle() as well as the new API. So, you have to switch to the new API here. Note, that the new API is not published yet. You should wait until we have resolved this ambiguity! We have to fix this ambiguity, as there are two methods with the same name and different return types at one object.

 ' using unpublished new API
 Dim oTitle As Object ' com.sun.star.chart2.XTitle
 Dim aStrings() As Object ' com.sun.star.chart2.XFormattedString
 ' aMyChart is the XChartDocument (XModel)
 oTitle = createUNOService( "com.sun.star.chart2.Title" )
 oStrings(0) = createUNOService( "com.sun.star.chart2.FormattedString" )
 oStrings(0).String = "My Title"
 oTitle.Text = oStrings()
 aMyChart.Title = oTitle

Personal tools