2017-02-19

7: To Build a First UNO Extension (LibreOffice Extension or Apache OpenOffice Extension), Part One

<The previous article in this series | The table of contents of this series | The next article in this series>

Main body START

To Know How to Handle (Read or Write) LibreOffice or Apache OpenOffice Writer or Calc Documents via Extensions from Java or Macro Programs

Here Is a Set of Artifacts That Can Be Used to Build a UNO Extension

-Hypothesizer

As the environment for developing UNO extensions has been built in the previous articles, we can create Ant build files or Gradle build scripts and source files for a UNO extension, and build the UNO extension.

-Rebutter

Um.

-Hypothesizer

In fact, I have already created them, and they are here.

-Rebutter

That sounds like a cooking TV program . . .

-Hypothesizer

After we expand the zip file in an arbitrary directory (here, ~/my-documents/development/java, on Linux and E:\Home\my-documents\development\java, on Windows), keeping the directories structure, these must be directories and files expanded.

commonBuild.properties
commonBuild01.xml
commonBuild02.xml
commonBuild01.gradle
commonBuild02.gradle
/unoUtilitiesToDisclose
 build.xml
 build.gradle
 /source
  /java
   /thebiasplanet
    /unoutilities
     /serviceshandling
       GlobalUnoServicesProviderUtility.java
  /resource
   MANIFEST.MF.addition
/hiUnoExtensionsUnoExtension
 build.xml
 build.gradle
 /source
  /java
   /thebiasplanet
    /uno
     /hiunoextensionsunoextension
      HiUnoExtensionsImplementation.java
      HiUnoExtensionsUnoExtensionGlobalServicesProvider.java
  /resource
   MANIFEST.MF.addition
   manifest.xml
   thebiasplanet.hiunoextensionsunoextension.uno.components
  /unoIdl
   /thebiasplanet
    /uno
     /hiunoextensionsunoextension
      XHiUnoExtensions.idl
      HiUnoExtensions.idl

What Are the Artifacts?

-Rebutter

Hmm, . . . what are they?

-Hypothesizer

Well, I wonder how I should explain: there are files I can easily explain and files I can't easily explain. As understandings are intertwined, to explain one thing enough, I have to explain some basic concepts first, which can become lengthy. As I haven't explained basic concepts of UNO, it's difficult to explain what some files are.

-Rebutter

That would be so. . . . Maybe you can't help but explain things using some terms as black boxes.

-Hypothesizer

Black boxes?

-Rebutter

For example, "there is a concept called XXX, which we can't explain enough here, but . . ."

-Hypothesizer

Ah-ha.

-Rebutter

Note, we don't want to say inaccurate things to smooth things over for the moment. That's a temptation, but causes confusions. Our explanations can be not-detailed if inevitable, but can not be incorrect, ever.

-Hypothesizer

Ah, we shouldn't say inaccurate things to make listeners feel understanding something, erroneously, for the moment.

-Rebutter

That's right.

-Hypothesizer

Note that although my explanations here aren't enough, we will delve into those artifacts after we have learned basic concepts of UNO.

-Rebutter

All right.

Projects-Common Files

-Hypothesizer

Well, 'commonBuild.properties', 'commonBuild01.xml', and 'commonBuild02.xml' in the root directory of the expansion are common Ant build files. By 'common', I mean, being used by all the projects.

-Rebutter

Do you mean there are multiple projects?

-Hypothesizer

Yes, there are two projects in the zip file, and common files are meant to be also used by future projects.

-Rebutter

I see.

-Hypothesizer

The files, 'commonBuild01.gradle' and 'commonBuild02.gradle', in the root directory of the expansion are common Gradle build scripts. By 'common', I mean the same.

-Rebutter

All right.

The UNO Utilities Project

-Hypothesizer

The 'unoUtilitiesToDisclose' directory contains the UNO utilities project that makes the UNO utilities Jar file. The UNO utilities Jar file is used by projects that use UNO. That is, things commonly used by projects that use UNO are separated as an individual project, as including same source files in multiple projects is unwise.

-Rebutter

Certainly.

-Hypothesizer

The file, 'build.xml', in the project directory is the project-specific Ant build file, which uses the common Ant build files. The file, 'build.gradle', in the project directory is the project-specific Gradle build script, which uses the common Gradle build scripts.

-Rebutter

Ah-ha.

-Hypothesizer

The 'source' directory in the project directory is the root directory of all kinds of source files including Java source files, resource files like setting files, and UNO-specific source files.

-Rebutter

UNO-specific source files?

-Hypothesizer

I will explain about them later because this project doesn't have UNO-specific source files.

-Rebutter

OK.

-Hypothesizer

The 'java' directory in the 'source' directory is the root directory of Java source files.

'GlobalUnoServicesProviderUtility.java' is a UNO utility class. I will mention what that class is about, later.

The 'resource' directory in the 'source' directory is the root directory of resource files.

'MANIFEST.MF.addition' is a file that contains contents to be added to the Jar manifest file.

-Rebutter

I see.

Main body END

<The previous article in this series | The table of contents of this series | The next article in this series>