<?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=Global667</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=Global667"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Global667"/>
	<updated>2026-10-17T22:52:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235396</id>
		<title>Using Cpp with the OOo SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235396"/>
		<updated>2014-07-11T07:47:07Z</updated>

		<summary type="html">&lt;p&gt;Global667: Change Formating look now more like extensions main page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
&lt;br /&gt;
This site is about using C++ as a language to program OpenOffice extensions. &lt;br /&gt;
==== Common ====&lt;br /&gt;
* [[CppSDKAuthors|About the Author and Contributors]]&lt;br /&gt;
* [[GNU_Lesser_General_Public_License|GNU Lesser General Public License]]&lt;br /&gt;
* [[SDKInstallation|How to install the SDK and compile the C++ examples]]&lt;br /&gt;
* [[SDKCppLanguage|The UNO C++ Language]]&lt;br /&gt;
* [[UNO_automation_with_a_binary_(executable)|OpenOffice.org&amp;#039;s UNO automation with a binary (executable)]]&lt;br /&gt;
==== Writer, Calc, Draw and Impress ====&lt;br /&gt;
* [[Programming OooWriter |Programming OooWriter with C++]]&lt;br /&gt;
* [[Calc/API/Programming|OpenOffice Calc]]&lt;br /&gt;
* [[Programming_OOoDraw_and_OOoImpress|Programming OOoDraw and OOoImpress with C++]]&lt;br /&gt;
* [[Working_with_Shapes |Working with Shapes in C++]]&lt;br /&gt;
==== General Utilities ====&lt;br /&gt;
*[[Playing_with_Window_Toolkit_AWT|Playing with Window Toolkit AWT]]&lt;br /&gt;
*[[Executing_an_OOoBasic_macro_with_Cpp|Executing an OOoBasic macro with C++]]&lt;br /&gt;
* [[IDL_Files_and_Cpp|IDL Files and C++]]&lt;br /&gt;
* [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]]&lt;br /&gt;
* [[Constructing_Helpers|Constructing Helpers]]&lt;br /&gt;
==== Components ====&lt;br /&gt;
* [[Constructing_Components|Constructing Components in C++]]&lt;br /&gt;
* [[Component_and_Dialog|Managing a Dialog in a Component]]&lt;br /&gt;
* [[Going_further_with_Dialog_and_Component|Going further with Dialog and Components]]&lt;br /&gt;
* [[Writing_Professional_Components|Writing professional Components]]&lt;br /&gt;
==== AddOns ====&lt;br /&gt;
* [[Add-on|Constructing an Addon]]&lt;br /&gt;
* [[CompleteAddIn | OOoCalc AddOn in C++]]&lt;br /&gt;
* [[XML_and_Filter |XML, Filters and Files]]&lt;br /&gt;
{{Documentation/Caution|I have decided to give up with this C++ documentation. My last work was to add two chapters in summer 2009. I have done nothing more during last year. I only want to say this document is completely free, unfortunatly is not finished (particularly with addon and dialog). Please let this caution banner for a year and remove it after because tradition in OpenOffice documentation is to remove author&amp;#039;s names. After a year, it would be also great to remove my name everywhere it appears in other chapters. Thank you in Advance. 08:52, 26 August 2010 (UTC)}} &lt;br /&gt;
= See also=&lt;br /&gt;
==== General ====&lt;br /&gt;
* [[FR/Documentation/Cpp_Guide|French version of this document]].&lt;br /&gt;
* [[Documentation/DevGuide/OpenOffice.org_Developers_Guide | Developer&amp;#039;s Guide]]&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&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;
* [[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
* [[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://udk.openoffice.org/common/man/concept/unointro.html UNO Introduction]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=8702 Working with a database in C++] (not tackled in this document at the moment).&lt;br /&gt;
* [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
==== Coding ==== &lt;br /&gt;
* [[Writing_correct_Cplusplus|Writing correct C++]]&lt;br /&gt;
* [[MakeFile|Using make utility with SDK]] &lt;br /&gt;
* [[Writing_warning-free_code|Writing warning-free code]]&lt;br /&gt;
* [[Debugging |Debugging]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Article]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235395</id>
		<title>Using Cpp with the OOo SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235395"/>
		<updated>2014-07-11T02:10:24Z</updated>

		<summary type="html">&lt;p&gt;Global667: Structuring changed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
&lt;br /&gt;
This site is about using C++ as a language to program OpenOffice extensions. &lt;br /&gt;
* Common&lt;br /&gt;
** [[CppSDKAuthors|About the Author and Contributors]]&lt;br /&gt;
** [[GNU_Lesser_General_Public_License|GNU Lesser General Public License]]&lt;br /&gt;
** [[SDKInstallation|How to install the SDK and compile the C++ examples]]&lt;br /&gt;
** [[SDKCppLanguage|The UNO C++ Language]]&lt;br /&gt;
** [[UNO_automation_with_a_binary_(executable)|OpenOffice.org&amp;#039;s UNO automation with a binary (executable)]]&lt;br /&gt;
* Writer, Calc, Draw and Impress&lt;br /&gt;
** [[Programming OooWriter |Programming OooWriter with C++]]&lt;br /&gt;
** [[Calc/API/Programming|OpenOffice Calc]]&lt;br /&gt;
** [[Programming_OOoDraw_and_OOoImpress|Programming OOoDraw and OOoImpress with C++]]&lt;br /&gt;
** [[Working_with_Shapes |Working with Shapes in C++]]&lt;br /&gt;
* General Utilities&lt;br /&gt;
**[[Playing_with_Window_Toolkit_AWT|Playing with Window Toolkit AWT]]&lt;br /&gt;
**[[Executing_an_OOoBasic_macro_with_Cpp|Executing an OOoBasic macro with C++]]&lt;br /&gt;
** [[IDL_Files_and_Cpp|IDL Files and C++]]&lt;br /&gt;
** [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]]&lt;br /&gt;
** [[Constructing_Helpers|Constructing Helpers]]&lt;br /&gt;
* Components&lt;br /&gt;
** [[Constructing_Components|Constructing Components in C++]]&lt;br /&gt;
** [[Component_and_Dialog|Managing a Dialog in a Component]]&lt;br /&gt;
** [[Going_further_with_Dialog_and_Component|Going further with Dialog and Components]]&lt;br /&gt;
** [[Writing_Professional_Components|Writing professional Components]]&lt;br /&gt;
* AddOns&lt;br /&gt;
** [[Add-on|Constructing an Addon]]&lt;br /&gt;
** [[CompleteAddIn | OOoCalc addin in C++]]&lt;br /&gt;
** [[XML_and_Filter |XML, Filters and Files]]&lt;br /&gt;
{{Documentation/Caution|I have decided to give up with this C++ documentation. My last work was to add two chapters in summer 2009. I have done nothing more during last year. I only want to say this document is completely free, unfortunatly is not finished (particularly with addon and dialog). Please let this caution banner for a year and remove it after because tradition in OpenOffice documentation is to remove author&amp;#039;s names. After a year, it would be also great to remove my name everywhere it appears in other chapters. Thank you in Advance. 08:52, 26 August 2010 (UTC)}} &lt;br /&gt;
= See also=&lt;br /&gt;
* General&lt;br /&gt;
** [[FR/Documentation/Cpp_Guide|French version of this document]].&lt;br /&gt;
** [[Documentation/DevGuide/OpenOffice.org_Developers_Guide | Developer&amp;#039;s Guide]]&lt;br /&gt;
** [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&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;
** [[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
** [[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
** [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
** [http://udk.openoffice.org/common/man/concept/unointro.html UNO Introduction]&lt;br /&gt;
** [http://www.oooforum.org/forum/viewtopic.phtml?t=8702 Working with a database in C++] (not tackled in this document at the moment).&lt;br /&gt;
** [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
* Coding &lt;br /&gt;
** [[Writing_correct_Cplusplus|Writing correct C++]]&lt;br /&gt;
** [[MakeFile|Using make utility with SDK]] &lt;br /&gt;
** [[Writing_warning-free_code|Writing warning-free code]]&lt;br /&gt;
** [[Debugging |Debugging]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Article]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235394</id>
		<title>Using Cpp with the OOo SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235394"/>
		<updated>2014-07-11T01:57:08Z</updated>

		<summary type="html">&lt;p&gt;Global667: Formating&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
[[Image:HomePageCpp.png]]&lt;br /&gt;
&lt;br /&gt;
This site is about using C++ as a language to program OpenOffice extensions.&lt;br /&gt;
* Common&lt;br /&gt;
** [[CppSDKAuthors|About the Author and Contributors]]&lt;br /&gt;
** [[GNU_Lesser_General_Public_License|GNU Lesser General Public License]]&lt;br /&gt;
** [[MakeFile|Appendix : Using make utility]] with SDK&lt;br /&gt;
** [[SDKInstallation|How to install the SDK and compile the C++ examples]]&lt;br /&gt;
** [[SDKCppLanguage|The UNO C++ Language]]&lt;br /&gt;
** [[UNO_automation_with_a_binary_(executable)|OpenOffice.org&amp;#039;s UNO automation with a binary (executable)]]&lt;br /&gt;
* Writer, Calc, Draw and Impress&lt;br /&gt;
** [[Programming OooWriter |Programming OooWriter with C++]]&lt;br /&gt;
** [[Calc/API/Programming|OpenOffice Calc]]&lt;br /&gt;
** [[Programming_OOoDraw_and_OOoImpress|Programming OOoDraw and OOoImpress with C++]]&lt;br /&gt;
** [[Working_with_Shapes |Working with Shapes in C++]]&lt;br /&gt;
* General Utilities&lt;br /&gt;
**[[Playing_with_Window_Toolkit_AWT|Playing with Window Toolkit AWT]]&lt;br /&gt;
**[[Executing_an_OOoBasic_macro_with_Cpp|Executing an OOoBasic macro with C++]]&lt;br /&gt;
** [[IDL_Files_and_Cpp|IDL Files and C++]]&lt;br /&gt;
** [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]]&lt;br /&gt;
** [[Constructing_Helpers|Constructing Helpers]]&lt;br /&gt;
* Components&lt;br /&gt;
** [[Constructing_Components|Constructing Components in C++]]&lt;br /&gt;
** [[Component_and_Dialog|Managing a Dialog in a Component]]&lt;br /&gt;
** [[Going_further_with_Dialog_and_Component|Going further with Dialog and Components]]&lt;br /&gt;
* AddOns&lt;br /&gt;
** [[Add-on|Constructing an Addon]]&lt;br /&gt;
** [[CompleteAddIn | OOoCalc addin in C++]]&lt;br /&gt;
** [[Writing_Professional_Components|Writing professional Components]]&lt;br /&gt;
** [[XML_and_Filter |XML, Filters and Files]]&lt;br /&gt;
{{Documentation/Caution|I have decided to give up with this C++ documentation. My last work was to add two chapters in summer 2009. I have done nothing more during last year. I only want to say this document is completely free, unfortunatly is not finished (particularly with addon and dialog). Please let this caution banner for a year and remove it after because tradition in OpenOffice documentation is to remove author&amp;#039;s names. After a year, it would be also great to remove my name everywhere it appears in other chapters. Thank you in Advance. 08:52, 26 August 2010 (UTC)}} &lt;br /&gt;
= See also=&lt;br /&gt;
* General&lt;br /&gt;
** [[FR/Documentation/Cpp_Guide|French version of this document]].&lt;br /&gt;
** [[Documentation/DevGuide/OpenOffice.org_Developers_Guide | Developer&amp;#039;s Guide]]&lt;br /&gt;
** [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&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;
** [[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
** [[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
** [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
** [http://udk.openoffice.org/common/man/concept/unointro.html UNO Introduction]&lt;br /&gt;
** [http://www.oooforum.org/forum/viewtopic.phtml?t=8702 Working with a database in C++] (not tackled in this document at the moment).&lt;br /&gt;
** [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
* Coding &lt;br /&gt;
** [[Writing_correct_Cplusplus|Writing correct C++]]&lt;br /&gt;
** [[Writing_warning-free_code|Writing warning-free code]]&lt;br /&gt;
** [[Debugging |Debugging]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Article]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235393</id>
		<title>Using Cpp with the OOo SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235393"/>
		<updated>2014-07-11T01:53:19Z</updated>

		<summary type="html">&lt;p&gt;Global667: Formating&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
[[Image:HomePageCpp.png]]&lt;br /&gt;
This site is about using C++ as a language to program OpenOffice extensions.&lt;br /&gt;
* Common&lt;br /&gt;
** [[CppSDKAuthors|About the Author and Contributors]]&lt;br /&gt;
** [[GNU_Lesser_General_Public_License|GNU Lesser General Public License]]&lt;br /&gt;
** [[MakeFile|Appendix : Using make utility]] with SDK&lt;br /&gt;
** [[SDKInstallation|How to install the SDK and compile the C++ examples]]&lt;br /&gt;
** [[SDKCppLanguage|The UNO C++ Language]]&lt;br /&gt;
** [[UNO_automation_with_a_binary_(executable)|OpenOffice.org&amp;#039;s UNO automation with a binary (executable)]]&lt;br /&gt;
* Writer, Calc Draw and Impress&lt;br /&gt;
** [[Programming OooWriter |Programming OooWriter with C++]]&lt;br /&gt;
** [[Calc/API/Programming|OpenOffice Calc]]&lt;br /&gt;
** [[Programming_OOoDraw_and_OOoImpress|Programming OOoDraw and OOoImpress with C++]]&lt;br /&gt;
** [[Working_with_Shapes |Working with Shapes in C++]]&lt;br /&gt;
* General Utilities&lt;br /&gt;
**[[Playing_with_Window_Toolkit_AWT|Playing with Window Toolkit AWT]]&lt;br /&gt;
**[[Executing_an_OOoBasic_macro_with_Cpp|Executing an OOoBasic macro with C++]]&lt;br /&gt;
* [[IDL_Files_and_Cpp|IDL Files and C++]]&lt;br /&gt;
* [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]]&lt;br /&gt;
* [[Constructing_Helpers|Constructing Helpers]]&lt;br /&gt;
* [[Constructing_Components|Constructing Components in C++]]&lt;br /&gt;
* [[Component_and_Dialog|Managing a Dialog in a Component]]&lt;br /&gt;
* [[Going_further_with_Dialog_and_Component|Going further with Dialog and Components]]&lt;br /&gt;
* AddOns&lt;br /&gt;
** [[Add-on|Constructing an Addon]]&lt;br /&gt;
** [[CompleteAddIn | OOoCalc addin in C++]]&lt;br /&gt;
** [[Writing_Professional_Components|Writing professional Components]]&lt;br /&gt;
** [[XML_and_Filter |XML, Filters and Files]]&lt;br /&gt;
{{Documentation/Caution|I have decided to give up with this C++ documentation. My last work was to add two chapters in summer 2009. I have done nothing more during last year. I only want to say this document is completely free, unfortunatly is not finished (particularly with addon and dialog). Please let this caution banner for a year and remove it after because tradition in OpenOffice documentation is to remove author&amp;#039;s names. After a year, it would be also great to remove my name everywhere it appears in other chapters. Thank you in Advance. 08:52, 26 August 2010 (UTC)}} &lt;br /&gt;
= See also=&lt;br /&gt;
* General&lt;br /&gt;
** [[FR/Documentation/Cpp_Guide|French version of this document]].&lt;br /&gt;
** [[Documentation/DevGuide/OpenOffice.org_Developers_Guide | Developer&amp;#039;s Guide]]&lt;br /&gt;
** [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&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;
** [[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
** [[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
** [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
** [http://udk.openoffice.org/common/man/concept/unointro.html UNO Introduction]&lt;br /&gt;
** [http://www.oooforum.org/forum/viewtopic.phtml?t=8702 Working with a database in C++] (not tackled in this document at the moment).&lt;br /&gt;
** [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
* Coding &lt;br /&gt;
** [[Writing_correct_Cplusplus|Writing correct C++]]&lt;br /&gt;
** [[Writing_warning-free_code|Writing warning-free code]]&lt;br /&gt;
** [[Debugging |Debugging]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Article]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKCppLanguage&amp;diff=235392</id>
		<title>SDKCppLanguage</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKCppLanguage&amp;diff=235392"/>
		<updated>2014-07-11T00:56:00Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Our starting Example : Simple Binaries (Executable) */ formating&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
=The UNO C++ Language=&lt;br /&gt;
The aim of this chapter is to explain peculiarities of the C++ language in the UNO environment and not to provide skills on traditional C++. To put it differently, I want to give here the UNO/C++ background, quite helpful in getting us started.&lt;br /&gt;
You can find e-Books on C++ [http://www.smart2help.com/e-books/ here].&lt;br /&gt;
&lt;br /&gt;
See also [[Uno/Article/Understanding_Uno|Understanding Uno]], [[Documentation/DevGuide/FirstSteps/Objects%2C_Interfaces%2C_and_Services|Objects, Interfaces, and Services]] and [[Documentation/BASIC_Guide/UNO|OOoBasic UNO Guide]] for a start with UNO.&lt;br /&gt;
&lt;br /&gt;
== Our starting Example : Simple Binaries (Executable) ==&lt;br /&gt;
&lt;br /&gt;
We want now to start with a SDK example. The purpose of the  example presented is to create an executable which interacts with OpenOffice.org. We can imagine two kind of interactions : direct interaction with OpenOffice.org or interaction with one of OOo&amp;#039;s shared library. We focus on this second case where the makefile is simpler. The shared library involved is then cppuhelper.uno.so (cppuhelper.uno.dll under Windows). Former case will be examined later.&lt;br /&gt;
I assume (I know nobody of the SDK team) this example is given to provide the simplest example we can do with the SDK. This is the Lifetime example: see at “&amp;lt;SDK_Folder&amp;gt;/examples/DevelopersGuide/ProfUNO/Lifetime”&lt;br /&gt;
&lt;br /&gt;
Before diving into the examples, you will need to set up your programming environment so you can create UNO programs. What&amp;#039;s required depends on what platform you&amp;#039;re working. This is shown in the first example with LINUX platform.&lt;br /&gt;
To check this example you only have to launch the makefile :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/DevelopersGuide/ProfUNO/Lifetime&lt;br /&gt;
make&lt;br /&gt;
make ProfUnoLifetime.runexe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The last command line only launch the binary executable “ProfUnoLifetime” which interact with cpphelper.uno.so (cppuhelper.uno.dll under Windows) even if  OpenOffice.org is not running.&lt;br /&gt;
This example creates and releases an object, nothing more. The constructor and destructor of the object only write out a message. Its little size allows us to give its code here:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 1 First Example (from SDK)&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/weak.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyOWeakObject : public ::cppu::OWeakObject&lt;br /&gt;
{&lt;br /&gt;
public:    &lt;br /&gt;
MyOWeakObject() &lt;br /&gt;
{ &lt;br /&gt;
fprintf( stdout, &amp;quot;constructed\n&amp;quot; ); &lt;br /&gt;
}    &lt;br /&gt;
~MyOWeakObject() &lt;br /&gt;
{ &lt;br /&gt;
fprintf( stdout, &amp;quot;destructed\n&amp;quot; ); &lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void simple_object_creation_and_destruction()&lt;br /&gt;
{    &lt;br /&gt;
// create the UNO object    &lt;br /&gt;
com::sun::star::uno::XInterface * p = new MyOWeakObject(); &lt;br /&gt;
   &lt;br /&gt;
// acquire it, refcount becomes one    &lt;br /&gt;
p-&amp;gt;acquire();    &lt;br /&gt;
fprintf( stdout, &amp;quot;before release\n&amp;quot; ); &lt;br /&gt;
   &lt;br /&gt;
// release it, refcount drops to zero    &lt;br /&gt;
p-&amp;gt;release();    &lt;br /&gt;
fprintf( stdout, &amp;quot;after release\n&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
int main( char * argv[] )&lt;br /&gt;
{    &lt;br /&gt;
simple_object_creation_and_destruction();    &lt;br /&gt;
return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods acquire and release will be encountered later. What exactly they do is not important for the moment. This example shows us how to write a class which inherits from an other class, how to write and call methods and how to instantiate the class.&lt;br /&gt;
All the listings given below only need to modify this C++ code  compile it and run it. You can therefore use the same makefile by possibly changing the name of the source file  (tackled in next section).&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
The [[Documentation/DevGuide/FirstSteps/Common_Types|UNO types]] are given in the table below :&lt;br /&gt;
; UNO Types&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;550&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| |UNO||Type description||Java||C++||Basic&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
| char||16-bit unicode character type||char||sal_Unicode || -&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|boolean ||boolean type; true and false ||boolean ||sal_Bool||Boolean&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|byte ||8-bit ordinal type||byte ||sal_Int8 ||Integer&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|short ||signed 16-bit ordinal type||short ||sal_Int16 ||Integer &lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned short||unsigned 16-bit ordinal type||- ||sal_uInt16 ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|long ||signed 32-bit ordinal type||int ||sal_Int32 ||Long&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned long ||unsigned 32-bit type ||- ||sal_uInt32  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|hyper||signed 64-bit ordinal type||long  ||sal_Int64  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned hyper ||unsigned 64-bit ordinal type||- ||sal_uInt64  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|float  ||processor dependent float||float  ||float (IEEE float) ||Single&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|double  ||processor dependent double||double||double (IEEE double)||Double&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The UNO&amp;#039;s column represents all the types you can find in the specifications files : IDL files. We describe IDL files later (see chapter 10). The C++ column is what we are interested in when we program with this language. If you want to check the different programs given in this chapter, you can use the &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/DevelopersGuide/ProfUNO/Lifetime &lt;br /&gt;
example. Replace object_lifetime.cxx completely with the listing below (don&amp;#039;t forget to save the old file)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 2 A short UNO Program &lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	sal_Int32 var1;&lt;br /&gt;
	var1 = 34;&lt;br /&gt;
	printf(&amp;quot;The var1 value is : %d\n&amp;quot;,var1);&lt;br /&gt;
   	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then launch &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make ALL&lt;br /&gt;
make ProfUnoLifetime.runexe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and it works. Don&amp;#039;t forget ./setsdkenv_unix (only one time) on Linux and the corresponding command (setsdkenv_windows.bat) on Windows.&lt;br /&gt;
&lt;br /&gt;
==[[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Sequence|Sequences]]==&lt;br /&gt;
We can find also good materials in Developer&amp;#039;s guide on [[Documentation/DevGuide/FirstSteps/Sequence|Sequence]].&lt;br /&gt;
A sequence is an abstract view of a set of UNO types with a variable number of elements. As first example, we give a very simple program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 3  UNO Sequences&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
	//var1 = 34;&lt;br /&gt;
	SetOfInt[2]=44;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[2]);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The important things to notice are as follows:&lt;br /&gt;
* the type of each element of the set is put between angular brackets: &amp;quot;&amp;lt;&amp;quot; and &amp;quot;&amp;gt;&amp;quot;. In the example above sal_int32 is the type.&lt;br /&gt;
* declaration of sequence is done with parentheses &amp;quot;(&amp;quot; and &amp;quot;)&amp;quot; and the number of elements of the sequence between them.  In the example above a sequence of five sal_Int32 elements is declared.&lt;br /&gt;
* accessing elements of the sequence is done with &amp;quot;[&amp;quot; and &amp;quot;]&amp;quot; and an index between them (generaly called subscript operator). This allows us to say that sequences are referenced like arrays. But they are different in some way, for instance they don&amp;#039;t have a fixed size. &lt;br /&gt;
* We have to include Sequence.hxx file in a program when using Sequence. Note that this file is provided with the SDK and this not always the case for all hxx files (some of them have to be reconstructed).&lt;br /&gt;
We have to use the correct namespace with adding &amp;quot;using namespace ...&amp;quot; If you don&amp;#039;t use this statement you have to write com::sun::star::uno::Sequence instead of Sequence.&lt;br /&gt;
A Sequence can be created with arbitrary UNO type but not with other types. &lt;br /&gt;
The object SetOfInt has many methods. We give an example to show some of them:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 4 Examples of using Sequence Methods&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
	sal_Int32 *table;&lt;br /&gt;
	SetOfInt[2]=44;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[2]);&lt;br /&gt;
	// Tests whether the sequence has elements, i.e. elements count is greater than zero&lt;br /&gt;
	if (SetOfInt.hasElements()) printf(&amp;quot;Set not empty\n&amp;quot;);&lt;br /&gt;
	// Gets a pointer to elements array for reading and writing. If the sequence &lt;br /&gt;
	//  has a length of 0, then the returned pointer is undefined&lt;br /&gt;
	table = SetOfInt.getArray();&lt;br /&gt;
	table[4]=78;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[4]); // prints out 78&lt;br /&gt;
	SetOfInt.realloc(7);&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 7&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comments explain what is printed out when executing this example. The method realloc is particularly important: it allows the size of set to change.&lt;br /&gt;
&lt;br /&gt;
Let us focus on using sequences in function or as parameter. An example is again more descriptive than a long text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 5 Sequence and Parameters &lt;br /&gt;
// C++&lt;br /&gt;
// function&lt;br /&gt;
Sequence &amp;lt; sal_Int32 &amp;gt; initSequence(){&lt;br /&gt;
	sal_Int32 sourceArray[5]={1,2,3,4,5};&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SeqOfInt(sourceArray,5);&lt;br /&gt;
	return SeqOfInt;&lt;br /&gt;
}&lt;br /&gt;
// reference parameter&lt;br /&gt;
void initSequence2(Sequence &amp;lt; sal_Int32 &amp;gt; &amp;amp;SeqOfInt ) {&lt;br /&gt;
	sal_Int32 sourceArray[4]={1,2,3,4};&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SeqOfInt2(sourceArray,4);&lt;br /&gt;
	SeqOfInt=SeqOfInt2;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
An obvious call could be :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 6 Sequence and Parameters (following) &lt;br /&gt;
// C++&lt;br /&gt;
	SetOfInt = initSequence();&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 5&lt;br /&gt;
	initSequence2(SetOfInt);&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We cannot leave this section without adding that operators == and != are available with sequences. Note also that &amp;quot;toUnoSequence()&amp;quot;, &amp;quot;getCppuSequenceType()&amp;quot; and &amp;quot;getCharSequenceCppuType()&amp;quot; are also member functions.&lt;br /&gt;
&lt;br /&gt;
Passing a sequence into a function by value is, like a vector, somewhat inefficient because the function must make a copy of all elements. It&amp;#039;s better to use a constant reference as shown below:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 7 The Constant Reference method&lt;br /&gt;
//C++&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
// Passing a Sequence by value using the Constant Reference method&lt;br /&gt;
void avoidCopy(const Sequence&amp;lt; double &amp;gt; &amp;amp;ConstRef){&lt;br /&gt;
	// ConstRef[2]=6.7; would fail here&lt;br /&gt;
	for(int i=0;i&amp;lt;ConstRef.getLength();i++)&lt;br /&gt;
           cout&amp;lt;&amp;lt;ConstRef[i]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
	cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
main( ) {&lt;br /&gt;
    Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
    demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
    demo[2]=3.1;&lt;br /&gt;
    demo[3]=4.1;&lt;br /&gt;
    demo[4]=5.1;&lt;br /&gt;
    avoidCopy(demo);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See other material in Developer&amp;#039;s Guide (UNO C++ Binding).&lt;br /&gt;
&lt;br /&gt;
==Strings==&lt;br /&gt;
&lt;br /&gt;
In C, a string is simply an array of characters that always includes a binary zero (often called the null terminator) as its final array element. UNO/C++ API manages strings with two classes: OUString and OString. The former uses Unicode characters.&lt;br /&gt;
&lt;br /&gt;
; STRING UNO Type&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;550&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| |UNO||Type description||Java||C++||Basic&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
| string||String of 16-bit unicode characters ||Java.lang.string||::rtl::OUString || String&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
But, if you want to use ASCII characters the latter class is for you.&lt;br /&gt;
===OUString and OString===&lt;br /&gt;
OUString and OString classes are designed for UNO programmers. Only OString can be used with a standard C printf. To put it differently OString is nearer to the common C ASCII strings (array of characters) than OUString (which is an array of Unicode).&lt;br /&gt;
But all strings managed by UNO API are OUString. That means, if you want to see something in the console, you have to convert OUString to OString. If you ask something to the user and want to pass it to UNO API, you have to convert OString to OUString. Then if you want to use the console (in general for testing) you have to learn first both conversions.&lt;br /&gt;
&lt;br /&gt;
==== OUString to OString ====&lt;br /&gt;
&lt;br /&gt;
If OUStr is a OUString object, we give this example for conversion:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 8 Converting OUString into OString&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	OString o = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Conversion result : %s\n&amp;quot;, o.pData-&amp;gt;buffer );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== OString to OUString ====&lt;br /&gt;
The inverse conversion is easy too :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 9 Converting OString into OUString&lt;br /&gt;
// C++&lt;br /&gt;
	OUString foo;&lt;br /&gt;
	foo = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a complete conversion example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 10 A complete Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
using namespace rtl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString OUStr;&lt;br /&gt;
	OUStr = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	OString OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;OUStr was : %s\n&amp;quot;, OStr.pData-&amp;gt;buffer );&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We see that a rtl namespace has to be used. If not, please replace OUString by ::rtl::OUString.&lt;br /&gt;
OUString and OString objects are class type variables, and then the operations that can be performed on O(U)Strings take the form&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
        O(U)StringVariable.operation(argumentList)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, if string1 and string2 are variables of type OUString, then&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
        string1.compareTo(string2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
can be used to compare both strings. A function like compareTo(), which is part of the O(U)String-class is called a member function. The O(U)String class offers a large number of these member functions, as well as extensions of some well-known operators, like the assignment (=) and the comparison operator (==). These operators and functions are discussed in the following sections.&lt;br /&gt;
The OUString and OString methods are similar: we give a complete example which shows some of them:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 11 A more complete Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString OUStr1,OUStr2;&lt;br /&gt;
	OString OStr1, OStr2;&lt;br /&gt;
	OStr1=&amp;quot;Hi every body&amp;quot;;&lt;br /&gt;
	OStr2=&amp;quot;every body&amp;quot;;&lt;br /&gt;
	OUStr1 = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	OUStr2 = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	// Returns the length of this string&lt;br /&gt;
	printf(&amp;quot;Length : %d\n&amp;quot;,OUStr1.getLength()); // prints out 13&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
	printf(&amp;quot;CompareTo : %d\n&amp;quot;,OUStr1.compareTo(OUStr2)); // prints out 0&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
        // serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(&amp;quot;my_module.MyService2&amp;quot;) );&lt;br /&gt;
	printf(&amp;quot;equals : %d\n&amp;quot;,OUStr1.equals(OUStr2)); // prints out 1&lt;br /&gt;
	if (OUStr1.equals(OUStr2)) printf(&amp;quot;OK\n&amp;quot;);// prints out OK&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
	printf(&amp;quot;CompareToAscii : %d\n&amp;quot;,OUStr1.compareToAscii(OStr1)); // prints out 0&lt;br /&gt;
	// Compares two strings with a maximum count of characters&lt;br /&gt;
	printf(&amp;quot;CompareToAscii : %d\n&amp;quot;,OUStr1.compareToAscii(OStr1),10); // prints out 0&lt;br /&gt;
	// Perform a comparison of a substring in this string&lt;br /&gt;
	// is &amp;quot;every body&amp;quot; in position 3 of OUStr1 ?&lt;br /&gt;
	if (OUStr1.match(OUString::createFromAscii(&amp;quot;every body&amp;quot;),3))&lt;br /&gt;
		printf(&amp;quot;match : OK\n&amp;quot;); //prints out match : OK&lt;br /&gt;
	// Perform a comparison of a substring in this string&lt;br /&gt;
	if (OUStr1.matchAsciiL(OStr2,OStr2.getLength(),3))&lt;br /&gt;
		printf(&amp;quot;matchAsciiL: OK\n&amp;quot;);&lt;br /&gt;
	// Returns the float value from this string&lt;br /&gt;
	OUStr2 = OUString::createFromAscii(&amp;quot;1.675&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;toFloat : %f\n&amp;quot;,OUStr2.toFloat()); // prints out 1.675000&lt;br /&gt;
	// Value Of :&lt;br /&gt;
	OUStr1 = OUStr1.valueOf((float)1.56);&lt;br /&gt;
	OStr1 = OUStringToOString( OUStr1, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Value of : %s\n&amp;quot;, OStr1.pData-&amp;gt;buffer );&lt;br /&gt;
	// concat&lt;br /&gt;
	OUStr2=OUStr2.concat(OUString::createFromAscii(&amp;quot; ...&amp;quot;));&lt;br /&gt;
	OStr1 = OUStringToOString( OUStr2, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;concat is : %s\n&amp;quot;, OStr1.pData-&amp;gt;buffer );&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We can also see in this program how the concat method (three last lines) is used. The toFloat() conversion method is not alone: toBoolean(), toChar(), toInt32(), toInt64() , toDouble(), toAsciiLowerCase() and toAsciiUpperCase() exist also. Now we terminate with presenting some other methods (see C++ material):&lt;br /&gt;
&lt;br /&gt;
; String methods&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;850&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|Methods&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) ||Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 hashCode()||Returns a hashcode for this string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_int32 lastIndexOf(sal_Unicode ch )||Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex ) ||Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 lastIndexOf(const OUString &amp;amp; str ) || Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString copy(sal_Int32 beginIndex, sal_Int32 count ) OUString copy(sal_Int32 beginIndex ) ||Returns a new string that is a substring of this string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &amp;amp; newStr ) ||Returns a new string resulting from replacing n = count characters from position index in this string with newStr&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString replace(sal_Unicode oldChar, sal_Unicode newChar ) ||Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString trim() ||Returns a new string resulting from removing white space from both ends of the string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &amp;amp; index )  ||Returns a token in the string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
I cannot close this section without giving a code found in OOo source /OOB680_m5/registry/source/regimpl.cxx&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 11-b Printing out an OUString&lt;br /&gt;
// C++&lt;br /&gt;
void printString(rtl::OUString const &amp;amp; s) {&lt;br /&gt;
    printf(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    for (sal_Int32 i = 0; i &amp;lt; s.getLength(); ++i) {&lt;br /&gt;
        sal_Unicode c = s[i];&lt;br /&gt;
        if (c == &amp;#039;&amp;quot;&amp;#039; || c == &amp;#039;\\&amp;#039;) {&lt;br /&gt;
            printf(&amp;quot;\\%c&amp;quot;, static_cast&amp;lt; char &amp;gt;(c));&lt;br /&gt;
        } else if (s[i] &amp;gt;= &amp;#039; &amp;#039; &amp;amp;&amp;amp; s[i] &amp;lt;= &amp;#039;~&amp;#039;) {&lt;br /&gt;
            printf(&amp;quot;%c&amp;quot;, static_cast&amp;lt; char &amp;gt;(c));&lt;br /&gt;
        } else {&lt;br /&gt;
            printf(&amp;quot;\\u%04X&amp;quot;, static_cast&amp;lt; unsigned int &amp;gt;(c));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to see the content of an OUString with standard output, you have only to convert it in OString :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 11-c Printing out an OUString with standard C++ output&lt;br /&gt;
// C++&lt;br /&gt;
  OUString OUStr  = OUString::createFromAscii( &amp;quot;Hello&amp;quot; );&lt;br /&gt;
  OString   OStr  = OUStringToOString ( OUStr,RTL_TEXTENCODING_UTF8);&lt;br /&gt;
  cout &amp;lt;&amp;lt;  Ostr &amp;lt;&amp;lt; endl;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===File Path ===&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|Linux related content : the file paths are OS-dependent. To remove this dependency, UNO use URL and a way to transform a file path to an URL. We show an example now&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 12 UNO URL&lt;br /&gt;
// C++&lt;br /&gt;
// Don&amp;#039;t forget #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/edt.sxd&amp;quot;),sDocUrl);&lt;br /&gt;
// Windows C++ to check&lt;br /&gt;
//	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
//			  OUString::createFromAscii(&amp;quot;\&amp;quot;C:\\My Documents\\tata.sxc\&amp;quot;&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete example is given in the below listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 13 Using URL&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using namespace osl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString sDocUrl;&lt;br /&gt;
	OString toPrintOut;&lt;br /&gt;
   	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/edt.sxd&amp;quot;),sDocUrl);&lt;br /&gt;
	toPrintOut = OUStringToOString( sDocUrl, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;URL is : %s\n&amp;quot;, toPrintOut.pData-&amp;gt;buffer );&lt;br /&gt;
	// prints out URL is : file:///home/smoutou/edt.sxd&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which shows how to use the conversion. Remember that we work with UNO and therefore the URL is an OUString.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Windows|Only file paths have to be changed to transform these programs into Windows programs}}&lt;br /&gt;
&lt;br /&gt;
=== SDK Example ===&lt;br /&gt;
Here is some code provided by SDK :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 14 SDK Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/ustrbuf.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OUStringBuffer;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char * argv [] )&lt;br /&gt;
{&lt;br /&gt;
    // string concatination&lt;br /&gt;
&lt;br /&gt;
    sal_Int32 n = 42;&lt;br /&gt;
    double pi = 3.14159;&lt;br /&gt;
&lt;br /&gt;
    // give it an initial size, should be a good guess.&lt;br /&gt;
    // stringbuffer extends if necessary&lt;br /&gt;
    OUStringBuffer buf( 128 );&lt;br /&gt;
&lt;br /&gt;
    // append an ascii string&lt;br /&gt;
    buf.appendAscii( &amp;quot;pi ( here &amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    // numbers can be simply appended&lt;br /&gt;
    buf.append( pi );&lt;br /&gt;
&lt;br /&gt;
    // lets the compiler count the stringlength, so this is more efficient than&lt;br /&gt;
    // the above appendAscii call, where length of the string must be calculated at&lt;br /&gt;
    // runtime&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(&amp;quot; ) multiplied with &amp;quot; ) );&lt;br /&gt;
    buf.append( n );&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(&amp;quot; gives &amp;quot;) );&lt;br /&gt;
    buf.append( (double)( n * pi ) );&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( &amp;quot;.&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
    // now transfer the buffer into the string.&lt;br /&gt;
    // afterwards buffer is empty and may be reused again !&lt;br /&gt;
    OUString string = buf.makeStringAndClear();&lt;br /&gt;
&lt;br /&gt;
    // I could of course also used the OStringBuffer directly&lt;br /&gt;
    OString oString = rtl::OUStringToOString( string , RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
&lt;br /&gt;
    // just to print something&lt;br /&gt;
    printf( &amp;quot;%s\n&amp;quot; ,oString.getStr() );&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This example shows an other way to use OUString, OString and buffer.&lt;br /&gt;
 &lt;br /&gt;
For performance analysis see &lt;br /&gt;
[http://udk.openoffice.org/common/man/concept/string_invest.html Some String Performance Thoughts]&lt;br /&gt;
&lt;br /&gt;
===Sequence of Strings===&lt;br /&gt;
Sequence has been tackled in a previous [[SDKCppLanguage#Sequences|section]]. If you want to construct a Sequence of string (useful in list box ...) have a look on this piece of code :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 15 An Example of Sequence of Strings&lt;br /&gt;
// C++&lt;br /&gt;
// Sequence of string&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add using namespace com::sun::star::uno;&lt;br /&gt;
	Sequence&amp;lt;OUString&amp;gt;seqStrlistItems(2);&lt;br /&gt;
	seqStrlistItems[0]=OUString::createFromAscii(&amp;quot;Item1&amp;quot;);&lt;br /&gt;
	seqStrlistItems[1]=OUString::createFromAscii(&amp;quot;Item2&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// retrieve them and prints out&lt;br /&gt;
	for (int i=0;i&amp;lt;seqStrlistItems.getLength();i++){&lt;br /&gt;
		OString toPrintOut = OUStringToOString(seqStrlistItems[i],RTL_TEXTENCODING_ASCII_US);&lt;br /&gt;
		printf(&amp;quot;-- %s\n&amp;quot;,toPrintOut.pData-&amp;gt;buffer);&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This code prints out in the shell console :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- Item1&lt;br /&gt;
-- Item2&lt;br /&gt;
[smoutou@p3 Lifetime]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is easy to understand and therefore I have nothing more to say about it.&lt;br /&gt;
&lt;br /&gt;
===Exercise on  Sequence of Strings===&lt;br /&gt;
Write and test the following &amp;quot;convert2SeqOUStrInDEBUGMODE&amp;quot; function with a sequence of &amp;quot;sal_Int8&amp;quot; as parameter and which returns a sequence of Strings in a format like the dump method of the old &amp;quot;debug&amp;quot; of DOS. This format  [[UNO_registery_and_Bootstrapping#C.2B.2B_Code_to_recover_Information_in_a_Binary_Sequence|will be used here]], but without this function.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Solution&amp;#039;&amp;#039;&amp;#039; : here is the corresponng function code&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; convert2SeqOUStrInDEBUGMODE(Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes){&lt;br /&gt;
  sal_Int8 Hexa[16]={&amp;#039;0&amp;#039;,&amp;#039;1&amp;#039;,&amp;#039;2&amp;#039;,&amp;#039;3&amp;#039;,&amp;#039;4&amp;#039;,&amp;#039;5&amp;#039;,&amp;#039;6&amp;#039;,&amp;#039;7&amp;#039;,&amp;#039;8&amp;#039;,&amp;#039;9&amp;#039;,&amp;#039;A&amp;#039;,&amp;#039;B&amp;#039;,&amp;#039;C&amp;#039;,&amp;#039;D&amp;#039;,&amp;#039;E&amp;#039;,&amp;#039;F&amp;#039;};&lt;br /&gt;
  sal_Int32 lin,col;&lt;br /&gt;
  sal_Char line[80];&lt;br /&gt;
  sal_Int32 len,sequenceSize,index;&lt;br /&gt;
  len=seqBytes.getLength();&lt;br /&gt;
  sequenceSize=(len&amp;gt;&amp;gt;4)+2;&lt;br /&gt;
  if ((len&amp;amp;0XFFF0)==len) sequenceSize--; //if len%16==0&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; SeqOUStr(sequenceSize);&lt;br /&gt;
  // First line with length &lt;br /&gt;
  SeqOUStr[0] = OUString::createFromAscii(&amp;quot;Length:&amp;quot;)+&lt;br /&gt;
                OUString::valueOf((sal_Int32) seqBytes.getLength());&lt;br /&gt;
  len = len&amp;amp;0XFFF0; // remove the modulo 16&lt;br /&gt;
  for(lin=0;lin&amp;lt;len;lin=lin+16){&lt;br /&gt;
      for(col=0;col&amp;lt;16;col++){&lt;br /&gt;
        line[3*col]=Hexa[((unsigned char)seqBytes[lin+col])&amp;gt;&amp;gt;4];&lt;br /&gt;
	line[3*col+1]=Hexa[seqBytes[lin+col]&amp;amp;0x0F];&lt;br /&gt;
	line[3*col+2]=&amp;#039; &amp;#039;;&lt;br /&gt;
        if ((seqBytes[lin+col]&amp;lt;128)&amp;amp;&amp;amp;(seqBytes[lin+col]&amp;gt;20)) line[50+col]=seqBytes[lin+col];&lt;br /&gt;
        else line[50+col]=&amp;#039;.&amp;#039;;&lt;br /&gt;
      } /* end of for */&lt;br /&gt;
      line[66]=0; /* end of cstring...*/&lt;br /&gt;
      line[48]=&amp;#039; &amp;#039;;line[49]=&amp;#039; &amp;#039;;&lt;br /&gt;
  // ready to add the OUString in Sequence&lt;br /&gt;
      if ((lin%16)==0) index = lin/16+1; else index=lin/16+2;&lt;br /&gt;
      SeqOUStr[index]=OUString::createFromAscii(line);&lt;br /&gt;
  } /* end of for */ &lt;br /&gt;
  // the last line is more complicated because not complete&lt;br /&gt;
  // we only keep modulo&lt;br /&gt;
  len=seqBytes.getLength()&amp;amp;0x000F;&lt;br /&gt;
  if (len&amp;gt;0) { // only a line here if non-empty&lt;br /&gt;
  for (lin=0;lin&amp;lt;len;lin++){&lt;br /&gt;
    col=lin;&lt;br /&gt;
    line[3*col]=Hexa[((unsigned char)seqBytes[lin])&amp;gt;&amp;gt;4];&lt;br /&gt;
    line[3*col+1]=Hexa[seqBytes[lin]&amp;amp;0x0F];&lt;br /&gt;
    line[3*col+2]=&amp;#039; &amp;#039;;&lt;br /&gt;
    if ((seqBytes[lin]&amp;lt;128)&amp;amp;&amp;amp;(seqBytes[lin]&amp;gt;20)) line[50+col]=seqBytes[lin];&lt;br /&gt;
    else line[50+col]=&amp;#039;.&amp;#039;;&lt;br /&gt;
  }&lt;br /&gt;
  // we complete the line&lt;br /&gt;
  for (++col;col&amp;lt;16;col++){&lt;br /&gt;
	line[3*col]=&amp;#039; &amp;#039;;line[3*col+1]=&amp;#039; &amp;#039;;line[3*col+2]=&amp;#039; &amp;#039;;line[50+col]=&amp;#039; &amp;#039;;&lt;br /&gt;
  }&lt;br /&gt;
  line[66]=0; /* end of string...*/&lt;br /&gt;
  line[48]=&amp;#039; &amp;#039;;line[49]=&amp;#039; &amp;#039;;&lt;br /&gt;
  // ready to add the OUString in Sequence&lt;br /&gt;
  SeqOUStr[lin/16+2]=OUString::createFromAscii(line);&lt;br /&gt;
  } //end if&lt;br /&gt;
  return SeqOUStr;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
and now how this function can be used :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
sal_Int8 sourceArray[32]={1,22,23,24,55,56,57,8,9,10,11,12,13,14,15,16,17,18,19,61,62,-32,-33,-34,-35,26,127,-31,29,56,23,67};&lt;br /&gt;
        Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes(sourceArray,32);&lt;br /&gt;
	Sequence &amp;lt; OUString &amp;gt; seqOUStr=convert2SeqOUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[0], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[1], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[2], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
&amp;lt;/source&amp;gt; &lt;br /&gt;
In our [[Constructing_Helpers#Reflection_Helper|introspection tool]] we need also this format but in one string. It&amp;#039;s easy to write the corresponding code :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
OUString convert2OUStrInDEBUGMODE(Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes){&lt;br /&gt;
  Sequence &amp;lt;OUString&amp;gt; SeqOUStr = convert2SeqOUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
  OUString OUStr;&lt;br /&gt;
  for(sal_Int32 i=0;i&amp;lt;SeqOUStr.getLength();i++)&lt;br /&gt;
    OUStr = OUStr+SeqOUStr[i]+OUString::createFromAscii(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  return OUStr;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which can be used with :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
sal_Int8 sourceArray[32]={1,22,23,24,55,56,57,8,9,10,11,12,13,14,15,16,17,18,19,61,62,-32,-33,-34,-35,26,127,-31,29,56,23,67};&lt;br /&gt;
        Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes(sourceArray,32);&lt;br /&gt;
&lt;br /&gt;
        OUString OUStr=convert2OUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
        printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Any|Any]] ==&lt;br /&gt;
We can find also good materials in Developer&amp;#039;s guide on [[Documentation/DevGuide/FirstSteps/Any|Any type]]. [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Any|Any]] is easy to use only with &amp;lt;&amp;lt;= and &amp;gt;&amp;gt;= operators and we then often use intermediate variables. We can use also the build-in “makeAny” function :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 16 makeAny Example&lt;br /&gt;
// C++&lt;br /&gt;
Any any = makeAny((long) 1000);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We give first an example above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;]&lt;br /&gt;
//Listing 17 Any Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Any.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using com::sun::star::uno::Any;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace rtl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Any any,any2;&lt;br /&gt;
	sal_Int32 n=5,n2=18;&lt;br /&gt;
	any &amp;lt;&amp;lt;= n;&lt;br /&gt;
	// Gets the type name of the set value&lt;br /&gt;
	OUString OUStr = any.getValueTypeName();&lt;br /&gt;
	OString OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Any type : %s\n&amp;quot;, OStr.pData-&amp;gt;buffer );// prints out Any type : long&lt;br /&gt;
	// Tests if any contains a value&lt;br /&gt;
	if (any.hasValue()) printf(&amp;quot;Any has a value\n&amp;quot;);// prints out Any has a value&lt;br /&gt;
	// Clears this any. If the any already contains a value, that value will be destructed and&lt;br /&gt;
	// its memory freed. After this has been called, the any does not contain a value.&lt;br /&gt;
	any.clear();&lt;br /&gt;
	if (any.hasValue()) printf(&amp;quot;Any has a value\n&amp;quot;);// prints out nothing&lt;br /&gt;
	any &amp;lt;&amp;lt;= n2;&lt;br /&gt;
	any2 &amp;lt;&amp;lt;= OUStr;&lt;br /&gt;
	// Unequality operator: compares two anys. The values need not be of equal type,&lt;br /&gt;
	// e.g. a short integer is compared to a long integer&lt;br /&gt;
	if (any != any2) printf(&amp;quot;Two different any\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	Sequence&amp;lt; Any&amp;gt; aValues(2);&lt;br /&gt;
	aValues[0] &amp;lt;&amp;lt;= (float) 1.1; aValues[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Text&amp;quot;);&lt;br /&gt;
	aValues[1] &amp;gt;&amp;gt;= OUStr;&lt;br /&gt;
	OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	float real;&lt;br /&gt;
	aValues[0] &amp;gt;&amp;gt;= real;&lt;br /&gt;
	printf(&amp;quot;Seq - length : %d val : %f val %s\n&amp;quot;,aValues.getLength(),real,OStr.pData-&amp;gt;buffer);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This program prints out :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Any type : long&lt;br /&gt;
Any has a value&lt;br /&gt;
Two different any&lt;br /&gt;
Seq - length : 2 val : 1.100000 val Text&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Another important problem is a sequence of sequence of Any : we give now a piece of code without explanation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 18 Sequence of Sequence of Any&lt;br /&gt;
// C++&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; Any &amp;gt; &amp;gt; aValues(2); &lt;br /&gt;
Sequence&amp;lt; Any &amp;gt; aValues2(2);&lt;br /&gt;
aValues2[0] &amp;lt;&amp;lt;=  (double) 1.1; aValues2[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Hello&amp;quot;);&lt;br /&gt;
aValues[0] = aValues2;&lt;br /&gt;
aValues2[0] &amp;lt;&amp;lt;=  (double)2.2; aValues2[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Hi&amp;quot;);&lt;br /&gt;
aValues[1] = aValues2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This code uses two sequences. I have not found an other simpler way to do that. If anybody has a more straightforward solution, I would be happy learn about it. &lt;br /&gt;
If it is possible to access directely a value in a 2D array but I found only one means using an intermediate sequence (avalues2) in the case of sequence of sequence.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&lt;br /&gt;
We want now create a text file named &amp;quot;demo.txt&amp;quot;. Here is the code to do this :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 19 A little Example manipulating Files&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using namespace osl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString FileName;&lt;br /&gt;
	sal_Int8 tab[25]=&amp;quot;Hi every body\n&amp;quot;;&lt;br /&gt;
	sal_uInt64 nb;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/demo.txt&amp;quot;),FileName);&lt;br /&gt;
	File myfile(FileName);&lt;br /&gt;
	myfile.open(OpenFlag_Write);&lt;br /&gt;
	myfile.write(tab,(sal_uInt64)16,nb);&lt;br /&gt;
	printf(&amp;quot;%d bytes are written\n&amp;quot;,nb);&lt;br /&gt;
	myfile.close();&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/Note|The method open is not described in C++ documentation !!! I have found it while reading the “file.hxx” header file.}} &lt;br /&gt;
&lt;br /&gt;
The flag you can pass to the &amp;quot;open&amp;quot; method are :  OpenFlag_Write,  OpenFlag_Read,  OpenFlag_Create. The &amp;quot; using namespace osl;&amp;quot; is obligatory even if the compiler doesn&amp;#039;t complain without.&lt;br /&gt;
When a file is open, you can use the  methods above : &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
// Write a number of bytes to a file&lt;br /&gt;
write( const void * pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 &amp;amp; rBytesWritten );&lt;br /&gt;
&lt;br /&gt;
// Read a number of bytes from a file&lt;br /&gt;
read( void * pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 &amp;amp; rBytesRead );&lt;br /&gt;
&lt;br /&gt;
// Read a line from a file&lt;br /&gt;
ReadLine( ::rtl::ByteSequence &amp;amp; aSeq );&lt;br /&gt;
&lt;br /&gt;
// Test if the end of a file is reached&lt;br /&gt;
isEndOfFile( sal_Bool * pIsEOF );&lt;br /&gt;
&lt;br /&gt;
// Retrieve the current position of the internal pointer of an open file&lt;br /&gt;
getPos( sal_uInt64 &amp;amp; uPos );&lt;br /&gt;
&lt;br /&gt;
// Set the internal position pointer of an open file. &lt;br /&gt;
setPos( sal_uInt32 uHow, sal_Int64 uPos );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
There are other possibilities : move, remove, copy... See the documentation or read the file.hxx file.&lt;br /&gt;
&lt;br /&gt;
See [http://udk.openoffice.org/common/man/concept/streams.html « Streaming interfaces »]&lt;br /&gt;
for an other way to use files.&lt;br /&gt;
&lt;br /&gt;
== Threads ==&lt;br /&gt;
&lt;br /&gt;
It would be great to use the Thread Class but it&amp;#039;s  so badly documented that we begin with process instead thread.&lt;br /&gt;
Starting from an example posted in the forum Working with a Spreadsheet Document in C++ (by lirincy). This example gives a working code to start OOo if not started when launching a binary executable. We remove what was not usefull for us and give two examples.&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 20 A Process Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
	oslProcess hProcess = NULL;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString FileURL;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
	OUString::createFromAscii(&amp;quot;/home/smoutou/demo&amp;quot;),&lt;br /&gt;
		FileURL&lt;br /&gt;
	);&lt;br /&gt;
	oslProcessError osl_error = osl_executeProcess(&lt;br /&gt;
	 FileURL.pData,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 osl_Process_DETACHED,&lt;br /&gt;
	 0, /* osl_getCurrentSecurity() */&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 &amp;amp;hProcess );&lt;br /&gt;
	osl_error = osl_joinProcess(hProcess);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/Note|Note that the demo file is an existing binary in /home/smoutou.}}&lt;br /&gt;
If you want to pass something to the launched program see AppArgs variable in the second example :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 21 A second Process Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
	oslProcess hProcess = NULL;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString FileURL;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
	OUString::createFromAscii(&amp;quot;/home/smoutou/demo&amp;quot;),&lt;br /&gt;
		FileURL&lt;br /&gt;
	);&lt;br /&gt;
	OUString AppArgs = OUString::createFromAscii(&amp;quot;Arg1&amp;quot;);&lt;br /&gt;
	oslProcessError osl_error = osl_executeProcess(&lt;br /&gt;
	 FileURL.pData,&lt;br /&gt;
	 &amp;amp;AppArgs.pData,&lt;br /&gt;
	 1,&lt;br /&gt;
	 osl_Process_DETACHED,&lt;br /&gt;
	 0, /* osl_getCurrentSecurity() */&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 &amp;amp;hProcess );&lt;br /&gt;
	osl_error = osl_joinProcess(hProcess);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
I have tried working with thread but only with C style at the moment (not with using the thread class). Here is my first example code :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 22 A working Thread Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/thread.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt; // LINUX&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
/** wait _nSec seconds.&lt;br /&gt;
*/&lt;br /&gt;
void thread_sleep( sal_Int32 _nSec )&lt;br /&gt;
{&lt;br /&gt;
/// print statement in thread process must use fflush() to force display.&lt;br /&gt;
	printf(&amp;quot;# wait %d seconds. &amp;quot;, _nSec );&lt;br /&gt;
	fflush( stdout );&lt;br /&gt;
	sleep( _nSec );&lt;br /&gt;
	printf(&amp;quot;# done\n&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL thread1(void *) {&lt;br /&gt;
  while(1) &lt;br /&gt;
	printf(&amp;quot;\n thread running&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL thread2(int *nb){&lt;br /&gt;
  while(1) &lt;br /&gt;
	printf(&amp;quot;\n thread nb=%d running&amp;quot;,*nb);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/thread.h&amp;gt;&lt;br /&gt;
	oslThread hThread = NULL;&lt;br /&gt;
//oslWorkerFunction type : void (SAL_CALL *oslWorkerFunction)(void*); in osl/thread.h&lt;br /&gt;
	oslWorkerFunction pFunction = (void (SAL_CALL *)(void*)) thread2;&lt;br /&gt;
	int pthreaddata=2;&lt;br /&gt;
// create and start the thread2 with 2 as a parameter value&lt;br /&gt;
	oslThread hThread2 = osl_createThread(pFunction,(void *) &amp;amp;pthreaddata);&lt;br /&gt;
// create and start the thread1 &lt;br /&gt;
	hThread = osl_createThread(thread1,NULL);&lt;br /&gt;
					&lt;br /&gt;
	thread_sleep(2);&lt;br /&gt;
	osl_suspendThread(hThread);&lt;br /&gt;
	osl_suspendThread(hThread2);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
What is printed out is depending on how screen is managed by your OS. Under Linux I obtained something like :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running# done&lt;br /&gt;
 &lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here you can see the second thread launched writes at first and only when the main sleeping is terminated thread two is writing out. The other thread primitives can be found in osl/thread.h :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/** Create the thread, using the function-ptr pWorker as&lt;br /&gt;
	its main (worker) function. This functions receives in&lt;br /&gt;
	its void* parameter the value supplied by pThreadData.&lt;br /&gt;
	Once the OS-structures are initialized,the thread starts&lt;br /&gt;
	running.&lt;br /&gt;
	@return 0 if creation failed, otherwise a handle to the thread&lt;br /&gt;
*/&lt;br /&gt;
oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);&lt;br /&gt;
&lt;br /&gt;
/** Create the thread, using the function-ptr pWorker as&lt;br /&gt;
	its main (worker) function. This functions receives in&lt;br /&gt;
	its void* parameter the value supplied by pThreadData.&lt;br /&gt;
	The thread will be created, but it won&amp;#039;t start running.&lt;br /&gt;
	To wake-up the thread, use resume().&lt;br /&gt;
	@return 0 if creation failed, otherwise a handle to the thread&lt;br /&gt;
*/&lt;br /&gt;
oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);&lt;br /&gt;
&lt;br /&gt;
/** Release the thread handle.&lt;br /&gt;
	If Thread is NULL, the function won&amp;#039;t do anything.&lt;br /&gt;
	Note that we do not interfere with the actual running of&lt;br /&gt;
	the thread, we just free up the memory needed by the handle.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_destroyThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Wake-up a thread that was suspended with suspend() or&lt;br /&gt;
	createSuspended(). The oslThread must be valid!&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_resumeThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Suspend the execution of the thread. If you want the thread&lt;br /&gt;
	to continue, call resume(). The oslThread must be valid!&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_suspendThread(oslThread Thread);&lt;br /&gt;
/** Returns True if the thread was created and has not terminated yet.&lt;br /&gt;
	Note that according to this definition a &amp;quot;running&amp;quot; thread might be&lt;br /&gt;
	suspended! Also returns False is Thread is NULL.&lt;br /&gt;
*/&lt;br /&gt;
sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Blocks the calling thread until Thread has terminated.&lt;br /&gt;
	Returns immediately if Thread is NULL.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_joinWithThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Blocks the calling thread at least for the given number&lt;br /&gt;
    of time.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_waitThread(const TimeValue* pDelay);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information you can read [[Uno/Article/Multi-Thread_Programming|Multi-Thread Programming]].&lt;br /&gt;
&lt;br /&gt;
== To go further : the Enumeration Type Problem ==&lt;br /&gt;
Sometimes we will encounter enumeration values. We have to learn how to resolve the problem. An example will be discussed later but we give it without its context here. The Cell content in OOoCalc is described by an enumeration. How can I know that, is not easy with the previous material, but I want to tackle the problem even if too soon to understand for a first reading.&lt;br /&gt;
&lt;br /&gt;
All types used in programming are described in IDL files. Sometimes these IDL files are used to create hpp/hxx files.&lt;br /&gt;
&lt;br /&gt;
This example is around CellContentType.idl file. Here is the summary of this file where we remove comments :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;idl&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 23  CellContentType Enumeration type (IDL File)&lt;br /&gt;
// IDL&lt;br /&gt;
namespace com{&lt;br /&gt;
namespace sun{&lt;br /&gt;
namespace star{&lt;br /&gt;
namespace table{&lt;br /&gt;
enum CellContentType&lt;br /&gt;
{&lt;br /&gt;
    CellContentType_EMPTY = 0,&lt;br /&gt;
    CellContentType_VALUE = 1,&lt;br /&gt;
    CellContentType_TEXT = 2,&lt;br /&gt;
    CellContentType_FORMULA = 3,&lt;br /&gt;
    CellContentType_MAKE_FIXED_SIZE = SAL_MAX_ENUM&lt;br /&gt;
};&lt;br /&gt;
} // table&lt;br /&gt;
} // star&lt;br /&gt;
} // sun&lt;br /&gt;
} // com&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Three tips can be used when using this kind of enumeration :&lt;br /&gt;
* In C++ a corresponding using namespace is necessary&lt;br /&gt;
using namespace com::sun::star::table&lt;br /&gt;
This line can be drawn from the IDL file.&lt;br /&gt;
* In C++ an include directive is necessary&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/table/CellContentType.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The  name of the file to include and the path is easy to draw from IDL file.&lt;br /&gt;
* We have to construct the previous hpp file. This is done with adding the red line above in the makefile :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	com.sun.star.uno.XComponentContext \&lt;br /&gt;
	com.sun.star.uno.XWeak \&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.lang.XMain \&lt;br /&gt;
	com.sun.star.lang.XMultiServiceFactory \&lt;br /&gt;
	com.sun.star.lang.XSingleComponentFactory \&lt;br /&gt;
	com.sun.star.lang.XTypeProvider \&lt;br /&gt;
	com.sun.star.lang.XComponent \&lt;br /&gt;
	com.sun.star.registry.XSimpleRegistry \&lt;br /&gt;
	com.sun.star.registry.XImplementationRegistration \&lt;br /&gt;
	com.sun.star.bridge.XBridgeFactory \&lt;br /&gt;
	com.sun.star.bridge.XUnoUrlResolver \&lt;br /&gt;
	com.sun.star.table.CellContentType \&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After you can use this enumeration without problem like this :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 24 Enumeration type : an Example&lt;br /&gt;
//C++&lt;br /&gt;
// To check&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/table/CellContentType.hpp&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add &amp;quot;com.sun.star.table.CellContentType \&amp;quot; in the makefile&lt;br /&gt;
&lt;br /&gt;
	using namespace com::sun::star::table&lt;br /&gt;
	short enumval;&lt;br /&gt;
	enumval =  CellContentType_EMPTY;&lt;br /&gt;
	switch (enumval){&lt;br /&gt;
		case CellContentType_EMPTY : printf(&amp;quot;Empty\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_VALUE : printf(&amp;quot;Numerical Value\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_TEXT : printf(&amp;quot;Text\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_FORMULA : printf(&amp;quot;Formula\n&amp;quot;);break;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
What is shown here is a general SDK&amp;#039;s feature : we construct a hpp file starting from an IDL file. This is so important and unexpected for beginners that I will repeat many times these explanations [[UNO_automation_with_a_binary_%28executable%29#Introduction_to_Bootstrapping|later]] and more deeply [[IDL_Files_and_Cpp#Getting_an_interface_in_C.2B.2B|here]].&lt;br /&gt;
&lt;br /&gt;
== To go further : the Constant Type Problem ==&lt;br /&gt;
Values are not always defined with enumeration types as shown in previous section. Sometimes constants are used when programming with UNO. One example is again tackled [[OpenOffice_Calc#The_Compute_Function__Example|later]] but we want again writes on it now. We first present the corresponding IDL file (as an example)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;idl&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 25 CellFlags Constants type : IDL File &lt;br /&gt;
//IDL&lt;br /&gt;
module com {  module sun {  module star {  module sheet {&lt;br /&gt;
constants CellFlags&lt;br /&gt;
{&lt;br /&gt;
	const long VALUE = 1;&lt;br /&gt;
	const long DATETIME = 2;&lt;br /&gt;
	const long STRING = 4;&lt;br /&gt;
	const long ANNOTATION = 8;&lt;br /&gt;
	const long FORMULA = 16;&lt;br /&gt;
	const long HARDATTR = 32;&lt;br /&gt;
	const long STYLES = 64;&lt;br /&gt;
	const long OBJECTS = 128;&lt;br /&gt;
	const long EDITATTR = 256;&lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Compare this listing with Listing 23 to see the differences.&lt;br /&gt;
If you want to use the constants above you first generate the corresponding hpp file with modifying the makefile as in previous section, and then add the corresponding include directive :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;com/sun/star/sheet/CellFlags.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
in your C++ code. Note that with this include directive you can directly write something like &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
VALUE | DATETIME&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
instead of &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
CellFlags_VALUE | CellFlags_DATETIME&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
as seen previously.&lt;br /&gt;
&lt;br /&gt;
==Going further with Sequences==&lt;br /&gt;
We want to give any utilities used later in this document.&lt;br /&gt;
===Converting Sequences into Array===&lt;br /&gt;
Because it exists a correponding member function this conversion is very easy :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 27 Conversion Example&lt;br /&gt;
// C++&lt;br /&gt;
Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
sal_Int32 *table;&lt;br /&gt;
table = SetOfInt.getArray();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you read carefully to this point, this code is familiar for you : it&amp;#039;s drawn from Listing 4 and then already explained.&lt;br /&gt;
===Converting Sequence of Sequence into Array===&lt;br /&gt;
This problem has to be solved. We will use this kind of conversion later (see chapter 14). We first give two subprograms, to print out and to convert :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 28 Sequence of Sequence into 1D array&lt;br /&gt;
//C+&lt;br /&gt;
// Sequence of Sequence is printed out like that :&lt;br /&gt;
// toPrint[0][0] toPrint[0][1] toPrint[0][2]...&lt;br /&gt;
// toPrint[1][0] toPrint[1][1] toPrint[1][2]...&lt;br /&gt;
// ...&lt;br /&gt;
// Note that i denotes the first index&lt;br /&gt;
void printOutSeqSeq(const Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; &amp;amp;toPrint){&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;Prints out SeqSeq&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
        for(int i=0;i&amp;lt;toPrint.getLength();i++){&lt;br /&gt;
                Sequence &amp;lt; double &amp;gt; rLine = toPrint[i];&lt;br /&gt;
		double *line= rLine.getArray();&lt;br /&gt;
		for(int j=0;j&amp;lt;rLine.getLength();j++)&lt;br /&gt;
			cout &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; line[j] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
		cout &amp;lt;&amp;lt; endl;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
double *SeqSeqToArray1D(const Sequence &amp;lt; Sequence &amp;lt; double&amp;gt; &amp;gt; &amp;amp;seqseq){&lt;br /&gt;
	sal_Int32 iMax=seqseq.getLength(),jMax;&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; rLine = seqseq[0];&lt;br /&gt;
	jMax=rLine.getLength();	&lt;br /&gt;
	double *table1D = new double[iMax*jMax];&lt;br /&gt;
	for (sal_Int32 i = 0 ; i &amp;lt; iMax; i++ )&lt;br /&gt;
		for(sal_Int32 j = 0 ; j &amp;lt; jMax; j++ )&lt;br /&gt;
			table1D[i*jMax+j]= seqseq[i][j];&lt;br /&gt;
	return table1D;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Using these sub is easy : it can be done like that :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 29 Using the conversion&lt;br /&gt;
//C+&lt;br /&gt;
// We first construct a sequence&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
	demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
	demo[2]=3.1;&lt;br /&gt;
	demo[3]=4.1;&lt;br /&gt;
	demo[4]=5.1;&lt;br /&gt;
// We then construct the sequence of sequence&lt;br /&gt;
	Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; seqseq(3);&lt;br /&gt;
	for (int i=0; i&amp;lt;seqseq.getLength();i++)&lt;br /&gt;
            seqseq[i]=demo;&lt;br /&gt;
// We print out the result of the construction	&lt;br /&gt;
	printOutSeqSeq(seqseq);&lt;br /&gt;
// Here is the conversion&lt;br /&gt;
	double *table = SeqSeqToArray1D(seqseq);&lt;br /&gt;
// We finish wit printing out the result &lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;Array1D -&amp;gt; 2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;table[i*5+j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	....&lt;br /&gt;
	delete table;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which gives us :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Prints out SeqSeq&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
Array1D -&amp;gt; 2D :&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
[smoutou@p3 Lifetime]$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Converting a sequence of sequence directly in an 2D array is not an easy task because the compiler has to know the size of the second index before compiling. At first something like &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 30 Array2D conversion&lt;br /&gt;
// C++&lt;br /&gt;
double **SeqSeqToArray2D(const Sequence &amp;lt; Sequence &amp;lt; double&amp;gt; &amp;gt; &amp;amp;seqseq){&lt;br /&gt;
	double **table2D; &lt;br /&gt;
	double *table1D;&lt;br /&gt;
	table1D = SeqSeqToArray1D(seqseq);&lt;br /&gt;
	table2D = &amp;amp;table1D;&lt;br /&gt;
	return table2D;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
seems interesting but let&amp;#039;s see if that works out. A first idea is to write something like :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 31 Wrong code for  conversion&lt;br /&gt;
// C++&lt;br /&gt;
	double **table2= SeqSeqToArray2D(seqseq);&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt; table2[i][j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	delete table2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
but the compiler is unable to calculate table2[i][j] here. For that it has to evaluate the expression i*jMax+j but has no knowledge on jMax !!&lt;br /&gt;
&lt;br /&gt;
===More Abstractions with STL===&lt;br /&gt;
If you plan to use C++ you will certainly use the STL extensively. We begin first by conversions. Here is the easier one :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 32 Converting a Sequence of Sequence into a vector&lt;br /&gt;
// C++&lt;br /&gt;
// Inspired by Eric Ehlers&amp;#039;s code but using template&lt;br /&gt;
// See chapter 14&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; T &amp;gt;SeqSeqToVectorTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss) {&lt;br /&gt;
    vector &amp;lt; T &amp;gt;v;&lt;br /&gt;
    for (int i=0; i&amp;lt;ss.getLength(); i++)&lt;br /&gt;
        for (int j=0; j&amp;lt;ss[i].getLength(); j++)&lt;br /&gt;
            v.push_back(ss[i][j]);&lt;br /&gt;
    return v;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
My start point for achieving this code was Eric Ethler&amp;#039;s code presented [[CompleteAddIn#Transforming_an_Array_into_Sequence_of_Sequence|here]]. This code is again easy to use :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 33 Using the previous Convertion&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include&amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; T &amp;gt;SeqSeqToVectorTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss);&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
	demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
	demo[2]=3.1;&lt;br /&gt;
	demo[3]=4.1;&lt;br /&gt;
	demo[4]=5.1;&lt;br /&gt;
	Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; seqseq(3);&lt;br /&gt;
// simply use the same sequence&lt;br /&gt;
	for (int i=0; i&amp;lt;seqseq.getLength();i++)&lt;br /&gt;
            seqseq[i]=demo;&lt;br /&gt;
// template&lt;br /&gt;
	vector &amp;lt;double&amp;gt; v=SeqSeqToVectorTemplate(seqseq);&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;vector1D -&amp;gt; 2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;v[i*5+j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We give now three other conversions (see also [[CompleteAddIn#Transforming_an_Array_into_Sequence_of_Sequence|here]])&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 34 Converting Utilities with Template&lt;br /&gt;
// C++&lt;br /&gt;
// Inspired by Eric Ethler&amp;#039;s code but using template&lt;br /&gt;
// See chapter 14&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; VectorTemplateToSeqSeq(const vector &amp;lt; T &amp;gt; &amp;amp;v) {&lt;br /&gt;
    Sequence&amp;lt; Sequence&amp;lt; double &amp;gt; &amp;gt; ss(v.size());&lt;br /&gt;
    for (unsigned int i=0; i&amp;lt;v.size(); i++) {&lt;br /&gt;
        Sequence&amp;lt; T &amp;gt; s(1);&lt;br /&gt;
        s[0] = v[i];&lt;br /&gt;
        ss[i] = s;&lt;br /&gt;
    }&lt;br /&gt;
    return ss;&lt;br /&gt;
}&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; vector &amp;lt; T &amp;gt; &amp;gt;SeqSeqToMatrixTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss) {&lt;br /&gt;
    vector &amp;lt; vector &amp;lt; T &amp;gt; &amp;gt;vv;&lt;br /&gt;
    for (int i=0; i&amp;lt;ss.getLength(); i++) {&lt;br /&gt;
        vector &amp;lt; T &amp;gt;v;&lt;br /&gt;
        for (int j=0; j&amp;lt;ss[i].getLength(); j++)&lt;br /&gt;
            v.push_back(ss[i][j]);&lt;br /&gt;
        vv.push_back(v);&lt;br /&gt;
    }&lt;br /&gt;
    return vv;&lt;br /&gt;
}&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; MatrixTemplateToSeqSeq(&lt;br /&gt;
			const std::vector &amp;lt; std::vector &amp;lt; T &amp;gt; &amp;gt;&amp;amp;vv) {&lt;br /&gt;
    Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; ss(vv.size());&lt;br /&gt;
    for (unsigned int i=0; i&amp;lt;vv.size(); i++) {&lt;br /&gt;
        std::vector &amp;lt; T &amp;gt; v = vv[i];&lt;br /&gt;
        Sequence&amp;lt; T &amp;gt; s(v.size());&lt;br /&gt;
        for (unsigned int j=0; j&amp;lt;v.size(); j++)&lt;br /&gt;
            s[j] = v[j];&lt;br /&gt;
        ss[i] = s;&lt;br /&gt;
    }&lt;br /&gt;
    return ss;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
One way to use it is for instance :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 35 Converting Utilities with Template&lt;br /&gt;
//C++&lt;br /&gt;
	...&lt;br /&gt;
// seqseq must be initialized	&lt;br /&gt;
	vector &amp;lt;vector &amp;lt;double&amp;gt; &amp;gt; v2=SeqSeqToMatrixTemplate(seqseq);&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;vector2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;v2[i][j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Because there is a lot of algorithms based on STL I think these utilities will be very helpfull.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Cpp_Guide|French version of this chapter]].&lt;br /&gt;
* [[Uno/Article/Understanding_Uno|Understanding Uno]]&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [[Uno/Article/Multi-Thread Programming | Multi-Thread Programming]]&lt;br /&gt;
* To learn C++ : [http://www.smart2help.com/e-books/ C++ e-books]&lt;br /&gt;
* [http://en.wikibooks.org/wiki/Programming:Data_Structures Wiki on C++ Data Structures]&lt;br /&gt;
* [[Uno/Binary/Analysis/String_Performance|String Performance]]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKCppLanguage&amp;diff=235391</id>
		<title>SDKCppLanguage</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKCppLanguage&amp;diff=235391"/>
		<updated>2014-07-11T00:51:28Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Our starting Example : Simple Binaries (Executable) */ update text and source&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
=The UNO C++ Language=&lt;br /&gt;
The aim of this chapter is to explain peculiarities of the C++ language in the UNO environment and not to provide skills on traditional C++. To put it differently, I want to give here the UNO/C++ background, quite helpful in getting us started.&lt;br /&gt;
You can find e-Books on C++ [http://www.smart2help.com/e-books/ here].&lt;br /&gt;
&lt;br /&gt;
See also [[Uno/Article/Understanding_Uno|Understanding Uno]], [[Documentation/DevGuide/FirstSteps/Objects%2C_Interfaces%2C_and_Services|Objects, Interfaces, and Services]] and [[Documentation/BASIC_Guide/UNO|OOoBasic UNO Guide]] for a start with UNO.&lt;br /&gt;
&lt;br /&gt;
== Our starting Example : Simple Binaries (Executable) ==&lt;br /&gt;
&lt;br /&gt;
We want now to start with a SDK example. The purpose of the  example presented is to create an executable which interacts with OpenOffice.org. We can imagine two kind of interactions : direct interaction with OpenOffice.org or interaction with one of OOo&amp;#039;s shared library. We focus on this second case where the makefile is simpler. The shared library involved is then cppuhelper.uno.so (cppuhelper.uno.dll under Windows). Former case will be examined later.&lt;br /&gt;
I assume (I know nobody of the SDK team) this example is given to provide the simplest example we can do with the SDK. This is the Lifetime example: see at “&amp;lt;SDK_Folder&amp;gt;/examples/DevelopersGuide/ProfUNO/Lifetime”&lt;br /&gt;
&lt;br /&gt;
Before diving into the examples, you will need to set up your programming environment so you can create UNO programs. What&amp;#039;s required depends on what platform you&amp;#039;re working. This is shown in the first example with LINUX platform.&lt;br /&gt;
To check this example you only have to launch the makefile :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/DevelopersGuide/ProfUNO/Lifetime&lt;br /&gt;
make&lt;br /&gt;
make ProfUnoLifetime.runexe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The last command line only launch the binary executable “ProfUnoLifetime” which interact with cpphelper.uno.so (cppuhelper.uno.dll under Windows) even if  OpenOffice.org is not running.&lt;br /&gt;
This example creates and releases an object, nothing more. The constructor and destructor of the object only write out a message. Its little size allows us to give its code here:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 1 First Example (from SDK)&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;#include &amp;lt;cppuhelper/weak.hxx&amp;gt;class MyOWeakObject : public ::cppu::OWeakObject{public:    MyOWeakObject() { fprintf( stdout, &amp;quot;constructed\n&amp;quot; ); }    ~MyOWeakObject() { fprintf( stdout, &amp;quot;destructed\n&amp;quot; ); }};void simple_object_creation_and_destruction(){    // create the UNO object    com::sun::star::uno::XInterface * p = new MyOWeakObject();    // acquire it, refcount becomes one    p-&amp;gt;acquire();    fprintf( stdout, &amp;quot;before release\n&amp;quot; );    // release it, refcount drops to zero    p-&amp;gt;release();    fprintf( stdout, &amp;quot;after release\n&amp;quot; );}&lt;br /&gt;
int main( char * argv[] ){    simple_object_creation_and_destruction();    return 0;}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods acquire and release will be encountered later. What exactly they do is not important for the moment. This example shows us how to write a class which inherits from an other class, how to write and call methods and how to instantiate the class.&lt;br /&gt;
All the listings given below only need to modify this C++ code  compile it and run it. You can therefore use the same makefile by possibly changing the name of the source file  (tackled in next section).&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
The [[Documentation/DevGuide/FirstSteps/Common_Types|UNO types]] are given in the table below :&lt;br /&gt;
; UNO Types&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;550&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| |UNO||Type description||Java||C++||Basic&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
| char||16-bit unicode character type||char||sal_Unicode || -&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|boolean ||boolean type; true and false ||boolean ||sal_Bool||Boolean&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|byte ||8-bit ordinal type||byte ||sal_Int8 ||Integer&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|short ||signed 16-bit ordinal type||short ||sal_Int16 ||Integer &lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned short||unsigned 16-bit ordinal type||- ||sal_uInt16 ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|long ||signed 32-bit ordinal type||int ||sal_Int32 ||Long&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned long ||unsigned 32-bit type ||- ||sal_uInt32  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|hyper||signed 64-bit ordinal type||long  ||sal_Int64  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|unsigned hyper ||unsigned 64-bit ordinal type||- ||sal_uInt64  ||-&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|float  ||processor dependent float||float  ||float (IEEE float) ||Single&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|double  ||processor dependent double||double||double (IEEE double)||Double&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The UNO&amp;#039;s column represents all the types you can find in the specifications files : IDL files. We describe IDL files later (see chapter 10). The C++ column is what we are interested in when we program with this language. If you want to check the different programs given in this chapter, you can use the &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/DevelopersGuide/ProfUNO/Lifetime &lt;br /&gt;
example. Replace object_lifetime.cxx completely with the listing below (don&amp;#039;t forget to save the old file)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 2 A short UNO Program &lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	sal_Int32 var1;&lt;br /&gt;
	var1 = 34;&lt;br /&gt;
	printf(&amp;quot;The var1 value is : %d\n&amp;quot;,var1);&lt;br /&gt;
   	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then launch &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make ALL&lt;br /&gt;
make ProfUnoLifetime.runexe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and it works. Don&amp;#039;t forget ./setsdkenv_unix (only one time) on Linux and the corresponding command (setsdkenv_windows.bat) on Windows.&lt;br /&gt;
&lt;br /&gt;
==[[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Sequence|Sequences]]==&lt;br /&gt;
We can find also good materials in Developer&amp;#039;s guide on [[Documentation/DevGuide/FirstSteps/Sequence|Sequence]].&lt;br /&gt;
A sequence is an abstract view of a set of UNO types with a variable number of elements. As first example, we give a very simple program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 3  UNO Sequences&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
	//var1 = 34;&lt;br /&gt;
	SetOfInt[2]=44;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[2]);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The important things to notice are as follows:&lt;br /&gt;
* the type of each element of the set is put between angular brackets: &amp;quot;&amp;lt;&amp;quot; and &amp;quot;&amp;gt;&amp;quot;. In the example above sal_int32 is the type.&lt;br /&gt;
* declaration of sequence is done with parentheses &amp;quot;(&amp;quot; and &amp;quot;)&amp;quot; and the number of elements of the sequence between them.  In the example above a sequence of five sal_Int32 elements is declared.&lt;br /&gt;
* accessing elements of the sequence is done with &amp;quot;[&amp;quot; and &amp;quot;]&amp;quot; and an index between them (generaly called subscript operator). This allows us to say that sequences are referenced like arrays. But they are different in some way, for instance they don&amp;#039;t have a fixed size. &lt;br /&gt;
* We have to include Sequence.hxx file in a program when using Sequence. Note that this file is provided with the SDK and this not always the case for all hxx files (some of them have to be reconstructed).&lt;br /&gt;
We have to use the correct namespace with adding &amp;quot;using namespace ...&amp;quot; If you don&amp;#039;t use this statement you have to write com::sun::star::uno::Sequence instead of Sequence.&lt;br /&gt;
A Sequence can be created with arbitrary UNO type but not with other types. &lt;br /&gt;
The object SetOfInt has many methods. We give an example to show some of them:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 4 Examples of using Sequence Methods&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
	sal_Int32 *table;&lt;br /&gt;
	SetOfInt[2]=44;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[2]);&lt;br /&gt;
	// Tests whether the sequence has elements, i.e. elements count is greater than zero&lt;br /&gt;
	if (SetOfInt.hasElements()) printf(&amp;quot;Set not empty\n&amp;quot;);&lt;br /&gt;
	// Gets a pointer to elements array for reading and writing. If the sequence &lt;br /&gt;
	//  has a length of 0, then the returned pointer is undefined&lt;br /&gt;
	table = SetOfInt.getArray();&lt;br /&gt;
	table[4]=78;&lt;br /&gt;
	printf(&amp;quot;The value is : %d\n&amp;quot;,SetOfInt[4]); // prints out 78&lt;br /&gt;
	SetOfInt.realloc(7);&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 7&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The comments explain what is printed out when executing this example. The method realloc is particularly important: it allows the size of set to change.&lt;br /&gt;
&lt;br /&gt;
Let us focus on using sequences in function or as parameter. An example is again more descriptive than a long text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 5 Sequence and Parameters &lt;br /&gt;
// C++&lt;br /&gt;
// function&lt;br /&gt;
Sequence &amp;lt; sal_Int32 &amp;gt; initSequence(){&lt;br /&gt;
	sal_Int32 sourceArray[5]={1,2,3,4,5};&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SeqOfInt(sourceArray,5);&lt;br /&gt;
	return SeqOfInt;&lt;br /&gt;
}&lt;br /&gt;
// reference parameter&lt;br /&gt;
void initSequence2(Sequence &amp;lt; sal_Int32 &amp;gt; &amp;amp;SeqOfInt ) {&lt;br /&gt;
	sal_Int32 sourceArray[4]={1,2,3,4};&lt;br /&gt;
	Sequence &amp;lt; sal_Int32 &amp;gt; SeqOfInt2(sourceArray,4);&lt;br /&gt;
	SeqOfInt=SeqOfInt2;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
An obvious call could be :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 6 Sequence and Parameters (following) &lt;br /&gt;
// C++&lt;br /&gt;
	SetOfInt = initSequence();&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 5&lt;br /&gt;
	initSequence2(SetOfInt);&lt;br /&gt;
	printf(&amp;quot;New length : %d\n&amp;quot;,SetOfInt.getLength()); // prints out 4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We cannot leave this section without adding that operators == and != are available with sequences. Note also that &amp;quot;toUnoSequence()&amp;quot;, &amp;quot;getCppuSequenceType()&amp;quot; and &amp;quot;getCharSequenceCppuType()&amp;quot; are also member functions.&lt;br /&gt;
&lt;br /&gt;
Passing a sequence into a function by value is, like a vector, somewhat inefficient because the function must make a copy of all elements. It&amp;#039;s better to use a constant reference as shown below:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 7 The Constant Reference method&lt;br /&gt;
//C++&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
// Passing a Sequence by value using the Constant Reference method&lt;br /&gt;
void avoidCopy(const Sequence&amp;lt; double &amp;gt; &amp;amp;ConstRef){&lt;br /&gt;
	// ConstRef[2]=6.7; would fail here&lt;br /&gt;
	for(int i=0;i&amp;lt;ConstRef.getLength();i++)&lt;br /&gt;
           cout&amp;lt;&amp;lt;ConstRef[i]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
	cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
main( ) {&lt;br /&gt;
    Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
    demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
    demo[2]=3.1;&lt;br /&gt;
    demo[3]=4.1;&lt;br /&gt;
    demo[4]=5.1;&lt;br /&gt;
    avoidCopy(demo);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See other material in Developer&amp;#039;s Guide (UNO C++ Binding).&lt;br /&gt;
&lt;br /&gt;
==Strings==&lt;br /&gt;
&lt;br /&gt;
In C, a string is simply an array of characters that always includes a binary zero (often called the null terminator) as its final array element. UNO/C++ API manages strings with two classes: OUString and OString. The former uses Unicode characters.&lt;br /&gt;
&lt;br /&gt;
; STRING UNO Type&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;550&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| |UNO||Type description||Java||C++||Basic&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
| string||String of 16-bit unicode characters ||Java.lang.string||::rtl::OUString || String&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
But, if you want to use ASCII characters the latter class is for you.&lt;br /&gt;
===OUString and OString===&lt;br /&gt;
OUString and OString classes are designed for UNO programmers. Only OString can be used with a standard C printf. To put it differently OString is nearer to the common C ASCII strings (array of characters) than OUString (which is an array of Unicode).&lt;br /&gt;
But all strings managed by UNO API are OUString. That means, if you want to see something in the console, you have to convert OUString to OString. If you ask something to the user and want to pass it to UNO API, you have to convert OString to OUString. Then if you want to use the console (in general for testing) you have to learn first both conversions.&lt;br /&gt;
&lt;br /&gt;
==== OUString to OString ====&lt;br /&gt;
&lt;br /&gt;
If OUStr is a OUString object, we give this example for conversion:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 8 Converting OUString into OString&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	OString o = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Conversion result : %s\n&amp;quot;, o.pData-&amp;gt;buffer );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== OString to OUString ====&lt;br /&gt;
The inverse conversion is easy too :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 9 Converting OString into OUString&lt;br /&gt;
// C++&lt;br /&gt;
	OUString foo;&lt;br /&gt;
	foo = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a complete conversion example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 10 A complete Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
using namespace rtl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString OUStr;&lt;br /&gt;
	OUStr = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	OString OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;OUStr was : %s\n&amp;quot;, OStr.pData-&amp;gt;buffer );&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We see that a rtl namespace has to be used. If not, please replace OUString by ::rtl::OUString.&lt;br /&gt;
OUString and OString objects are class type variables, and then the operations that can be performed on O(U)Strings take the form&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
        O(U)StringVariable.operation(argumentList)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example, if string1 and string2 are variables of type OUString, then&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
        string1.compareTo(string2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
can be used to compare both strings. A function like compareTo(), which is part of the O(U)String-class is called a member function. The O(U)String class offers a large number of these member functions, as well as extensions of some well-known operators, like the assignment (=) and the comparison operator (==). These operators and functions are discussed in the following sections.&lt;br /&gt;
The OUString and OString methods are similar: we give a complete example which shows some of them:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 11 A more complete Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString OUStr1,OUStr2;&lt;br /&gt;
	OString OStr1, OStr2;&lt;br /&gt;
	OStr1=&amp;quot;Hi every body&amp;quot;;&lt;br /&gt;
	OStr2=&amp;quot;every body&amp;quot;;&lt;br /&gt;
	OUStr1 = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	OUStr2 = OUString::createFromAscii(&amp;quot;Hi every body&amp;quot;);&lt;br /&gt;
	// Returns the length of this string&lt;br /&gt;
	printf(&amp;quot;Length : %d\n&amp;quot;,OUStr1.getLength()); // prints out 13&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
	printf(&amp;quot;CompareTo : %d\n&amp;quot;,OUStr1.compareTo(OUStr2)); // prints out 0&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
        // serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(&amp;quot;my_module.MyService2&amp;quot;) );&lt;br /&gt;
	printf(&amp;quot;equals : %d\n&amp;quot;,OUStr1.equals(OUStr2)); // prints out 1&lt;br /&gt;
	if (OUStr1.equals(OUStr2)) printf(&amp;quot;OK\n&amp;quot;);// prints out OK&lt;br /&gt;
	// Compares two strings&lt;br /&gt;
	printf(&amp;quot;CompareToAscii : %d\n&amp;quot;,OUStr1.compareToAscii(OStr1)); // prints out 0&lt;br /&gt;
	// Compares two strings with a maximum count of characters&lt;br /&gt;
	printf(&amp;quot;CompareToAscii : %d\n&amp;quot;,OUStr1.compareToAscii(OStr1),10); // prints out 0&lt;br /&gt;
	// Perform a comparison of a substring in this string&lt;br /&gt;
	// is &amp;quot;every body&amp;quot; in position 3 of OUStr1 ?&lt;br /&gt;
	if (OUStr1.match(OUString::createFromAscii(&amp;quot;every body&amp;quot;),3))&lt;br /&gt;
		printf(&amp;quot;match : OK\n&amp;quot;); //prints out match : OK&lt;br /&gt;
	// Perform a comparison of a substring in this string&lt;br /&gt;
	if (OUStr1.matchAsciiL(OStr2,OStr2.getLength(),3))&lt;br /&gt;
		printf(&amp;quot;matchAsciiL: OK\n&amp;quot;);&lt;br /&gt;
	// Returns the float value from this string&lt;br /&gt;
	OUStr2 = OUString::createFromAscii(&amp;quot;1.675&amp;quot;);&lt;br /&gt;
	printf(&amp;quot;toFloat : %f\n&amp;quot;,OUStr2.toFloat()); // prints out 1.675000&lt;br /&gt;
	// Value Of :&lt;br /&gt;
	OUStr1 = OUStr1.valueOf((float)1.56);&lt;br /&gt;
	OStr1 = OUStringToOString( OUStr1, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Value of : %s\n&amp;quot;, OStr1.pData-&amp;gt;buffer );&lt;br /&gt;
	// concat&lt;br /&gt;
	OUStr2=OUStr2.concat(OUString::createFromAscii(&amp;quot; ...&amp;quot;));&lt;br /&gt;
	OStr1 = OUStringToOString( OUStr2, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;concat is : %s\n&amp;quot;, OStr1.pData-&amp;gt;buffer );&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We can also see in this program how the concat method (three last lines) is used. The toFloat() conversion method is not alone: toBoolean(), toChar(), toInt32(), toInt64() , toDouble(), toAsciiLowerCase() and toAsciiUpperCase() exist also. Now we terminate with presenting some other methods (see C++ material):&lt;br /&gt;
&lt;br /&gt;
; String methods&lt;br /&gt;
{| border cellspacing=&amp;quot;0&amp;quot; width=&amp;quot;850&amp;quot;&lt;br /&gt;
|- style = &amp;quot;background:#b3e2d1;text-align:center&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|Methods&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) ||Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 hashCode()||Returns a hashcode for this string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_int32 lastIndexOf(sal_Unicode ch )||Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex ) ||Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|sal_Int32 lastIndexOf(const OUString &amp;amp; str ) || Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString copy(sal_Int32 beginIndex, sal_Int32 count ) OUString copy(sal_Int32 beginIndex ) ||Returns a new string that is a substring of this string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &amp;amp; newStr ) ||Returns a new string resulting from replacing n = count characters from position index in this string with newStr&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString replace(sal_Unicode oldChar, sal_Unicode newChar ) ||Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString trim() ||Returns a new string resulting from removing white space from both ends of the string&lt;br /&gt;
|- style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &amp;amp; index )  ||Returns a token in the string&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
I cannot close this section without giving a code found in OOo source /OOB680_m5/registry/source/regimpl.cxx&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 11-b Printing out an OUString&lt;br /&gt;
// C++&lt;br /&gt;
void printString(rtl::OUString const &amp;amp; s) {&lt;br /&gt;
    printf(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
    for (sal_Int32 i = 0; i &amp;lt; s.getLength(); ++i) {&lt;br /&gt;
        sal_Unicode c = s[i];&lt;br /&gt;
        if (c == &amp;#039;&amp;quot;&amp;#039; || c == &amp;#039;\\&amp;#039;) {&lt;br /&gt;
            printf(&amp;quot;\\%c&amp;quot;, static_cast&amp;lt; char &amp;gt;(c));&lt;br /&gt;
        } else if (s[i] &amp;gt;= &amp;#039; &amp;#039; &amp;amp;&amp;amp; s[i] &amp;lt;= &amp;#039;~&amp;#039;) {&lt;br /&gt;
            printf(&amp;quot;%c&amp;quot;, static_cast&amp;lt; char &amp;gt;(c));&lt;br /&gt;
        } else {&lt;br /&gt;
            printf(&amp;quot;\\u%04X&amp;quot;, static_cast&amp;lt; unsigned int &amp;gt;(c));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    printf(&amp;quot;\&amp;quot;&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you want to see the content of an OUString with standard output, you have only to convert it in OString :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 11-c Printing out an OUString with standard C++ output&lt;br /&gt;
// C++&lt;br /&gt;
  OUString OUStr  = OUString::createFromAscii( &amp;quot;Hello&amp;quot; );&lt;br /&gt;
  OString   OStr  = OUStringToOString ( OUStr,RTL_TEXTENCODING_UTF8);&lt;br /&gt;
  cout &amp;lt;&amp;lt;  Ostr &amp;lt;&amp;lt; endl;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===File Path ===&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|Linux related content : the file paths are OS-dependent. To remove this dependency, UNO use URL and a way to transform a file path to an URL. We show an example now&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 12 UNO URL&lt;br /&gt;
// C++&lt;br /&gt;
// Don&amp;#039;t forget #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString sDocUrl;&lt;br /&gt;
    osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/edt.sxd&amp;quot;),sDocUrl);&lt;br /&gt;
// Windows C++ to check&lt;br /&gt;
//	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
//			  OUString::createFromAscii(&amp;quot;\&amp;quot;C:\\My Documents\\tata.sxc\&amp;quot;&amp;quot;),sDocUrl);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete example is given in the below listing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 13 Using URL&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using namespace osl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString sDocUrl;&lt;br /&gt;
	OString toPrintOut;&lt;br /&gt;
   	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/edt.sxd&amp;quot;),sDocUrl);&lt;br /&gt;
	toPrintOut = OUStringToOString( sDocUrl, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;URL is : %s\n&amp;quot;, toPrintOut.pData-&amp;gt;buffer );&lt;br /&gt;
	// prints out URL is : file:///home/smoutou/edt.sxd&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which shows how to use the conversion. Remember that we work with UNO and therefore the URL is an OUString.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Windows|Only file paths have to be changed to transform these programs into Windows programs}}&lt;br /&gt;
&lt;br /&gt;
=== SDK Example ===&lt;br /&gt;
Here is some code provided by SDK :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 14 SDK Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/ustrbuf.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OUStringBuffer;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char * argv [] )&lt;br /&gt;
{&lt;br /&gt;
    // string concatination&lt;br /&gt;
&lt;br /&gt;
    sal_Int32 n = 42;&lt;br /&gt;
    double pi = 3.14159;&lt;br /&gt;
&lt;br /&gt;
    // give it an initial size, should be a good guess.&lt;br /&gt;
    // stringbuffer extends if necessary&lt;br /&gt;
    OUStringBuffer buf( 128 );&lt;br /&gt;
&lt;br /&gt;
    // append an ascii string&lt;br /&gt;
    buf.appendAscii( &amp;quot;pi ( here &amp;quot; );&lt;br /&gt;
&lt;br /&gt;
    // numbers can be simply appended&lt;br /&gt;
    buf.append( pi );&lt;br /&gt;
&lt;br /&gt;
    // lets the compiler count the stringlength, so this is more efficient than&lt;br /&gt;
    // the above appendAscii call, where length of the string must be calculated at&lt;br /&gt;
    // runtime&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(&amp;quot; ) multiplied with &amp;quot; ) );&lt;br /&gt;
    buf.append( n );&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(&amp;quot; gives &amp;quot;) );&lt;br /&gt;
    buf.append( (double)( n * pi ) );&lt;br /&gt;
    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( &amp;quot;.&amp;quot; ) );&lt;br /&gt;
&lt;br /&gt;
    // now transfer the buffer into the string.&lt;br /&gt;
    // afterwards buffer is empty and may be reused again !&lt;br /&gt;
    OUString string = buf.makeStringAndClear();&lt;br /&gt;
&lt;br /&gt;
    // I could of course also used the OStringBuffer directly&lt;br /&gt;
    OString oString = rtl::OUStringToOString( string , RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
&lt;br /&gt;
    // just to print something&lt;br /&gt;
    printf( &amp;quot;%s\n&amp;quot; ,oString.getStr() );&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This example shows an other way to use OUString, OString and buffer.&lt;br /&gt;
 &lt;br /&gt;
For performance analysis see &lt;br /&gt;
[http://udk.openoffice.org/common/man/concept/string_invest.html Some String Performance Thoughts]&lt;br /&gt;
&lt;br /&gt;
===Sequence of Strings===&lt;br /&gt;
Sequence has been tackled in a previous [[SDKCppLanguage#Sequences|section]]. If you want to construct a Sequence of string (useful in list box ...) have a look on this piece of code :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 15 An Example of Sequence of Strings&lt;br /&gt;
// C++&lt;br /&gt;
// Sequence of string&lt;br /&gt;
#include &amp;lt;rtl/string.hxx&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add using namespace com::sun::star::uno;&lt;br /&gt;
	Sequence&amp;lt;OUString&amp;gt;seqStrlistItems(2);&lt;br /&gt;
	seqStrlistItems[0]=OUString::createFromAscii(&amp;quot;Item1&amp;quot;);&lt;br /&gt;
	seqStrlistItems[1]=OUString::createFromAscii(&amp;quot;Item2&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// retrieve them and prints out&lt;br /&gt;
	for (int i=0;i&amp;lt;seqStrlistItems.getLength();i++){&lt;br /&gt;
		OString toPrintOut = OUStringToOString(seqStrlistItems[i],RTL_TEXTENCODING_ASCII_US);&lt;br /&gt;
		printf(&amp;quot;-- %s\n&amp;quot;,toPrintOut.pData-&amp;gt;buffer);&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This code prints out in the shell console :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- Item1&lt;br /&gt;
-- Item2&lt;br /&gt;
[smoutou@p3 Lifetime]$ &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is easy to understand and therefore I have nothing more to say about it.&lt;br /&gt;
&lt;br /&gt;
===Exercise on  Sequence of Strings===&lt;br /&gt;
Write and test the following &amp;quot;convert2SeqOUStrInDEBUGMODE&amp;quot; function with a sequence of &amp;quot;sal_Int8&amp;quot; as parameter and which returns a sequence of Strings in a format like the dump method of the old &amp;quot;debug&amp;quot; of DOS. This format  [[UNO_registery_and_Bootstrapping#C.2B.2B_Code_to_recover_Information_in_a_Binary_Sequence|will be used here]], but without this function.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Solution&amp;#039;&amp;#039;&amp;#039; : here is the corresponng function code&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Sequence&amp;lt; OUString &amp;gt; convert2SeqOUStrInDEBUGMODE(Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes){&lt;br /&gt;
  sal_Int8 Hexa[16]={&amp;#039;0&amp;#039;,&amp;#039;1&amp;#039;,&amp;#039;2&amp;#039;,&amp;#039;3&amp;#039;,&amp;#039;4&amp;#039;,&amp;#039;5&amp;#039;,&amp;#039;6&amp;#039;,&amp;#039;7&amp;#039;,&amp;#039;8&amp;#039;,&amp;#039;9&amp;#039;,&amp;#039;A&amp;#039;,&amp;#039;B&amp;#039;,&amp;#039;C&amp;#039;,&amp;#039;D&amp;#039;,&amp;#039;E&amp;#039;,&amp;#039;F&amp;#039;};&lt;br /&gt;
  sal_Int32 lin,col;&lt;br /&gt;
  sal_Char line[80];&lt;br /&gt;
  sal_Int32 len,sequenceSize,index;&lt;br /&gt;
  len=seqBytes.getLength();&lt;br /&gt;
  sequenceSize=(len&amp;gt;&amp;gt;4)+2;&lt;br /&gt;
  if ((len&amp;amp;0XFFF0)==len) sequenceSize--; //if len%16==0&lt;br /&gt;
  Sequence&amp;lt; OUString &amp;gt; SeqOUStr(sequenceSize);&lt;br /&gt;
  // First line with length &lt;br /&gt;
  SeqOUStr[0] = OUString::createFromAscii(&amp;quot;Length:&amp;quot;)+&lt;br /&gt;
                OUString::valueOf((sal_Int32) seqBytes.getLength());&lt;br /&gt;
  len = len&amp;amp;0XFFF0; // remove the modulo 16&lt;br /&gt;
  for(lin=0;lin&amp;lt;len;lin=lin+16){&lt;br /&gt;
      for(col=0;col&amp;lt;16;col++){&lt;br /&gt;
        line[3*col]=Hexa[((unsigned char)seqBytes[lin+col])&amp;gt;&amp;gt;4];&lt;br /&gt;
	line[3*col+1]=Hexa[seqBytes[lin+col]&amp;amp;0x0F];&lt;br /&gt;
	line[3*col+2]=&amp;#039; &amp;#039;;&lt;br /&gt;
        if ((seqBytes[lin+col]&amp;lt;128)&amp;amp;&amp;amp;(seqBytes[lin+col]&amp;gt;20)) line[50+col]=seqBytes[lin+col];&lt;br /&gt;
        else line[50+col]=&amp;#039;.&amp;#039;;&lt;br /&gt;
      } /* end of for */&lt;br /&gt;
      line[66]=0; /* end of cstring...*/&lt;br /&gt;
      line[48]=&amp;#039; &amp;#039;;line[49]=&amp;#039; &amp;#039;;&lt;br /&gt;
  // ready to add the OUString in Sequence&lt;br /&gt;
      if ((lin%16)==0) index = lin/16+1; else index=lin/16+2;&lt;br /&gt;
      SeqOUStr[index]=OUString::createFromAscii(line);&lt;br /&gt;
  } /* end of for */ &lt;br /&gt;
  // the last line is more complicated because not complete&lt;br /&gt;
  // we only keep modulo&lt;br /&gt;
  len=seqBytes.getLength()&amp;amp;0x000F;&lt;br /&gt;
  if (len&amp;gt;0) { // only a line here if non-empty&lt;br /&gt;
  for (lin=0;lin&amp;lt;len;lin++){&lt;br /&gt;
    col=lin;&lt;br /&gt;
    line[3*col]=Hexa[((unsigned char)seqBytes[lin])&amp;gt;&amp;gt;4];&lt;br /&gt;
    line[3*col+1]=Hexa[seqBytes[lin]&amp;amp;0x0F];&lt;br /&gt;
    line[3*col+2]=&amp;#039; &amp;#039;;&lt;br /&gt;
    if ((seqBytes[lin]&amp;lt;128)&amp;amp;&amp;amp;(seqBytes[lin]&amp;gt;20)) line[50+col]=seqBytes[lin];&lt;br /&gt;
    else line[50+col]=&amp;#039;.&amp;#039;;&lt;br /&gt;
  }&lt;br /&gt;
  // we complete the line&lt;br /&gt;
  for (++col;col&amp;lt;16;col++){&lt;br /&gt;
	line[3*col]=&amp;#039; &amp;#039;;line[3*col+1]=&amp;#039; &amp;#039;;line[3*col+2]=&amp;#039; &amp;#039;;line[50+col]=&amp;#039; &amp;#039;;&lt;br /&gt;
  }&lt;br /&gt;
  line[66]=0; /* end of string...*/&lt;br /&gt;
  line[48]=&amp;#039; &amp;#039;;line[49]=&amp;#039; &amp;#039;;&lt;br /&gt;
  // ready to add the OUString in Sequence&lt;br /&gt;
  SeqOUStr[lin/16+2]=OUString::createFromAscii(line);&lt;br /&gt;
  } //end if&lt;br /&gt;
  return SeqOUStr;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
and now how this function can be used :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
sal_Int8 sourceArray[32]={1,22,23,24,55,56,57,8,9,10,11,12,13,14,15,16,17,18,19,61,62,-32,-33,-34,-35,26,127,-31,29,56,23,67};&lt;br /&gt;
        Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes(sourceArray,32);&lt;br /&gt;
	Sequence &amp;lt; OUString &amp;gt; seqOUStr=convert2SeqOUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[0], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[1], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
	printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( seqOUStr[2], RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
&amp;lt;/source&amp;gt; &lt;br /&gt;
In our [[Constructing_Helpers#Reflection_Helper|introspection tool]] we need also this format but in one string. It&amp;#039;s easy to write the corresponding code :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
OUString convert2OUStrInDEBUGMODE(Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes){&lt;br /&gt;
  Sequence &amp;lt;OUString&amp;gt; SeqOUStr = convert2SeqOUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
  OUString OUStr;&lt;br /&gt;
  for(sal_Int32 i=0;i&amp;lt;SeqOUStr.getLength();i++)&lt;br /&gt;
    OUStr = OUStr+SeqOUStr[i]+OUString::createFromAscii(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  return OUStr;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which can be used with :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
sal_Int8 sourceArray[32]={1,22,23,24,55,56,57,8,9,10,11,12,13,14,15,16,17,18,19,61,62,-32,-33,-34,-35,26,127,-31,29,56,23,67};&lt;br /&gt;
        Sequence &amp;lt; sal_Int8 &amp;gt; seqBytes(sourceArray,32);&lt;br /&gt;
&lt;br /&gt;
        OUString OUStr=convert2OUStrInDEBUGMODE(seqBytes);&lt;br /&gt;
        printf(&amp;quot;%s\n&amp;quot;,OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US ).pData-&amp;gt;buffer);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Any|Any]] ==&lt;br /&gt;
We can find also good materials in Developer&amp;#039;s guide on [[Documentation/DevGuide/FirstSteps/Any|Any type]]. [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno#Any|Any]] is easy to use only with &amp;lt;&amp;lt;= and &amp;gt;&amp;gt;= operators and we then often use intermediate variables. We can use also the build-in “makeAny” function :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 16 makeAny Example&lt;br /&gt;
// C++&lt;br /&gt;
Any any = makeAny((long) 1000);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We give first an example above :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;]&lt;br /&gt;
//Listing 17 Any Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Any.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using com::sun::star::uno::Any;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace rtl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	Any any,any2;&lt;br /&gt;
	sal_Int32 n=5,n2=18;&lt;br /&gt;
	any &amp;lt;&amp;lt;= n;&lt;br /&gt;
	// Gets the type name of the set value&lt;br /&gt;
	OUString OUStr = any.getValueTypeName();&lt;br /&gt;
	OString OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	printf( &amp;quot;Any type : %s\n&amp;quot;, OStr.pData-&amp;gt;buffer );// prints out Any type : long&lt;br /&gt;
	// Tests if any contains a value&lt;br /&gt;
	if (any.hasValue()) printf(&amp;quot;Any has a value\n&amp;quot;);// prints out Any has a value&lt;br /&gt;
	// Clears this any. If the any already contains a value, that value will be destructed and&lt;br /&gt;
	// its memory freed. After this has been called, the any does not contain a value.&lt;br /&gt;
	any.clear();&lt;br /&gt;
	if (any.hasValue()) printf(&amp;quot;Any has a value\n&amp;quot;);// prints out nothing&lt;br /&gt;
	any &amp;lt;&amp;lt;= n2;&lt;br /&gt;
	any2 &amp;lt;&amp;lt;= OUStr;&lt;br /&gt;
	// Unequality operator: compares two anys. The values need not be of equal type,&lt;br /&gt;
	// e.g. a short integer is compared to a long integer&lt;br /&gt;
	if (any != any2) printf(&amp;quot;Two different any\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	Sequence&amp;lt; Any&amp;gt; aValues(2);&lt;br /&gt;
	aValues[0] &amp;lt;&amp;lt;= (float) 1.1; aValues[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Text&amp;quot;);&lt;br /&gt;
	aValues[1] &amp;gt;&amp;gt;= OUStr;&lt;br /&gt;
	OStr = OUStringToOString( OUStr, RTL_TEXTENCODING_ASCII_US );&lt;br /&gt;
	float real;&lt;br /&gt;
	aValues[0] &amp;gt;&amp;gt;= real;&lt;br /&gt;
	printf(&amp;quot;Seq - length : %d val : %f val %s\n&amp;quot;,aValues.getLength(),real,OStr.pData-&amp;gt;buffer);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This program prints out :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Any type : long&lt;br /&gt;
Any has a value&lt;br /&gt;
Two different any&lt;br /&gt;
Seq - length : 2 val : 1.100000 val Text&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Another important problem is a sequence of sequence of Any : we give now a piece of code without explanation :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 18 Sequence of Sequence of Any&lt;br /&gt;
// C++&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; Any &amp;gt; &amp;gt; aValues(2); &lt;br /&gt;
Sequence&amp;lt; Any &amp;gt; aValues2(2);&lt;br /&gt;
aValues2[0] &amp;lt;&amp;lt;=  (double) 1.1; aValues2[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Hello&amp;quot;);&lt;br /&gt;
aValues[0] = aValues2;&lt;br /&gt;
aValues2[0] &amp;lt;&amp;lt;=  (double)2.2; aValues2[1] &amp;lt;&amp;lt;= OUString::createFromAscii(&amp;quot;Hi&amp;quot;);&lt;br /&gt;
aValues[1] = aValues2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This code uses two sequences. I have not found an other simpler way to do that. If anybody has a more straightforward solution, I would be happy learn about it. &lt;br /&gt;
If it is possible to access directely a value in a 2D array but I found only one means using an intermediate sequence (avalues2) in the case of sequence of sequence.&lt;br /&gt;
&lt;br /&gt;
== Files ==&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&lt;br /&gt;
We want now create a text file named &amp;quot;demo.txt&amp;quot;. Here is the code to do this :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 19 A little Example manipulating Files&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
using namespace osl;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
	OUString FileName;&lt;br /&gt;
	sal_Int8 tab[25]=&amp;quot;Hi every body\n&amp;quot;;&lt;br /&gt;
	sal_uInt64 nb;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
                 OUString::createFromAscii(&amp;quot;/home/smoutou/demo.txt&amp;quot;),FileName);&lt;br /&gt;
	File myfile(FileName);&lt;br /&gt;
	myfile.open(OpenFlag_Write);&lt;br /&gt;
	myfile.write(tab,(sal_uInt64)16,nb);&lt;br /&gt;
	printf(&amp;quot;%d bytes are written\n&amp;quot;,nb);&lt;br /&gt;
	myfile.close();&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/Note|The method open is not described in C++ documentation !!! I have found it while reading the “file.hxx” header file.}} &lt;br /&gt;
&lt;br /&gt;
The flag you can pass to the &amp;quot;open&amp;quot; method are :  OpenFlag_Write,  OpenFlag_Read,  OpenFlag_Create. The &amp;quot; using namespace osl;&amp;quot; is obligatory even if the compiler doesn&amp;#039;t complain without.&lt;br /&gt;
When a file is open, you can use the  methods above : &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
// Write a number of bytes to a file&lt;br /&gt;
write( const void * pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 &amp;amp; rBytesWritten );&lt;br /&gt;
&lt;br /&gt;
// Read a number of bytes from a file&lt;br /&gt;
read( void * pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 &amp;amp; rBytesRead );&lt;br /&gt;
&lt;br /&gt;
// Read a line from a file&lt;br /&gt;
ReadLine( ::rtl::ByteSequence &amp;amp; aSeq );&lt;br /&gt;
&lt;br /&gt;
// Test if the end of a file is reached&lt;br /&gt;
isEndOfFile( sal_Bool * pIsEOF );&lt;br /&gt;
&lt;br /&gt;
// Retrieve the current position of the internal pointer of an open file&lt;br /&gt;
getPos( sal_uInt64 &amp;amp; uPos );&lt;br /&gt;
&lt;br /&gt;
// Set the internal position pointer of an open file. &lt;br /&gt;
setPos( sal_uInt32 uHow, sal_Int64 uPos );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
There are other possibilities : move, remove, copy... See the documentation or read the file.hxx file.&lt;br /&gt;
&lt;br /&gt;
See [http://udk.openoffice.org/common/man/concept/streams.html « Streaming interfaces »]&lt;br /&gt;
for an other way to use files.&lt;br /&gt;
&lt;br /&gt;
== Threads ==&lt;br /&gt;
&lt;br /&gt;
It would be great to use the Thread Class but it&amp;#039;s  so badly documented that we begin with process instead thread.&lt;br /&gt;
Starting from an example posted in the forum Working with a Spreadsheet Document in C++ (by lirincy). This example gives a working code to start OOo if not started when launching a binary executable. We remove what was not usefull for us and give two examples.&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 20 A Process Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
	oslProcess hProcess = NULL;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString FileURL;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
	OUString::createFromAscii(&amp;quot;/home/smoutou/demo&amp;quot;),&lt;br /&gt;
		FileURL&lt;br /&gt;
	);&lt;br /&gt;
	oslProcessError osl_error = osl_executeProcess(&lt;br /&gt;
	 FileURL.pData,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 osl_Process_DETACHED,&lt;br /&gt;
	 0, /* osl_getCurrentSecurity() */&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 &amp;amp;hProcess );&lt;br /&gt;
	osl_error = osl_joinProcess(hProcess);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/Note|Note that the demo file is an existing binary in /home/smoutou.}}&lt;br /&gt;
If you want to pass something to the launched program see AppArgs variable in the second example :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 21 A second Process Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/process.h&amp;gt;&lt;br /&gt;
	oslProcess hProcess = NULL;&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/file.hxx&amp;gt;&lt;br /&gt;
	OUString FileURL;&lt;br /&gt;
	osl::FileBase::getFileURLFromSystemPath(&lt;br /&gt;
	OUString::createFromAscii(&amp;quot;/home/smoutou/demo&amp;quot;),&lt;br /&gt;
		FileURL&lt;br /&gt;
	);&lt;br /&gt;
	OUString AppArgs = OUString::createFromAscii(&amp;quot;Arg1&amp;quot;);&lt;br /&gt;
	oslProcessError osl_error = osl_executeProcess(&lt;br /&gt;
	 FileURL.pData,&lt;br /&gt;
	 &amp;amp;AppArgs.pData,&lt;br /&gt;
	 1,&lt;br /&gt;
	 osl_Process_DETACHED,&lt;br /&gt;
	 0, /* osl_getCurrentSecurity() */&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 NULL,&lt;br /&gt;
	 0,&lt;br /&gt;
	 &amp;amp;hProcess );&lt;br /&gt;
	osl_error = osl_joinProcess(hProcess);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
I have tried working with thread but only with C style at the moment (not with using the thread class). Here is my first example code :&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 22 A working Thread Example&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;osl/thread.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt; // LINUX&lt;br /&gt;
&lt;br /&gt;
using rtl::OUString;&lt;br /&gt;
using rtl::OString;&lt;br /&gt;
&lt;br /&gt;
/** wait _nSec seconds.&lt;br /&gt;
*/&lt;br /&gt;
void thread_sleep( sal_Int32 _nSec )&lt;br /&gt;
{&lt;br /&gt;
/// print statement in thread process must use fflush() to force display.&lt;br /&gt;
	printf(&amp;quot;# wait %d seconds. &amp;quot;, _nSec );&lt;br /&gt;
	fflush( stdout );&lt;br /&gt;
	sleep( _nSec );&lt;br /&gt;
	printf(&amp;quot;# done\n&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL thread1(void *) {&lt;br /&gt;
  while(1) &lt;br /&gt;
	printf(&amp;quot;\n thread running&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void SAL_CALL thread2(int *nb){&lt;br /&gt;
  while(1) &lt;br /&gt;
	printf(&amp;quot;\n thread nb=%d running&amp;quot;,*nb);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main( ) {&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;osl/thread.h&amp;gt;&lt;br /&gt;
	oslThread hThread = NULL;&lt;br /&gt;
//oslWorkerFunction type : void (SAL_CALL *oslWorkerFunction)(void*); in osl/thread.h&lt;br /&gt;
	oslWorkerFunction pFunction = (void (SAL_CALL *)(void*)) thread2;&lt;br /&gt;
	int pthreaddata=2;&lt;br /&gt;
// create and start the thread2 with 2 as a parameter value&lt;br /&gt;
	oslThread hThread2 = osl_createThread(pFunction,(void *) &amp;amp;pthreaddata);&lt;br /&gt;
// create and start the thread1 &lt;br /&gt;
	hThread = osl_createThread(thread1,NULL);&lt;br /&gt;
					&lt;br /&gt;
	thread_sleep(2);&lt;br /&gt;
	osl_suspendThread(hThread);&lt;br /&gt;
	osl_suspendThread(hThread2);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
What is printed out is depending on how screen is managed by your OS. Under Linux I obtained something like :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running&lt;br /&gt;
 thread running# done&lt;br /&gt;
 &lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 thread nb=2 running&lt;br /&gt;
 ....&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here you can see the second thread launched writes at first and only when the main sleeping is terminated thread two is writing out. The other thread primitives can be found in osl/thread.h :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/** Create the thread, using the function-ptr pWorker as&lt;br /&gt;
	its main (worker) function. This functions receives in&lt;br /&gt;
	its void* parameter the value supplied by pThreadData.&lt;br /&gt;
	Once the OS-structures are initialized,the thread starts&lt;br /&gt;
	running.&lt;br /&gt;
	@return 0 if creation failed, otherwise a handle to the thread&lt;br /&gt;
*/&lt;br /&gt;
oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);&lt;br /&gt;
&lt;br /&gt;
/** Create the thread, using the function-ptr pWorker as&lt;br /&gt;
	its main (worker) function. This functions receives in&lt;br /&gt;
	its void* parameter the value supplied by pThreadData.&lt;br /&gt;
	The thread will be created, but it won&amp;#039;t start running.&lt;br /&gt;
	To wake-up the thread, use resume().&lt;br /&gt;
	@return 0 if creation failed, otherwise a handle to the thread&lt;br /&gt;
*/&lt;br /&gt;
oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);&lt;br /&gt;
&lt;br /&gt;
/** Release the thread handle.&lt;br /&gt;
	If Thread is NULL, the function won&amp;#039;t do anything.&lt;br /&gt;
	Note that we do not interfere with the actual running of&lt;br /&gt;
	the thread, we just free up the memory needed by the handle.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_destroyThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Wake-up a thread that was suspended with suspend() or&lt;br /&gt;
	createSuspended(). The oslThread must be valid!&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_resumeThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Suspend the execution of the thread. If you want the thread&lt;br /&gt;
	to continue, call resume(). The oslThread must be valid!&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_suspendThread(oslThread Thread);&lt;br /&gt;
/** Returns True if the thread was created and has not terminated yet.&lt;br /&gt;
	Note that according to this definition a &amp;quot;running&amp;quot; thread might be&lt;br /&gt;
	suspended! Also returns False is Thread is NULL.&lt;br /&gt;
*/&lt;br /&gt;
sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Blocks the calling thread until Thread has terminated.&lt;br /&gt;
	Returns immediately if Thread is NULL.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_joinWithThread(oslThread Thread);&lt;br /&gt;
&lt;br /&gt;
/** Blocks the calling thread at least for the given number&lt;br /&gt;
    of time.&lt;br /&gt;
*/&lt;br /&gt;
void SAL_CALL osl_waitThread(const TimeValue* pDelay);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information you can read [[Uno/Article/Multi-Thread_Programming|Multi-Thread Programming]].&lt;br /&gt;
&lt;br /&gt;
== To go further : the Enumeration Type Problem ==&lt;br /&gt;
Sometimes we will encounter enumeration values. We have to learn how to resolve the problem. An example will be discussed later but we give it without its context here. The Cell content in OOoCalc is described by an enumeration. How can I know that, is not easy with the previous material, but I want to tackle the problem even if too soon to understand for a first reading.&lt;br /&gt;
&lt;br /&gt;
All types used in programming are described in IDL files. Sometimes these IDL files are used to create hpp/hxx files.&lt;br /&gt;
&lt;br /&gt;
This example is around CellContentType.idl file. Here is the summary of this file where we remove comments :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;idl&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 23  CellContentType Enumeration type (IDL File)&lt;br /&gt;
// IDL&lt;br /&gt;
namespace com{&lt;br /&gt;
namespace sun{&lt;br /&gt;
namespace star{&lt;br /&gt;
namespace table{&lt;br /&gt;
enum CellContentType&lt;br /&gt;
{&lt;br /&gt;
    CellContentType_EMPTY = 0,&lt;br /&gt;
    CellContentType_VALUE = 1,&lt;br /&gt;
    CellContentType_TEXT = 2,&lt;br /&gt;
    CellContentType_FORMULA = 3,&lt;br /&gt;
    CellContentType_MAKE_FIXED_SIZE = SAL_MAX_ENUM&lt;br /&gt;
};&lt;br /&gt;
} // table&lt;br /&gt;
} // star&lt;br /&gt;
} // sun&lt;br /&gt;
} // com&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Three tips can be used when using this kind of enumeration :&lt;br /&gt;
* In C++ a corresponding using namespace is necessary&lt;br /&gt;
using namespace com::sun::star::table&lt;br /&gt;
This line can be drawn from the IDL file.&lt;br /&gt;
* In C++ an include directive is necessary&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/table/CellContentType.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The  name of the file to include and the path is easy to draw from IDL file.&lt;br /&gt;
* We have to construct the previous hpp file. This is done with adding the red line above in the makefile :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TYPES := \&lt;br /&gt;
	com.sun.star.uno.XNamingService \&lt;br /&gt;
	com.sun.star.uno.XComponentContext \&lt;br /&gt;
	com.sun.star.uno.XWeak \&lt;br /&gt;
	com.sun.star.uno.XAggregation \&lt;br /&gt;
	com.sun.star.lang.XMain \&lt;br /&gt;
	com.sun.star.lang.XMultiServiceFactory \&lt;br /&gt;
	com.sun.star.lang.XSingleComponentFactory \&lt;br /&gt;
	com.sun.star.lang.XTypeProvider \&lt;br /&gt;
	com.sun.star.lang.XComponent \&lt;br /&gt;
	com.sun.star.registry.XSimpleRegistry \&lt;br /&gt;
	com.sun.star.registry.XImplementationRegistration \&lt;br /&gt;
	com.sun.star.bridge.XBridgeFactory \&lt;br /&gt;
	com.sun.star.bridge.XUnoUrlResolver \&lt;br /&gt;
	com.sun.star.table.CellContentType \&lt;br /&gt;
	com.sun.star.container.XHierarchicalNameAccess&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After you can use this enumeration without problem like this :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 24 Enumeration type : an Example&lt;br /&gt;
//C++&lt;br /&gt;
// To check&lt;br /&gt;
// Don&amp;#039;t forget to add #include &amp;lt;com/sun/star/table/CellContentType.hpp&amp;gt;&lt;br /&gt;
// Don&amp;#039;t forget to add &amp;quot;com.sun.star.table.CellContentType \&amp;quot; in the makefile&lt;br /&gt;
&lt;br /&gt;
	using namespace com::sun::star::table&lt;br /&gt;
	short enumval;&lt;br /&gt;
	enumval =  CellContentType_EMPTY;&lt;br /&gt;
	switch (enumval){&lt;br /&gt;
		case CellContentType_EMPTY : printf(&amp;quot;Empty\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_VALUE : printf(&amp;quot;Numerical Value\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_TEXT : printf(&amp;quot;Text\n&amp;quot;);break;&lt;br /&gt;
		case CellContentType_FORMULA : printf(&amp;quot;Formula\n&amp;quot;);break;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
What is shown here is a general SDK&amp;#039;s feature : we construct a hpp file starting from an IDL file. This is so important and unexpected for beginners that I will repeat many times these explanations [[UNO_automation_with_a_binary_%28executable%29#Introduction_to_Bootstrapping|later]] and more deeply [[IDL_Files_and_Cpp#Getting_an_interface_in_C.2B.2B|here]].&lt;br /&gt;
&lt;br /&gt;
== To go further : the Constant Type Problem ==&lt;br /&gt;
Values are not always defined with enumeration types as shown in previous section. Sometimes constants are used when programming with UNO. One example is again tackled [[OpenOffice_Calc#The_Compute_Function__Example|later]] but we want again writes on it now. We first present the corresponding IDL file (as an example)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;idl&amp;quot;&amp;gt;&lt;br /&gt;
// Listing 25 CellFlags Constants type : IDL File &lt;br /&gt;
//IDL&lt;br /&gt;
module com {  module sun {  module star {  module sheet {&lt;br /&gt;
constants CellFlags&lt;br /&gt;
{&lt;br /&gt;
	const long VALUE = 1;&lt;br /&gt;
	const long DATETIME = 2;&lt;br /&gt;
	const long STRING = 4;&lt;br /&gt;
	const long ANNOTATION = 8;&lt;br /&gt;
	const long FORMULA = 16;&lt;br /&gt;
	const long HARDATTR = 32;&lt;br /&gt;
	const long STYLES = 64;&lt;br /&gt;
	const long OBJECTS = 128;&lt;br /&gt;
	const long EDITATTR = 256;&lt;br /&gt;
};&lt;br /&gt;
}; }; }; };&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Compare this listing with Listing 23 to see the differences.&lt;br /&gt;
If you want to use the constants above you first generate the corresponding hpp file with modifying the makefile as in previous section, and then add the corresponding include directive :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;com/sun/star/sheet/CellFlags.hpp&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
in your C++ code. Note that with this include directive you can directly write something like &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
VALUE | DATETIME&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
instead of &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// C++&lt;br /&gt;
CellFlags_VALUE | CellFlags_DATETIME&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
as seen previously.&lt;br /&gt;
&lt;br /&gt;
==Going further with Sequences==&lt;br /&gt;
We want to give any utilities used later in this document.&lt;br /&gt;
===Converting Sequences into Array===&lt;br /&gt;
Because it exists a correponding member function this conversion is very easy :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 27 Conversion Example&lt;br /&gt;
// C++&lt;br /&gt;
Sequence &amp;lt; sal_Int32 &amp;gt; SetOfInt(5);&lt;br /&gt;
sal_Int32 *table;&lt;br /&gt;
table = SetOfInt.getArray();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If you read carefully to this point, this code is familiar for you : it&amp;#039;s drawn from Listing 4 and then already explained.&lt;br /&gt;
===Converting Sequence of Sequence into Array===&lt;br /&gt;
This problem has to be solved. We will use this kind of conversion later (see chapter 14). We first give two subprograms, to print out and to convert :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 28 Sequence of Sequence into 1D array&lt;br /&gt;
//C+&lt;br /&gt;
// Sequence of Sequence is printed out like that :&lt;br /&gt;
// toPrint[0][0] toPrint[0][1] toPrint[0][2]...&lt;br /&gt;
// toPrint[1][0] toPrint[1][1] toPrint[1][2]...&lt;br /&gt;
// ...&lt;br /&gt;
// Note that i denotes the first index&lt;br /&gt;
void printOutSeqSeq(const Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; &amp;amp;toPrint){&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;Prints out SeqSeq&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
        for(int i=0;i&amp;lt;toPrint.getLength();i++){&lt;br /&gt;
                Sequence &amp;lt; double &amp;gt; rLine = toPrint[i];&lt;br /&gt;
		double *line= rLine.getArray();&lt;br /&gt;
		for(int j=0;j&amp;lt;rLine.getLength();j++)&lt;br /&gt;
			cout &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; line[j] &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
		cout &amp;lt;&amp;lt; endl;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
double *SeqSeqToArray1D(const Sequence &amp;lt; Sequence &amp;lt; double&amp;gt; &amp;gt; &amp;amp;seqseq){&lt;br /&gt;
	sal_Int32 iMax=seqseq.getLength(),jMax;&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; rLine = seqseq[0];&lt;br /&gt;
	jMax=rLine.getLength();	&lt;br /&gt;
	double *table1D = new double[iMax*jMax];&lt;br /&gt;
	for (sal_Int32 i = 0 ; i &amp;lt; iMax; i++ )&lt;br /&gt;
		for(sal_Int32 j = 0 ; j &amp;lt; jMax; j++ )&lt;br /&gt;
			table1D[i*jMax+j]= seqseq[i][j];&lt;br /&gt;
	return table1D;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Using these sub is easy : it can be done like that :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 29 Using the conversion&lt;br /&gt;
//C+&lt;br /&gt;
// We first construct a sequence&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
	demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
	demo[2]=3.1;&lt;br /&gt;
	demo[3]=4.1;&lt;br /&gt;
	demo[4]=5.1;&lt;br /&gt;
// We then construct the sequence of sequence&lt;br /&gt;
	Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; seqseq(3);&lt;br /&gt;
	for (int i=0; i&amp;lt;seqseq.getLength();i++)&lt;br /&gt;
            seqseq[i]=demo;&lt;br /&gt;
// We print out the result of the construction	&lt;br /&gt;
	printOutSeqSeq(seqseq);&lt;br /&gt;
// Here is the conversion&lt;br /&gt;
	double *table = SeqSeqToArray1D(seqseq);&lt;br /&gt;
// We finish wit printing out the result &lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;Array1D -&amp;gt; 2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;table[i*5+j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	....&lt;br /&gt;
	delete table;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
which gives us :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Prints out SeqSeq&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
Array1D -&amp;gt; 2D :&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
 1.1  2.1  3.1  4.1  5.1&lt;br /&gt;
[smoutou@p3 Lifetime]$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Converting a sequence of sequence directly in an 2D array is not an easy task because the compiler has to know the size of the second index before compiling. At first something like &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 30 Array2D conversion&lt;br /&gt;
// C++&lt;br /&gt;
double **SeqSeqToArray2D(const Sequence &amp;lt; Sequence &amp;lt; double&amp;gt; &amp;gt; &amp;amp;seqseq){&lt;br /&gt;
	double **table2D; &lt;br /&gt;
	double *table1D;&lt;br /&gt;
	table1D = SeqSeqToArray1D(seqseq);&lt;br /&gt;
	table2D = &amp;amp;table1D;&lt;br /&gt;
	return table2D;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
seems interesting but let&amp;#039;s see if that works out. A first idea is to write something like :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 31 Wrong code for  conversion&lt;br /&gt;
// C++&lt;br /&gt;
	double **table2= SeqSeqToArray2D(seqseq);&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt; table2[i][j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	delete table2;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
but the compiler is unable to calculate table2[i][j] here. For that it has to evaluate the expression i*jMax+j but has no knowledge on jMax !!&lt;br /&gt;
&lt;br /&gt;
===More Abstractions with STL===&lt;br /&gt;
If you plan to use C++ you will certainly use the STL extensively. We begin first by conversions. Here is the easier one :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 32 Converting a Sequence of Sequence into a vector&lt;br /&gt;
// C++&lt;br /&gt;
// Inspired by Eric Ehlers&amp;#039;s code but using template&lt;br /&gt;
// See chapter 14&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; T &amp;gt;SeqSeqToVectorTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss) {&lt;br /&gt;
    vector &amp;lt; T &amp;gt;v;&lt;br /&gt;
    for (int i=0; i&amp;lt;ss.getLength(); i++)&lt;br /&gt;
        for (int j=0; j&amp;lt;ss[i].getLength(); j++)&lt;br /&gt;
            v.push_back(ss[i][j]);&lt;br /&gt;
    return v;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
My start point for achieving this code was Eric Ethler&amp;#039;s code presented [[CompleteAddIn#Transforming_an_Array_into_Sequence_of_Sequence|here]]. This code is again easy to use :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 33 Using the previous Convertion&lt;br /&gt;
// C++&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include&amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;cppuhelper/bootstrap.hxx&amp;gt;&lt;br /&gt;
#include &amp;lt;com/sun/star/uno/Sequence.hxx&amp;gt;&lt;br /&gt;
using namespace com::sun::star::uno;&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; T &amp;gt;SeqSeqToVectorTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss);&lt;br /&gt;
main( ) {&lt;br /&gt;
	Sequence &amp;lt; double &amp;gt; demo(5);&lt;br /&gt;
	demo[0]=1.1;&lt;br /&gt;
    demo[1]=2.1;&lt;br /&gt;
	demo[2]=3.1;&lt;br /&gt;
	demo[3]=4.1;&lt;br /&gt;
	demo[4]=5.1;&lt;br /&gt;
	Sequence &amp;lt; Sequence &amp;lt; double &amp;gt; &amp;gt; seqseq(3);&lt;br /&gt;
// simply use the same sequence&lt;br /&gt;
	for (int i=0; i&amp;lt;seqseq.getLength();i++)&lt;br /&gt;
            seqseq[i]=demo;&lt;br /&gt;
// template&lt;br /&gt;
	vector &amp;lt;double&amp;gt; v=SeqSeqToVectorTemplate(seqseq);&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;vector1D -&amp;gt; 2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;v[i*5+j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
We give now three other conversions (see also [[CompleteAddIn#Transforming_an_Array_into_Sequence_of_Sequence|here]])&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 34 Converting Utilities with Template&lt;br /&gt;
// C++&lt;br /&gt;
// Inspired by Eric Ethler&amp;#039;s code but using template&lt;br /&gt;
// See chapter 14&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; VectorTemplateToSeqSeq(const vector &amp;lt; T &amp;gt; &amp;amp;v) {&lt;br /&gt;
    Sequence&amp;lt; Sequence&amp;lt; double &amp;gt; &amp;gt; ss(v.size());&lt;br /&gt;
    for (unsigned int i=0; i&amp;lt;v.size(); i++) {&lt;br /&gt;
        Sequence&amp;lt; T &amp;gt; s(1);&lt;br /&gt;
        s[0] = v[i];&lt;br /&gt;
        ss[i] = s;&lt;br /&gt;
    }&lt;br /&gt;
    return ss;&lt;br /&gt;
}&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
vector &amp;lt; vector &amp;lt; T &amp;gt; &amp;gt;SeqSeqToMatrixTemplate(const Sequence&amp;lt; Sequence &amp;lt; T &amp;gt; &amp;gt;&amp;amp; ss) {&lt;br /&gt;
    vector &amp;lt; vector &amp;lt; T &amp;gt; &amp;gt;vv;&lt;br /&gt;
    for (int i=0; i&amp;lt;ss.getLength(); i++) {&lt;br /&gt;
        vector &amp;lt; T &amp;gt;v;&lt;br /&gt;
        for (int j=0; j&amp;lt;ss[i].getLength(); j++)&lt;br /&gt;
            v.push_back(ss[i][j]);&lt;br /&gt;
        vv.push_back(v);&lt;br /&gt;
    }&lt;br /&gt;
    return vv;&lt;br /&gt;
}&lt;br /&gt;
template&amp;lt; typename T&amp;gt;&lt;br /&gt;
Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; MatrixTemplateToSeqSeq(&lt;br /&gt;
			const std::vector &amp;lt; std::vector &amp;lt; T &amp;gt; &amp;gt;&amp;amp;vv) {&lt;br /&gt;
    Sequence&amp;lt; Sequence&amp;lt; T &amp;gt; &amp;gt; ss(vv.size());&lt;br /&gt;
    for (unsigned int i=0; i&amp;lt;vv.size(); i++) {&lt;br /&gt;
        std::vector &amp;lt; T &amp;gt; v = vv[i];&lt;br /&gt;
        Sequence&amp;lt; T &amp;gt; s(v.size());&lt;br /&gt;
        for (unsigned int j=0; j&amp;lt;v.size(); j++)&lt;br /&gt;
            s[j] = v[j];&lt;br /&gt;
        ss[i] = s;&lt;br /&gt;
    }&lt;br /&gt;
    return ss;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
One way to use it is for instance :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
//Listing 35 Converting Utilities with Template&lt;br /&gt;
//C++&lt;br /&gt;
	...&lt;br /&gt;
// seqseq must be initialized	&lt;br /&gt;
	vector &amp;lt;vector &amp;lt;double&amp;gt; &amp;gt; v2=SeqSeqToMatrixTemplate(seqseq);&lt;br /&gt;
	cout &amp;lt;&amp;lt; &amp;quot;vector2D : &amp;quot;&amp;lt;&amp;lt; endl;&lt;br /&gt;
	for (int i=0; i&amp;lt; 3; i++){&lt;br /&gt;
		for (int j=0;j&amp;lt;5;j++)&lt;br /&gt;
			cout&amp;lt;&amp;lt;&amp;quot; &amp;quot;&amp;lt;&amp;lt;v2[i][j]&amp;lt;&amp;lt;&amp;quot; &amp;quot;;&lt;br /&gt;
		cout&amp;lt;&amp;lt;endl;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Because there is a lot of algorithms based on STL I think these utilities will be very helpfull.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Cpp_Guide|French version of this chapter]].&lt;br /&gt;
* [[Uno/Article/Understanding_Uno|Understanding Uno]]&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [[Uno/Article/Multi-Thread Programming | Multi-Thread Programming]]&lt;br /&gt;
* To learn C++ : [http://www.smart2help.com/e-books/ C++ e-books]&lt;br /&gt;
* [http://en.wikibooks.org/wiki/Programming:Data_Structures Wiki on C++ Data Structures]&lt;br /&gt;
* [[Uno/Binary/Analysis/String_Performance|String Performance]]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235390</id>
		<title>Using Cpp with the OOo SDK</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Using_Cpp_with_the_OOo_SDK&amp;diff=235390"/>
		<updated>2014-07-11T00:33:58Z</updated>

		<summary type="html">&lt;p&gt;Global667: Delete off topic link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
[[Image:HomePageCpp.png]]&lt;br /&gt;
&lt;br /&gt;
This site is about using C++ as a language to program OpenOffice extensions.&lt;br /&gt;
* [[CppSDKAuthors|About the Author and Contributors]]&lt;br /&gt;
* [[SDKInstallation|How to install the SDK and compile the C++ examples]]&lt;br /&gt;
* [[SDKCppLanguage|The UNO C++ Language]]&lt;br /&gt;
* [[UNO_automation_with_a_binary_(executable)|OpenOffice.org&amp;#039;s UNO automation with a binary (executable)]]&lt;br /&gt;
* [[Calc/API/Programming|OpenOffice Calc]]&lt;br /&gt;
* [[Programming_OOoDraw_and_OOoImpress|C++ automation of OOoDraw and OOoImpress]]&lt;br /&gt;
* [[Working_with_Shapes |Working with Shapes in C++]]&lt;br /&gt;
* [[Programming OooWriter |Programming OooWriter with C++]]&lt;br /&gt;
* General Utilities&lt;br /&gt;
**[[Playing_with_Window_Toolkit_AWT|Playing with Window Toolkit AWT]]&lt;br /&gt;
**[[Executing_an_OOoBasic_macro_with_Cpp|Executing an OOoBasic macro with C++]]&lt;br /&gt;
* [[IDL_Files_and_Cpp|IDL Files and C++]]&lt;br /&gt;
* [[UNO_registery_and_Bootstrapping|UNO registery and Bootstrapping]]&lt;br /&gt;
* [[Constructing_Helpers|Constructing Helpers]]&lt;br /&gt;
* [[Constructing_Components|Constructing Components in C++]]&lt;br /&gt;
* [[Component_and_Dialog|Managing a Dialog in a Component]]&lt;br /&gt;
* [[Going_further_with_Dialog_and_Component|Going further with Dialog and Components]]&lt;br /&gt;
* [[Add-on|Constructing an Addon]]&lt;br /&gt;
* [[CompleteAddIn | OOoCalc addin in C++]]&lt;br /&gt;
* [[Writing_Professional_Components|Writing professional Components]]&lt;br /&gt;
* [[XML_and_Filter |XML, Filters and Files]]&lt;br /&gt;
* [[MakeFile|Appendix : Using make utility]] with SDK&lt;br /&gt;
* [[GNU_Lesser_General_Public_License|GNU Lesser General Public License]]&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|I have decided to give up with this C++ documentation. My last work was to add two chapters in summer 2009. I have done nothing more during last year. I only want to say this document is completely free, unfortunatly is not finished (particularly with addon and dialog). Please let this caution banner for a year and remove it after because tradition in OpenOffice documentation is to remove author&amp;#039;s names. After a year, it would be also great to remove my name everywhere it appears in other chapters. Thank you in Advance. [[User:SergeMoutou|SergeMoutou]] 08:52, 26 August 2010 (UTC)}} &lt;br /&gt;
= See also=&lt;br /&gt;
== General ==&lt;br /&gt;
* [[FR/Documentation/Cpp_Guide|French version of this document]].&lt;br /&gt;
* [[Documentation/DevGuide/OpenOffice.org_Developers_Guide | Developer&amp;#039;s Guide]]&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&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;
* [[Tutorial_UNO_Library|UNO tutorial]]&lt;br /&gt;
* [[Tutorial_UNO_IDL|UNO IDL]]&lt;br /&gt;
* [[Uno/Article/Types%26Reflection]]&lt;br /&gt;
* [http://udk.openoffice.org/common/man/concept/unointro.html UNO Introduction]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=8702 Working with a database in C++] (not tackled in this document at the moment).&lt;br /&gt;
* [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== Coding ==&lt;br /&gt;
* [[Writing_correct_Cplusplus|Writing correct C++]]&lt;br /&gt;
* [[Writing_warning-free_code|Writing warning-free code]]&lt;br /&gt;
* [[Debugging |Debugging]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide]]&lt;br /&gt;
[[Category:Uno]]&lt;br /&gt;
[[Category:Article]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235389</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235389"/>
		<updated>2014-07-10T21:46:36Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* How to install the SDK and compile the C++ examples */ Add help suggestions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
* If you have questions, use your preferred search engine first. If this not works visit: https://forum.openoffice.org to get help.&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html or type and run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install openoffice.org openoffice.org-dev openoffice.org-dev-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235388</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235388"/>
		<updated>2014-07-10T21:39:39Z</updated>

		<summary type="html">&lt;p&gt;Global667: Tagging win section only as NeedsRework&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html or type and run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install openoffice.org openoffice.org-dev openoffice.org-dev-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235387</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235387"/>
		<updated>2014-07-10T21:37:00Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under LINUX */ add text command to download AOO and SDK&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html or type and run&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install openoffice.org openoffice.org-dev openoffice.org-dev-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235386</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235386"/>
		<updated>2014-07-10T21:32:55Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Solaris */ Delete Solaris isn&amp;#039;t supported in AOO4&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235385</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235385"/>
		<updated>2014-07-10T21:23:32Z</updated>

		<summary type="html">&lt;p&gt;Global667: update shortening&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. If you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235384</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235384"/>
		<updated>2014-07-10T21:15:58Z</updated>

		<summary type="html">&lt;p&gt;Global667: clean linux part, mac os additions (checkpoint save)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
To work with the SDK and C++ use an editor of your choice.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 4.1.0 for OpenOffice.org 4.1.0 under Ubuntu.&lt;br /&gt;
* Make sure you have development tools installed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc make build-essential&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth, but they don&amp;#039;t support C++ programming. Feel free to help adding this feature: For Eclipse visit [[OpenOffice_Eclipse_Integration]]. For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235383</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235383"/>
		<updated>2014-07-10T20:46:11Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* How to install the SDK and compile the C++ examples */ additions, expansions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
The following points are important, if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* You need to have OpenOffice.org and OpenOffice SDK in the identical version&lt;br /&gt;
* You need to install the SDK into a directory other than the one of the AOO application&lt;br /&gt;
* It is strongly recommended to install the newest Java JDK on your system&lt;br /&gt;
* Make your operating system up to date&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth.&lt;br /&gt;
For Eclipse visit [[OpenOffice_Eclipse_Integration]].&lt;br /&gt;
For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235373</id>
		<title>OpenOffice NetBeans Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235373"/>
		<updated>2014-07-08T20:07:50Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* From source */ make some clearer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:OOo-Netbeans-Plugin.png|right]]&lt;br /&gt;
= Overview =&lt;br /&gt;
The OpenOffice.org API plugin for NetBeans simplifies the development of OpenOffice.org extensions. You can use the OpenOffice.org API to program OpenOffice.org, and automate remote or in process tasks extend OpenOffice.org with completely new functionality. The OpenOffice.org API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete OpenOffice.org extension packages (comparable to the NetBeans plugin modules).&lt;br /&gt;
&lt;br /&gt;
= Download and Installation =&lt;br /&gt;
The plugin appears automatically in Netbeans 6.5.x, 6.7.x, 6.8 (version 2.0.6) but is not listed for later versions.&lt;br /&gt;
&lt;br /&gt;
The plugin is available for download from [http://people.apache.org/~cmarcum/devtools/ http://people.apache.org/~cmarcum/devtools/] provided by Carl Marcum. Use 3.x versions for extension development for OpenOffice.org versions 3.0 thru 3.4. Use the latest 4.0.5 alpha version for extension development for Apache OpenOffice 4.x. This version is under active development and will be made available in the NetBeans plugin manager list when finished. Until then, remember that it is an &amp;#039;&amp;#039;&amp;#039;Beta&amp;#039;&amp;#039;&amp;#039; version.&lt;br /&gt;
&lt;br /&gt;
The configuration is self explanatory, for detailed information see [[OpenOffice_NetBeans_Integration#Configuration|Configuration]]. &lt;br /&gt;
&lt;br /&gt;
The source is available in the Apache OpenOffice.org source SVN repository in the &amp;#039;&amp;#039;&amp;#039;devtools&amp;#039;&amp;#039;&amp;#039; tree. The trunk is under development and the tagged 3.0.0.beta will build and run.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;[https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== From source ==&lt;br /&gt;
The NetBeans-plugin for 4.1.0 is beta and you need to compile by hand. It doesn&amp;#039;t support C++ development for now.&lt;br /&gt;
* Install NetBeans from https://netbeans.org/downloads/ take &amp;quot;Java SE&amp;quot; or &amp;quot;All&amp;quot; Package&lt;br /&gt;
* Under NetBeans create a new SVN (anonymous) repository to https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/ and checkout&lt;br /&gt;
* Create a NBM from the project you get from SVN. On errors install the needed plugins like junit.&lt;br /&gt;
* Install the NBM, now you find the OpenOffice Project under &amp;quot;New Project...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
Overview of the features included in the current plugin.&lt;br /&gt;
== Project Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New Project...&amp;amp;quot; and choose category &amp;amp;quot;OpenOffice.org&amp;amp;quot; to open a new project. All project types create working code. Once the project wizard is finished, a working&lt;br /&gt;
compilable project is created. It may not do anything, but it can be used&lt;br /&gt;
in OpenOffice.org from the beginning.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org Client Application Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE client application project with additional support of the &lt;br /&gt;
simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client &lt;br /&gt;
application. The result is a portable jar file that bootstraps OpenOffice.org on any supported OS.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an office extension package. The wizard collects the necessary information for new &lt;br /&gt;
Calc built-in functions and abstracts from the underlying UNO technology.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[General_UNO_Component_Project_Type|General UNO Component Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a&lt;br /&gt;
UNO component library and an OpenOffice.org extension package. The wizard collects information about services &lt;br /&gt;
and additional optional interfaces which should be implemented. Additional IDL types can also be&lt;br /&gt;
defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an OpenOffice.org extension package. The wizard collects the necessary information for an &lt;br /&gt;
OpenOffice.org Add-On component and generates an Add-On specific code skeleton.&lt;br /&gt;
&lt;br /&gt;
== File Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New File...&amp;amp;quot; and select &amp;amp;quot;OpenOffice.org&amp;amp;quot; as category to create a new file for an OpenOffice.org project. Note, that the OpenOffice.org category is available in all projects, although it only makes sense to use it in one of the projects stated above.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcu file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcu file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcs file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcs file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;UNO idl file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You can use a file type wizard to create idl files. In the first step, you must select the name location&lt;br /&gt;
and UNO type (e.g. Service or Interface). You can add additional &lt;br /&gt;
information in the second step. When an interface is created, the second step asks about&lt;br /&gt;
the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose&lt;br /&gt;
to also create an implementation object (only available for service or interface), a Java skeleton file implementing&lt;br /&gt;
your new idl file will also be created.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Java UNO Object file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be &lt;br /&gt;
registered in OpenOffice.org when your extension is deployed.&lt;br /&gt;
&lt;br /&gt;
== Create, deploy and debug ==&lt;br /&gt;
These are actions that are available in the context menu of an extension project in the &amp;amp;quot;Project&amp;amp;quot; &lt;br /&gt;
view.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Debug Extension in Target OpenOffice.org&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered in a temporary user installation of OpenOffice.org, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then OpenOffice.org is started with this user installation. To trigger the registered extension, an appropriate action must be done in OpenOffice.org.&lt;br /&gt;
Execution stops at any breakpoints added to the code of the extension and debugging can start from there.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Deploy and Run OpenOffice.org Extension&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered inside the user installation of OpenOffice.org. Then OpenOffice.org is started.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Create OXT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the &amp;amp;quot;dist&amp;amp;quot; directory of the project.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Publish Extension on OpenOffice.org Website&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The starting page for uploading and publishing your extension on api.services.openoffice.org is loaded in your default web browser.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;External Jars&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension&amp;#039;s classpath. A registered extension in OpenOffice.org can still use the functionality provided there.&lt;br /&gt;
The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
&lt;br /&gt;
Find here links to the specifications of the plugin on the api.openoffice.org page.&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration.odt OpenOffice.org Plugin for NetBeans]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-addon-wizard.odt OpenOffice.org Plugin for NetBeans: Add-On Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-calc-addin-wizard.odt OpenOffice.org Plugin for NetBeans: Add-In Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-component-wizard.odt OpenOffice.org Plugin for NetBeans: Component Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-debug-component.odt OpenOffice.org Plugin for NetBeans: Debug Feature]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-new-idl-type.odt OpenOffice.org Plugin for NetBeans: IDL type support]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-description-xml.odt OpenOffice.org Plugin for NetBeans: Support description.xml]&lt;br /&gt;
&lt;br /&gt;
= Working with the plugin =&lt;br /&gt;
The following section describes how you can work with the plugin and describes the requirements because the plugin  make use of some external stuff provided by an office and the OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
The plugin works only in combination with OpenOffice.org and an appropriate OpenOffice.org Software Development Kit (SDK). The minimal suggested version is OpenOffice.org 2.0.4. With earlier versions, some features of the plugin will not work.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org OpenOffice.org]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[http://www.sun.com/staroffice StarOffice 8]&amp;#039;&amp;#039;&amp;#039; or higher versions of both programs&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org/sdk.html OpenOffice.org Software Development Kit (SDK)]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Note that the versions of OpenOffice.org and the OpenOffice.org SDK must match for everything to work.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
Before you can use the new project types you must configure the plugin because it needs an installed OpenOffice.org and OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
* As default settings, a standard installation will be found by the plugin - but only if OpenOffice.org together with the SDK are present.&lt;br /&gt;
* When you choose the OpenOffice.org installation and an appropriate SDK is found, that SDK is chosen, the &amp;amp;quot;OpenOffice.org SDK Installation&amp;amp;quot; field is then disabled.&lt;br /&gt;
* If you change the OpenOffice.org or OpenOffice.org SDK installation, these changes are effective for projects created from now on only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For changing the office and SDK installation please choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API plugin&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and select a valid OpenOffice.org and OpenOffice.org SDK installation. &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:OpenOffice_Extensions_Plugin_Options.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The configuration step automatically installs a new OpenOffice.org library which can be used in other projects to support the OpenOffice.org API. Including this library in your own projects enables context sensitive help and code completion.&lt;br /&gt;
&lt;br /&gt;
Note: on Debian/Ubuntu, the OpenOffice.org installation directory is &amp;lt;code&amp;gt;/usr/lib/openoffice/&amp;lt;/code&amp;gt;. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script &amp;lt;code&amp;gt;/usr/bin/ooffice&amp;lt;/code&amp;gt; to see where the &amp;lt;code&amp;gt;ooqstart&amp;lt;/code&amp;gt; executable is in your installation.&lt;br /&gt;
&lt;br /&gt;
== Working with new Project Types ==&lt;br /&gt;
The plugin integrates four new project types under the category &amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Calc Add-Ins&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Client Application&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Component&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; OpenOffice.org -&amp;gt; &amp;lt;project_type&amp;gt;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
For more details about the project types please take a look at&lt;br /&gt;
*[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org UNO Client Application Project Type]]&lt;br /&gt;
*[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&lt;br /&gt;
*[[General_UNO_Component_Project_Type|OpenOffice.org Component Project Type]]&lt;br /&gt;
*[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&lt;br /&gt;
&lt;br /&gt;
== Migrate Projects ==&lt;br /&gt;
To migrate projects from an older version of the plugin to a new one is not necessary - the plugin itself will take care of that: build-uno-impl.xml and the project-uno.properties are updated, when updated versions of these files are needed for new features of the updated plugin. Note that build-uno-impl.xml will be overwritten, but project-uno.properties not. In the properties file, only new entries are added, existing ones are kept as they are. The update of the files happens when an old project is opened with a new version of the plugin and for all opened projects when the new plugin is downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
When migrating from one Office version to another (or porting a project across platforms), only a library has to be changed, called &amp;amp;quot;OpenOffice.org &amp;lt;version_number&amp;gt;&amp;amp;quot; (or &amp;amp;quot;StarOffice &amp;lt;version_number&amp;gt;&amp;amp;quot;). Choose &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Libraries&amp;#039;&amp;#039;&amp;#039; to get an overview of the existing libraries. A library is created when a valid OpenOffice.org and OpenOffice.org SDK is selected in &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API Plugin&amp;#039;&amp;#039;&amp;#039; (See [[OpenOffice_NetBeans_Integration#Configuration|Configuration]] for more details).&lt;br /&gt;
* To change the library, click right on the project in the &amp;#039;&amp;#039;&amp;#039;Project&amp;#039;&amp;#039;&amp;#039; window and open the properties. Select &amp;#039;&amp;#039;&amp;#039;Libraries&amp;#039;&amp;#039;&amp;#039; as category and remove the one that points to the old installation and add the new one.&lt;br /&gt;
* When porting the project across platforms, NetBeans notifies that a reference problem exists. The steps for changing the libraries also help in this case.&lt;br /&gt;
&lt;br /&gt;
== Known Problems and Missing Features ==&lt;br /&gt;
&lt;br /&gt;
* Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.&lt;br /&gt;
* &amp;amp;quot;Red Dot Problem&amp;amp;quot;: When you have created a project that supports own idl files (e.g. a Clac AddIn), a &amp;amp;quot;clean&amp;amp;quot; on the project will produce &amp;amp;quot;red dots&amp;amp;quot; that show that imported functionality is missing. The cause for this is the deleted jar file with the idl types that are used in your project. Although this does not seem to be the case, a compile will work and solve the problem. Sometimes the signs appear when &amp;amp;quot;clean and build&amp;amp;quot; is chosen - here the compiled idl files exist, but NetBeans does not recognize that. Open the offending Java file to solve that. Solution: compile idl files in the background and produce a &amp;amp;quot;shadow&amp;amp;quot; jar file in a temp directory that can be used even if the &amp;amp;quot;official&amp;amp;quot; file in the &amp;lt;project_name&amp;gt;/dist folder is deleted.&lt;br /&gt;
* With NetBeans versions at least 6.1 there is an update problem regarding NetBeans property sheets and node views: property sheet changes are not reflected in the node view. Seems like the notify mechanism for these updates has changed.&lt;br /&gt;
&lt;br /&gt;
= Releases =&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=5 cellspacing=0 border=1 style=&amp;quot;border-collapse:collapse; margin-left: 3em; border-color: #333;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color: #DEDEDE;&amp;quot;&lt;br /&gt;
| Release Version || Planned Release Date || Release Date || Planned Features&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.0 || 05/08/07 || 05/08/07 || -&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1 || 09/01/07 || 09/18/07 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1| see 1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.1 || 03/08 || 03/20/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.2 || 04/08 || 04/30/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.2]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.3 || 06/30/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.3]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0 || 09/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_2.0| see 2.0]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.3 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.4 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.5 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.6 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.7.alpha || - || - || changes to support NetBeans 6.9, opnly available in the file section of the API project, [http://api.openoffice.org/files/documents/22/4772/org-openoffice-extensions-2.0.7.alpha.nbm org-openoffice-extensions-2.0.7.alpha.nbm]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;amp;nbsp;&amp;amp;nbsp;Detailed download statistics can be found [[OpenOffice_NetBeans_Integration/Releases/Download_Statistic| here]] (not up-to-date)&lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Releases/Release_1.2#Current_issues_concerning_NetBeans_6|Issues]] for using the plugin with NetBeans 6.&lt;br /&gt;
&lt;br /&gt;
= Planned Features =&lt;br /&gt;
The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.&lt;br /&gt;
&lt;br /&gt;
== New Project Types ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Scripting_Project_Type|OpenOffice.org Scripting Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will create an adapted J2SE class library project with special support for OpenOffice.org scripting. It should provide you the possibility to import scripts from OpenOffice.org and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_SmartTag_Project_Type|OpenOffice.org SmartTag Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will simplify the development of SmartTags for the OpenOffice.org Writer application.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_API_Library_Wrapper_Project_Type|OpenOffice.org API Library API Wrapper Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type should create a &amp;#039;&amp;#039;Library Wrapper Module&amp;#039;&amp;#039; to support simple usage of the OpenOffice.org API in your own projects. It bundles the necessary API jar files from OpenOffice.org in the library and in client applications. This of course is necessary to make use of the OpenOffice.org API in clients running on machines where no OpenOffice.org is installed and where the communication with OpenOffice.org is made over a remote socket connection.&lt;br /&gt;
&lt;br /&gt;
== Common Features ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Editor for xcu files&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.&lt;br /&gt;
&lt;br /&gt;
= Quality Assurance =&lt;br /&gt;
&lt;br /&gt;
If you find bugs please submit a new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=DEFECT issue] in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration_QA|Schedule for OpenOffice.org NetBeans Integration QA ]]&lt;br /&gt;
&lt;br /&gt;
= Localization =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Localization|Localization Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Things to be done =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/To-Dos|ToDo list]]&lt;br /&gt;
&lt;br /&gt;
= Feedback =&lt;br /&gt;
We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on [mailto:dev@api.openoffice.org dev@api.openoffice.org] (Note: you have to be subscribed on the mailing list).&lt;br /&gt;
&lt;br /&gt;
You can also submit new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=FEATURE feature] or [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=ENHANCEMENT enhancement] requests in the issue tracker in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:NetBeans]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Effort]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235372</id>
		<title>OpenOffice NetBeans Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235372"/>
		<updated>2014-07-08T13:05:23Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Build and install from source */ Clearer headline&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:OOo-Netbeans-Plugin.png|right]]&lt;br /&gt;
= Overview =&lt;br /&gt;
The OpenOffice.org API plugin for NetBeans simplifies the development of OpenOffice.org extensions. You can use the OpenOffice.org API to program OpenOffice.org, and automate remote or in process tasks extend OpenOffice.org with completely new functionality. The OpenOffice.org API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete OpenOffice.org extension packages (comparable to the NetBeans plugin modules).&lt;br /&gt;
&lt;br /&gt;
= Download and Installation =&lt;br /&gt;
The plugin appears automatically in Netbeans 6.5.x, 6.7.x, 6.8 (version 2.0.6) but is not listed for later versions.&lt;br /&gt;
&lt;br /&gt;
The plugin is available for download from [http://people.apache.org/~cmarcum/devtools/ http://people.apache.org/~cmarcum/devtools/] provided by Carl Marcum. Use 3.x versions for extension development for OpenOffice.org versions 3.0 thru 3.4. Use the latest 4.0.5 alpha version for extension development for Apache OpenOffice 4.x. This version is under active development and will be made available in the NetBeans plugin manager list when finished. Until then, remember that it is an &amp;#039;&amp;#039;&amp;#039;Beta&amp;#039;&amp;#039;&amp;#039; version.&lt;br /&gt;
&lt;br /&gt;
The configuration is self explanatory, for detailed information see [[OpenOffice_NetBeans_Integration#Configuration|Configuration]]. &lt;br /&gt;
&lt;br /&gt;
The source is available in the Apache OpenOffice.org source SVN repository in the &amp;#039;&amp;#039;&amp;#039;devtools&amp;#039;&amp;#039;&amp;#039; tree. The trunk is under development and the tagged 3.0.0.beta will build and run.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;[https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== From source ==&lt;br /&gt;
The NetBeans-plugin for 4.1.0 is beta and you need to compile by hand. It seems that it doesn&amp;#039;t support C++ development for now.&lt;br /&gt;
* Install NetBeans from https://netbeans.org/downloads/ take &amp;quot;Java SE&amp;quot; or &amp;quot;All&amp;quot; Package&lt;br /&gt;
* Under NetBeans create a new SVN (anonymous) repository to https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/ and checkout&lt;br /&gt;
* Create a NBM from the project you get from SVN. On errors install the needed plugins like junit.&lt;br /&gt;
* Install the NBM&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
Overview of the features included in the current plugin.&lt;br /&gt;
== Project Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New Project...&amp;amp;quot; and choose category &amp;amp;quot;OpenOffice.org&amp;amp;quot; to open a new project. All project types create working code. Once the project wizard is finished, a working&lt;br /&gt;
compilable project is created. It may not do anything, but it can be used&lt;br /&gt;
in OpenOffice.org from the beginning.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org Client Application Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE client application project with additional support of the &lt;br /&gt;
simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client &lt;br /&gt;
application. The result is a portable jar file that bootstraps OpenOffice.org on any supported OS.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an office extension package. The wizard collects the necessary information for new &lt;br /&gt;
Calc built-in functions and abstracts from the underlying UNO technology.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[General_UNO_Component_Project_Type|General UNO Component Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a&lt;br /&gt;
UNO component library and an OpenOffice.org extension package. The wizard collects information about services &lt;br /&gt;
and additional optional interfaces which should be implemented. Additional IDL types can also be&lt;br /&gt;
defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an OpenOffice.org extension package. The wizard collects the necessary information for an &lt;br /&gt;
OpenOffice.org Add-On component and generates an Add-On specific code skeleton.&lt;br /&gt;
&lt;br /&gt;
== File Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New File...&amp;amp;quot; and select &amp;amp;quot;OpenOffice.org&amp;amp;quot; as category to create a new file for an OpenOffice.org project. Note, that the OpenOffice.org category is available in all projects, although it only makes sense to use it in one of the projects stated above.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcu file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcu file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcs file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcs file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;UNO idl file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You can use a file type wizard to create idl files. In the first step, you must select the name location&lt;br /&gt;
and UNO type (e.g. Service or Interface). You can add additional &lt;br /&gt;
information in the second step. When an interface is created, the second step asks about&lt;br /&gt;
the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose&lt;br /&gt;
to also create an implementation object (only available for service or interface), a Java skeleton file implementing&lt;br /&gt;
your new idl file will also be created.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Java UNO Object file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be &lt;br /&gt;
registered in OpenOffice.org when your extension is deployed.&lt;br /&gt;
&lt;br /&gt;
== Create, deploy and debug ==&lt;br /&gt;
These are actions that are available in the context menu of an extension project in the &amp;amp;quot;Project&amp;amp;quot; &lt;br /&gt;
view.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Debug Extension in Target OpenOffice.org&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered in a temporary user installation of OpenOffice.org, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then OpenOffice.org is started with this user installation. To trigger the registered extension, an appropriate action must be done in OpenOffice.org.&lt;br /&gt;
Execution stops at any breakpoints added to the code of the extension and debugging can start from there.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Deploy and Run OpenOffice.org Extension&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered inside the user installation of OpenOffice.org. Then OpenOffice.org is started.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Create OXT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the &amp;amp;quot;dist&amp;amp;quot; directory of the project.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Publish Extension on OpenOffice.org Website&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The starting page for uploading and publishing your extension on api.services.openoffice.org is loaded in your default web browser.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;External Jars&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension&amp;#039;s classpath. A registered extension in OpenOffice.org can still use the functionality provided there.&lt;br /&gt;
The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
&lt;br /&gt;
Find here links to the specifications of the plugin on the api.openoffice.org page.&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration.odt OpenOffice.org Plugin for NetBeans]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-addon-wizard.odt OpenOffice.org Plugin for NetBeans: Add-On Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-calc-addin-wizard.odt OpenOffice.org Plugin for NetBeans: Add-In Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-component-wizard.odt OpenOffice.org Plugin for NetBeans: Component Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-debug-component.odt OpenOffice.org Plugin for NetBeans: Debug Feature]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-new-idl-type.odt OpenOffice.org Plugin for NetBeans: IDL type support]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-description-xml.odt OpenOffice.org Plugin for NetBeans: Support description.xml]&lt;br /&gt;
&lt;br /&gt;
= Working with the plugin =&lt;br /&gt;
The following section describes how you can work with the plugin and describes the requirements because the plugin  make use of some external stuff provided by an office and the OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
The plugin works only in combination with OpenOffice.org and an appropriate OpenOffice.org Software Development Kit (SDK). The minimal suggested version is OpenOffice.org 2.0.4. With earlier versions, some features of the plugin will not work.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org OpenOffice.org]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[http://www.sun.com/staroffice StarOffice 8]&amp;#039;&amp;#039;&amp;#039; or higher versions of both programs&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org/sdk.html OpenOffice.org Software Development Kit (SDK)]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Note that the versions of OpenOffice.org and the OpenOffice.org SDK must match for everything to work.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
Before you can use the new project types you must configure the plugin because it needs an installed OpenOffice.org and OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
* As default settings, a standard installation will be found by the plugin - but only if OpenOffice.org together with the SDK are present.&lt;br /&gt;
* When you choose the OpenOffice.org installation and an appropriate SDK is found, that SDK is chosen, the &amp;amp;quot;OpenOffice.org SDK Installation&amp;amp;quot; field is then disabled.&lt;br /&gt;
* If you change the OpenOffice.org or OpenOffice.org SDK installation, these changes are effective for projects created from now on only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For changing the office and SDK installation please choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API plugin&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and select a valid OpenOffice.org and OpenOffice.org SDK installation. &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:OpenOffice_Extensions_Plugin_Options.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The configuration step automatically installs a new OpenOffice.org library which can be used in other projects to support the OpenOffice.org API. Including this library in your own projects enables context sensitive help and code completion.&lt;br /&gt;
&lt;br /&gt;
Note: on Debian/Ubuntu, the OpenOffice.org installation directory is &amp;lt;code&amp;gt;/usr/lib/openoffice/&amp;lt;/code&amp;gt;. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script &amp;lt;code&amp;gt;/usr/bin/ooffice&amp;lt;/code&amp;gt; to see where the &amp;lt;code&amp;gt;ooqstart&amp;lt;/code&amp;gt; executable is in your installation.&lt;br /&gt;
&lt;br /&gt;
== Working with new Project Types ==&lt;br /&gt;
The plugin integrates four new project types under the category &amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Calc Add-Ins&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Client Application&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Component&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; OpenOffice.org -&amp;gt; &amp;lt;project_type&amp;gt;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
For more details about the project types please take a look at&lt;br /&gt;
*[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org UNO Client Application Project Type]]&lt;br /&gt;
*[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&lt;br /&gt;
*[[General_UNO_Component_Project_Type|OpenOffice.org Component Project Type]]&lt;br /&gt;
*[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&lt;br /&gt;
&lt;br /&gt;
== Migrate Projects ==&lt;br /&gt;
To migrate projects from an older version of the plugin to a new one is not necessary - the plugin itself will take care of that: build-uno-impl.xml and the project-uno.properties are updated, when updated versions of these files are needed for new features of the updated plugin. Note that build-uno-impl.xml will be overwritten, but project-uno.properties not. In the properties file, only new entries are added, existing ones are kept as they are. The update of the files happens when an old project is opened with a new version of the plugin and for all opened projects when the new plugin is downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
When migrating from one Office version to another (or porting a project across platforms), only a library has to be changed, called &amp;amp;quot;OpenOffice.org &amp;lt;version_number&amp;gt;&amp;amp;quot; (or &amp;amp;quot;StarOffice &amp;lt;version_number&amp;gt;&amp;amp;quot;). Choose &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Libraries&amp;#039;&amp;#039;&amp;#039; to get an overview of the existing libraries. A library is created when a valid OpenOffice.org and OpenOffice.org SDK is selected in &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API Plugin&amp;#039;&amp;#039;&amp;#039; (See [[OpenOffice_NetBeans_Integration#Configuration|Configuration]] for more details).&lt;br /&gt;
* To change the library, click right on the project in the &amp;#039;&amp;#039;&amp;#039;Project&amp;#039;&amp;#039;&amp;#039; window and open the properties. Select &amp;#039;&amp;#039;&amp;#039;Libraries&amp;#039;&amp;#039;&amp;#039; as category and remove the one that points to the old installation and add the new one.&lt;br /&gt;
* When porting the project across platforms, NetBeans notifies that a reference problem exists. The steps for changing the libraries also help in this case.&lt;br /&gt;
&lt;br /&gt;
== Known Problems and Missing Features ==&lt;br /&gt;
&lt;br /&gt;
* Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.&lt;br /&gt;
* &amp;amp;quot;Red Dot Problem&amp;amp;quot;: When you have created a project that supports own idl files (e.g. a Clac AddIn), a &amp;amp;quot;clean&amp;amp;quot; on the project will produce &amp;amp;quot;red dots&amp;amp;quot; that show that imported functionality is missing. The cause for this is the deleted jar file with the idl types that are used in your project. Although this does not seem to be the case, a compile will work and solve the problem. Sometimes the signs appear when &amp;amp;quot;clean and build&amp;amp;quot; is chosen - here the compiled idl files exist, but NetBeans does not recognize that. Open the offending Java file to solve that. Solution: compile idl files in the background and produce a &amp;amp;quot;shadow&amp;amp;quot; jar file in a temp directory that can be used even if the &amp;amp;quot;official&amp;amp;quot; file in the &amp;lt;project_name&amp;gt;/dist folder is deleted.&lt;br /&gt;
* With NetBeans versions at least 6.1 there is an update problem regarding NetBeans property sheets and node views: property sheet changes are not reflected in the node view. Seems like the notify mechanism for these updates has changed.&lt;br /&gt;
&lt;br /&gt;
= Releases =&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=5 cellspacing=0 border=1 style=&amp;quot;border-collapse:collapse; margin-left: 3em; border-color: #333;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color: #DEDEDE;&amp;quot;&lt;br /&gt;
| Release Version || Planned Release Date || Release Date || Planned Features&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.0 || 05/08/07 || 05/08/07 || -&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1 || 09/01/07 || 09/18/07 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1| see 1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.1 || 03/08 || 03/20/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.2 || 04/08 || 04/30/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.2]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.3 || 06/30/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.3]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0 || 09/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_2.0| see 2.0]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.3 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.4 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.5 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.6 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.7.alpha || - || - || changes to support NetBeans 6.9, opnly available in the file section of the API project, [http://api.openoffice.org/files/documents/22/4772/org-openoffice-extensions-2.0.7.alpha.nbm org-openoffice-extensions-2.0.7.alpha.nbm]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;amp;nbsp;&amp;amp;nbsp;Detailed download statistics can be found [[OpenOffice_NetBeans_Integration/Releases/Download_Statistic| here]] (not up-to-date)&lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Releases/Release_1.2#Current_issues_concerning_NetBeans_6|Issues]] for using the plugin with NetBeans 6.&lt;br /&gt;
&lt;br /&gt;
= Planned Features =&lt;br /&gt;
The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.&lt;br /&gt;
&lt;br /&gt;
== New Project Types ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Scripting_Project_Type|OpenOffice.org Scripting Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will create an adapted J2SE class library project with special support for OpenOffice.org scripting. It should provide you the possibility to import scripts from OpenOffice.org and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_SmartTag_Project_Type|OpenOffice.org SmartTag Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will simplify the development of SmartTags for the OpenOffice.org Writer application.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_API_Library_Wrapper_Project_Type|OpenOffice.org API Library API Wrapper Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type should create a &amp;#039;&amp;#039;Library Wrapper Module&amp;#039;&amp;#039; to support simple usage of the OpenOffice.org API in your own projects. It bundles the necessary API jar files from OpenOffice.org in the library and in client applications. This of course is necessary to make use of the OpenOffice.org API in clients running on machines where no OpenOffice.org is installed and where the communication with OpenOffice.org is made over a remote socket connection.&lt;br /&gt;
&lt;br /&gt;
== Common Features ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Editor for xcu files&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.&lt;br /&gt;
&lt;br /&gt;
= Quality Assurance =&lt;br /&gt;
&lt;br /&gt;
If you find bugs please submit a new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=DEFECT issue] in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration_QA|Schedule for OpenOffice.org NetBeans Integration QA ]]&lt;br /&gt;
&lt;br /&gt;
= Localization =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Localization|Localization Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Things to be done =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/To-Dos|ToDo list]]&lt;br /&gt;
&lt;br /&gt;
= Feedback =&lt;br /&gt;
We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on [mailto:dev@api.openoffice.org dev@api.openoffice.org] (Note: you have to be subscribed on the mailing list).&lt;br /&gt;
&lt;br /&gt;
You can also submit new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=FEATURE feature] or [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=ENHANCEMENT enhancement] requests in the issue tracker in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:NetBeans]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Effort]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235371</id>
		<title>OpenOffice NetBeans Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235371"/>
		<updated>2014-07-08T12:34:01Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Build and install from source */ formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:OOo-Netbeans-Plugin.png|right]]&lt;br /&gt;
= Overview =&lt;br /&gt;
The OpenOffice.org API plugin for NetBeans simplifies the development of OpenOffice.org extensions. You can use the OpenOffice.org API to program OpenOffice.org, and automate remote or in process tasks extend OpenOffice.org with completely new functionality. The OpenOffice.org API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete OpenOffice.org extension packages (comparable to the NetBeans plugin modules).&lt;br /&gt;
&lt;br /&gt;
= Download and Installation =&lt;br /&gt;
The plugin appears automatically in Netbeans 6.5.x, 6.7.x, 6.8 (version 2.0.6) but is not listed for later versions.&lt;br /&gt;
&lt;br /&gt;
The plugin is available for download from [http://people.apache.org/~cmarcum/devtools/ http://people.apache.org/~cmarcum/devtools/] provided by Carl Marcum. Use 3.x versions for extension development for OpenOffice.org versions 3.0 thru 3.4. Use the latest 4.0.5 alpha version for extension development for Apache OpenOffice 4.x. This version is under active development and will be made available in the NetBeans plugin manager list when finished. Until then, remember that it is an &amp;#039;&amp;#039;&amp;#039;Beta&amp;#039;&amp;#039;&amp;#039; version.&lt;br /&gt;
&lt;br /&gt;
The configuration is self explanatory, for detailed information see [[OpenOffice_NetBeans_Integration#Configuration|Configuration]]. &lt;br /&gt;
&lt;br /&gt;
The source is available in the Apache OpenOffice.org source SVN repository in the &amp;#039;&amp;#039;&amp;#039;devtools&amp;#039;&amp;#039;&amp;#039; tree. The trunk is under development and the tagged 3.0.0.beta will build and run.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;[https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Build and install from source ==&lt;br /&gt;
The NetBeans-plugin for 4.1.0 is beta and you need to compile by hand. It seems that it doesn&amp;#039;t support C++ development for now.&lt;br /&gt;
* Install NetBeans 8.0 from https://netbeans.org/downloads/ take &amp;quot;Java SE&amp;quot; or &amp;quot;All&amp;quot; Package&lt;br /&gt;
* Under NetBeans create a new SVN (anonymous) repository to https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/&lt;br /&gt;
* Create a NBM from the project you get from SVN. On errors install the needed plugins like junit.&lt;br /&gt;
* Install the NBM&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
Overview of the features included in the current plugin.&lt;br /&gt;
== Project Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New Project...&amp;amp;quot; and choose category &amp;amp;quot;OpenOffice.org&amp;amp;quot; to open a new project. All project types create working code. Once the project wizard is finished, a working&lt;br /&gt;
compilable project is created. It may not do anything, but it can be used&lt;br /&gt;
in OpenOffice.org from the beginning.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org Client Application Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE client application project with additional support of the &lt;br /&gt;
simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client &lt;br /&gt;
application. The result is a portable jar file that bootstraps OpenOffice.org on any supported OS.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an office extension package. The wizard collects the necessary information for new &lt;br /&gt;
Calc built-in functions and abstracts from the underlying UNO technology.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[General_UNO_Component_Project_Type|General UNO Component Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a&lt;br /&gt;
UNO component library and an OpenOffice.org extension package. The wizard collects information about services &lt;br /&gt;
and additional optional interfaces which should be implemented. Additional IDL types can also be&lt;br /&gt;
defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an OpenOffice.org extension package. The wizard collects the necessary information for an &lt;br /&gt;
OpenOffice.org Add-On component and generates an Add-On specific code skeleton.&lt;br /&gt;
&lt;br /&gt;
== File Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New File...&amp;amp;quot; and select &amp;amp;quot;OpenOffice.org&amp;amp;quot; as category to create a new file for an OpenOffice.org project. Note, that the OpenOffice.org category is available in all projects, although it only makes sense to use it in one of the projects stated above.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcu file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcu file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcs file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcs file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;UNO idl file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You can use a file type wizard to create idl files. In the first step, you must select the name location&lt;br /&gt;
and UNO type (e.g. Service or Interface). You can add additional &lt;br /&gt;
information in the second step. When an interface is created, the second step asks about&lt;br /&gt;
the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose&lt;br /&gt;
to also create an implementation object (only available for service or interface), a Java skeleton file implementing&lt;br /&gt;
your new idl file will also be created.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Java UNO Object file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be &lt;br /&gt;
registered in OpenOffice.org when your extension is deployed.&lt;br /&gt;
&lt;br /&gt;
== Create, deploy and debug ==&lt;br /&gt;
These are actions that are available in the context menu of an extension project in the &amp;amp;quot;Project&amp;amp;quot; &lt;br /&gt;
view.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Debug Extension in Target OpenOffice.org&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered in a temporary user installation of OpenOffice.org, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then OpenOffice.org is started with this user installation. To trigger the registered extension, an appropriate action must be done in OpenOffice.org.&lt;br /&gt;
Execution stops at any breakpoints added to the code of the extension and debugging can start from there.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Deploy and Run OpenOffice.org Extension&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered inside the user installation of OpenOffice.org. Then OpenOffice.org is started.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Create OXT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the &amp;amp;quot;dist&amp;amp;quot; directory of the project.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Publish Extension on OpenOffice.org Website&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The starting page for uploading and publishing your extension on api.services.openoffice.org is loaded in your default web browser.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;External Jars&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension&amp;#039;s classpath. A registered extension in OpenOffice.org can still use the functionality provided there.&lt;br /&gt;
The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
&lt;br /&gt;
Find here links to the specifications of the plugin on the api.openoffice.org page.&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration.odt OpenOffice.org Plugin for NetBeans]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-addon-wizard.odt OpenOffice.org Plugin for NetBeans: Add-On Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-calc-addin-wizard.odt OpenOffice.org Plugin for NetBeans: Add-In Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-component-wizard.odt OpenOffice.org Plugin for NetBeans: Component Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-debug-component.odt OpenOffice.org Plugin for NetBeans: Debug Feature]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-new-idl-type.odt OpenOffice.org Plugin for NetBeans: IDL type support]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-description-xml.odt OpenOffice.org Plugin for NetBeans: Support description.xml]&lt;br /&gt;
&lt;br /&gt;
= Working with the plugin =&lt;br /&gt;
The following section describes how you can work with the plugin and describes the requirements because the plugin  make use of some external stuff provided by an office and the OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
The plugin works only in combination with OpenOffice.org and an appropriate OpenOffice.org Software Development Kit (SDK). The minimal suggested version is OpenOffice.org 2.0.4. With earlier versions, some features of the plugin will not work.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org OpenOffice.org]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[http://www.sun.com/staroffice StarOffice 8]&amp;#039;&amp;#039;&amp;#039; or higher versions of both programs&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org/sdk.html OpenOffice.org Software Development Kit (SDK)]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Note that the versions of OpenOffice.org and the OpenOffice.org SDK must match for everything to work.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
Before you can use the new project types you must configure the plugin because it needs an installed OpenOffice.org and OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
* As default settings, a standard installation will be found by the plugin - but only if OpenOffice.org together with the SDK are present.&lt;br /&gt;
* When you choose the OpenOffice.org installation and an appropriate SDK is found, that SDK is chosen, the &amp;amp;quot;OpenOffice.org SDK Installation&amp;amp;quot; field is then disabled.&lt;br /&gt;
* If you change the OpenOffice.org or OpenOffice.org SDK installation, these changes are effective for projects created from now on only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For changing the office and SDK installation please choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API plugin&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and select a valid OpenOffice.org and OpenOffice.org SDK installation. &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:OpenOffice_Extensions_Plugin_Options.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The configuration step automatically installs a new OpenOffice.org library which can be used in other projects to support the OpenOffice.org API. Including this library in your own projects enables context sensitive help and code completion.&lt;br /&gt;
&lt;br /&gt;
Note: on Debian/Ubuntu, the OpenOffice.org installation directory is &amp;lt;code&amp;gt;/usr/lib/openoffice/&amp;lt;/code&amp;gt;. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script &amp;lt;code&amp;gt;/usr/bin/ooffice&amp;lt;/code&amp;gt; to see where the &amp;lt;code&amp;gt;ooqstart&amp;lt;/code&amp;gt; executable is in your installation.&lt;br /&gt;
&lt;br /&gt;
== Working with new Project Types ==&lt;br /&gt;
The plugin integrates four new project types under the category &amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Calc Add-Ins&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Client Application&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Component&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; OpenOffice.org -&amp;gt; &amp;lt;project_type&amp;gt;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
For more details about the project types please take a look at&lt;br /&gt;
*[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org UNO Client Application Project Type]]&lt;br /&gt;
*[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&lt;br /&gt;
*[[General_UNO_Component_Project_Type|OpenOffice.org Component Project Type]]&lt;br /&gt;
*[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&lt;br /&gt;
&lt;br /&gt;
== Migrate Projects ==&lt;br /&gt;
To migrate projects from an older version of the plugin to a new one is not necessary - the plugin itself will take care of that: build-uno-impl.xml and the project-uno.properties are updated, when updated versions of these files are needed for new features of the updated plugin. Note that build-uno-impl.xml will be overwritten, but project-uno.properties not. In the properties file, only new entries are added, existing ones are kept as they are. The update of the files happens when an old project is opened with a new version of the plugin and for all opened projects when the new plugin is downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
When migrating from one Office version to another (or porting a project across platforms), only a library has to be changed, called &amp;amp;quot;OpenOffice.org &amp;lt;version_number&amp;gt;&amp;amp;quot; (or &amp;amp;quot;StarOffice &amp;lt;version_number&amp;gt;&amp;amp;quot;). Choose &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Libraries&amp;#039;&amp;#039;&amp;#039; to get an overview of the existing libraries. A library is created when a valid OpenOffice.org and OpenOffice.org SDK is selected in &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API Plugin&amp;#039;&amp;#039;&amp;#039; (See [[OpenOffice_NetBeans_Integration#Configuration|Configuration]] for more details).&lt;br /&gt;
* To change the library, click right on the project in the &amp;#039;&amp;#039;&amp;#039;Project&amp;#039;&amp;#039;&amp;#039; window and open the properties. Select &amp;#039;&amp;#039;&amp;#039;Libraries&amp;#039;&amp;#039;&amp;#039; as category and remove the one that points to the old installation and add the new one.&lt;br /&gt;
* When porting the project across platforms, NetBeans notifies that a reference problem exists. The steps for changing the libraries also help in this case.&lt;br /&gt;
&lt;br /&gt;
== Known Problems and Missing Features ==&lt;br /&gt;
&lt;br /&gt;
* Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.&lt;br /&gt;
* &amp;amp;quot;Red Dot Problem&amp;amp;quot;: When you have created a project that supports own idl files (e.g. a Clac AddIn), a &amp;amp;quot;clean&amp;amp;quot; on the project will produce &amp;amp;quot;red dots&amp;amp;quot; that show that imported functionality is missing. The cause for this is the deleted jar file with the idl types that are used in your project. Although this does not seem to be the case, a compile will work and solve the problem. Sometimes the signs appear when &amp;amp;quot;clean and build&amp;amp;quot; is chosen - here the compiled idl files exist, but NetBeans does not recognize that. Open the offending Java file to solve that. Solution: compile idl files in the background and produce a &amp;amp;quot;shadow&amp;amp;quot; jar file in a temp directory that can be used even if the &amp;amp;quot;official&amp;amp;quot; file in the &amp;lt;project_name&amp;gt;/dist folder is deleted.&lt;br /&gt;
* With NetBeans versions at least 6.1 there is an update problem regarding NetBeans property sheets and node views: property sheet changes are not reflected in the node view. Seems like the notify mechanism for these updates has changed.&lt;br /&gt;
&lt;br /&gt;
= Releases =&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=5 cellspacing=0 border=1 style=&amp;quot;border-collapse:collapse; margin-left: 3em; border-color: #333;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color: #DEDEDE;&amp;quot;&lt;br /&gt;
| Release Version || Planned Release Date || Release Date || Planned Features&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.0 || 05/08/07 || 05/08/07 || -&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1 || 09/01/07 || 09/18/07 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1| see 1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.1 || 03/08 || 03/20/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.2 || 04/08 || 04/30/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.2]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.3 || 06/30/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.3]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0 || 09/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_2.0| see 2.0]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.3 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.4 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.5 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.6 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.7.alpha || - || - || changes to support NetBeans 6.9, opnly available in the file section of the API project, [http://api.openoffice.org/files/documents/22/4772/org-openoffice-extensions-2.0.7.alpha.nbm org-openoffice-extensions-2.0.7.alpha.nbm]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;amp;nbsp;&amp;amp;nbsp;Detailed download statistics can be found [[OpenOffice_NetBeans_Integration/Releases/Download_Statistic| here]] (not up-to-date)&lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Releases/Release_1.2#Current_issues_concerning_NetBeans_6|Issues]] for using the plugin with NetBeans 6.&lt;br /&gt;
&lt;br /&gt;
= Planned Features =&lt;br /&gt;
The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.&lt;br /&gt;
&lt;br /&gt;
== New Project Types ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Scripting_Project_Type|OpenOffice.org Scripting Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will create an adapted J2SE class library project with special support for OpenOffice.org scripting. It should provide you the possibility to import scripts from OpenOffice.org and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_SmartTag_Project_Type|OpenOffice.org SmartTag Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will simplify the development of SmartTags for the OpenOffice.org Writer application.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_API_Library_Wrapper_Project_Type|OpenOffice.org API Library API Wrapper Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type should create a &amp;#039;&amp;#039;Library Wrapper Module&amp;#039;&amp;#039; to support simple usage of the OpenOffice.org API in your own projects. It bundles the necessary API jar files from OpenOffice.org in the library and in client applications. This of course is necessary to make use of the OpenOffice.org API in clients running on machines where no OpenOffice.org is installed and where the communication with OpenOffice.org is made over a remote socket connection.&lt;br /&gt;
&lt;br /&gt;
== Common Features ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Editor for xcu files&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.&lt;br /&gt;
&lt;br /&gt;
= Quality Assurance =&lt;br /&gt;
&lt;br /&gt;
If you find bugs please submit a new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=DEFECT issue] in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration_QA|Schedule for OpenOffice.org NetBeans Integration QA ]]&lt;br /&gt;
&lt;br /&gt;
= Localization =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Localization|Localization Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Things to be done =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/To-Dos|ToDo list]]&lt;br /&gt;
&lt;br /&gt;
= Feedback =&lt;br /&gt;
We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on [mailto:dev@api.openoffice.org dev@api.openoffice.org] (Note: you have to be subscribed on the mailing list).&lt;br /&gt;
&lt;br /&gt;
You can also submit new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=FEATURE feature] or [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=ENHANCEMENT enhancement] requests in the issue tracker in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:NetBeans]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Effort]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235370</id>
		<title>OpenOffice NetBeans Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235370"/>
		<updated>2014-07-08T12:31:37Z</updated>

		<summary type="html">&lt;p&gt;Global667: Updating the installation rules to 4.1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:OOo-Netbeans-Plugin.png|right]]&lt;br /&gt;
= Overview =&lt;br /&gt;
The OpenOffice.org API plugin for NetBeans simplifies the development of OpenOffice.org extensions. You can use the OpenOffice.org API to program OpenOffice.org, and automate remote or in process tasks extend OpenOffice.org with completely new functionality. The OpenOffice.org API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete OpenOffice.org extension packages (comparable to the NetBeans plugin modules).&lt;br /&gt;
&lt;br /&gt;
= Download and Installation =&lt;br /&gt;
The plugin appears automatically in Netbeans 6.5.x, 6.7.x, 6.8 (version 2.0.6) but is not listed for later versions.&lt;br /&gt;
&lt;br /&gt;
The plugin is available for download from [http://people.apache.org/~cmarcum/devtools/ http://people.apache.org/~cmarcum/devtools/] provided by Carl Marcum. Use 3.x versions for extension development for OpenOffice.org versions 3.0 thru 3.4. Use the latest 4.0.5 alpha version for extension development for Apache OpenOffice 4.x. This version is under active development and will be made available in the NetBeans plugin manager list when finished. Until then, remember that it is an &amp;#039;&amp;#039;&amp;#039;Beta&amp;#039;&amp;#039;&amp;#039; version.&lt;br /&gt;
&lt;br /&gt;
The configuration is self explanatory, for detailed information see [[OpenOffice_NetBeans_Integration#Configuration|Configuration]]. &lt;br /&gt;
&lt;br /&gt;
The source is available in the Apache OpenOffice.org source SVN repository in the &amp;#039;&amp;#039;&amp;#039;devtools&amp;#039;&amp;#039;&amp;#039; tree. The trunk is under development and the tagged 3.0.0.beta will build and run.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;[https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Build and install from source ==&lt;br /&gt;
The NetBeans-plugin for 4.1.0 is beta and you need to compile by hand. It seems that it doesn&amp;#039;t support C++ development for now.&lt;br /&gt;
* Install NetBeans 8.0 from https://netbeans.org/downloads/ take &amp;quot;Java SE&amp;quot; or &amp;quot;All&amp;quot; Package&lt;br /&gt;
* Under NetBeans create a new SVN (anonymous) repository to &amp;lt;blockquote&amp;gt; https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/ &amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* Create a NBM from the project you get from SVN. On errors install the needed plugins like junit.&lt;br /&gt;
* Install the NBM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
Overview of the features included in the current plugin.&lt;br /&gt;
== Project Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New Project...&amp;amp;quot; and choose category &amp;amp;quot;OpenOffice.org&amp;amp;quot; to open a new project. All project types create working code. Once the project wizard is finished, a working&lt;br /&gt;
compilable project is created. It may not do anything, but it can be used&lt;br /&gt;
in OpenOffice.org from the beginning.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org Client Application Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE client application project with additional support of the &lt;br /&gt;
simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client &lt;br /&gt;
application. The result is a portable jar file that bootstraps OpenOffice.org on any supported OS.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an office extension package. The wizard collects the necessary information for new &lt;br /&gt;
Calc built-in functions and abstracts from the underlying UNO technology.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[General_UNO_Component_Project_Type|General UNO Component Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a&lt;br /&gt;
UNO component library and an OpenOffice.org extension package. The wizard collects information about services &lt;br /&gt;
and additional optional interfaces which should be implemented. Additional IDL types can also be&lt;br /&gt;
defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an OpenOffice.org extension package. The wizard collects the necessary information for an &lt;br /&gt;
OpenOffice.org Add-On component and generates an Add-On specific code skeleton.&lt;br /&gt;
&lt;br /&gt;
== File Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New File...&amp;amp;quot; and select &amp;amp;quot;OpenOffice.org&amp;amp;quot; as category to create a new file for an OpenOffice.org project. Note, that the OpenOffice.org category is available in all projects, although it only makes sense to use it in one of the projects stated above.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcu file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcu file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcs file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcs file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;UNO idl file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You can use a file type wizard to create idl files. In the first step, you must select the name location&lt;br /&gt;
and UNO type (e.g. Service or Interface). You can add additional &lt;br /&gt;
information in the second step. When an interface is created, the second step asks about&lt;br /&gt;
the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose&lt;br /&gt;
to also create an implementation object (only available for service or interface), a Java skeleton file implementing&lt;br /&gt;
your new idl file will also be created.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Java UNO Object file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be &lt;br /&gt;
registered in OpenOffice.org when your extension is deployed.&lt;br /&gt;
&lt;br /&gt;
== Create, deploy and debug ==&lt;br /&gt;
These are actions that are available in the context menu of an extension project in the &amp;amp;quot;Project&amp;amp;quot; &lt;br /&gt;
view.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Debug Extension in Target OpenOffice.org&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered in a temporary user installation of OpenOffice.org, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then OpenOffice.org is started with this user installation. To trigger the registered extension, an appropriate action must be done in OpenOffice.org.&lt;br /&gt;
Execution stops at any breakpoints added to the code of the extension and debugging can start from there.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Deploy and Run OpenOffice.org Extension&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered inside the user installation of OpenOffice.org. Then OpenOffice.org is started.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Create OXT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the &amp;amp;quot;dist&amp;amp;quot; directory of the project.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Publish Extension on OpenOffice.org Website&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The starting page for uploading and publishing your extension on api.services.openoffice.org is loaded in your default web browser.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;External Jars&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension&amp;#039;s classpath. A registered extension in OpenOffice.org can still use the functionality provided there.&lt;br /&gt;
The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
&lt;br /&gt;
Find here links to the specifications of the plugin on the api.openoffice.org page.&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration.odt OpenOffice.org Plugin for NetBeans]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-addon-wizard.odt OpenOffice.org Plugin for NetBeans: Add-On Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-calc-addin-wizard.odt OpenOffice.org Plugin for NetBeans: Add-In Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-component-wizard.odt OpenOffice.org Plugin for NetBeans: Component Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-debug-component.odt OpenOffice.org Plugin for NetBeans: Debug Feature]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-new-idl-type.odt OpenOffice.org Plugin for NetBeans: IDL type support]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-description-xml.odt OpenOffice.org Plugin for NetBeans: Support description.xml]&lt;br /&gt;
&lt;br /&gt;
= Working with the plugin =&lt;br /&gt;
The following section describes how you can work with the plugin and describes the requirements because the plugin  make use of some external stuff provided by an office and the OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
The plugin works only in combination with OpenOffice.org and an appropriate OpenOffice.org Software Development Kit (SDK). The minimal suggested version is OpenOffice.org 2.0.4. With earlier versions, some features of the plugin will not work.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org OpenOffice.org]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[http://www.sun.com/staroffice StarOffice 8]&amp;#039;&amp;#039;&amp;#039; or higher versions of both programs&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org/sdk.html OpenOffice.org Software Development Kit (SDK)]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Note that the versions of OpenOffice.org and the OpenOffice.org SDK must match for everything to work.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
Before you can use the new project types you must configure the plugin because it needs an installed OpenOffice.org and OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
* As default settings, a standard installation will be found by the plugin - but only if OpenOffice.org together with the SDK are present.&lt;br /&gt;
* When you choose the OpenOffice.org installation and an appropriate SDK is found, that SDK is chosen, the &amp;amp;quot;OpenOffice.org SDK Installation&amp;amp;quot; field is then disabled.&lt;br /&gt;
* If you change the OpenOffice.org or OpenOffice.org SDK installation, these changes are effective for projects created from now on only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For changing the office and SDK installation please choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API plugin&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and select a valid OpenOffice.org and OpenOffice.org SDK installation. &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:OpenOffice_Extensions_Plugin_Options.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The configuration step automatically installs a new OpenOffice.org library which can be used in other projects to support the OpenOffice.org API. Including this library in your own projects enables context sensitive help and code completion.&lt;br /&gt;
&lt;br /&gt;
Note: on Debian/Ubuntu, the OpenOffice.org installation directory is &amp;lt;code&amp;gt;/usr/lib/openoffice/&amp;lt;/code&amp;gt;. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script &amp;lt;code&amp;gt;/usr/bin/ooffice&amp;lt;/code&amp;gt; to see where the &amp;lt;code&amp;gt;ooqstart&amp;lt;/code&amp;gt; executable is in your installation.&lt;br /&gt;
&lt;br /&gt;
== Working with new Project Types ==&lt;br /&gt;
The plugin integrates four new project types under the category &amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Calc Add-Ins&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Client Application&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Component&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; OpenOffice.org -&amp;gt; &amp;lt;project_type&amp;gt;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
For more details about the project types please take a look at&lt;br /&gt;
*[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org UNO Client Application Project Type]]&lt;br /&gt;
*[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&lt;br /&gt;
*[[General_UNO_Component_Project_Type|OpenOffice.org Component Project Type]]&lt;br /&gt;
*[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&lt;br /&gt;
&lt;br /&gt;
== Migrate Projects ==&lt;br /&gt;
To migrate projects from an older version of the plugin to a new one is not necessary - the plugin itself will take care of that: build-uno-impl.xml and the project-uno.properties are updated, when updated versions of these files are needed for new features of the updated plugin. Note that build-uno-impl.xml will be overwritten, but project-uno.properties not. In the properties file, only new entries are added, existing ones are kept as they are. The update of the files happens when an old project is opened with a new version of the plugin and for all opened projects when the new plugin is downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
When migrating from one Office version to another (or porting a project across platforms), only a library has to be changed, called &amp;amp;quot;OpenOffice.org &amp;lt;version_number&amp;gt;&amp;amp;quot; (or &amp;amp;quot;StarOffice &amp;lt;version_number&amp;gt;&amp;amp;quot;). Choose &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Libraries&amp;#039;&amp;#039;&amp;#039; to get an overview of the existing libraries. A library is created when a valid OpenOffice.org and OpenOffice.org SDK is selected in &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API Plugin&amp;#039;&amp;#039;&amp;#039; (See [[OpenOffice_NetBeans_Integration#Configuration|Configuration]] for more details).&lt;br /&gt;
* To change the library, click right on the project in the &amp;#039;&amp;#039;&amp;#039;Project&amp;#039;&amp;#039;&amp;#039; window and open the properties. Select &amp;#039;&amp;#039;&amp;#039;Libraries&amp;#039;&amp;#039;&amp;#039; as category and remove the one that points to the old installation and add the new one.&lt;br /&gt;
* When porting the project across platforms, NetBeans notifies that a reference problem exists. The steps for changing the libraries also help in this case.&lt;br /&gt;
&lt;br /&gt;
== Known Problems and Missing Features ==&lt;br /&gt;
&lt;br /&gt;
* Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.&lt;br /&gt;
* &amp;amp;quot;Red Dot Problem&amp;amp;quot;: When you have created a project that supports own idl files (e.g. a Clac AddIn), a &amp;amp;quot;clean&amp;amp;quot; on the project will produce &amp;amp;quot;red dots&amp;amp;quot; that show that imported functionality is missing. The cause for this is the deleted jar file with the idl types that are used in your project. Although this does not seem to be the case, a compile will work and solve the problem. Sometimes the signs appear when &amp;amp;quot;clean and build&amp;amp;quot; is chosen - here the compiled idl files exist, but NetBeans does not recognize that. Open the offending Java file to solve that. Solution: compile idl files in the background and produce a &amp;amp;quot;shadow&amp;amp;quot; jar file in a temp directory that can be used even if the &amp;amp;quot;official&amp;amp;quot; file in the &amp;lt;project_name&amp;gt;/dist folder is deleted.&lt;br /&gt;
* With NetBeans versions at least 6.1 there is an update problem regarding NetBeans property sheets and node views: property sheet changes are not reflected in the node view. Seems like the notify mechanism for these updates has changed.&lt;br /&gt;
&lt;br /&gt;
= Releases =&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=5 cellspacing=0 border=1 style=&amp;quot;border-collapse:collapse; margin-left: 3em; border-color: #333;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color: #DEDEDE;&amp;quot;&lt;br /&gt;
| Release Version || Planned Release Date || Release Date || Planned Features&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.0 || 05/08/07 || 05/08/07 || -&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1 || 09/01/07 || 09/18/07 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1| see 1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.1 || 03/08 || 03/20/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.2 || 04/08 || 04/30/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.2]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.3 || 06/30/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.3]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0 || 09/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_2.0| see 2.0]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.3 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.4 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.5 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.6 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.7.alpha || - || - || changes to support NetBeans 6.9, opnly available in the file section of the API project, [http://api.openoffice.org/files/documents/22/4772/org-openoffice-extensions-2.0.7.alpha.nbm org-openoffice-extensions-2.0.7.alpha.nbm]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;amp;nbsp;&amp;amp;nbsp;Detailed download statistics can be found [[OpenOffice_NetBeans_Integration/Releases/Download_Statistic| here]] (not up-to-date)&lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Releases/Release_1.2#Current_issues_concerning_NetBeans_6|Issues]] for using the plugin with NetBeans 6.&lt;br /&gt;
&lt;br /&gt;
= Planned Features =&lt;br /&gt;
The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.&lt;br /&gt;
&lt;br /&gt;
== New Project Types ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Scripting_Project_Type|OpenOffice.org Scripting Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will create an adapted J2SE class library project with special support for OpenOffice.org scripting. It should provide you the possibility to import scripts from OpenOffice.org and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_SmartTag_Project_Type|OpenOffice.org SmartTag Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will simplify the development of SmartTags for the OpenOffice.org Writer application.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_API_Library_Wrapper_Project_Type|OpenOffice.org API Library API Wrapper Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type should create a &amp;#039;&amp;#039;Library Wrapper Module&amp;#039;&amp;#039; to support simple usage of the OpenOffice.org API in your own projects. It bundles the necessary API jar files from OpenOffice.org in the library and in client applications. This of course is necessary to make use of the OpenOffice.org API in clients running on machines where no OpenOffice.org is installed and where the communication with OpenOffice.org is made over a remote socket connection.&lt;br /&gt;
&lt;br /&gt;
== Common Features ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Editor for xcu files&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.&lt;br /&gt;
&lt;br /&gt;
= Quality Assurance =&lt;br /&gt;
&lt;br /&gt;
If you find bugs please submit a new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=DEFECT issue] in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration_QA|Schedule for OpenOffice.org NetBeans Integration QA ]]&lt;br /&gt;
&lt;br /&gt;
= Localization =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Localization|Localization Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Things to be done =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/To-Dos|ToDo list]]&lt;br /&gt;
&lt;br /&gt;
= Feedback =&lt;br /&gt;
We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on [mailto:dev@api.openoffice.org dev@api.openoffice.org] (Note: you have to be subscribed on the mailing list).&lt;br /&gt;
&lt;br /&gt;
You can also submit new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=FEATURE feature] or [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=ENHANCEMENT enhancement] requests in the issue tracker in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:NetBeans]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Effort]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235369</id>
		<title>OpenOffice NetBeans Integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=OpenOffice_NetBeans_Integration&amp;diff=235369"/>
		<updated>2014-07-08T12:22:06Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Download and Installation */ add Ooo 4.1 and Netbeans 8.0 support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[image:OOo-Netbeans-Plugin.png|right]]&lt;br /&gt;
= Overview =&lt;br /&gt;
The OpenOffice.org API plugin for NetBeans simplifies the development of OpenOffice.org extensions. You can use the OpenOffice.org API to program OpenOffice.org, and automate remote or in process tasks extend OpenOffice.org with completely new functionality. The OpenOffice.org API plugin for NetBeans simplifies accessing and using of the API in new projects and simplifies the task of creating complete OpenOffice.org extension packages (comparable to the NetBeans plugin modules).&lt;br /&gt;
&lt;br /&gt;
= Download and Installation =&lt;br /&gt;
The plugin appears automatically in Netbeans 6.5.x, 6.7.x, 6.8 (version 2.0.6) but is not listed for later versions.&lt;br /&gt;
&lt;br /&gt;
The plugin is available for download from [http://people.apache.org/~cmarcum/devtools/ http://people.apache.org/~cmarcum/devtools/] provided by Carl Marcum. Use 3.x versions for extension development for OpenOffice.org versions 3.0 thru 3.4. Use the latest 4.0.5 alpha version for extension development for Apache OpenOffice 4.x. This version is under active development and will be made available in the NetBeans plugin manager list when finished. Until then, remember that it is an &amp;#039;&amp;#039;&amp;#039;Beta&amp;#039;&amp;#039;&amp;#039; version.&lt;br /&gt;
&lt;br /&gt;
The configuration is self explanatory, for detailed information see [[OpenOffice_NetBeans_Integration#Configuration|Configuration]]. &lt;br /&gt;
&lt;br /&gt;
The source is available in the Apache OpenOffice.org source SVN repository in the &amp;#039;&amp;#039;&amp;#039;devtools&amp;#039;&amp;#039;&amp;#039; tree. The trunk is under development and the tagged 3.0.0.beta will build and run.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;[https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/trunk]&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Download and install for NetBeans 8.0 and OpenOffice 4.1.0 ==&lt;br /&gt;
The NetBeans-plugin is beta and you need to compile by hand. It seems that it doesn&amp;#039;t support C++ development for now.&lt;br /&gt;
* Install NetBeans 8.0 from https://netbeans.org/downloads/ take Java SE or All Package&lt;br /&gt;
* Under NetBeans create a new SVN (anonymous) repository to https://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/&lt;br /&gt;
* Open the Project make Clean/Build. On errors install the needed plugins like junit.&lt;br /&gt;
* Create a NBM and install it&lt;br /&gt;
&lt;br /&gt;
= Build and Install from Source =&lt;br /&gt;
There is a tagged version of 3.0.0.beta in the SVN repository. To checkout this version using subversion to a directory aoo-netbeans:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
svn co http://svn.apache.org/repos/asf/openoffice/devtools/netbeansintegration/tags/3.0.0.beta aoo-netbeans&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Netbeans 7.x then select File -&amp;gt; Open Project and navigate to the aoo-netbeans directory the source was checked out to.&amp;lt;br /&amp;gt;&lt;br /&gt;
In the projects window RMB on project -&amp;gt; Create NBM. The .nbm file will be located in the build sub-directory of the project.&amp;lt;br /&amp;gt;&lt;br /&gt;
Select Tools -&amp;gt; Plugins and select Downloaded Tab -&amp;gt; Add and select org-openoffice-extensions.nbm from project build directory then check box and Install.&lt;br /&gt;
&lt;br /&gt;
Setup AOO Installation and SDK Settings below are still valid.&lt;br /&gt;
&lt;br /&gt;
= Features =&lt;br /&gt;
Overview of the features included in the current plugin.&lt;br /&gt;
== Project Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New Project...&amp;amp;quot; and choose category &amp;amp;quot;OpenOffice.org&amp;amp;quot; to open a new project. All project types create working code. Once the project wizard is finished, a working&lt;br /&gt;
compilable project is created. It may not do anything, but it can be used&lt;br /&gt;
in OpenOffice.org from the beginning.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org Client Application Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE client application project with additional support of the &lt;br /&gt;
simple UNO bootstrap feature. To enable this, some pre-compiled glue code is bundled with the client &lt;br /&gt;
application. The result is a portable jar file that bootstraps OpenOffice.org on any supported OS.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an office extension package. The wizard collects the necessary information for new &lt;br /&gt;
Calc built-in functions and abstracts from the underlying UNO technology.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[General_UNO_Component_Project_Type|General UNO Component Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a&lt;br /&gt;
UNO component library and an OpenOffice.org extension package. The wizard collects information about services &lt;br /&gt;
and additional optional interfaces which should be implemented. Additional IDL types can also be&lt;br /&gt;
defined. A complete code skeleton is generated, with the component helper functions and the default interface methods already implemented.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This project type creates an adapted J2SE class library project with special support for a UNO &lt;br /&gt;
component library and an OpenOffice.org extension package. The wizard collects the necessary information for an &lt;br /&gt;
OpenOffice.org Add-On component and generates an Add-On specific code skeleton.&lt;br /&gt;
&lt;br /&gt;
== File Types ==&lt;br /&gt;
Click on &amp;amp;quot;File&amp;amp;quot; - &amp;amp;quot;New File...&amp;amp;quot; and select &amp;amp;quot;OpenOffice.org&amp;amp;quot; as category to create a new file for an OpenOffice.org project. Note, that the OpenOffice.org category is available in all projects, although it only makes sense to use it in one of the projects stated above.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcu file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcu file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;xcs file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Create an empty xcs file type. The files are recognized in NetBeans and &lt;br /&gt;
syntax highlighting is supported. &lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;UNO idl file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You can use a file type wizard to create idl files. In the first step, you must select the name location&lt;br /&gt;
and UNO type (e.g. Service or Interface). You can add additional &lt;br /&gt;
information in the second step. When an interface is created, the second step asks about&lt;br /&gt;
the functions that the interface should contain. A complete working idl file is created, and NetBeans provides syntax highlighting. When you choose&lt;br /&gt;
to also create an implementation object (only available for service or interface), a Java skeleton file implementing&lt;br /&gt;
your new idl file will also be created.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Java UNO Object file type&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This file wizard creates a Java skeleton file that implements all functions defined in an interface or service idl file. If you choose a service, the Java implementation file will also be &lt;br /&gt;
registered in OpenOffice.org when your extension is deployed.&lt;br /&gt;
&lt;br /&gt;
== Create, deploy and debug ==&lt;br /&gt;
These are actions that are available in the context menu of an extension project in the &amp;amp;quot;Project&amp;amp;quot; &lt;br /&gt;
view.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Debug Extension in Target OpenOffice.org&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered in a temporary user installation of OpenOffice.org, which is located in the build directory of the project. (Cleaning of the project removes the user installation again.) Then OpenOffice.org is started with this user installation. To trigger the registered extension, an appropriate action must be done in OpenOffice.org.&lt;br /&gt;
Execution stops at any breakpoints added to the code of the extension and debugging can start from there.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Deploy and Run OpenOffice.org Extension&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, &amp;amp;quot;Create OXT&amp;amp;quot; is executed. The resulting OXT file is registered inside the user installation of OpenOffice.org. Then OpenOffice.org is started.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Create OXT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
If necessary, your code is compiled. The resulting jar file is packed into an OXT file, together with other necessary files such as configuration files, a manifest file, and images. The OXT file is located in the &amp;amp;quot;dist&amp;amp;quot; directory of the project.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Publish Extension on OpenOffice.org Website&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The starting page for uploading and publishing your extension on api.services.openoffice.org is loaded in your default web browser.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;External Jars&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Additional external jars that are used in an extension are automatically copied into the OXT file and added to the extension&amp;#039;s classpath. A registered extension in OpenOffice.org can still use the functionality provided there.&lt;br /&gt;
The jars can be added to the project as a single jar or as part of a NetBeans library. Note: All the jars from a library will be added to the OXT file, independent from their usage in the extension.&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
&lt;br /&gt;
Find here links to the specifications of the plugin on the api.openoffice.org page.&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration.odt OpenOffice.org Plugin for NetBeans]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-addon-wizard.odt OpenOffice.org Plugin for NetBeans: Add-On Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-calc-addin-wizard.odt OpenOffice.org Plugin for NetBeans: Add-In Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-component-wizard.odt OpenOffice.org Plugin for NetBeans: Component Wizard]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-debug-component.odt OpenOffice.org Plugin for NetBeans: Debug Feature]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-new-idl-type.odt OpenOffice.org Plugin for NetBeans: IDL type support]&lt;br /&gt;
&lt;br /&gt;
[http://specs.openoffice.org/sdk/tools/spec_openoffice-netbeans-integration-description-xml.odt OpenOffice.org Plugin for NetBeans: Support description.xml]&lt;br /&gt;
&lt;br /&gt;
= Working with the plugin =&lt;br /&gt;
The following section describes how you can work with the plugin and describes the requirements because the plugin  make use of some external stuff provided by an office and the OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
The plugin works only in combination with OpenOffice.org and an appropriate OpenOffice.org Software Development Kit (SDK). The minimal suggested version is OpenOffice.org 2.0.4. With earlier versions, some features of the plugin will not work.&lt;br /&gt;
&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org OpenOffice.org]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[http://www.sun.com/staroffice StarOffice 8]&amp;#039;&amp;#039;&amp;#039; or higher versions of both programs&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[http://download.openoffice.org/sdk.html OpenOffice.org Software Development Kit (SDK)]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Note that the versions of OpenOffice.org and the OpenOffice.org SDK must match for everything to work.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
Before you can use the new project types you must configure the plugin because it needs an installed OpenOffice.org and OpenOffice.org SDK.&lt;br /&gt;
&lt;br /&gt;
Note: &lt;br /&gt;
* As default settings, a standard installation will be found by the plugin - but only if OpenOffice.org together with the SDK are present.&lt;br /&gt;
* When you choose the OpenOffice.org installation and an appropriate SDK is found, that SDK is chosen, the &amp;amp;quot;OpenOffice.org SDK Installation&amp;amp;quot; field is then disabled.&lt;br /&gt;
* If you change the OpenOffice.org or OpenOffice.org SDK installation, these changes are effective for projects created from now on only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For changing the office and SDK installation please choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API plugin&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
and select a valid OpenOffice.org and OpenOffice.org SDK installation. &lt;br /&gt;
&amp;lt;br&amp;gt;[[Image:OpenOffice_Extensions_Plugin_Options.png|center]]&amp;lt;br&amp;gt;&lt;br /&gt;
The configuration step automatically installs a new OpenOffice.org library which can be used in other projects to support the OpenOffice.org API. Including this library in your own projects enables context sensitive help and code completion.&lt;br /&gt;
&lt;br /&gt;
Note: on Debian/Ubuntu, the OpenOffice.org installation directory is &amp;lt;code&amp;gt;/usr/lib/openoffice/&amp;lt;/code&amp;gt;. For other *nix platforms the location may vary, but you can find the location by inspecting the shell script &amp;lt;code&amp;gt;/usr/bin/ooffice&amp;lt;/code&amp;gt; to see where the &amp;lt;code&amp;gt;ooqstart&amp;lt;/code&amp;gt; executable is in your installation.&lt;br /&gt;
&lt;br /&gt;
== Working with new Project Types ==&lt;br /&gt;
The plugin integrates four new project types under the category &amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Add-On&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Calc Add-Ins&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Client Application&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;StarOffice/OpenOffice.org Component&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The wizards will collect the necessary information to create the new projects and should follow the NetBeans philosophy. You can simply choose&lt;br /&gt;
*&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;File -&amp;gt; New Project -&amp;gt; OpenOffice.org -&amp;gt; &amp;lt;project_type&amp;gt;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&lt;br /&gt;
For more details about the project types please take a look at&lt;br /&gt;
*[[OpenOffice_Simple_UNO_Client_Application_Project_Type|OpenOffice.org UNO Client Application Project Type]]&lt;br /&gt;
*[[OpenOffice_Calc_Add-In_Project_Type|OpenOffice.org Calc Add-In Project Type]]&lt;br /&gt;
*[[General_UNO_Component_Project_Type|OpenOffice.org Component Project Type]]&lt;br /&gt;
*[[OpenOffice_Add-On_Project_Type|OpenOffice.org Add-On Project Type]]&lt;br /&gt;
&lt;br /&gt;
== Migrate Projects ==&lt;br /&gt;
To migrate projects from an older version of the plugin to a new one is not necessary - the plugin itself will take care of that: build-uno-impl.xml and the project-uno.properties are updated, when updated versions of these files are needed for new features of the updated plugin. Note that build-uno-impl.xml will be overwritten, but project-uno.properties not. In the properties file, only new entries are added, existing ones are kept as they are. The update of the files happens when an old project is opened with a new version of the plugin and for all opened projects when the new plugin is downloaded and installed.&lt;br /&gt;
&lt;br /&gt;
When migrating from one Office version to another (or porting a project across platforms), only a library has to be changed, called &amp;amp;quot;OpenOffice.org &amp;lt;version_number&amp;gt;&amp;amp;quot; (or &amp;amp;quot;StarOffice &amp;lt;version_number&amp;gt;&amp;amp;quot;). Choose &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Libraries&amp;#039;&amp;#039;&amp;#039; to get an overview of the existing libraries. A library is created when a valid OpenOffice.org and OpenOffice.org SDK is selected in &amp;#039;&amp;#039;&amp;#039;Tools -&amp;gt; Options -&amp;gt; Miscellaneous -&amp;gt; OOo API Plugin&amp;#039;&amp;#039;&amp;#039; (See [[OpenOffice_NetBeans_Integration#Configuration|Configuration]] for more details).&lt;br /&gt;
* To change the library, click right on the project in the &amp;#039;&amp;#039;&amp;#039;Project&amp;#039;&amp;#039;&amp;#039; window and open the properties. Select &amp;#039;&amp;#039;&amp;#039;Libraries&amp;#039;&amp;#039;&amp;#039; as category and remove the one that points to the old installation and add the new one.&lt;br /&gt;
* When porting the project across platforms, NetBeans notifies that a reference problem exists. The steps for changing the libraries also help in this case.&lt;br /&gt;
&lt;br /&gt;
== Known Problems and Missing Features ==&lt;br /&gt;
&lt;br /&gt;
* Context sensitive help does not work on Linux (Solaris not yet tested), even the javadoc generated Java UNO runtime reference documentation does not work on Linux. Under Windows both work as expected.&lt;br /&gt;
* &amp;amp;quot;Red Dot Problem&amp;amp;quot;: When you have created a project that supports own idl files (e.g. a Clac AddIn), a &amp;amp;quot;clean&amp;amp;quot; on the project will produce &amp;amp;quot;red dots&amp;amp;quot; that show that imported functionality is missing. The cause for this is the deleted jar file with the idl types that are used in your project. Although this does not seem to be the case, a compile will work and solve the problem. Sometimes the signs appear when &amp;amp;quot;clean and build&amp;amp;quot; is chosen - here the compiled idl files exist, but NetBeans does not recognize that. Open the offending Java file to solve that. Solution: compile idl files in the background and produce a &amp;amp;quot;shadow&amp;amp;quot; jar file in a temp directory that can be used even if the &amp;amp;quot;official&amp;amp;quot; file in the &amp;lt;project_name&amp;gt;/dist folder is deleted.&lt;br /&gt;
* With NetBeans versions at least 6.1 there is an update problem regarding NetBeans property sheets and node views: property sheet changes are not reflected in the node view. Seems like the notify mechanism for these updates has changed.&lt;br /&gt;
&lt;br /&gt;
= Releases =&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=5 cellspacing=0 border=1 style=&amp;quot;border-collapse:collapse; margin-left: 3em; border-color: #333;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background-color: #DEDEDE;&amp;quot;&lt;br /&gt;
| Release Version || Planned Release Date || Release Date || Planned Features&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.0 || 05/08/07 || 05/08/07 || -&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1 || 09/01/07 || 09/18/07 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1| see 1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.1 || 03/08 || 03/20/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.1]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.2 || 04/08 || 04/30/08 || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.2]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 1.1.3 || 06/30/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_1.1.x| see 1.1.3]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0 || 09/08 || - || [[OpenOffice_NetBeans_Integration/Releases/Release_2.0| see 2.0]]&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.3 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.4 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.5 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.6 || - || - || bugfixes only&lt;br /&gt;
|- align=center&lt;br /&gt;
| 2.0.7.alpha || - || - || changes to support NetBeans 6.9, opnly available in the file section of the API project, [http://api.openoffice.org/files/documents/22/4772/org-openoffice-extensions-2.0.7.alpha.nbm org-openoffice-extensions-2.0.7.alpha.nbm]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;amp;nbsp;&amp;amp;nbsp;Detailed download statistics can be found [[OpenOffice_NetBeans_Integration/Releases/Download_Statistic| here]] (not up-to-date)&lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Releases/Release_1.2#Current_issues_concerning_NetBeans_6|Issues]] for using the plugin with NetBeans 6.&lt;br /&gt;
&lt;br /&gt;
= Planned Features =&lt;br /&gt;
The focus is on creating new wizards for various tasks plus common basic functionality. The main programming language is Java. Support for C++ is also planned and depends on the C++ support in NetBeans which will be available at least for NetBeans 6.0. The planned feature list is not final and more specialized wizards for other service provider interfaces (SPI) are coming in the future.&lt;br /&gt;
&lt;br /&gt;
== New Project Types ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_Scripting_Project_Type|OpenOffice.org Scripting Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will create an adapted J2SE class library project with special support for OpenOffice.org scripting. It should provide you the possibility to import scripts from OpenOffice.org and open documents, edit, change and build these scripts, debug them and export them back (currently the support is planned for Java scripts only).&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_SmartTag_Project_Type|OpenOffice.org SmartTag Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type will simplify the development of SmartTags for the OpenOffice.org Writer application.&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;[[OpenOffice_API_Library_Wrapper_Project_Type|OpenOffice.org API Library API Wrapper Project Type]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This new project type should create a &amp;#039;&amp;#039;Library Wrapper Module&amp;#039;&amp;#039; to support simple usage of the OpenOffice.org API in your own projects. It bundles the necessary API jar files from OpenOffice.org in the library and in client applications. This of course is necessary to make use of the OpenOffice.org API in clients running on machines where no OpenOffice.org is installed and where the communication with OpenOffice.org is made over a remote socket connection.&lt;br /&gt;
&lt;br /&gt;
== Common Features ==&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;Editor for xcu files&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;This must be defined in detail but we can think of a special editor for OpenOffice .org configuration files.&lt;br /&gt;
&lt;br /&gt;
= Quality Assurance =&lt;br /&gt;
&lt;br /&gt;
If you find bugs please submit a new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=DEFECT issue] in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration_QA|Schedule for OpenOffice.org NetBeans Integration QA ]]&lt;br /&gt;
&lt;br /&gt;
= Localization =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/Localization|Localization Tutorial]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Things to be done =&lt;br /&gt;
* [[OpenOffice_NetBeans_Integration/To-Dos|ToDo list]]&lt;br /&gt;
&lt;br /&gt;
= Feedback =&lt;br /&gt;
We will continuously extend and improve the plugin in the future and your feedback is welcome and highly appreciated. We would like to invite you to discuss it on [mailto:dev@api.openoffice.org dev@api.openoffice.org] (Note: you have to be subscribed on the mailing list).&lt;br /&gt;
&lt;br /&gt;
You can also submit new [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=FEATURE feature] or [http://api.openoffice.org/issues/enter_bug.cgi?component=sdk&amp;amp;issue_type=ENHANCEMENT enhancement] requests in the issue tracker in the category &amp;#039;&amp;#039;&amp;#039;sdk&amp;#039;&amp;#039;&amp;#039; and the subcomponent &amp;#039;&amp;#039;&amp;#039;netbeans-integration&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:NetBeans]]&lt;br /&gt;
[[Category:API]]&lt;br /&gt;
[[Category:Effort]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235368</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235368"/>
		<updated>2014-07-08T02:40:26Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X */ grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth.&lt;br /&gt;
For Eclipse visit [[OpenOffice_Eclipse_Integration]].&lt;br /&gt;
For Netbeans visit [[OpenOffice_NetBeans_Integration]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235367</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235367"/>
		<updated>2014-07-08T02:38:45Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X */ Make some links internal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and [[Documentation/DevGuide]] &lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth.&lt;br /&gt;
For Eclipse visit [[OpenOffice_Eclipse_Integration]]&lt;br /&gt;
For Netbeans visit [[OpenOffice_NetBeans_Integration]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235366</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235366"/>
		<updated>2014-07-08T02:26:29Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X */ adding next step links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/ and https://wiki.openoffice.org/wiki/Documentation/DevGuide&lt;br /&gt;
&lt;br /&gt;
Its recommended to use Eclipse or Netbeans to develop with OpenOffice SDK. There are plugins for booth.&lt;br /&gt;
For Eclipse visit https://wiki.openoffice.org/wiki/OpenOffice_Eclipse_Integration&lt;br /&gt;
For Netbeans visit https://wiki.openoffice.org/wiki/OpenOffice_NetBeans_Integration&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235365</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235365"/>
		<updated>2014-07-08T01:10:34Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X */ bugfix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix # Need to run every time before you use the SDK&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; &lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235364</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235364"/>
		<updated>2014-07-08T00:59:57Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X */ bugfix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* (Optional) Install MacPorts from http://www.macports.org. You need MacPorts to install optional Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235363</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235363"/>
		<updated>2014-07-08T00:55:19Z</updated>

		<summary type="html">&lt;p&gt;Global667: Put windows stuff in windows chapter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Installing with the free MS Visual C++ Toolkit 2003 ===&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
=== Other Windows Installations descriptions ===&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235362</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235362"/>
		<updated>2014-07-08T00:51:07Z</updated>

		<summary type="html">&lt;p&gt;Global667: Put linux stuff in linux chapter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in your shell and then &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235361</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235361"/>
		<updated>2014-07-08T00:22:41Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X (Intel processors) */ Make it more general&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1.0 and OpenOffice 4.1.0 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other Intel Mac configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install newest OpenOffice and the corresponding SDK from http://openoffice.apache.org/downloads.html (Choose MacOS_x86-64)&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235360</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235360"/>
		<updated>2014-07-07T23:00:54Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X (Intel processors) */ wrong link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X (Intel processors) ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under https://developer.apple.com&lt;br /&gt;
* Install OpenOffice 4.1&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Install the SDK from http://openoffice.apache.org/downloads.html (You need 4.1.0 for MacOS_x86-64)&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235359</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235359"/>
		<updated>2014-07-07T22:56:07Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X (Intel processors) */ Add conclusion of the SDK test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X (Intel processors) ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under http://www.developer.apple.com&lt;br /&gt;
* Install OpenOffice 4.1&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Install the SDK from http://openoffice.apache.org/downloads.html (You need 4.1.0 for MacOS_x86-64)&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything went fine, you should see a new document, with the content of &amp;lt;SDK_Folder&amp;gt;/examples/cpp/DocumentLoader/test.odt.&lt;br /&gt;
&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235358</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235358"/>
		<updated>2014-07-07T22:27:40Z</updated>

		<summary type="html">&lt;p&gt;Global667: Undo revision 235357 by Global667 (talk) text was deleted don&amp;#039;t know why&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X (Intel processors) ==&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
The text below describes the installation of the SDK 4.1 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under http://www.developer.apple.com&lt;br /&gt;
* Install OpenOffice 4.1&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Install the SDK from http://openoffice.apache.org/downloads.html (You need 4.1.0 for MacOS_x86-64)&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Further informations see: http://www.openoffice.org/api/SDK/&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235357</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235357"/>
		<updated>2014-07-07T22:22:58Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Installation under Mac OS X (Intel processors) */ Spelling, add link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235356</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235356"/>
		<updated>2014-07-07T22:12:06Z</updated>

		<summary type="html">&lt;p&gt;Global667: Add Mac support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X (Intel processors) ==&lt;br /&gt;
&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
the text below describes the installation of the SDK 4.1 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other configurations too.&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under http://www.developer.apple.com&lt;br /&gt;
* Install OpenOffice 4.1&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
* Install the SDK from http://openoffice.apache.org/downloads.html (You need 4.1.0 for MacOS_x86-64)&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoder.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235355</id>
		<title>SDKInstallation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=SDKInstallation&amp;diff=235355"/>
		<updated>2014-07-07T22:09:44Z</updated>

		<summary type="html">&lt;p&gt;Global667: Add Mac support (checkpoint save)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/Banner}}&lt;br /&gt;
{{Documentation/NeedsRework}}&lt;br /&gt;
= How to install the SDK and compile the C++ examples =&lt;br /&gt;
&lt;br /&gt;
For both Linux and Windows the following points are very important if you want to succeed in building C++ components and snippets:&lt;br /&gt;
* you need to have OpenOffice.org 1.1.0 or higher installed (SDK won&amp;#039;t run without it)&lt;br /&gt;
* you need to install the SDK into a directory other than the one of the OOo application&lt;br /&gt;
&lt;br /&gt;
== Installation under Mac OS X (Intel processors) ==&lt;br /&gt;
&lt;br /&gt;
{{Documentation/OSX|&lt;br /&gt;
&lt;br /&gt;
the text below describes the installation of the SDK 4.1 on Mac OS X 10.9.4 with Xcode 4.1.1. It would works for other configurations too.&lt;br /&gt;
&lt;br /&gt;
* Install Xcode. You can get it from the Apple App Store. Perhaps you must be registered as Mac developer under http://www.developer.apple.com&lt;br /&gt;
&lt;br /&gt;
* Install OpenOffice 4.1&lt;br /&gt;
&lt;br /&gt;
* Install MacPorts from http://www.macports.org. Perhaps you need to customize the path. You need MacPorts to install Unix-like software needed by the SDK.&lt;br /&gt;
&lt;br /&gt;
* Install the SDK from http://openoffice.apache.org/downloads.html (You need 4.1.0 for MacOS_x86-64)&lt;br /&gt;
&lt;br /&gt;
* Test the SDK. Open a terminal and look for the SDK folder. Now type and run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;lt;SDK_Folder&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
cd examples/cpp/DocumentLoader&lt;br /&gt;
make&lt;br /&gt;
soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot; &amp;amp; make DocumentLoder.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under LINUX ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the SDK 1.1.0 for OpenOffice.org1.1.0&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation. &lt;br /&gt;
Even if you don&amp;#039;t plan to use Java it is strongly recommended to install the JDK (1.4.1_01 or higher for OOo 1.1 SDK)&lt;br /&gt;
Of course a C++ compiler is needed (3.0.1 or higher). GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
When ready, launch : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
tar xzvf Ooo_1.1.0_LinuxIntel_sdk.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and go to the new created directory (in this example OpenOffice.org1.1_SDK) and launch the configure script which asks you relevant directories. We give here among others :&lt;br /&gt;
* where is your OpenOffice.org installed ? (for me /usr/lib/openoffice : noted &amp;lt;Ooo&amp;gt; later)&lt;br /&gt;
* Where is your Java SDK installed ? (for me /usr/java/j2sdk1.4.2_04)&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX.&lt;br /&gt;
&lt;br /&gt;
From now on, we will always note the SDK directory installation as : &amp;lt;OpenOffice.org1.1_SDK&amp;gt;. Please don&amp;#039;t confuse with &amp;lt;Ooo&amp;gt; which is the openoffice.org /program/ directory.&lt;br /&gt;
&lt;br /&gt;
You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
The OOo2.0SDK installation is done also by launching the setsdkenv_unix script but asking more information :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * SDK environment is prepared for Linux&lt;br /&gt;
 *&lt;br /&gt;
 * SDK = /home/smoutou/openoffice.org2.0_sdk&lt;br /&gt;
 * Office = /opt/openoffice.org2.0&lt;br /&gt;
 * URE =&lt;br /&gt;
 * Make = /usr/bin&lt;br /&gt;
 * Zip = /usr/bin&lt;br /&gt;
 * C++ Compiler = /usr/bin&lt;br /&gt;
 * Java = /usr/java/j2sdk1.4.2_04&lt;br /&gt;
 * Special Output directory = /home/smoutou&lt;br /&gt;
 * Auto deployment = YES&lt;br /&gt;
 *&lt;br /&gt;
 ************************************************************************&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation under Solaris ==&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
The text below describe the installation of the OpenOffic.org SDK 3.1 for OpenOffice.org3.1&lt;br /&gt;
&lt;br /&gt;
The Software Development Kit (SDK) works on the top of an existing Openoffice.org installation because of using the same libraries. The SDK requires an Openoffice.org installation (default installation directory for Solaris is /opt/openoffice.org/ and /opt/openoffice.org3/)&lt;br /&gt;
&lt;br /&gt;
Depending on which language you wish to use, you will need either:&lt;br /&gt;
The Java SDK which can be obtained [http://java.sun.com/javase/downloads/index.jsp here].&lt;br /&gt;
Or a C++ complier (g++ 3.0.1 or higher is recommended). As well as GNU make (3.79.1 or higher) is also essential.&lt;br /&gt;
&lt;br /&gt;
First download the Solaris SDK from [http://download.openoffice.org/sdk/index.html here].&lt;br /&gt;
&lt;br /&gt;
Now run the install script by typing the following command. This script will prompt you for a temporary directory where it will extract the installation package. Just press enter and the package will be extracted into the directory shown in brackets (in this case /var/tmp/unpack_openofficeorg). If you wish to extract the package into a separate directory, type in the full directory path at the prompt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh OOo-SDK_3.1.1_SolarisSparc_install_en-US.sh&lt;br /&gt;
Select the directory in which to save the unpacked files. [/var/tmp/unpack_openofficeorg]&lt;br /&gt;
&lt;br /&gt;
File is being checked for errors ...&lt;br /&gt;
Unpacking ...&lt;br /&gt;
All files have been successfully unpacked.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now navigate into the packages directory under the unpacked installation directory that was just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /var/tmp/unpack_openofficeorg/packages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go ahead an install the SDK package using pfexec.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# pfexec pkgadd -d . &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To check if the installation succeeded, attempt to navigate into the sdk directory under the OpenOffic.org basis directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /opt/openoffice.org/basis3.1/sdk&lt;br /&gt;
# ls&lt;br /&gt;
bin/                    examples/               setsdkenv_unix.csh.in&lt;br /&gt;
classes/                idl/                    setsdkenv_unix.sh.in&lt;br /&gt;
config.guess            include/                settings/&lt;br /&gt;
config.sub              index.html              share/&lt;br /&gt;
configure.pl            lib/&lt;br /&gt;
docs/                   setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you are ready to use the SDK. Every time you want to use it you have to launch the setsdkenv_unix script for environment variables. Automating this is not a problem under UNIX. You can find a little complement of this chapter in &amp;lt;OpenOffice.org1.1_SDK&amp;gt;/docs/install.html&lt;br /&gt;
&lt;br /&gt;
In order to use the SDK you need to first execute the setsdkevn_unx script in the &amp;lt;OpenOffice.org&amp;gt;/basis3.1/sdk directory (/opt/openoffice.org/basis3.1/sdk for me). Before you execute this script, you need to locate all of the development tools for the language you will be using. Below is a list of the tools that the script prompts for and the locations of the tools on my machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OpenOffice.org3 installation = /opt/openoffice.org3&lt;br /&gt;
GNU make 3.79.1 or higher = /usr/bin&lt;br /&gt;
C++ compiler (g++ 3.0.1 or higher) = /usr/bin&lt;br /&gt;
Zip = /usr/bin&lt;br /&gt;
Java = /usr/jdk/latest/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Input the paths to your development tools when prompted. &lt;br /&gt;
&lt;br /&gt;
You are now ready to use the OpenOffice SDK&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation under Windows ==&lt;br /&gt;
{{Documentation/Windows|&lt;br /&gt;
&lt;br /&gt;
You need a compiler out of the Microsoft Visual Studio family (other compilers like MinGW have turned out to be hard to configure for OOo on Windows).&lt;br /&gt;
The first thing after having installed the SDK is to launch the configureWindowsNT.bat and set all the necessary directories for proper use of the SDK.&lt;br /&gt;
If that has been done you have already installed everything, but *wait* one very important thing you should still know of:&lt;br /&gt;
Every time you want to run your own code or one of the SDK examples you need to launch the setsdkenv_Windows batch file from your command shell. The title of it should now be &amp;quot;Shell prepared for SDK&amp;quot;. Happy coding, compiling and building now (I tell you it&amp;#039;s easy from now on!).&lt;br /&gt;
GanescuCarmen describes some problems he encounter when trying SDK examples under Windows :&lt;br /&gt;
“I also use the 1.1 OO version. &lt;br /&gt;
&lt;br /&gt;
I had a lots of problems. &lt;br /&gt;
Finally I succeeded to obtain the the header files, and in VC I needed some library to be included into project and some files(uno.idl) to be added to rdb files. &lt;br /&gt;
It was very hard to understand what it means registry(the rdb file not the Registry itself). &lt;br /&gt;
&lt;br /&gt;
I was expecting to register something in Registry but it wasn&amp;#039;t like this. &lt;br /&gt;
And with the service manager I had some problems, with the port, because the connection with 8100 port was not done. &lt;br /&gt;
I had to modify a file and to add some code for 8100 port. &lt;br /&gt;
&lt;br /&gt;
But I did it and it works now.”&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installing with the free MS Visual C++ Toolkit 2003 ==&lt;br /&gt;
{{Documentation/HelpNeeded|This section needs help for update because &amp;#039;&amp;#039;&amp;#039;MS Visual C++ Toolkit 2003&amp;#039;&amp;#039;&amp;#039; seems no more available. Please have a look at Microsoft for the free Visual C++ tools at the moment.}}&lt;br /&gt;
I have installed DevCpp to have a make executable file.&lt;br /&gt;
I have downloaded the free Visual C++ Toolkit 2003 here :&lt;br /&gt;
http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&amp;amp;displaylang=en&lt;br /&gt;
&lt;br /&gt;
and then I have installed it. &amp;#039;&amp;#039;&amp;#039;(This link is broken.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I launch first C:\openoffice\OpenOffice.org2.0_SDK\configureWindowsNT.bat&lt;br /&gt;
which asks any questions :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set OO_SDK_HOME=C:\openoffice\OpenOffice.org2.0_SDK&lt;br /&gt;
set OFFICE_HOME=C:\Program Files\OpenOffice.org 2.0&lt;br /&gt;
set OO_SDK_MAKE_HOME=C:\Dev-C++\Bin&lt;br /&gt;
set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual C++ Toolkit 2003\Bin&lt;br /&gt;
set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_03&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and I am ready to launch setsdkenv_windows.bat&lt;br /&gt;
&lt;br /&gt;
I have modified the following file :&lt;br /&gt;
C:\openoffice\OpenOffice.org2.0_SDK\examples\DevelopersGuide\ProfUNO\CppBinding\office_connect.cxx &lt;br /&gt;
to change the port accordingly to what OOo is listening.&lt;br /&gt;
&lt;br /&gt;
I have modified the makefile :&lt;br /&gt;
added : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CC_INCLUDES = -I&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include&amp;quot; \&lt;br /&gt;
              -I&amp;quot;C:\openoffice\OpenOffice.org2.0_SDK\include&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and added libraries too :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(@D))&lt;br /&gt;
	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))&lt;br /&gt;
ifeq &amp;quot;$(OS)&amp;quot; &amp;quot;WIN&amp;quot;&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \&lt;br /&gt;
	 $&amp;lt; $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)\&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libcp.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\libc.lib&amp;quot; \&lt;br /&gt;
       &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\oldnames.lib&amp;quot; \&lt;br /&gt;
	 &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib\kernel32.lib&amp;quot; &lt;br /&gt;
else&lt;br /&gt;
	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $&amp;lt; \&lt;br /&gt;
	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB)&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I suppose there is a more straightforward way to add these libraries with adding the corresponding include path but I am unable to do that with VC++. &lt;br /&gt;
&lt;br /&gt;
I find a solution of the previous problem three weeks later. My problem comes in fact from  a bug in setsdkenv_windows.bat. A little correction in the file setsdkenv_windows.bat makes it possible to avoid the makefile modifications :&lt;br /&gt;
Put :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
instead of :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
REM Set environment for C++ compiler tools, if necessary.&lt;br /&gt;
if defined OO_SDK_CPP_HOME call &amp;quot;%OO_SDK_CPP_HOME%\VCVARS32.bat&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I think&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
%OO_SDK_CPP_HOME%\..\VCVARS32.bat&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
could work too (but not checked). You can also move vcvars32.bat in %OO_SDK_CPP_HOME% &lt;br /&gt;
(&amp;quot;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin&amp;quot; for me).&lt;br /&gt;
&lt;br /&gt;
== Other Windows Installations descriptions ==&lt;br /&gt;
&lt;br /&gt;
You can find in [http://www.oooforum.org/forum/viewtopic.phtml?t=23772 OOoForum] a post entitled Guide for develop OpenOffice apps with VC++ .net (by [[CppSDKAuthors|LarsB]])&lt;br /&gt;
&lt;br /&gt;
1.Download and install OpenOffice.&lt;br /&gt;
&lt;br /&gt;
2.Download and install OpenOffice SDK&lt;br /&gt;
&lt;br /&gt;
3.Create a new folder inludecpp in &amp;lt;oo_sdk_path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.Open Dos console change directory to &amp;lt;oo_sdk_path&amp;gt;\windows\bin &lt;br /&gt;
&lt;br /&gt;
4.1 run cppumaker with followig paramerers &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -BUCR -O &amp;lt;oo_sdk_path&amp;gt;\includecpp &amp;lt;office_programm_dir&amp;gt;\types.rdb &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or better with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cppumaker -Gc -BUCR -O&amp;lt;includes_path&amp;gt; &amp;lt;ooffice_path&amp;gt;\URE\misc\types.rdb &amp;lt;ooffice_path&amp;gt;\Basis\program\offapi.rdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
in recent versions.&lt;br /&gt;
&lt;br /&gt;
(Attention: If you recieve a init error, copy types.rdb into the &amp;lt;oo_sdk_path&amp;gt;\windows\bin folder!) &lt;br /&gt;
After that all hpp and hdl files should be created in &amp;lt;oo_sdk_path&amp;gt;\includecpp&lt;br /&gt;
&lt;br /&gt;
5.Open Visual Studio and create a new Win32 Console Application. &lt;br /&gt;
Applay the following changes to your project.&lt;br /&gt;
&lt;br /&gt;
5.1. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Include Files &lt;br /&gt;
Add \include directory and &amp;lt;oo_sdk_path&amp;gt;\includecpp &lt;br /&gt;
&lt;br /&gt;
5.2. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Library files &lt;br /&gt;
Add &amp;lt;oo_sdk_path&amp;gt;\windows\lib directory &lt;br /&gt;
&lt;br /&gt;
5.3. Tools -&amp;gt;Options-&amp;gt;Projects-&amp;gt;VC++ Directories -&amp;gt; Executable files &lt;br /&gt;
Add &amp;lt;office_programm_dir&amp;gt;\program directory (location where you installed the version of the OpenOffice)&lt;br /&gt;
 &lt;br /&gt;
5.4 Open the Project Settings &lt;br /&gt;
&lt;br /&gt;
5.4.1 Change Configuration to all All Configurations (the combobox in the left corner of the window) &lt;br /&gt;
&lt;br /&gt;
5.4.2 Add the additional libraries &lt;br /&gt;
&lt;br /&gt;
Properties-&amp;gt;Linker-&amp;gt;ComandLine in the Additional Options tab the library files &lt;br /&gt;
isal.lib icppu.lib icppuhelper.lib isal.lib isalhelper.lib ireg.lib irmcxt.lib stlport_vc71.lib&lt;br /&gt;
&lt;br /&gt;
6.(example) Add the DocumentLoader.cxx from the cpp examples of the sdk &lt;br /&gt;
and compile. The source should compile without errors. &lt;br /&gt;
&lt;br /&gt;
INFO : If you got the following error have a look at the solution 2 postings above! &lt;br /&gt;
Up to now, with the steps above i got the following error, when i run the DocumentLoader example. &lt;br /&gt;
The error is thrown, when the prog execution reach the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reference&amp;lt; XSimpleRegistry &amp;gt; xSimpleRegistry( ::cppu::createSimpleRegistry() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with error shown below :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: &lt;br /&gt;
Window title: Microsoft Visual C++ Debug Library &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If somebody has experience with this kind of error it will be nice if he could &lt;br /&gt;
post a solution. So that here is a complete little guide for OpenOffice with VC++ .NET &lt;br /&gt;
&lt;br /&gt;
Regards &lt;br /&gt;
[[CppSDKAuthors|Lars]]&lt;br /&gt;
&lt;br /&gt;
[[CppSDKAuthors|François]] has improved the complete procedure with remarks :  &lt;br /&gt;
Following all the steps I (_francois_) encountered two problems &lt;br /&gt;
&lt;br /&gt;
* first in point 4.4.2&lt;br /&gt;
 &lt;br /&gt;
But there I guess it&amp;#039;s because the procedure was meant for SDK 2 and I&amp;#039;m using SDK 1.1 &lt;br /&gt;
The stlport_vc71.lib which you must include is distributed with the SDK 2 in the SDK 1.1 stlport_vc7.lib &lt;br /&gt;
you just need to include the stlport_vc7.lib instead of stlport_vc71.lib &lt;br /&gt;
&lt;br /&gt;
* second problem after successfuly compiling the DocumentLoader in Visual Studio I was getting the following error&lt;br /&gt;
Error: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Window title: Microsoft Visual C++ Debug Libary &lt;br /&gt;
Headline: Debug Error &lt;br /&gt;
Msg: This application has requested the Runtime to terminate it in an usual way. &lt;br /&gt;
Please contact the support team for more information.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After going on debug in the visual studio I found the following line was responsible&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
xSimpleRegistry-&amp;gt;open( OUString( RTL_CONSTASCII_USTRINGPARAM(&amp;quot;DocumentLoader.rdb&amp;quot;) ), sal_True, sal_False );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The DocumentLoader.rdb was missing ... I noticed that if I compiled the DocumentLoader exemples from command line with the makefile provided with the exemple a DocumentLoader.rdb was generated. I had a look at the Makefile I isolated the lines which seemed to generate the DocumentLoader.rdb into my Debug folder (or wherever your set your DocumentLoader.exe to be put by Visual Studio) in my Visual Studio project...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
regmerge c:\travail\DocumentLoader\debug\DocumentLoader.rdb / &amp;quot;C:\ooo\office\program\types.rdb&amp;quot; &lt;br /&gt;
&lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c connector.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c remotebridge.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c bridgefac.uno.dll &lt;br /&gt;
regcomp -register -r c:\travail\DocumentLoader\debug\DocumentLoader.rdb -c uuresolver.uno.dll &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I launched all the above lines in the prompt shell and it worked I had my DocumentLoader.rdb in my Debug folder &lt;br /&gt;
&lt;br /&gt;
I launched my exe file and it worked, great... &lt;br /&gt;
&lt;br /&gt;
Now I guess I still need to figure out which *.uno.dll needs to be included for which functions used in the programm, but still it&amp;#039;s a good start. &lt;br /&gt;
If anyone has any information about that (It may actualy be documented somewhere) don&amp;#039;t hesitate)&lt;br /&gt;
&lt;br /&gt;
== The Development Tools of the SDK ==&lt;br /&gt;
&lt;br /&gt;
There are several development tools provided with the SDK : idlc, cppumaker, javamaker, rdbmaker, pkgchk, regcomp, regmerge, regview, xml2cmp, uno, and autodoc. You can find a short documentation on these tools at &amp;lt;OOo_SDK&amp;gt;/docs/tools.html and also in [[Documentation/DevGuide/WritingUNO/Required_Files|Developer&amp;#039;s Guide]].&lt;br /&gt;
&lt;br /&gt;
See also [[Compiler_versions_used_by_port_maintainers_and_release_engineers|Compiler versions used by port maintainers and release engineers]]&lt;br /&gt;
&lt;br /&gt;
== One Cpp Example ==&lt;br /&gt;
If you want to check the Cpp examples, you have to launch first (as mentioned before)&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./setsdkenv_unix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
in your shell and then &lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
For Openoffice.org 2.x, run instead:&lt;br /&gt;
{{Documentation/Linux|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;Ooo&amp;gt;/program/soffice &amp;quot;-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Now Openoffice.org is listening on UNO connections through the network (here from localhost only).&lt;br /&gt;
We are ready to compile our first example and to check if it works correctly. For that we go in &lt;br /&gt;
&amp;lt;OpenOffice.org1.1_SDK&amp;gt;/examples/cpp/DocumentLoader directory.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will compile the example, and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make DocumentLoader.run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will launch the example. This example only load a Ooowriter&amp;#039;s file (test.sxw) provided with the SDK.&lt;br /&gt;
&lt;br /&gt;
Bear in mind the easier way to construct the examples of the SDK is to use the makefiles provided. When you are a beginner with the SDK you always underestimate important steps : for example the registry step discussed later. I estimate to have understand something when I am able to construct it starting with nothing (but skills). In the case of SDK this will take me a long time (and probably will not be finished). Then I can give you an advice : if you want to start a project, begin with modifying an example of the SDK.  &lt;br /&gt;
&lt;br /&gt;
Other SDK&amp;#039;s examples are discussed later, but you can have a look to : &lt;br /&gt;
&lt;br /&gt;
*[[Counter_Example|Counter example]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Home_Page}}&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[FR/Documentation/Installation_du_SDK|French version of this chapter]].&lt;br /&gt;
* [[Uno/Cpp/Tutorials/Introduction_to_Cpp_Uno|C++ and UNO tutorial]]&lt;br /&gt;
* [http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx Prepare the OOo SDK]&lt;br /&gt;
* [http://www.oooforum.org/forum/viewtopic.phtml?t=79911&amp;amp;highlight= missing files in sdk]&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;
&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:Cpp]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16361</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16361"/>
		<updated>2006-09-06T01:33:07Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen, um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Strings (Textvariablen) werden in doppelte Anführrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von [http://www.openoffice.org/dev_docs/source/sdk/ hier] herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterativer Zugriff auf untergeordnete Objekte &amp;lt;br&amp;gt;( berechtigungsgesteuerte Auflistung )=&lt;br /&gt;
Manchmal ist zum Zugriff auf ein gewünschtes Objekt eine Enumeration (Auflistung) nötig. Beispielsweise ein Satz innerhalb eines Dokumentes oder innerhalb einer Auswahl.&lt;br /&gt;
&lt;br /&gt;
Wenn innerhalb eines OpenOffice-Writer Dokuments eine Text selektiert wird, können die Methoden &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; verwand werden. &lt;br /&gt;
com.sun.star.text.TextRange ist die Schnittstelle (Interface): com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Aufgabe 3: Erweitere das obige Beispiel so, das eine MessageBox aller Worte des Schrifttyps &amp;quot;bold&amp;quot; zeigt .&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16360</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16360"/>
		<updated>2006-09-06T01:31:26Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Iterativer Zugriff auf untergeordnete Objekte (berechtigungsgesteuerte Auflistung) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen, um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Strings (Textvariablen) werden in doppelte Anführrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von [http://www.openoffice.org/dev_docs/source/sdk/ hier] herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterativer Zugriff auf untergeordnete Objekte &lt;br /&gt;
(berechtigungsgesteuerte Auflistung)=&lt;br /&gt;
Manchmal ist zum Zugriff auf ein gewünschtes Objekt eine Enumeration (Auflistung) nötig. Beispielsweise ein Satz innerhalb eines Dokumentes oder innerhalb einer Auswahl.&lt;br /&gt;
&lt;br /&gt;
Wenn innerhalb eines OpenOffice-Writer Dokuments eine Text selektiert wird, können die Methoden &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; verwand werden. &lt;br /&gt;
com.sun.star.text.TextRange ist die Schnittstelle (Interface): com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Aufgabe 3: Erweitere das obige Beispiel so, das eine MessageBox aller Worte des Schrifttyps &amp;quot;bold&amp;quot; zeigt .&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16359</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16359"/>
		<updated>2006-09-06T01:30:51Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Iterative Access to Subordinate Objects (Enumeration access) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen, um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Strings (Textvariablen) werden in doppelte Anführrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von [http://www.openoffice.org/dev_docs/source/sdk/ hier] herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterativer Zugriff auf untergeordnete Objekte (berechtigungsgesteuerte Auflistung)=&lt;br /&gt;
Manchmal ist zum Zugriff auf ein gewünschtes Objekt eine Enumeration (Auflistung) nötig. Beispielsweise ein Satz innerhalb eines Dokumentes oder innerhalb einer Auswahl.&lt;br /&gt;
&lt;br /&gt;
Wenn innerhalb eines OpenOffice-Writer Dokuments eine Text selektiert wird, können die Methoden &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; verwand werden. &lt;br /&gt;
com.sun.star.text.TextRange ist die Schnittstelle (Interface): com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Aufgabe 3: Erweitere das obige Beispiel so, das eine MessageBox aller Worte des Schrifttyps &amp;quot;bold&amp;quot; zeigt .&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16357</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16357"/>
		<updated>2006-09-06T01:08:48Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* X-Ray tool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen, um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Strings (Textvariablen) werden in doppelte Anführrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von [http://www.openoffice.org/dev_docs/source/sdk/ hier] herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16356</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16356"/>
		<updated>2006-09-06T01:03:02Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Eingeben von Programm-Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen, um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Strings (Textvariablen) werden in doppelte Anführrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von ??? herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16355</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16355"/>
		<updated>2006-09-06T01:01:38Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Eingeben von Programm-Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot;(-&amp;gt;dt.Auto-Vervollständigung), also die Fähigkeit eines Editors den Text automatisch zu vervollständigen um den Schreibprozess zu beschleunigen, während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Stings (Textvariablen) werden in doppelte Anfürhrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von ??? herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16354</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16354"/>
		<updated>2006-09-06T00:57:53Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Wohin schreibe ich den Code? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Bibliotheken können maximal 64kb groß sein. Eine Bibliothek kann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot; (Code-Vervollständigung ???) während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Stings (Textvariablen) werden in doppelte Anfürhrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von ??? herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16353</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16353"/>
		<updated>2006-09-06T00:56:44Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Wohin schreibe ich den Code? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfügbare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Biblitheken können maximal 64kb groß sein. Eine Bibliothek cann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot; (Code-Vervollständigung ???) während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Stings (Textvariablen) werden in doppelte Anfürhrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von ??? herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16352</id>
		<title>DE/Makro Basic Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=DE/Makro_Basic_Tutorial&amp;diff=16352"/>
		<updated>2006-09-06T00:55:46Z</updated>

		<summary type="html">&lt;p&gt;Global667: /* Wohin schreibe ich den Code? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:de.openoffice.org|Makro Basic Tutorial]]&lt;br /&gt;
&lt;br /&gt;
{| cellspacing=0 cellpadding=5 style=&amp;quot;border: 1px solid black;&amp;quot;&lt;br /&gt;
| bgcolor=orange colspan=2 |&amp;#039;&amp;#039;&amp;#039;Achtung, work in progress&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Dieses Dokument wird gerade übersetzt, wer mag, darf auch gerne helfen. &lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Arbeitstitel:&amp;#039;&amp;#039;&amp;#039; || &amp;quot;Einführung: Basic für OOo-Erweiterungen&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Originaldokument:&amp;#039;&amp;#039;&amp;#039; || [[Extensions_development_basic]]&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Ursprünglicher Autor:&amp;#039;&amp;#039;&amp;#039; || Ian Laurenson&lt;br /&gt;
|-&lt;br /&gt;
| offene Fragen: || sind mit ??? gekennzeichnet&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Diese Seite soll Ihnen eine Einführung in das Schreiben von Makros mit OpenOffice.org Basic geben. Grundkenntnisse im Programmieren werden vorausgesetzt. Bitte fühlen Sie sich frei, diese Seite zu editieren, um sie lesbarer zu machen. Ich hoffe, das Sie Ihnen von Nutzen sein wird.&lt;br /&gt;
&lt;br /&gt;
Wenn Sie bereits mit den Grundlagen vertraut sind, können Sie sich auch direkt im KochBuch ([[CookBook]]) Wrapper (Hüllfunktionen ???) und Beispiele anschauen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Wohin schreibe ich den Code? =&lt;br /&gt;
&lt;br /&gt;
Der Basic-Code wird bei OpenOffice.org in &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gespeichert, die in &amp;#039;&amp;#039;&amp;#039;Bibliotheken&amp;#039;&amp;#039;&amp;#039; zusammengefasst sind. &lt;br /&gt;
&lt;br /&gt;
Eine Bibliothek kann&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;allgemein&amp;#039;&amp;#039;&amp;#039;, also für die gesamte (Netzwerk-) Installation verfügbar sein (&amp;quot;OOo Makros und Dialoge&amp;quot;)&lt;br /&gt;
* nur für den aktuellen &amp;#039;&amp;#039;&amp;#039;Benutzer&amp;#039;&amp;#039;&amp;#039; verfügbar sein (&amp;quot;Meine Makros und Dialoge&amp;quot;)&lt;br /&gt;
* in einem &amp;#039;&amp;#039;&amp;#039;Dokument&amp;#039;&amp;#039;&amp;#039; oder in einer Vorlage abgelegt sein, so dass ihr Code nur zur Verfügung steht, wenn das Dokument geöffnet ist. &lt;br /&gt;
Bibliotheken, die nicht in einem Dokument abgelegt sind (also allgemein oder für den aktuellen Benutzer verfübare Bibliotheken) werden im Folgenden als &amp;#039;&amp;#039;OpenOffice.org Bibliotheken&amp;#039;&amp;#039; zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
Der physische Speicherort für diese OpenOffice.org Bibliotheken wird unter&amp;lt;br&amp;gt;&amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Optionen… &amp;gt; OpenOffice.org &amp;gt; Pfade &amp;gt; BASIC&amp;#039;&amp;#039;&amp;#039; festgelegt.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Anmerkung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Hüten Sie sich, Bibliotheken auf Dateisystem-Ebene zu verschieben oder zu kopieren. Benutzen Sie stattdessen den Dialog &amp;quot;Makros verwalten&amp;quot; oder den Paket-Manager&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Module in Biblitheken können maximal 64kb groß sein. Eine Bibliothek cann bis zu 16 000 Module enthalten. Weitere Infos finden Sie in der Online-Hilfe unter &amp;quot;Module und Bibliotheken&amp;quot; (???).&lt;br /&gt;
&lt;br /&gt;
= Die Entwicklungsumgebung (IDE) =&lt;br /&gt;
&lt;br /&gt;
Öffnen Sie die Entwicklungsumgebung:&lt;br /&gt;
* in OOo 1.1.x unter &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro ...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* in OOo 1.9.x und höher unter &amp;#039;&amp;#039;&amp;#039; Extras &amp;gt; Makros &amp;gt; Makros verwalten &amp;gt; OpenOffice.org Basic...&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Zum Einstieg benutzen wir das &amp;quot;Modul1&amp;quot; aus der Bibliothek &amp;quot;Standard&amp;quot; des aktuellen Benutzers:&lt;br /&gt;
&lt;br /&gt;
Geben Sie einen Namen für das neue Makro ein: &amp;quot;HelloWorld&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Wählen Sie die Option &amp;#039;&amp;#039;&amp;#039;Standard&amp;#039;&amp;#039;&amp;#039; im Auswahlfeld &amp;quot;Makro aus:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Klicken Sie auf &amp;#039;&amp;#039;&amp;#039;Neu&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Jetzt sollten Sie etwa folgendes sehen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Cursor sollte am Anfang der Zeile &amp;lt;tt&amp;gt;Sub HelloWorld&amp;lt;/tt&amp;gt; stehen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Das geöffnete IDE-Fenster ist sowohl über das Menü im OpenOffice.org-Fenster als auch über die Programmleiste des Betriebssystems erreichbar.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Eingeben von Programm-Code =&lt;br /&gt;
&lt;br /&gt;
Löschen Sie folgende Zeilen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
REM  *****  BASIC  *****&lt;br /&gt;
 &lt;br /&gt;
Sub Main&lt;br /&gt;
 &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Schreiben Sie unterhalb der Zeile &amp;quot;Sub HelloWorld&amp;quot;: &amp;lt;tt&amp;gt;msgbox &amp;quot;Hello World!&amp;quot;&amp;lt;/tt&amp;gt;, so dass es in etwa so aussieht:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
Sub HelloWorld&lt;br /&gt;
  msgbox &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Die IDE beherrscht zwar keine &amp;quot;code completion&amp;quot; (Code-Vervollständigung ???) während der Eingabe, verfügt aber über eine kontext-sensitive Hilfe, wenn Sie während der Eingabe F1 oder &amp;quot;Hilfe&amp;quot; drücken oder der Cursor in einem Befehl steht.&amp;lt;br&amp;gt;Bei OpenOffice.org Basic-Befehlen wird die Groß- und Kleinschreibung nicht unterschieden. So sind die Eingaben msgbox, MSGBOX oder Msgbox äquivalent.&amp;lt;br&amp;gt; Stings (Textvariablen) werden in doppelte Anfürhrungszeichen eingeschlossen.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Den Code ausführen =&lt;br /&gt;
&lt;br /&gt;
Hierfür gibt es mehrere Möglichkeiten:&lt;br /&gt;
&lt;br /&gt;
* direkt aus der IDE: das Symbol &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039; (das 3. Symbol in der 2. Leiste) ruft das ERSTE Makro des aktuellen Moduls auf.&lt;br /&gt;
* aus dem Menü &amp;quot;Extras&amp;quot;:&lt;br /&gt;
** (Version 1.1.x) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makros &amp;gt; Makro…&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
** (Version 1.9.x und höher) &amp;#039;&amp;#039;&amp;#039;Extras &amp;gt; Makro &amp;gt; Makro auführen…&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Dem Makro ein Tastaturkürzel zuweisen (todo).&lt;br /&gt;
* Dem Makro einen Menüeintrag zuweisen (todo).&lt;br /&gt;
* Dem Makro ein Symbolleisten-Symbol zuweisen (todo).&lt;br /&gt;
* Ein Kontroll-Element in einem Dokument erstellen (todo).&lt;br /&gt;
* Das Makro einem Ereignis zuweisen (todo)&lt;br /&gt;
&lt;br /&gt;
Führen Sie für den Anfang die &amp;quot;HelloWorld&amp;quot;-Subroutine aus, indem Sie auf das &amp;#039;&amp;#039;&amp;#039;Ausführen&amp;#039;&amp;#039;&amp;#039;-Symbol klicken. Ein kleiner Dialog mit dem Titel &amp;quot;soffice&amp;quot; und dem Text &amp;quot;Hello World&amp;quot; sollte aufpoppen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Speichern des Code =&lt;br /&gt;
&lt;br /&gt;
Der Code wird immer automatisch gespeichert, wenn sein Container gespeichert wird. Wenn das Modul also in einer (allgemeinen oder benutzerspezifischen) OpenOffice.org-Bibliothek enthalten ist, wird es beim Schließen der Anwendung OpenOffice.org gespeichert. Entsprechend werden Dokument-interne Bibliotheken biem Speichern des Dokuments mit-gesichert.&lt;br /&gt;
&lt;br /&gt;
Auf der Standard-Symbolleiste der IDE (normalerweise die oberste Symbolleiste) finden Sie ein Symbol &amp;quot;Speichern&amp;quot;. Befindet sich der Code in einem Dokument oder einer Vorlage, dann speichert der Klick auf dieses Symbol das gesamte Dokument. Handelt es sich dagegen um eine OpenOffice.org-Bibliothek, wird nur die aktuelle Bibliothek gespeichert.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Variablen =&lt;br /&gt;
&lt;br /&gt;
Bei Variablen kann durch &amp;lt;tt&amp;gt;Option Explicit&amp;lt;/tt&amp;gt; zu Beginn des Moduls die explizite Deklaration erzwungen werden. Zu Sinn und Unsinn des Deklarierens von Variablen lesen Sie [http://www.oooforum.org/forum/viewtopic.phtml?t=5845 diese Diskussion].&lt;br /&gt;
&lt;br /&gt;
In dieser Diskussion vertritt der ursprüngliche Autor dieses Wiki-Beitrags die Position, dass  Variablen immer deklariert werden sollten. Mittlerweile hat er seine Meinung geändert. Kurz: es ist eine Frage des persönlichen Geschmacks. Unabhängig davon sollten nach Auffassung des ursprünglichen Autors Variablen nach folgener Konvention benannt werden, die auch bei den Beispielen aus diesem Wiki verwendet wurde:&lt;br /&gt;
&lt;br /&gt;
Der erste Buchstabe der Variable steht für den Typ des in der Variable gespeicherten Wertes. Dabei bezeichnen folgende Buchstaben die entsprechenden Datentypen (in Anlehung an das Tutorial.pdf von Sun):&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Buchstabe&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Bedeutung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|a&lt;br /&gt;
|Struktur (Structure)&lt;br /&gt;
|-&lt;br /&gt;
|b&lt;br /&gt;
|Bool&amp;#039;sch (WAHR oder FALSCH)&lt;br /&gt;
|-&lt;br /&gt;
|e&lt;br /&gt;
|Aufzählung (Enumeration). Diese Variable kann nur einen begrenzten Satz von Werten enthalten.&lt;br /&gt;
|-&lt;br /&gt;
|f&lt;br /&gt;
|Fließkomma-Zahl (3.402823 x 1038 bis 1.401298 x 10-45. Eine einzelne Variable kann bis zu 4 Bytes umfassen)&amp;lt;br&amp;gt;&amp;quot;Double&amp;quot; (doppelte Genauigkeit, 1.79769313486232 x 10308 bis 4.94065645841247 x 10-324. Eine Double-Variable kann bis zu 8 Bytes umfassen)&amp;lt;br&amp;gt;Währung (-922337203685477.5808 bis +922337203685477.5807 ebenfalls 8 Byte umfassend)&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
|Feld (Array) (aka Sequenz aka Matrix)&lt;br /&gt;
|-&lt;br /&gt;
|n&lt;br /&gt;
|Integer (-32768 to 32767.) oder&amp;lt;br&amp;gt;Long (-2147483648 and 2147483647).&lt;br /&gt;
|-&lt;br /&gt;
|o&lt;br /&gt;
|Objekt, Service oder Interface&lt;br /&gt;
|-&lt;br /&gt;
|s&lt;br /&gt;
|Text (String) (Eine String-Variable kann bis zu 65535 Unicode-Zeichen enthalten).&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|Schnittstelle (Interface), um anzuzeigen, dass nur Methoden einer bstimmten Schnittstelle eines Objekts verwendet werden.&lt;br /&gt;
|-&lt;br /&gt;
|v&lt;br /&gt;
|Variant, irgend ein Typ&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Benutzen Sie lange, beschreibende Variablennamen unter Verwendung von CamelCase (Groß-Klein-Schreibung).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Achtung:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|Bei benutzerdefinierten OpenOffice.org Basic-Variablen spielt die Groß-/Kleinschreibunge keine Rolle. Bei UNO-API-Konstanten aber sehr wohl!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Ausnahmen von der Regel, lange Namen zu verwenden, sind Index-Variablen (meist i, j oder k), sowie Strings (meist als s bezeichnet).&lt;br /&gt;
&lt;br /&gt;
Bearbeiten Sie nun die sub HelloWorld, so dass der Code ungefähr wie im folgenden aussieht und führen Sie sie aus:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub HelloWorld&lt;br /&gt;
dim i as integer &amp;#039;This line is optional&lt;br /&gt;
  for i = 0 to 2&lt;br /&gt;
    &amp;#039;These lines are indented for ease of reading only&lt;br /&gt;
    &amp;#039;all your code should be like this for lonog time survival&lt;br /&gt;
    msgbox &amp;quot;Hello World &amp;quot; &amp;amp; i&lt;br /&gt;
  next i&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mehr Infos zur Verwendung von Variablen erhalten Sie in der Online-Hilfe unter &amp;quot;Variablen benutzen&amp;quot; (???)&lt;br /&gt;
&lt;br /&gt;
= Die OpenOffice.org API =&lt;br /&gt;
&lt;br /&gt;
Dieser Abschnitt beginnt mit einem Beispiel. Anschließend wird das Beispiel erläutert.&lt;br /&gt;
&lt;br /&gt;
Versuchen Sie den folgenden Code in Dokumenten unterschiedlichen Typs auszuführen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
msgbox fnWhichComponent(thisComponent)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function fnWhichComponent(oDoc) as string&lt;br /&gt;
if HasUnoInterfaces(oDoc, &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot;) then &lt;br /&gt;
   if thisComponent.supportsService (&amp;quot;com.sun.star.text.GenericTextDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Text&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.sheet.SpreadsheetDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Spreadsheet&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.presentation.PresentationDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Presentation&amp;quot;&lt;br /&gt;
   elseif thisComponent.supportsService(&amp;quot;com.sun.star.drawing.GenericDrawingDocument&amp;quot;) then&lt;br /&gt;
      fnWhichComponent = &amp;quot;Drawing&amp;quot;&lt;br /&gt;
   else&lt;br /&gt;
      fnWhichComponent = &amp;quot;Oops current document something else&amp;quot;&lt;br /&gt;
   end if&lt;br /&gt;
else&lt;br /&gt;
   fnWhichComponent = &amp;quot;Not a document&amp;quot;&lt;br /&gt;
end if&lt;br /&gt;
End function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Namenskonventionen für Subroutinen ==&lt;br /&gt;
im obigen Beispiel beginnt die Benutzer-definierte Funktion mit den Buchstaben &amp;quot;fn&amp;quot;. Diese Konvention (an die sich der ursprüngliche Autor hält) kennzeichnet eine Funktion als Benutzer-definiert. Entsprechend beginnt eine Benutzer-definierte Subroutine mit &amp;quot;sub&amp;quot;. Diese im Folgenden benutzten Konventionen sollen Ihnen als Anfängern helfen, Benutzer-definierte von eingebauten Routinen/Funktionen zu unterscheiden.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Einführung in die OpenOffice.org API ==&lt;br /&gt;
&lt;br /&gt;
In diesem Abschnitt werden folgende Begriffe erläutert:&lt;br /&gt;
&lt;br /&gt;
* Interface (Schnittstelle)&lt;br /&gt;
* Modul&lt;br /&gt;
* Service (Dienst)&lt;br /&gt;
* Methode&lt;br /&gt;
* Property (Eigenschaft)&lt;br /&gt;
&lt;br /&gt;
Den Unterschied zwischen einer Schnittstelle und einem Service zu kennen, ist zwar nicht unbedingt Voraussetzung zum Programmieren unter OpenOffice.org, aber es hilft, die Dokumentation zu verstehen, und auch bei der Introspektion. Möglicherweise werden Sie den folgenden Abschnitt mindestens zwei mal lesen müssen!&lt;br /&gt;
&lt;br /&gt;
Eine Schnittstelle ist eine &amp;#039;&amp;#039;Definition&amp;#039;&amp;#039; eines Satzes von Methoden (und ihren Argumenten), die ein Dienst, der diese Schnittstelle implementiert, enthalten muss.&lt;br /&gt;
&lt;br /&gt;
Schnittstellen werden aus Gründen der Namensgebung zu &amp;#039;&amp;#039;&amp;#039;Modulen&amp;#039;&amp;#039;&amp;#039; gruppiert. Alle Schnittstellen (und Dienste) beginnen mit &amp;lt;tt&amp;gt;com.sun.star&amp;lt;/tt&amp;gt;, gefolgt vom Modul-Namen, dann kommt der Name der Schnittstelle (oder des Dienstes).&lt;br /&gt;
&lt;br /&gt;
Beispielsweise bieten die meisten Dienste die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.beans.XPropertySet&amp;lt;/tt&amp;gt;. Diese Schnittstelle ist im Modul &amp;lt;tt&amp;gt;beans&amp;lt;/tt&amp;gt; gespeichert und ermöglicht Zugriff auf die Eigenschaften (Properties)  eines Dienstes. Eine &amp;#039;&amp;#039;&amp;#039;Eigenschaft&amp;#039;&amp;#039;&amp;#039; ist ein Wert, eine &amp;#039;&amp;#039;&amp;#039;Methode&amp;#039;&amp;#039;&amp;#039; ist dagegen eine Aktion.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann viele Dienste enthalten.&lt;br /&gt;
&lt;br /&gt;
Ein OpenOffice.org-Objekt kann einen Dienst enthalten, der eine Schnittstelle implementiert, in welcher eine Methode beschreibt, dass ein anderes OpenOffice.org-Objekt zurückgegeben wird.&lt;br /&gt;
&lt;br /&gt;
== Introspektion ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;HasUnoInterfaces&amp;#039;&amp;#039;&amp;#039; ist eine OpenOffice.org-Basic-Funktion zur Introspektion. Informieren Sie sich über  [http://www.oooforum.org/forum/viewtopic.phtml?t=7068 Introspektion in anderen Sprachen].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; gibt &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurück, wenn beim spezifizierten Objekt alle spezifizierten Schnittstellen verfügbar sind.&lt;br /&gt;
&lt;br /&gt;
Die meisten OpenOffice.org-Objekte enthalten die Methode &amp;#039;&amp;#039;&amp;#039;supportsService&amp;#039;&amp;#039;&amp;#039; weil sie die Schnittstelle &amp;lt;code&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/code&amp;gt; enthalten.&lt;br /&gt;
&lt;br /&gt;
Im obigen Beispiel prüft &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt;, ob das aktuelle Dokument die Schnittstelle &amp;lt;tt&amp;gt;com.sun.star.lang.XServiceInfo&amp;lt;/tt&amp;gt; implementiert, da andernfalls die Methode &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; fehlen würde. Der Aufruf dieser Methode würde in diesem Fall einen Laufzeitfehler verursachen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; ist eine Methode, die den Wert &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; zurückgibt, wenn der spezifizierte Service verfügbar ist. Das obige Beispiel prüft das Vorhandensein eines Service, um so den Typ des aktuell aktiven Dokuments zu bestimmen.&lt;br /&gt;
&lt;br /&gt;
== X-Ray tool ==&lt;br /&gt;
Die Benutzung von &amp;lt;tt&amp;gt;HasUnoInterfaces&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;supportsService&amp;lt;/tt&amp;gt; reicht aus, um sich zur Laufzeit über ein Objekt zu informieren, aber zum Lernen eignet sich das [http://ooomacros.org/dev.php#101416 X-Ray tool von Bernard Marcelly] viel besser. Laden Sie das ZIP-File herunter, entpacken Sie es und öffnen Sie das enthaltene Dokument mit OpenOffice.org. Befolgen Sie anschließend die Installationsanweisungen.&lt;br /&gt;
&lt;br /&gt;
Das &amp;#039;&amp;#039;&amp;#039;X-Ray tool&amp;#039;&amp;#039;&amp;#039; verlangt bei der Konfiguration eine lokale Kopie des OpenOffice.org SDK. Laden Sie es von ??? herunter und entpacken Sie es. &lt;br /&gt;
&lt;br /&gt;
Nun können Sie die beiden auskommentierten Zeilen des obigen Beispiels entkommentieren (den Apostroph entfernen):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039;basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
&amp;#039;xray.xray thisComponent&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Führen Sie das Makro dann erneut aus.&lt;br /&gt;
&lt;br /&gt;
Ab Xray Version 5 heißt das Kommando einfach &amp;#039;&amp;#039;&amp;#039;xray&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;BasicLibraries&amp;#039;&amp;#039;&amp;#039; ist ein OpenOffice.org-Basic-Befehl, der ein Objekt zurückgibt, mit dem man auf die OpenOffice.org Bibliotheken zugreifen kann. Die Methode &amp;lt;tt&amp;gt;loadLibrary&amp;lt;/tt&amp;gt; macht die Routinen aus dieser Bibliothek verfügbar. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xray.xray&amp;lt;/tt&amp;gt; spezifiziert die Subroutine &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; im Modul &amp;lt;tt&amp;gt;xray&amp;lt;/tt&amp;gt; in dieser Bibliothek, &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; ist das Objekt, das an xray zur Introspektion übergeben wird. &lt;br /&gt;
&lt;br /&gt;
Um mit einem bestimmten Objekt zu arbeiten erfordert häufig, dieses Objekt zu finden oder zu erzeugen, indem man mit &amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; oder &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt; beginnt.&lt;br /&gt;
&lt;br /&gt;
== Desktop, Dokumente, Selektionen ==&lt;br /&gt;
&amp;lt;tt&amp;gt;StarDesktop&amp;lt;/tt&amp;gt; und &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; sind OpenOffice.org-Basic-Befehle, die sich auf die Applikation bzw. das aktuell aktive Dokument beziehen. &lt;br /&gt;
&lt;br /&gt;
Im Unterschied zu Microsoft Office ist OpenOffice.org eine Anwendung mit unterschiedlichen Komponenten. Beim Ausführen von Code möchte man häufig wissen, welche Komponente aktuell aktiv ist. Der obige Code zeigt eine Möglichkeit, dies zu überprüfen. &lt;br /&gt;
&lt;br /&gt;
StarDesktop bezieht sich auf einen konzeptuellen Desktop (der historisch tatsächlich mal existiert hat) und meint de facto die Anwendung OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
== Neue Dokumente erzeugen ==&lt;br /&gt;
Um ein neues Text-Dokument zu erzeugen: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Um ein neues Tabellen-Dokument zu erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ein sinnvoller Ansatz wäre, eine einfache Funktion zu schreiben:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnNewDoc(sDocType as string)&lt;br /&gt;
fnNewDoc = StarDesktop.loadComponentFromURL(&amp;quot;private:factory/&amp;quot; &amp;amp; sDocType , &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Dann könnte man neue Dokumente ganz einfach erzeugen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;swriter&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;scalc&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;simpress&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;sdraw&amp;quot;)&lt;br /&gt;
oDoc = fnNewDoc(&amp;quot;smath&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Siehe http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html .&lt;br /&gt;
&lt;br /&gt;
== Ein bestehendes Dokument öffnen ==&lt;br /&gt;
Im folgenden Beispiel sehen Sie, wie Sie eine Datei öffnen können. OpenOffice.org URLs sind in [[DE: URL Grundlagen]] erläutert. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot; &amp;#039; Windows&lt;br /&gt;
sFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; &amp;#039; Linux&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
oDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Auch hier könnte eine einfache Funktion das Schreiben verkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
function fnOpenDoc(sFile)&lt;br /&gt;
sURL = ConvertToURL(sFile)&lt;br /&gt;
fnOpenDoc = StarDesktop.loadComponentFromURL(sURL, &amp;quot;_blank&amp;quot;, 0, Array())&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Beispiele für Aufrufe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc.sxc&amp;quot;) &amp;#039; Windows&lt;br /&gt;
oDoc = fnOpenDoc(&amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot;) &amp;#039; Linux&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Die aktuelle Selektion ==&lt;br /&gt;
Häufig werden Sie eine Funktion schreiben wollen, die etwas mit dem aktuell selektierten Bereich anstellt. &amp;lt;tt&amp;gt;ThisComponent&amp;lt;/tt&amp;gt; enthält die Methode &amp;lt;tt&amp;gt;getCurrentSelection&amp;lt;/tt&amp;gt;. Da viele unterschiedliche Objekte selektiert sein könnten, werden Sie zuerst prüfen wollen, ob das selektierte Objekt über den Dienst verfügt, der die Methode enthält, mit der Sie das Objekt bearbeiten wollen.&lt;br /&gt;
&lt;br /&gt;
Editieren Sie die Subroutine main im nachfolgenden Code und führen Sie sie mehrfach in einem Textdokument aus, wobei Sie unterschiedliche Objekte selektieren. (Um mehr als einen Textblock zu selektieren, betätigen Sie die &amp;#039;&amp;#039;&amp;#039;Strg&amp;#039;&amp;#039;&amp;#039;-Taste).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
        oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
        &amp;#039;xray.xray oCurSelection&lt;br /&gt;
        if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
                msgbox &amp;quot;There are &amp;quot; &amp;amp; oCurSelection.getCount() &amp;amp; _&lt;br /&gt;
                 &amp;quot; selections in the current text document.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Wenn nichts selektiert ist, beträgt die Anzahl der Selektionen eins (nämlich der Einfügepunkt), wenn ein Textblock selektiert ist, beträgt die Anzahl ebenfalls eins, wenn zwei Textblöcke selektiert sind, beträgt sie drei: der Einfügepunkt sowie die beiden selektierten Textblöcke.&lt;br /&gt;
&lt;br /&gt;
Übung 1: Modifizieren Sie den obigen Code so, dass er mit selektierten Zellbereichen in einem Tabellendokument funktioniert.&lt;br /&gt;
&lt;br /&gt;
Frage 1: Wie hoch ist die Anzahl der Selektionen, wenn zwei Zellblöcke selektiert sind?&lt;br /&gt;
&lt;br /&gt;
==Properties==&lt;br /&gt;
Wenn Sie die Zeile &amp;lt;tt&amp;gt;&amp;#039;xray.xray oCurSelection&amp;lt;/tt&amp;gt; entkommentieren, so dass xray läuft, sehen Sie, dass das Objekt, worauf &amp;lt;tt&amp;gt;oCurSelection&amp;lt;/tt&amp;gt; zeigt, eine &amp;quot;Property&amp;quot; namens &amp;lt;tt&amp;gt;Count&amp;lt;/tt&amp;gt; besitzt, mit einer Beschreibung &amp;quot;pseudo-prop, read only&amp;quot;. In OpenOffice.org Basic könnten Sie &amp;lt;tt&amp;gt;oCurSelection.count&amp;lt;/tt&amp;gt; schreiben, da dies aber in keiner anderen Sprache, mit der Sie auf die OpenOffice.org API zugreifen können, möglich ist, werde ich versuchen, in diesem Wiki nur über Methoden zuzugreifen. (Möglicherweise vergesse ich das auch das eine oder andere Mal). &lt;br /&gt;
&lt;br /&gt;
Das nächste Beispiel zeigt, wie man einen Property-Wert für die aktuellen Selektionen ändert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
sub main&lt;br /&gt;
basicLibraries.loadLibrary(&amp;quot;Xray&amp;quot;)&lt;br /&gt;
if fnWhichComponent(thisComponent) = &amp;quot;Text&amp;quot; then&lt;br /&gt;
   oCurSelection = thisComponent.getCurrentSelection()&lt;br /&gt;
   if oCurSelection.supportsService(&amp;quot;com.sun.star.text.TextRanges&amp;quot;) then&lt;br /&gt;
      nCount = oCurSelection.Count&lt;br /&gt;
      &amp;#039;xray.xray oCurSelection.getByIndex(0)&lt;br /&gt;
      &amp;#039;Warnung: Am Einfügepunkt wird die selbe Aktion zwei mal angewandt -&lt;br /&gt;
      &amp;#039;das macht in diesem Fall nichts, kann aber durchaus problematisch werden.&lt;br /&gt;
      for i = 0 to nCount - 1&lt;br /&gt;
         oCurSelection.getByIndex(i).setPropertyValue(&amp;quot;CharStyleName&amp;quot;, &amp;quot;Strong Emphasis&amp;quot;)&lt;br /&gt;
      next&lt;br /&gt;
   end if&lt;br /&gt;
end if&lt;br /&gt;
end sub&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In OpenOffice.org Basic kann man die Zuweisung auch abkürzen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oCurSelection(i).CharStyleName = &amp;quot;Strong Emphasis&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Hier in diesem Wiki versuche ich, sowohl zur Indexierung als auch zur Zuweisung von Properties die vollständigen Methoden zu verwenden. Dadurch kann der Code leichter in andere Sprachen portiert werden und es hilft Ihnen auch, zu verstehen, was vor sich geht (nochmal: Bitte um Entschuldigung, wenn ich mal von dieser Regel abweiche, weil ich es eigentlich nicht gewohnt bin)&lt;br /&gt;
&lt;br /&gt;
Übung 2: Schreiben Sie den obigen Code so um, dass die Warnung entfernt werden kann.&lt;br /&gt;
&lt;br /&gt;
Siehe [[DE:Aktuelle Selektion]] ([[ Current selection]]).&lt;br /&gt;
&lt;br /&gt;
=Iterative Access to Subordinate Objects (Enumeration access)=&lt;br /&gt;
Sometimes to access the desired object an enumeration is required. For example paragraphs, within a document or within a selection. &lt;br /&gt;
&lt;br /&gt;
When a Writer document is active and some text is selected, both &amp;lt;tt&amp;gt;thisDocument.getText()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;thisComponent.getCurrentSelection().getByIndex(i)&amp;lt;/tt&amp;gt; have the service: com.sun.star.text.TextRange which has the interface: com.sun.star.container.XContentEnumerationAccess, it is possible to create an enumeration of the paragraphs for the current document or for a particular selection. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
&amp;#039; Create enumeration object&lt;br /&gt;
oTextElementEnum = thisComponent.getText().createEnumeration()&lt;br /&gt;
&amp;#039;or thisComponent.getCurrentSelection().getByIndex(i).createEnumeration()&lt;br /&gt;
 &lt;br /&gt;
&amp;#039; loop over all text elements&lt;br /&gt;
while oTextElementEnum.hasMoreElements()&lt;br /&gt;
        oTextElement = oTextElementEnum.nextElement&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.TextTable&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a table.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
        if oTextElement.supportsService(&amp;quot;com.sun.star.text.Paragraph&amp;quot;) then&lt;br /&gt;
                MsgBox &amp;quot;The current block contains a paragraph.&amp;quot;&lt;br /&gt;
        end if&lt;br /&gt;
wend&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Exercise 3: Extend the above example to display in a message box all text portions that are bold. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Named access=&lt;br /&gt;
Some objects provide named access to a particular type of subordinate object, some others indexed access, and some both named and indexed access. &lt;br /&gt;
&lt;br /&gt;
For example if the current document in OpenOffice.org is a spreadsheet then to access a particular sheet can be done by index access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByIndex(0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or named access: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oSheet = thisComponent.getSheets.getByName(&amp;quot;Sheet1&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To check if an object with a particular name already exists use &amp;lt;tt&amp;gt;hasByName&amp;lt;/tt&amp;gt;, for example: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
if thisComponent.getSheets.hasByName(&amp;quot;Sheet1&amp;quot;) then&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
To loop through all the available object names can be done like: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
mNames = thisComponent.getSheets.getElementnames&lt;br /&gt;
for i = lbound(mNames) to ubound(mNames)&lt;br /&gt;
        msgbox mNames(i)&lt;br /&gt;
next&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Some named subordinate objects also provide the interface:  com.sun.star.container.XNameContainer. This interface defines that such objects should have the following methods: &amp;lt;tt&amp;gt;insertByName&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;replaceByname&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;removeByName&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
E.g. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
thisComponent.getSheets.insertByName(&amp;quot;NewSheet&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create new objects=&lt;br /&gt;
Some objects have services which implement interfaces to provide specific methods for creating a particular type of object. &lt;br /&gt;
&lt;br /&gt;
For example if the current document is a Writer document then &amp;lt;tt&amp;gt;thisComponent.getText&amp;lt;/tt&amp;gt; is an object that provides the service com.sun.star.text.Text which implements the interface  com.sun.star.text.XSimpleText which defines the methods &amp;lt;tt&amp;gt;createTextCursor&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;createTextCursorByRange&amp;lt;/tt&amp;gt;. Both of these methods create a text cursor for accessing the text of the document. These cursors are quite independent of the view cursor . The view cursor is visible on the screen and is manipulated by the user (and can be manipulated by program control), where as a text cursor is not visible on the screen and is solely used by program control. The following code snippet demonstrates creating a new text cursor, such that it starts at the same location as the viewCursor and is then moved independent of the view cursor. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oVC = thisComponent.getCurrentController.getViewCursor&lt;br /&gt;
oCursor = oVC.getText.createTextCursorByRange(oVC)&lt;br /&gt;
oCursor.gotoStartOfSentence(false)&lt;br /&gt;
oCursor.gotoEndOfSentence(true)&lt;br /&gt;
msgbox oCursor.getString&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some objects are context dependent and get created using the method &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; which is defined in the interface com.sun.star.lang.XMultiServiceFactory. For example to add a rectangle to the first page of a drawing document: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
dim aSize as new com.sun.star.awt.Size&lt;br /&gt;
 &lt;br /&gt;
aPoint.x = 1000&lt;br /&gt;
aPoint.y = 1000&lt;br /&gt;
 &lt;br /&gt;
aSize.Width = 10000&lt;br /&gt;
aSize.Height = 10000&lt;br /&gt;
 &lt;br /&gt;
oRectangleShape = thisComponent.createInstance(&amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;)&lt;br /&gt;
oRectangleShape.Size = aSize&lt;br /&gt;
oRectangleShape.Position = aPoint&lt;br /&gt;
 &lt;br /&gt;
thisComponent.getDrawPages.getByIndex(0).add(oRectangleShape)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example also uses UNO structs see below for more information on UNO stucts. &lt;br /&gt;
&lt;br /&gt;
Some objects are context independent to create these objects use the OpenOffice.org Basic command createUnoService. For example to create the equivalent to StarDesktop: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
oDesktop = createUnoService(&amp;quot;com.sun.star.frame.Desktop&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process that I use to determine how to access or create an object is as follows: &lt;br /&gt;
&lt;br /&gt;
Does the object already exist if so I should be able to access it from something like &amp;lt;tt&amp;gt;thisComponent&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Will the new object belong to another object, if so does the owner have a specific method for creating the object, if so use it. &lt;br /&gt;
&lt;br /&gt;
The new object will belong to another object, but that object doesn&amp;#039;t provide a specific method for creating it, but does provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt;. If the object doesn&amp;#039;t provide &amp;lt;tt&amp;gt;createInstance&amp;lt;/tt&amp;gt; are you sure you are using the correct object, or is it context independent. &lt;br /&gt;
&lt;br /&gt;
I have found working out how to create an object to be quite difficult with existing documentation so I hope that this document/wiki will eventually make this clear. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==UNO structs==&lt;br /&gt;
UNO structures can be declared using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;dim&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
dim aPoint as new com.sun.star.awt.Point&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Or by using the OpenOffice.org Basic command &amp;lt;tt&amp;gt;createUnoStruct&amp;lt;/tt&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
aPoint = createUnoStruct(&amp;quot;com.sun.star.awt.Point&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
|When declaring UNO structs case is important. Note that everything upto the name of the struct is lowercase, and that the name of the struct is in TitleCase.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating Listeners and Handlers==&lt;br /&gt;
Through the user interface it is possible to assign macros to some events: &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.1.x: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Configure… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org versions 1.9.x and above: &amp;#039;&amp;#039;&amp;#039;Tools &amp;gt; Customize… &amp;gt; Events&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
It is also possible to assign macros to a wider range of events using the OpenOffice.org Basic command CreateUnoListener. This same command is used for creating both listeners and handlers. A listener checks for an event and always allows other listeners to respond to the event as well. A handler listens for an event, and can optionally consume the event so that other listeners don&amp;#039;t get to act on it. &lt;br /&gt;
&lt;br /&gt;
The following example creates a keyHandler: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[oobas]&lt;br /&gt;
global IannzExampleKeyHandler&lt;br /&gt;
 &lt;br /&gt;
sub SetupKeyHandler&lt;br /&gt;
oController = thisComponent.currentController&lt;br /&gt;
IannzExampleKeyHandler = CreateUnoListener(&amp;quot;KeyHandler_&amp;quot;,&amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;)&lt;br /&gt;
oController.addKeyHandler(IannzExampleKeyHandler) &amp;#039; Register the listener&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub RemoveKeyHandler&lt;br /&gt;
thisComponent.currentController.removeKeyHandler(IannzExampleKeyHandler)&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
sub KeyHandler_disposing&lt;br /&gt;
end sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyReleased(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
        KeyHandler_keyReleased = False    &lt;br /&gt;
end function&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
function KeyHandler_keyPressed(oKeyEvent as new com.sun.star.awt.KeyHandler) as boolean&lt;br /&gt;
KeyHandler_keyPressed = false   &amp;#039;Let other listeners handle the event&lt;br /&gt;
if oKeyEvent.modifiers = com.sun.star.awt.KeyModifier.MOD2 then &amp;#039;Control key was pressed&lt;br /&gt;
        if oKeyEvent.keyCode = com.sun.star.awt.Key.Q then&lt;br /&gt;
                msgbox &amp;quot;Alt + Q was pressed&amp;quot;&lt;br /&gt;
                KeyHandler_keyPressed = true    &amp;#039;Don&amp;#039;t let other listeners process this event&lt;br /&gt;
        end if&lt;br /&gt;
end if&lt;br /&gt;
end function&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
A variable declared as global keeps its value even after the macro exits. In this case we want to be able to use this variable later to remove the handler. As variables declared globally could be used in other libraries to try and avoid conflict I start all my global variables with Iannz my registered name for the OpenOffice.org web site. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub SetupKeyHandler&amp;lt;/tt&amp;gt; sets up the handler. The first parameter to CreateUnoListener is the staring name for the methods that will be called when that type of event occurs in this example .&amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The second parameter is the name of the interface for the listener or handler, &amp;quot;com.sun.star.awt.XKeyHandler&amp;quot;. The name is case sensitive, everything up to and including the module name is always lowercase, the name of the interface always starts with &amp;quot;X&amp;quot; and the remainder is in TitleCase. &lt;br /&gt;
&lt;br /&gt;
Use the SDK to find out what methods the interface must supply. You must supply routines for all of these methods even if you don&amp;#039;t intend to use them. You also need to supply a disposing method. The names of these routines start with the string given in the first parameter to CreateUnoListener , in this example &amp;lt;tt&amp;gt;&amp;quot;KeyHandler_&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Thus in the example there is &amp;lt;tt&amp;gt;KeyHandler_disposing&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;KeyHandler_keyReleased&amp;lt;/tt&amp;gt; which don&amp;#039;t actually do anything but are required, and &amp;lt;tt&amp;gt;KeyHandler_keyPressed&amp;lt;/tt&amp;gt; which actually does the job. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;sub RemoveKeyHandler&amp;lt;/tt&amp;gt; demonstrates how to remove the handler.&lt;br /&gt;
&lt;br /&gt;
=OpenOffice.org constants=&lt;br /&gt;
The above example uses OpenOffice.org constants. &lt;br /&gt;
&lt;br /&gt;
E.g. com.sun.star.awt.KeyModifier.MOD2&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org constants are case sensitive. Everything up to and including the module name is always lowercase. The constant group is in TitleCase. The actual constant name is always UPPERCASE. &lt;br /&gt;
&lt;br /&gt;
Programmers not using OpenOffice.org Basic may not have access to these constants. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Using the recorder=&lt;br /&gt;
See [[ The OpenOffice.org recorder and UNO dispatch calls]] section for a discussion on recording UNO Dispatch commands versus writing API calls.&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Global667</name></author>
	</entry>
</feed>