<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jiao.jianhua</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jiao.jianhua"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Jiao.jianhua"/>
	<updated>2026-10-19T21:11:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29988</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29988"/>
		<updated>2007-04-12T03:18:00Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Common Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxesImpl.java]  ||  npower || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxisImpl.java]  || npower || in progress  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || complete || not-tested &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartTileImpl.java ChartTitleImpl.java]  || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || Jiao.Jianhua || in progress&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || || in word ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29822</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29822"/>
		<updated>2007-04-10T09:23:51Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Common Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxesImpl.java]  ||  npower || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxisImpl.java]  || npower || in progress  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || complete || not-tested &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartTileImpl.java ChartTitleImpl.java]  || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || Jiao.Jianhua || in progress&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29821</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29821"/>
		<updated>2007-04-10T09:23:25Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Calc Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxesImpl.java]  ||  npower || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxisImpl.java]  || npower || in progress  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || complete || not-tested &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartTileImpl.java ChartTitleImpl.java]  || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || Jiao.Jianhu || in progress&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || Jiao.Jianhu || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29820</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29820"/>
		<updated>2007-04-10T09:22:18Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Common Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxesImpl.java]  ||  npower || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxisImpl.java]  || npower || in progress  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || complete || not-tested &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartTileImpl.java ChartTitleImpl.java]  || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || Jiao.Jianhu || in progress&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || Jiao.Jianhu || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || Jiao.Jianhua || calc complete, no full text ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29819</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29819"/>
		<updated>2007-04-10T09:20:39Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Common Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxesImpl.java]  ||  npower || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AxesImpl.java AxisImpl.java]  || npower || in progress  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || complete || not-tested &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartTileImpl.java ChartTitleImpl.java]  || npower || complete || not-tested&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || Jiao.Jianhu ||&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || Jiao.Jianhua || &lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || Jiao.Jianhu ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || Jiao.Jianhua ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || jiao.jianhua ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29092</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=29092"/>
		<updated>2007-03-26T02:57:00Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Calc Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  || jiao.jianhua  || in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || jiao.jianhua ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=28852</id>
		<title>Porting notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Porting_notes&amp;diff=28852"/>
		<updated>2007-03-23T03:53:23Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Common Objects to port */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Things to watch out for ===&lt;br /&gt;
* The mapping of the vba constants is different. Take for example the &amp;lt;tt&amp;gt;xlGuess&amp;lt;/tt&amp;gt; constant, in VBA it&amp;#039;s fully qualified name is &amp;lt;tt&amp;gt;Excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt;, in the helperapi it&amp;#039;s &amp;lt;tt&amp;gt;com.sun.star.helper.constant.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; and in oovbaapi it&amp;#039;s &amp;lt;tt&amp;gt;org.openoffice.excel.XlYesNoGuess.xlGuess&amp;lt;/tt&amp;gt; &lt;br /&gt;
* All objects in the helperapi extend [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/HelperInterfaceAdaptor.java?rev=1.1 HelperInterfaceAdaptor], nothing similar (yet) exists in oovbaapi so this can be ignored in the implementation&lt;br /&gt;
* There are a quite few helper classes in the helperapi project e.g. &amp;lt;tt&amp;gt;RangeHelper.java&amp;lt;/tt&amp;gt; they shouldn&amp;#039;t be confused with the actual implementation objects we wish to port.&lt;br /&gt;
* classes and idl files of the same name can exist in multiple namespaces and this can be confusing. Because the helperapi was written with both the word and excel api(s) in mind there can be classes that share a common implementation and interfaces e.g.&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/calc/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/common/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
** &amp;lt;tt&amp;gt;com/sun/star/helper/writer/XShape.idl&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Collections, these are handled differently see implementing a vba [[Porting notes#Collection|Collection]] in oovbaapi&lt;br /&gt;
* Every helperapi idl method defines [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/BasicErrorException.idl BasicErrorException] which allows and api method to transfer an error code and associated string paramater to basic.&lt;br /&gt;
&lt;br /&gt;
=== Hints for porting idl ===&lt;br /&gt;
==== Objects with Default Properties ====&lt;br /&gt;
This is something not handled by the helperapi but something you should be aware of when implementing a vba compatibility object. What is a default property, an example probably explains the concept better.&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;) = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 Range(&amp;quot;a1&amp;quot;).Value = &amp;quot;text&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Value&amp;lt;/tt&amp;gt; is a default property in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultProperty.idl XDefaultProperty.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Objects with Default Method ====&lt;br /&gt;
&lt;br /&gt;
Similar to above some vba objects have a default method e.g. the &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col(1).Name&lt;br /&gt;
&lt;br /&gt;
is a short cut for&lt;br /&gt;
&lt;br /&gt;
 set col = Sheets&lt;br /&gt;
 msgbox col.Item(1).Name&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; is a default method in the example above. We can provide similar behavior in basic with a compatibility api object ensuring the object implements [http://api.openoffice.org/source/browse/*checkout*/api/udkapi/com/sun/star/script/XDefaultMethod.idl XDefaultMethod.idl ]&lt;br /&gt;
&lt;br /&gt;
==== Porting Collection objects ====&lt;br /&gt;
Generally all collection objects have a &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;Item&amp;lt;/tt&amp;gt; method and additionally the behaviour mentioned above. Also Collection objects can be used in a &amp;lt;tt&amp;gt;For Each&amp;lt;/tt&amp;gt; loop. To cater for that a helper implementation object &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; provides the necessary information to the basic runtime to allow it to provide the classic vba &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; class syntax support. It also requires to be initialised by an XIndexAccess implementation. Additionally the class inheriting from  &amp;lt;tt&amp;gt;ScVbaCollectionBaseImpl&amp;lt;/tt&amp;gt; must provide the  translation between the object iterated ( via XIndexAccess ) and the corrosponding compatibilty object returned to openoffice basic via the the &amp;lt;tt&amp;gt;createCollectionObject&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
A example of a ported &amp;lt;tt&amp;gt;Collection&amp;lt;/tt&amp;gt; object can be found in the [[Porting example]] section&lt;br /&gt;
&lt;br /&gt;
=== Calc Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by || Status || Notes&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl] ||  ||   || there is a partial (untested) implementation in the porting example section, would be nice for some one to finish&lt;br /&gt;
|-&lt;br /&gt;
| XFilter.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java]  ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XFilters.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FiltersImpl.java FiltersImpl.java] ||  ||  || see above.&lt;br /&gt;
|-&lt;br /&gt;
| XAxes.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxis.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XAxisTitle.idl || xxxx  ||  ||   ||&lt;br /&gt;
|-&lt;br /&gt;
| XCalc.idl || xxxx  || not required for porting see [[Application Object]] ||  || This is not a &amp;#039;real&amp;#039; object but in a collection of global method/attributes that probably should be part of the XApplication.idl interface&lt;br /&gt;
|-&lt;br /&gt;
| XChartObject.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectImpl.java ChartObjectImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XChartObjects.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartObjectsImpl.java ChartObjectsImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XChart.idl || [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartImpl.java ChartImpl.java] || npower || in progress || &lt;br /&gt;
|-&lt;br /&gt;
| XCharts.idl ||  [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/ChartsImpl.java ChartsImpl.java]  ||  npower ||  in progress ||&lt;br /&gt;
|-&lt;br /&gt;
| XChartTitle.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabel.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XDataLabels.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatCondition.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormatConditions.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XFormat.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XHPageBreaks.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XName.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XNames.idl || xxxx  || sola ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPageBreak.idl || xxxx  ||  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPageSetup.idl XPageSetup.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PageSetupImpl.java PageSetupImpl]  || zhang ||&lt;br /&gt;
|-&lt;br /&gt;
|[http://api.openoffice.org/source/browse/api/helperapi/com/sun/star/helper/calc/XPane.idl XPane.idl] || [http://api.openoffice.org/source/browse/api/helperapi/impl/com/sun/star/helper/calc/PaneImpl.java PaneImpl]  || Jiao.Jianhua || calc complete||&lt;br /&gt;
|-&lt;br /&gt;
| XPoint.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XPoints.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XProtection.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTable.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XQueryTables.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XShape.idl || xxxx  || jiao.jianhua ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapes.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XStyles.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XTitle.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreak.idl || xxxx  ||  ||&lt;br /&gt;
|-&lt;br /&gt;
| XVPageBreaks.idl|| xxxx  ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Common Objects to port ===&lt;br /&gt;
{| style=&amp;quot;vertical-align:top; text-align:left; background-color:#efefef;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color:#d6d6d6;font-weight:bold;&amp;quot; &lt;br /&gt;
| Object || helperapi implementation name || Porting stared by? || Status ||&lt;br /&gt;
|-&lt;br /&gt;
| XAutoFilter.idl || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPictureFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XColorFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XPosSize || xxxx || Jiao.Jianhua || implemented in org.openoffice.XControl ||&lt;br /&gt;
|-&lt;br /&gt;
| XWindow || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFileSearch || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XWrapFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFillFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XShapeRange || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XFoundFiles || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XLineFormat || xxxx || ||&lt;br /&gt;
|-&lt;br /&gt;
| XTextFrame || xxxx || jiao.jianhua ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Missing attributes/methods to port ===&lt;br /&gt;
[[Application Object]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28735</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28735"/>
		<updated>2007-03-21T10:04:18Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
我们现在来看一个例子：我们首先来看::com::sun::star::document::OfficeDocument，查看&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl（下面呈现的，并且去除了所有注释）：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在[[IDL_Files_and_Cpp_zh#IDL_.E8.AF.A6.E8.BF.B0|这个章节]]，我们已经涉及了接口。&lt;br /&gt;
[http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png 开发手册图标]更明确的表示了这个结构。如果我们需要查看::com::sun::star::text::TextDocument，请参考&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
可以看到，TextDocument服务和OfficeDocument服务都在这里。&lt;br /&gt;
&lt;br /&gt;
现在，我们深入这个例子，并且增加注释。为了这个目的，我们使用以前处理过的代码。(请查看[[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28734</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28734"/>
		<updated>2007-03-21T09:59:54Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
我们现在来看一个例子：我们首先来看::com::sun::star::document::OfficeDocument，查看&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl（下面呈现的，并且去除了所有注释）：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在[[IDL_Files_and_Cpp_zh#IDL_.E8.AF.A6.E8.BF.B0|这个章节]]，我们已经涉及了接口。&lt;br /&gt;
[http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png 开发手册图标]更明确的表示了这个结构。如果我们需要查看::com::sun::star::text::TextDocument，请参考&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28729</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28729"/>
		<updated>2007-03-21T09:54:54Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
我们现在来看一个例子：我们首先来看::com::sun::star::document::OfficeDocument，查看&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl（下面呈现的，并且去除了所有注释）：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在[[IDL_Files_and_Cpp_zh#IDL_.E8.AF.A6.E8.BF.B0|这个章节]]，我们已经提及了接口。&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28728</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28728"/>
		<updated>2007-03-21T09:51:24Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
我们现在来看一个例子：我们首先来看::com::sun::star::document::OfficeDocument，查看&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl（下面呈现的，并且去除了所有注释）：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28727</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28727"/>
		<updated>2007-03-21T09:49:25Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
我们现在来看一个例子：我们首先来看::com::sun::star::document::OfficeDocument，查看&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl（下面呈现的，并且去除了所有的注释）：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28726</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28726"/>
		<updated>2007-03-21T09:45:36Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 一个具体的例子 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
对SDK，这些IDL文件可以在 &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/目录找到。当然，有个问题就是，这些SDK中的UNO IDL文件和二进制的OpenOffice.org库是有些区别的。这是因为SDK通常是在新版的OpenOffice.org发布后几个月才出现（现在不是这样）。然而，对于这个改变，我们将会在介绍另外一种方法：注册表浏览（registry exploring）后给予解释。事实上，此刻我并不清楚通过注册表可以得到什么样的信息。(具体请参考 [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28722</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28722"/>
		<updated>2007-03-21T09:10:27Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* A concrete Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== 一个具体的例子 ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28721</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28721"/>
		<updated>2007-03-21T09:09:51Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
有时，特别对字处理，对某些API方法的调用，只有通过开发手册才能准确知道返回了哪些基础服务。这点对字处理特别严重。但是，通常来说，当你知道你有什么服务，那就可以通过API文档准确推断出查询哪些接口是有效的。不需要猜测，这是科学的方法。&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28720</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28720"/>
		<updated>2007-03-21T08:59:11Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
对于这两个服务，还有其他的问题。如果这是从表格得到一个com.sun.star.table.CellRange，那么它就只是一个CellRange。但是，如果是从电子表格得到的，那么它就不只是一个CellRange，而是个真实的com.sun.star.sheet.SheetCellRange。 SheetCellRange只是CellRange的扩展版。而这两个服务通过对一个表格或者电子表格调用getCellRangeByName()得到。 &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28718</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28718"/>
		<updated>2007-03-21T08:47:40Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么知道是什么服务可用了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28717</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28717"/>
		<updated>2007-03-21T08:46:22Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么，我就知道是什么服务了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
如果你知道服务的名字，那么就通常知道什么接口是可用的－－通过查看API文档，不需要猜测，不需要Xray工具，这绝对科学。这些可用接口的集合就是，服务本身的接口和这个服务包含的所有服务，并对这个概念递归使用的到的所有接口。 &lt;br /&gt;
&lt;br /&gt;
在下来的案例中，都很明确的知道拥有什么服务。 &lt;br /&gt;
&lt;br /&gt;
如果你可以调用getCellRangeByName()，那么你就有个SheetCellRange服务。如果可以调用getCellByPosition()，那么就只有SheetCell可以使用。对于SheetCell和SheetCellRange，有许多相同的内容可用，但是，他们却是不同的东西。 SheetCellRange指的是一个矩形区域内单元格的集合，而SheetCell只表示一个单元格。有些操作，对一个单元格可以，但把单元格集合在一起就不可以对之操作。 &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28712</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28712"/>
		<updated>2007-03-21T07:59:08Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
对上面的讨论，如果使用TextDocument取代SpreadsheetDocument。&lt;br /&gt;
那么怎么知道什么是基础的服务呢？ &lt;br /&gt;
&lt;br /&gt;
这里没有捷径，通常的方法就是观察。如果你装载了一个电子表格，那么你就有了SpreadsheetDocument服务。 &lt;br /&gt;
&lt;br /&gt;
相同的，如果通过服务的名称创建一个对象，例如： &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
那么，我就知道是什么服务了，因为我给出了服务的名字。 &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28711</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28711"/>
		<updated>2007-03-21T07:50:13Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
因此，对服务SpreadsheetDocument－一个电子表格文档，就集合了接口XSpreadsheetDocument和服务OfficeDocument中的接口。所以，尽管loadComponentFromURL返回的是一些接口，但是这些接口的都是基于一个基础的服务，这个服务就是SpreadsheetDocument。参考API文档，你就可以知道查询（query）哪些接口是有效的。 &lt;br /&gt;
SpreadsheetDocument有服务（？）XSpreadsheetDocument。&lt;br /&gt;
OfficeDocument拥有服务（？）XPrintable和XStorable. &lt;br /&gt;
因为SpreadsheetDocument包含OfficeDocument，所以从SpreadsheetDocument查询接口XPrintable或者XStorable都是有效的。 &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28661</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28661"/>
		<updated>2007-03-20T07:50:58Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多服务 &lt;br /&gt;
#更多接口 &lt;br /&gt;
当然，对（1）来说，服务中的服务也同样意味着这些原始服务包含更多的接口。 &lt;br /&gt;
让我来看一个不同的例子。 &lt;br /&gt;
SpreadsheetDocument是一个服务。 &lt;br /&gt;
SpreadsheetDocument包括服务OfficeDocument。对应的IDL文件如下：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28660</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28660"/>
		<updated>2007-03-20T07:46:06Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Danny Brewer 的观点 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
然而，在API文档中，理解“服务”的概念是非常重要的。服务是聚合一下内容的唯一方法： &lt;br /&gt;
#更多的服务 &lt;br /&gt;
#更多的接口 &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28258</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28258"/>
		<updated>2007-03-16T10:09:15Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 通过IDL文件获取UNO信息 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer]] 的观点 ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28257</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28257"/>
		<updated>2007-03-16T10:05:37Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 通过IDL文件获取UNO信息 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。但是我们还是重复一下Danny Brewer&amp;#039;s在OOoForum的观点。&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28256</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28256"/>
		<updated>2007-03-16T10:03:42Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 通过IDL文件获取UNO信息 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic 不能精确的表现方法和属性。&lt;br /&gt;
 &lt;br /&gt;
另一方法就是使用[http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
在前面的章节我们已经提供了相应的例子（特别[[Programming_OooWriter|programming OOoWriter in C++]]）。相信读者已经有了这方面的经验。  We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28249</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28249"/>
		<updated>2007-03-16T09:47:40Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 通过IDL文件获取UNO信息 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(访问 [http://www.ooomacros.org/dev.php#101416 这里]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28248</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28248"/>
		<updated>2007-03-16T09:46:39Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Gathering UNO information with IDL files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= 通过IDL文件获取UNO信息 =&lt;br /&gt;
有多种方法可以获的UNO内的信息。&lt;br /&gt;
 &lt;br /&gt;
一个方法是使用OOoBasic和Bernard Marcelly的Xray工具(available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28244</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28244"/>
		<updated>2007-03-16T09:39:56Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 深入IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在文档 [[Working_with_Shapes|shapes]] 中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28243</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28243"/>
		<updated>2007-03-16T09:39:27Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 深入IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 在[[Working_with_Shapes|shapes]]中就会碰到属性处理。&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28242</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28242"/>
		<updated>2007-03-16T09:37:23Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 深入IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
在OOo对象的术语中，特性和属性是有些区别的。而仅有的区别就是访问的方法不同。属性使用set/getPropertyValue(PropertyName,Any)访问，然而，特性是通过set/get(AttributeName)方法。. 我们在We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28241</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28241"/>
		<updated>2007-03-16T09:31:38Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 深入IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们通常会在这个文档（[[Counter_Example#IDL_File|the counter example]]）中遇到。&lt;br /&gt;
&lt;br /&gt;
接口可以衍生自基接口。一个衍生接口可以声明自身的特性和方法。但是，在衍生的接口中，特性和方法不能被重定义。&lt;br /&gt;
一个继承接口的例子：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
也可以多重继承：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
对于服务的继承，将在下个章节进行介绍。&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28238</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28238"/>
		<updated>2007-03-16T09:23:53Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 深入IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
方法可以有参数。参数列表中的每个参数必须以方向标志（direction flags）开始，也就是在一个知名的类型和参数标识符之前，必须有[in],[out]或者[inout]。下面给出的例子我们会经常在这个文档[[Counter_Example#IDL_File|the counter example]]中遇到：&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28237</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28237"/>
		<updated>2007-03-16T09:11:21Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Further with IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 深入IDL ==&lt;br /&gt;
IDL类型 :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28234</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28234"/>
		<updated>2007-03-16T09:07:54Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 描述一个模块 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28233</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28233"/>
		<updated>2007-03-16T09:07:33Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Specifying a module */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== 描述一个模块 ==&lt;br /&gt;
下来，对这个IDL描述，我们仍然使用相同的例子。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28232</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28232"/>
		<updated>2007-03-16T09:05:03Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以公开（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28231</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28231"/>
		<updated>2007-03-16T09:04:00Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* IDL 详述 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义接口的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28230</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28230"/>
		<updated>2007-03-16T09:03:03Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Specifying a service */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义解的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==描述一个服务==&lt;br /&gt;
继续使用上面的例子，下面就是对应的IDL描述。&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// 公开的接口:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
在这里，我们看到一个float的类型。其它的IDL类型会在后面逐步引入。&lt;br /&gt;
&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28229</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28229"/>
		<updated>2007-03-16T08:59:40Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Specifying an interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义解的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==描述一个接口==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28228</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28228"/>
		<updated>2007-03-16T08:58:20Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Specifying an interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义解的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
我们选择的例子，接口XdrivingDirection (不包括在OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28227</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28227"/>
		<updated>2007-03-16T08:57:20Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* IDL 详述 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义解的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。&lt;br /&gt;
 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28226</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28226"/>
		<updated>2007-03-16T08:56:56Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* IDL 详述 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
接口使用接口定义语言（IDL）描述。UNO使用UNO-IDL作为其接口定义语言。IDL是描述性语言（不是编程语言），用来描述对象实现的接口。通过IDL，你可以定义解的名字和每个特性、方法的名字等等。如果你创建了IDL文件，就可以使用IDL编译器创建C++头文件。 &lt;br /&gt;
开始的例子，我们只是使用IDL直接描述一些简单的模块（modules）。&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28225</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28225"/>
		<updated>2007-03-16T08:37:44Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* IDL specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL 详述 =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28224</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28224"/>
		<updated>2007-03-16T08:33:41Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
服务类似Java对象。&lt;br /&gt;
&lt;br /&gt;
1. 服务可以继承其他服务或者什么都不继承。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
2. 服务可以含有（include）其他的服务或者什么都不包含。（每个服务都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
3. 服务可以导出（实现）接口。&lt;br /&gt;
 &lt;br /&gt;
4. 服务拥有属性。 &lt;br /&gt;
&lt;br /&gt;
5. 接口可以继承其他的接口或者什么也不继承。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
6. 接口可以含有（include）其他的接口或者什么都不包含。（每个接口都递归的遵循这个规则。）&lt;br /&gt;
 &lt;br /&gt;
7. 接口能够执行/实现（implement）方法。&lt;br /&gt;
 &lt;br /&gt;
8. 接口名称通常有一个大写X。 &lt;br /&gt;
&lt;br /&gt;
通过这些规则，就可以推断，方法通常（ALWAYS）在接口中，而属性通常在服务中。&lt;br /&gt;
&lt;br /&gt;
另请参阅[[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]]和 [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28223</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28223"/>
		<updated>2007-03-16T08:16:10Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法 getPropertyValue 和 setPropertyValue。” 这个定义也恰好区分了特性和属性的含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer]]的规则&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28222</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28222"/>
		<updated>2007-03-16T08:12:40Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法getPropertyValue和setPropertyValue。” 这个定义也恰好区分了特性和属性含义。服务是属性的集合，接口是方法的集合，而这些方法则提供了改变属性的途径（means）。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer&amp;#039;s]] rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28221</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28221"/>
		<updated>2007-03-16T08:07:46Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
对于 OpenOffice API, 服务是一个抽象的概念，它提供了一些特定的接口和特性/属性（properties/attributes）。就像开发手册（Developer&amp;#039;s Guide）中所说：“属性是对象（an object）的数据。对象的通用接口（generic interface）可以使用属性的名字来实现对属性的访问，这些接口包括方法getPropertyValue和setPropertyValue。” 这个定义也恰好区分了特性和属性含义。服务 A service has a collection of properties and an interface is a collection of methods that provide a means to change properties. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer&amp;#039;s]] rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28216</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28216"/>
		<updated>2007-03-16T04:29:16Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* 简介 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
参考 [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2].&lt;br /&gt;
In OpenOffice API, a &amp;quot;service&amp;quot; is an abstract concept providing certain interfaces and properties/attributes. As Developer&amp;#039;s Guide states : “Properties are data in an object that are provided by name over a generic interface for property access, that contains getPropertyValue() and setPropertyValue() access methods.”. It would be better to distinguish between attribute and property. A service has a collection of properties and an interface is a collection of methods that provide a means to change properties. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer&amp;#039;s]] rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28215</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28215"/>
		<updated>2007-03-16T04:27:22Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== 简介 ==&lt;br /&gt;
See [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2]&lt;br /&gt;
In OpenOffice API, a &amp;quot;service&amp;quot; is an abstract concept providing certain interfaces and properties/attributes. As Developer&amp;#039;s Guide states : “Properties are data in an object that are provided by name over a generic interface for property access, that contains getPropertyValue() and setPropertyValue() access methods.”. It would be better to distinguish between attribute and property. A service has a collection of properties and an interface is a collection of methods that provide a means to change properties. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer&amp;#039;s]] rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28214</id>
		<title>IDL Files and Cpp zh</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=IDL_Files_and_Cpp_zh&amp;diff=28214"/>
		<updated>2007-03-16T04:25:01Z</updated>

		<summary type="html">&lt;p&gt;Jiao.jianhua: /* Services and Interfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://wiki.services.openoffice.org/wiki/IDL_Files_and_Cpp en]&lt;br /&gt;
&lt;br /&gt;
介绍性的文章，请参阅[http://udk.openoffice.org/cpp/man/component_tutorial.html component tutorial].&lt;br /&gt;
&lt;br /&gt;
= 服务（Services）和接口（Interfaces） =&lt;br /&gt;
== Introduction ==&lt;br /&gt;
See [http://api.openoffice.org/basic/man/tutorial/tutorial.pdf tutorial (in pdf) chapter 2]&lt;br /&gt;
In OpenOffice API, a &amp;quot;service&amp;quot; is an abstract concept providing certain interfaces and properties/attributes. As Developer&amp;#039;s Guide states : “Properties are data in an object that are provided by name over a generic interface for property access, that contains getPropertyValue() and setPropertyValue() access methods.”. It would be better to distinguish between attribute and property. A service has a collection of properties and an interface is a collection of methods that provide a means to change properties. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[CppSDKAuthors|Danny Brewer&amp;#039;s]] rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Services are similar to objects in java. &lt;br /&gt;
&lt;br /&gt;
1. A service can inherit from zero or one other service. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
2. A service can include zero or more services. (which each service can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
3. A service can export (implement) interfaces.&lt;br /&gt;
 &lt;br /&gt;
4. A service can have properties. &lt;br /&gt;
&lt;br /&gt;
5. An interface can inherit from zero or one other interface. (which each interface can recursively follow these rules.)&lt;br /&gt;
 &lt;br /&gt;
6. An interface can include from zero or more interfaces. (which each interface can recursively apply these rules.)&lt;br /&gt;
 &lt;br /&gt;
7. An interface can implement methods.&lt;br /&gt;
 &lt;br /&gt;
8. An interface is always named with an X. &lt;br /&gt;
&lt;br /&gt;
From these rules you can deduce that methods are ALWAYS found in interfaces, and properties are ALWAYS found in services.&lt;br /&gt;
&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= IDL specification =&lt;br /&gt;
Interfaces are specified using an Interface definition language (IDL). UNO uses UNO-IDL as the interface definition language. The Interface Definition Language (IDL) is a descriptive language (not a programming language) to describe the interfaces being implemented by the objects. Within IDL, you define the name of the interface, the names of each of the attributes and methods, and so forth. Once you&amp;#039;ve created the IDL file, you can use an IDL compiler to generate the header files in the C++ programming language. &lt;br /&gt;
The way to specify simple modules with IDL is so straightforward that we choose to give only examples at first.&lt;br /&gt;
&lt;br /&gt;
==Specifying an interface==&lt;br /&gt;
We choose as an example, the interface XdrivingDirection (not in OOo):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Specifying a service==&lt;br /&gt;
Example above is still used, here is the corresponding IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface XdrivingDirection&lt;br /&gt;
	{&lt;br /&gt;
		void turnLeft();&lt;br /&gt;
		void turnRight();&lt;br /&gt;
	};&lt;br /&gt;
interface XaccelerationControl&lt;br /&gt;
	{&lt;br /&gt;
		void speedUp();&lt;br /&gt;
		void slowDown();&lt;br /&gt;
	};&lt;br /&gt;
service car&lt;br /&gt;
	{&lt;br /&gt;
		// exported interfaces:&lt;br /&gt;
		interface XdrivingDirection;&lt;br /&gt;
		interface XaccelerationControl;&lt;br /&gt;
		[attribute] float speed; &lt;br /&gt;
		[attribute] float angle;&lt;br /&gt;
	};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We see a float type and we would use other IDL types later.&lt;br /&gt;
== Specifying a module ==&lt;br /&gt;
Now, the same example would give this IDL specification :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
module my_module&lt;br /&gt;
	{&lt;br /&gt;
	interface Xsomething&lt;br /&gt;
		{&lt;br /&gt;
			void methodone();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service1&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface Xsomething;&lt;br /&gt;
		};&lt;br /&gt;
	interface XsomethingElse&lt;br /&gt;
		{&lt;br /&gt;
			void methodTwo();&lt;br /&gt;
			void methodThree();&lt;br /&gt;
		};&lt;br /&gt;
	service my_service2&lt;br /&gt;
		{&lt;br /&gt;
			// exported interfaces:&lt;br /&gt;
			interface XsomethingElse;&lt;br /&gt;
		};&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Further with IDL ==&lt;br /&gt;
The IDL&amp;#039;s types are :&lt;br /&gt;
&amp;lt;TABLE WIDTH=100% BORDER=1 BORDERCOLOR=&amp;quot;#000000&amp;quot; CELLPADDING=4 CELLSPACING=0&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;&amp;lt;FONT COLOR=&amp;quot;#000000&amp;quot;&amp;gt;char&amp;lt;/FONT&amp;gt; &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;16-bit unicode character type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;boolean type; true and false&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;byte &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;8-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned short &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 16-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;long &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 32-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned long&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 32-bit integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;hyper &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;signed 64-bit ordinal integer type&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned hyper&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;unsigned 64-bit ordinal integer type &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;float &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent float&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;double&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;processor dependent double &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;string of 16-bit unicode characters&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
		&amp;lt;TR VALIGN=TOP&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;any&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;universal type, takes every fundamental&lt;br /&gt;
				or compound UNO type, similar to Variant in other environments or&lt;br /&gt;
				Object in Java&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=12%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;void &amp;lt;/FONT&amp;gt;&lt;br /&gt;
				&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
			&amp;lt;TD WIDTH=38%&amp;gt;&lt;br /&gt;
				&amp;lt;P&amp;gt;&amp;lt;FONT FACE=&amp;quot;Thorndale&amp;quot;&amp;gt;Indicates that a method does not&lt;br /&gt;
				provide a return value&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt;&lt;br /&gt;
			&amp;lt;/TD&amp;gt;&lt;br /&gt;
		&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;/TABLE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Methods can have arguments. Each argument in the argument list must begin with one of the direction flags [ in ] , [ out ] or [ inout ] before a known type and identifier for the argument is given. We give an example that we will often encounter in this document : [[Counter_Example#IDL_File|the counter example]]&lt;br /&gt;
&lt;br /&gt;
An interface can be derived from a base interface. A derived interface can declare its own attributes and methods. Attributes and methods cannot be redefined in the derived interface.&lt;br /&gt;
An example of interface inheritance :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//IDL&lt;br /&gt;
interface animal {&lt;br /&gt;
	attribute long age;&lt;br /&gt;
};&lt;br /&gt;
interface dog : animal {&lt;br /&gt;
	attribute short leg;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Multiple inheritance is also possible :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL&lt;br /&gt;
interface dog : animal, friend {&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Inheritance in service is presented in the next chapter.&lt;br /&gt;
&lt;br /&gt;
In the OOo object terminology there is a difference between attribute and property. The only difference is how to access them. Properties are accessed with setPropertyValue(PropertyName,Any) whereas attributes are accessed with set/get(AttributeName) methods. We have already encounter properties manipulation when examining [[Working_with_Shapes|shapes]].&lt;br /&gt;
&lt;br /&gt;
= Gathering UNO information with IDL files =&lt;br /&gt;
There are several ways to find information on UNO.&lt;br /&gt;
 &lt;br /&gt;
One way is to use OooBasic and Bernard Marcelly&amp;#039;s Xray tool (available [http://www.ooomacros.org/dev.php#101416 here]). &amp;#039;&amp;#039;&amp;#039;Problem&amp;#039;&amp;#039;&amp;#039; : OooBasic doesn&amp;#039;t show exact methods and properties.&lt;br /&gt;
 &lt;br /&gt;
An other way is to use web service at : [http://api.openoffice.org/docs/common/ref/index-files/index-1.html General OOoWEB Index]&lt;br /&gt;
&lt;br /&gt;
We have provided examples in previous chapters (particularly [[Programming_OooWriter|programming OOoWriter in C++]]) and then normally reader has skills on the subject. We recall however the points (from Danny Brewer&amp;#039;s post in OOoForum).&lt;br /&gt;
&lt;br /&gt;
== [[CppSDKAuthors|Danny Brewer &amp;#039;s]] Point of View ==&lt;br /&gt;
&lt;br /&gt;
Nonetheless, it is important to understand the concept of a &amp;quot;service&amp;quot; in the API docs. A service is just a way to group.... &lt;br /&gt;
# more services &lt;br /&gt;
# interfaces &lt;br /&gt;
The (1) more services part, of course, means that there are even more interfaces available at the original service. &lt;br /&gt;
Let me give a different example. &lt;br /&gt;
SpreadsheetDocument is a service. &lt;br /&gt;
SpreadsheetDocument includes the service OfficeDocument. The correponding IDL file shows us this point :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 7 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service SpreadsheetDocument&lt;br /&gt;
{&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** common service for all types of documents.&lt;br /&gt;
	 */&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
&lt;br /&gt;
	..........&lt;br /&gt;
&lt;br /&gt;
	//-------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	/** provides access to the collection of spreadsheets.&lt;br /&gt;
	 */&lt;br /&gt;
	interface com::sun::star::sheet::XSpreadsheetDocument;&lt;br /&gt;
&lt;br /&gt;
	//------------------------------------------------------------------------- &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Therefore, the combined set of interfaces from both SpreadsheetDocument and OfficeDocument are available at a Spreadsheet document. &lt;br /&gt;
So, even though loadComponentFromURL returns some interface, that interface represents an underlying service which is a SpreadsheetDocument. By looking at the API docs, you can tell what valid interfaces you may query. &lt;br /&gt;
SpreadsheetDocument has service XSpreadsheetDocument. &lt;br /&gt;
OfficeDocument has service XPrintable and XStorable. &lt;br /&gt;
Since SpreadsheetDocument includes OfficeDocument, it is therefore valid to queryInterface for either XPrintable or XStorable from a SpreadsheetDocument. &lt;br /&gt;
&lt;br /&gt;
Now in the above discussion, substitute TextDocument for SpreadsheetDocument.&lt;br /&gt;
How to tell what is the underlying service? &lt;br /&gt;
&lt;br /&gt;
There is no magic formula for that. Generally it is obvious. If you load a Spreadsheet, then you have the SpreadsheetDocument service. &lt;br /&gt;
&lt;br /&gt;
Similarly, if I create an object by its service name..... &lt;br /&gt;
oShape = oDoc.createUnoService( &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot; ) &lt;br /&gt;
then I know what service it is, because I gave the service name. &lt;br /&gt;
&lt;br /&gt;
You can always tell what interfaces are available if you know the name of the service -- just by looking at the API docs. No guesswork. No need for Xray. It is an absolute science. The collection of valid interfaces are the interfaces of the service itself, and of all of the services which the service includes, recursively. &lt;br /&gt;
&lt;br /&gt;
In some cases, it is fairly clear what service you have. &lt;br /&gt;
&lt;br /&gt;
If you call getCellRangeByName(), then you have a SheetCellRange. If you call getCellByPosition(), then you only have a SheetCell. Many of the same things are available on both a SheetCell and a SheetCellRange, but they are different animals. A SheetCellRange does represent a rectangular group of cells, while a SheetCell represents only a single cell. There are things you can do to a single cell that you cannot do to a group of cells together. &lt;br /&gt;
&lt;br /&gt;
There are other issues as well. If you get a com.sun.star.table.CellRange from a table, it is just that. But if you get one from a spreadsheet, it is not only that, but it is really a com.sun.star.sheet.SheetCellRange. The SheetCellRange is merely an extended version of the CellRange. Which of the two services you have depends on whether you called getCellRangeByName() on a table, or on a spreadsheet. &lt;br /&gt;
&lt;br /&gt;
Sometimes, especially in Writer, only the Developer&amp;#039;s Guide helps clear up exactly what underlying service you get back from some other API method call. Writer is especially bad about that. But it is always the case that when you know what service you have, you can directly deduce, only from the API docs, exactly all of the interfaces that are valid to query. No guesswork. It is an exact science.&lt;br /&gt;
&lt;br /&gt;
== A concrete Example ==&lt;br /&gt;
&lt;br /&gt;
The IDL files are available with SDK in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/  directory. Of course, the problem with this way is we only see the SDK&amp;#039;s UNO IDL documentation, which can be slightly different from the Openoffice.org binary : remember the SDK comes months after a new version of Openoffice.org (it&amp;#039;s not the case now). However, we will explain this way after just mentioning an other way : registry exploring. In fact, at the moment, I have no idea what kind of information can be derived from registery (see [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]])&lt;br /&gt;
&lt;br /&gt;
We want now to show an example : we start from a ::com::sun::star::document::OfficeDocument and then examine &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/document/OfficeDocument.idl presented below, (with removing all comments) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 8 Interface Specification&lt;br /&gt;
//IDL&lt;br /&gt;
service OfficeDocument&lt;br /&gt;
{&lt;br /&gt;
	interface com::sun::star::frame::XModel;&lt;br /&gt;
    interface com::sun::star::util::XModifiable;&lt;br /&gt;
	interface com::sun::star::frame::XStorable;&lt;br /&gt;
	interface com::sun::star::view::XPrintable;&lt;br /&gt;
    [optional] interface XEventBroadcaster;&lt;br /&gt;
	[optional] interface XEventsSupplier;&lt;br /&gt;
    [optional] interface XDocumentInfoSupplier;&lt;br /&gt;
    [optional] interface XViewDataSupplier;&lt;br /&gt;
    [optional] interface com::sun::star::view::XPrintJobBroadcaster;&lt;br /&gt;
	[property, optional] boolean AutomaticControlFocus;&lt;br /&gt;
	[property, optional] boolean ApplyFormDesignMode;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Remember we have already tackled Interfaces in [[IDL_Files_and_Cpp#IDL_specification|this section]].&lt;br /&gt;
This is shown with the  [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/TextDocumentWithMethods.png Developper&amp;#039;s Guide Figure]. If we now examine the &lt;br /&gt;
::com::sun::star::text::TextDocument we find in  &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/com/sun/star/text/TextDocument.idl&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service TextDocument&lt;br /&gt;
{&lt;br /&gt;
	service com::sun::star::document::OfficeDocument;&lt;br /&gt;
	interface com::sun::star::text::XTextDocument;&lt;br /&gt;
	interface com::sun::star::util::XSearchable;&lt;br /&gt;
	interface com::sun::star::util::XRefreshable;&lt;br /&gt;
	....&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As can be seen TextDocument service and OfficeDocument service are together.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s time to go deeper in our example and provide code with comments. For this purpose, we shall take code already tackled (see [[Programming_OooWriter#The_XTextCursor_Interface|the Corresponding Writer Code]]).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
//Listing 9 Writer Example&lt;br /&gt;
//C++&lt;br /&gt;
    OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = &lt;br /&gt;
                    rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	    sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
&lt;br /&gt;
   Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
xWriterComponent gives us TextDocument service and then OfficeDocument service as already said. XTextDocument is an Interface of TextDocument service.  XTextDocument.idl shows us the getText method but we don&amp;#039;t know what new services are available. Only two ways to know that : Internet [http://api.openoffice.org/docs/common/ref/com/sun/star/text/XText.html XText interface]gives the answer : the service is com.sun.star.text.Text. The other way is to use Reflection as described later in [[IDL_Files_and_Cpp#Core_reflection_service__and_its_Interfaces|this section]].&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 10 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
    Reference&amp;lt; XText &amp;gt; xText = xTextDocument-&amp;gt;getText();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
We try to get a XTextCursor Interface&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 11 Writer Example (continuation)&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt; XTextCursor&amp;gt; xTextCursor = xText-&amp;gt;createTextCursor();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
But how to explain this code ? Looking in XText.idl files only shows two methods :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//Listing 12 XText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XText: com::sun::star::text::XSimpleText&lt;br /&gt;
{ &lt;br /&gt;
	void insertTextContent( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] com::sun::star::text::XTextContent xContent, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
	void removeTextContent( [in] com::sun::star::text::XTextContent xContent ) &lt;br /&gt;
			raises( com::sun::star::container::NoSuchElementException ); &lt;br /&gt;
 &lt;br /&gt;
}; &lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
But if you have a closer look at the IDL file, you will see the inheritance from XSimpleText. Is the createTextCursor method here ? Yes, as you can see.&lt;br /&gt;
&amp;lt;pre&amp;gt;  &lt;br /&gt;
//Listing 13 XSimpleText Interface IDL file&lt;br /&gt;
// IDL&lt;br /&gt;
module com {  module sun {  module star {  module text {  &lt;br /&gt;
interface XSimpleText: com::sun::star::text::XTextRange&lt;br /&gt;
{ &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursor(); &lt;br /&gt;
	com::sun::star::text::XTextCursor createTextCursorByRange( [in] com::sun::star::text::XTextRange aTextPosition ); &lt;br /&gt;
    [oneway] void insertString( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] string aString, &lt;br /&gt;
			 [in] boolean bAbsorb ); &lt;br /&gt;
 	void insertControlCharacter( [in] com::sun::star::text::XTextRange xRange, &lt;br /&gt;
			 [in] short nControlCharacter, &lt;br /&gt;
			 [in] boolean bAbsorb ) &lt;br /&gt;
			raises( com::sun::star::lang::IllegalArgumentException ); &lt;br /&gt;
 &lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What are the services available here ? I have found them with a reflection tool :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
******** Services : 8&lt;br /&gt;
com.sun.star.text.TextSortable&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesComplex&lt;br /&gt;
com.sun.star.style.ParagraphPropertiesAsian&lt;br /&gt;
com.sun.star.style.ParagraphProperties&lt;br /&gt;
com.sun.star.style.CharacterPropertiesComplex&lt;br /&gt;
com.sun.star.style.CharacterPropertiesAsian&lt;br /&gt;
com.sun.star.style.CharacterProperties&lt;br /&gt;
com.sun.star.text.TextCursor&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can probably find all of them with internet but I think it will be a long task : a good reason for explaining reflection services later in this chapter.&lt;br /&gt;
&lt;br /&gt;
Yes you have to walk through such ways to find what you can do when programming. Fortunately there is a shorter way : the SDK examples. Most of them are in Java but I have found many ideas with them.&lt;br /&gt;
&lt;br /&gt;
= IDL  and C++ =&lt;br /&gt;
This problem is tackled in [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+2+UNO+C%2B%2B+Binding Developer&amp;#039;s guide]&lt;br /&gt;
&lt;br /&gt;
== Getting an interface in C++ ==&lt;br /&gt;
In C++, you only have variables of an Interface type. &lt;br /&gt;
One of the most often encountered problem in C++ programming is querying an interface. This problem occurs very rarely in OooBasic but very often in C++/Java. We can find an example in &amp;quot;[[SDKCppLanguage|SDK C++ language]]&amp;quot; and many other in [[UNO_automation_with_a_binary_%28executable%29|Office UNO automation]]. As an example, we suppose we have to get a com::sun::star::document::officeDocument service. This is done in general by something like:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 2 C++ code to get a service&lt;br /&gt;
//C++&lt;br /&gt;
Reference&amp;lt;com::sun::star::document::officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
Listing 3 using namespace to simplify the code&lt;br /&gt;
//C++&lt;br /&gt;
using namespace com::sun::star::document;&lt;br /&gt;
....&lt;br /&gt;
Reference&amp;lt;officeDocument&amp;gt; OfDoc = something_to_get_this_service();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and we want to query the XStorable interface to save our document. Three steps are involved in this query :&lt;br /&gt;
# Add your code&amp;#039;s line as UNO&amp;#039;s query&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 4 The UNO query in C++ code&lt;br /&gt;
// C++&lt;br /&gt;
// query from com::sun::star::frame::XStorable interface&lt;br /&gt;
	Reference&amp;lt; XStorable &amp;gt; oToStore (OfDoc, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
# Add the hpp file in an include statement. Add the corresponding namespace in an using namespace statement. Including is done with :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 5 The corresponding include statement&lt;br /&gt;
//C++&lt;br /&gt;
	#include &amp;lt;com/sun/star/frame/XStorable.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and the corresponding namespace statement is :&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 6 The corresponding namespace statement&lt;br /&gt;
//C++&lt;br /&gt;
	using namespace com::sun::star::frame;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
#Add the corresponding type in the makefile as shown below in red :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# makefile&lt;br /&gt;
# added com.sun.star.frame.XStorable&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.frame.XStorable \&lt;br /&gt;
	com.sun.star.lang.XMain \ &lt;br /&gt;
    ...&lt;br /&gt;
    com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Learn to realize these three steps : you can not program in C++ without encountering an interface&amp;#039;s query. This problem of asking an interface is already tackled in chapters 3 and 4. &lt;br /&gt;
&lt;br /&gt;
You have to learn to get interface in an other way.&lt;br /&gt;
&lt;br /&gt;
==Getting an Interface through XMultiServiceFactory==&lt;br /&gt;
&lt;br /&gt;
We have already encountered such a thing, so it should be quite familiar to us by now. But, because we have not discussed every step in detail, I want to illustrate how it works.&lt;br /&gt;
&lt;br /&gt;
The previous section only deals with getting interfaces directely available because the corresponding service is available. For instance the code below deals with only one arrow of the Figure below and getting a Xmodel inteface starting from XtextDocument is a simple UNO_QUERY call (last line of the listing).&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 19 Simple UNO_QUERY call&lt;br /&gt;
// C++&lt;br /&gt;
OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/Documents/demo.sxw&amp;quot;),sDocUrl);&lt;br /&gt;
    Reference&amp;lt; XComponent &amp;gt; xWriterComponent = rComponentLoader-&amp;gt;loadComponentFromURL(&lt;br /&gt;
	sDocUrl,&lt;br /&gt;
        OUString::createFromAscii(&amp;quot;_blank&amp;quot;),&lt;br /&gt;
        0,&lt;br /&gt;
        Sequence &amp;lt; ::com::sun::star::beans::PropertyValue &amp;gt;());&lt;br /&gt;
 &lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to include #include &amp;lt;com/sun/star/frame/XModel.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt; XModel &amp;gt; xModel (xTextDocument,UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:SimpleUNOQUERY.png|center]]&lt;br /&gt;
&lt;br /&gt;
But how can you get an interface if the corresponding service is not directly available ?&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;First case :&amp;#039;&amp;#039;&amp;#039; a method of your interface allows to get the new interface. It was the case of the code of Listing 11. In this case the corresponding hdl file is not necessary and I have not found a way to retrieve the new services available witout a reflection tool !&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Second case :&amp;#039;&amp;#039;&amp;#039; no interface&amp;#039;s method can help you. You have to query a service before getting the interface. This can be done with two or three instructions style. I have already used both styles. Have a look into this listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 20 Getting an Interface with XMultiServiceFacory&lt;br /&gt;
// C++&lt;br /&gt;
    Reference &amp;lt; XTextDocument &amp;gt; xTextDocument (xWriterComponent,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
    Reference &amp;lt;XTextTable&amp;gt; xTable (oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
			OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;)),UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which uses two instruction style. With three instructions style, the same code  is shown in the listing above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 21 Inserting a Table in a OOoWriter Document&lt;br /&gt;
// C++&lt;br /&gt;
    Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = oDocMSF-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/text/XTextTable.hpp&amp;gt;&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both method require to include (and then construct) the corresponding hpp file (here XtextTable.hpp) but not for the service because you get it with a method (named « createInstance » in this case). We give a schematic to  summarize what we talked about.&lt;br /&gt;
&lt;br /&gt;
[[Image:ComplexUNOQUERY.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Last question :&amp;#039;&amp;#039;&amp;#039; is it possible to start from any XMultiServiceFactory interface ? The answer to this question is no. Have a look to the code below where I take  rOfficeServiceManager instead of oDocMSF because it&amp;#039;s a XmultiServiceFactory Interface too.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 22 Wrong code&lt;br /&gt;
// C++&lt;br /&gt;
//  Reference&amp;lt;XMultiServiceFactory&amp;gt; oDocMSF (xTextDocument,UNO_QUERY);&lt;br /&gt;
// using rOfficeServiceManager instead oDocMSF&lt;br /&gt;
	Reference&amp;lt; XInterface &amp;gt; textTable = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
	               OUString::createFromAscii(&amp;quot;com.sun.star.text.TextTable&amp;quot;) );&lt;br /&gt;
	Reference&amp;lt; XTextTable &amp;gt; xTable(textTable, UNO_QUERY);&lt;br /&gt;
	if (!xTable.is()) {&lt;br /&gt;
		printf(&amp;quot;Erreur creation XTextTable interface !\n&amp;quot;);&lt;br /&gt;
	return 1;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code compiles but gives a runtime error. This only means you cannot use every XMultiServiceFactory interface to get every Interface. If you are working with a document ask the corresponding XMultiServiceFactory interface. At this point only experience can help you. &lt;br /&gt;
&lt;br /&gt;
Note before going further that a code used many times so far, can find an explanation even if here the XMultiServiceFactory interface is not obtained in a standard way :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
//Listing 23 Classic code&lt;br /&gt;
// C++&lt;br /&gt;
int main( ) {&lt;br /&gt;
//retrieve an instance of the remote service manager&lt;br /&gt;
    Reference&amp;lt; XMultiServiceFactory &amp;gt; rOfficeServiceManager;&lt;br /&gt;
    rOfficeServiceManager = ooConnect();&lt;br /&gt;
    &lt;br /&gt;
//get the desktop service using createInstance returns an XInterface type&lt;br /&gt;
    Reference&amp;lt; XInterface  &amp;gt; Desktop = rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ));&lt;br /&gt;
&lt;br /&gt;
//query for the XComponentLoader interface&lt;br /&gt;
    Reference&amp;lt; XComponentLoader &amp;gt; rComponentLoader (Desktop, UNO_QUERY);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy to retreive the three instructions style to get the XcomponentLoader, isn&amp;#039;t it ?&lt;br /&gt;
&lt;br /&gt;
An other more technical problem is the mapping : you have an IDL file, how is it compiled in C++ ? The next chapter tackle the subject : you can skip it in a first reading and go on into the chapter 1.5.&lt;br /&gt;
&lt;br /&gt;
== Mapping for Modules and Interfaces ==&lt;br /&gt;
For instance: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// IDL &lt;br /&gt;
module M &lt;br /&gt;
{ struct E { long L; &lt;br /&gt;
  }; &lt;br /&gt;
}; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is mapped into: &lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
// C++ &lt;br /&gt;
namespace M &lt;br /&gt;
{ struct E &lt;br /&gt;
  { Long L; }; &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
and E can be referred outside of M as M::E. Alternatively, a C++ using statement for namespace M can be used so that E can be referred to simply as E:&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp] &lt;br /&gt;
// C++ &lt;br /&gt;
using namespace M; &lt;br /&gt;
E e;&lt;br /&gt;
  e.L = 3;&lt;br /&gt;
&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Core reflection service  and its Interfaces =&lt;br /&gt;
&lt;br /&gt;
Many entry points for reflection are descibed in the SDK. We give again any of them here and show a way to use them with C++.&lt;br /&gt;
&lt;br /&gt;
== XIdlReflection interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIDLReflection_Interface |here]]&lt;br /&gt;
&lt;br /&gt;
== The XIntrospection Interface ==&lt;br /&gt;
&lt;br /&gt;
This interface is described [[XIntrospection_Interface |here]] with code&amp;#039;s example. Other code is given in [[Constructing_Helpers#Reflection_Helper|Constructing Helpers]] section.&lt;br /&gt;
See also [[Extensions_development_basic#Introducing_the_OpenOffice.org_API|Introducing the OpenOffice.org_API]] and [[Extensions_development_basic#Introspection|OOoBasic Introspection]].&lt;br /&gt;
&lt;br /&gt;
= Using Java Inspector =&lt;br /&gt;
For an introduction of using Java with OOo, see [[JavaEclipseTuto|Java and Eclipse tutorial]]. This point is not tackled here : we are only interested by using a Java component with C++.&lt;br /&gt;
&lt;br /&gt;
It is possible in principle, to use the Java inspector tools from every programming languages because it&amp;#039;s a component. The way to do that is very simple :&lt;br /&gt;
&lt;br /&gt;
1°) Compile the java example in &amp;lt;OpenOffice.org_SDK&amp;gt;/examples/java/Inspector after adding SDK_AUTO_DEPLOYMENT = YES in the beginning of makefile.&lt;br /&gt;
&lt;br /&gt;
2°) Create a OOoBasic example, for instance :&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;Listing 17 Simple OOoBasic example to call the Java Inspector&lt;br /&gt;
&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
Sub JavaInspector           &lt;br /&gt;
	o = createUnoService(&amp;quot;org.OpenOffice.InstanceInspector&amp;quot;)&lt;br /&gt;
	&amp;#039;XRay.XRay o&lt;br /&gt;
	oReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; )&lt;br /&gt;
	o.inspect(oReflection)	&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If java is not properly installed when running this program a dialog box will print out. Follow the instructions to install it (you have to know where your virtual machine (JRE) is installed.&lt;br /&gt;
We see below in Figure what is the result of this program.&lt;br /&gt;
&lt;br /&gt;
[[Image:Inspector3.png]]&lt;br /&gt;
&lt;br /&gt;
Our problem is now to use the Java Inspector from C++. But I encounter a problem when I try to do that. Here is the way I choose :&lt;br /&gt;
&lt;br /&gt;
# construct a urd file starting from IDL (in makefile)&lt;br /&gt;
# don&amp;#039;t forget the registry of urd file in makefile&lt;br /&gt;
# add org.OpenOffice.XInstanceInspector in the TYPES macro in the makefile&lt;br /&gt;
# copy IDL file from &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/java/Inspector/XInstanceInspector.idl into &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/idl/org/OpenOffice/ XInstanceInspector.idl&lt;br /&gt;
# add the #include &amp;lt;org/OpenOffice/XInstanceInspector.hpp&amp;gt;  and using namespace org::OpenOffice;&lt;br /&gt;
# add this code&lt;br /&gt;
&amp;lt;code&amp;gt;[cpp]&lt;br /&gt;
	// C++&lt;br /&gt;
	Any toInspect;&lt;br /&gt;
	toInspect &amp;lt;&amp;lt;= rDesktop;&lt;br /&gt;
	Reference&amp;lt; XInstanceInspector &amp;gt; xinspect (rOfficeServiceManager-&amp;gt;createInstance(&lt;br /&gt;
    OUString::createFromAscii( &amp;quot;org.OpenOffice.InstanceInspector&amp;quot; )),UNO_QUERY);&lt;br /&gt;
    xinspect-&amp;gt;inspect(toInspect);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And it works like in OOoBasic. The corresponding Linux makefile is :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Listing 18 Simple Makefile to compile a Java Inspector C++ call&lt;br /&gt;
# very simple makefile&lt;br /&gt;
HELPER = ReflectionHelper&lt;br /&gt;
CXXFILE = office_connect.cxx&lt;br /&gt;
OBJFILE = office_connect.o&lt;br /&gt;
OUTBIN = office_connect&lt;br /&gt;
OUT_COMP_INC = ../../../../LINUXexample.out/inc&lt;br /&gt;
OUT_COMP_OBJ = ../../../../LINUXexample.out/obj&lt;br /&gt;
OUT_COMP_BIN = ../../../../LINUXexample.out/bin&lt;br /&gt;
# added for Inspector&lt;br /&gt;
OUT_COMP_URD = $(OUT_COMP_BIN)&lt;br /&gt;
# end added&lt;br /&gt;
COMPONENT_RDB = $(OUT_COMP_BIN)/office_connect.rdb&lt;br /&gt;
CC_FLAGS = -c -O -fpic -fno-rtti&lt;br /&gt;
CC_DEFINES = -DUNX -DGCC -DLINUX -DCPPU_ENV=gcc3&lt;br /&gt;
PS = /&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	....&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess \&lt;br /&gt;
	org.OpenOffice.XInstanceInspector&lt;br /&gt;
# last line added&lt;br /&gt;
&lt;br /&gt;
TYPESLIST = $(foreach t,$(TYPES),-T$(t))&lt;br /&gt;
GENHPPFILES = $(foreach t,$(TYPES),$(OUT_COMP_INC)/$(subst .,/,$(t)).hpp)&lt;br /&gt;
&lt;br /&gt;
ALL : \&lt;br /&gt;
    ProUNOCppBindingExample&lt;br /&gt;
&lt;br /&gt;
# added for Inspector&lt;br /&gt;
#building urd file&lt;br /&gt;
$(OUT_COMP_URD)/XInstanceInspector.urd : ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
	-mkdir -p $(OUT_COMP_URD)&lt;br /&gt;
	idlc -I. -I../../../../idl -O$(OUT_COMP_URD)  ../../../../idl/org/OpenOffice/XInstanceInspector.idl&lt;br /&gt;
&lt;br /&gt;
# end added&lt;br /&gt;
&lt;br /&gt;
#office_connectrc is provided with SDK&lt;br /&gt;
$(OUT_COMP_BIN)/office_connectrc : office_connectrc&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	cp office_connectrc $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
&lt;br /&gt;
$(COMPONENT_RDB) : $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
# added for Inspector&lt;br /&gt;
	regmerge $(COMPONENT_RDB) /UCR $(OUT_COMP_URD)/XInstanceInspector.urd&lt;br /&gt;
# end added&lt;br /&gt;
	regmerge $(COMPONENT_RDB) / &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo   Register necessary runtime components in $(COMPONENT_RDB)&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c connector.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c remotebridge.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c bridgefac.uno.so&lt;br /&gt;
	regcomp -register -r $(COMPONENT_RDB) -c uuresolver.uno.so&lt;br /&gt;
#	@echo bla &amp;gt; $@&lt;br /&gt;
&lt;br /&gt;
$(GENHPPFILES) :  $(subst /,$(PS),$(@D))&lt;br /&gt;
	mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
# modified for Inspector	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) &amp;quot;/usr/lib/openoffice/program/types.rdb&amp;quot;&lt;br /&gt;
	cppumaker -Gc -BUCR -O$(OUT_COMP_INC) $(TYPESLIST) $(COMPONENT_RDB)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(OBJFILE) : $(CXXFILE) $(GENHPPFILES) $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(subst /,$(PS),$(@D))&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(OBJFILE) $(CXXFILE)&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_OBJ)/$(HELPER).o : $(HELPER).cxx $(HELPER).hpp&lt;br /&gt;
	-mkdir -p $(OUT_COMP_OBJ)/&lt;br /&gt;
	gcc $(CC_FLAGS) $(CC_INCLUDES) -I. -I/usr/include -I$(OUT_COMP_INC)/examples \&lt;br /&gt;
	-I../../../../include -I$(OUT_COMP_INC) $(CC_DEFINES) -o$(OUT_COMP_OBJ)/$(HELPER).o $(HELPER).cxx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$(OUT_COMP_BIN)/$(OUTBIN) : $(OUT_COMP_OBJ)/$(OBJFILE) $(OUT_COMP_OBJ)/$(HELPER).o&lt;br /&gt;
	-mkdir -p $(OUT_COMP_BIN)&lt;br /&gt;
	gcc -Wl -export-dynamic -L../../../../LINUXexample.out/lib -L../../../../linux/lib -L/usr/lib/openoffice/program \&lt;br /&gt;
	$(OUT_COMP_OBJ)/$(HELPER).o \&lt;br /&gt;
	-o$(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_OBJ)/$(OBJFILE) -lcppuhelpergcc3 -lcppu -lsalhelpergcc3 -lsal -lstlport_gcc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ProUNOCppBindingExample : $(COMPONENT_RDB) $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
	@echo Please use one of the following commands to execute the examples!&lt;br /&gt;
	@echo&lt;br /&gt;
	@echo make office_connect.run&lt;br /&gt;
	@echo --------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
office_connect.run : $(OUT_COMP_BIN)/$(OUTBIN) $(OUT_COMP_BIN)/office_connectrc&lt;br /&gt;
	cd $(OUT_COMP_BIN) &amp;amp;&amp;amp; $(OUTBIN)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
*[[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
*[[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI10.html IDL Files and C++] (Chapter 10 from UNO/C++ document) &lt;br /&gt;
* Writing a Program to Control OpenOffice.org, by Franco Pingiori — [http://www.linuxjournal.com/article/8550 Part 1] and [http://www.linuxjournal.com/article/8608 Part 2], Linux Journal&lt;br /&gt;
* See also [[Object Inspector|The New Object Inspector]]&lt;br /&gt;
* [[Extensions_introspection|Extensions Introspection]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Tutorial]]&lt;/div&gt;</summary>
		<author><name>Jiao.jianhua</name></author>
	</entry>
</feed>