Skip to content

Commit

Permalink
Refs #3 - doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
cbmarcum committed Jun 19, 2020
1 parent 130f9ff commit 15b1f80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
29 changes: 16 additions & 13 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,24 @@

== Introduction

UNO stands for Universal Network Objects and is the base component technology for Apache OpenOffice.
*UNO* stands for *Universal Network Objects* and is the base component technology for **Apache OpenOffice**.

GUNO stands for Groovy UNO and is an Apache Groovy language extension of the Java UNO API's. The artifact of this extension is a Java jar file that when used in a Groovy script or class adds convenience methods to the regular Java UNO API's.
*GUNO* stands for *Groovy UNO* and is an *Apache Groovy* language extension of the **Java UNO API's**. The artifact of this extension is a Java jar file that when used in a Groovy script or class adds convenience methods to the regular Java UNO API's.

The goal of the Groovy UNO Extension is to allow UNO programming that is less verbose than using the Java UNO API's alone.
*The goal of the Groovy UNO Extension is to allow UNO programming that is less verbose than using the Java UNO API's alone.*

These methods are implemented using Groovy Extension Modules. An extension module allows you to add new methods to existing classes, including classes which are precompiled, like classes from the JDK or in this case Java UNO classes. These new methods, unlike those defined through a metaclass or using a category, are available globally.
These methods are implemented using **Groovy Extension Modules**. An extension module allows you to **add new methods to existing classes**, including classes which are precompiled, like classes from the JDK or in this case Java UNO classes. These new methods, unlike those defined through a metaclass or using a category, are available globally.

Aside from a few general methods, initial efforts have been on enhancing the spreadsheet API's and future work will be on enhancing the other applications.

== Usage
:author: Carl Marcum
:email: [email protected]
:toc: left

=== Preface
The best way to explain the differences between the Java UNO API's and using Groovy with and without the extension is with some example code. Many of the examples are spreadsheet examples are from SCalc.java that is included with the AOO SDK.

=== Get an XComponentLoader

Java way (assumes XComponentContext xComponentContext reference)
*Java Example* (assumes XComponentContext xComponentContext reference)

[source,java]
----
XMultiComponentFactory mxRemoteServiceManager = null
Expand All @@ -36,23 +33,29 @@ XMultiComponentFactory mxRemoteServiceManager = null
"com.sun.star.frame.Desktop", self))
----

Groovy Extension way
*Groovy Extension Example*

[source,java]
----
XComponentLoader aLoader = mxRemoteContext.componentLoader
----

=== UnoRuntime.queryInterface

The UnoRuntime.queryInterface(ReturnObject.class, FromObject) method can be replaced with the new FromObject.guno(ReturnObject.class) method.
Java way (assumes we have a reference to XSpreadsheetDocument myDoc..)
[source,]

*Java Example* (assumes we have a reference to XSpreadsheetDocument myDoc..)

[source,java]
----
XSpreadsheets xSheets = myDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSheets);
xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, oIndexSheets.getByIndex(0));
----

Groovy Extension way [source,java]
*Groovy Extension Example*

[source,java]
----
XSpreadsheets xSheets = myDoc.sheets
XIndexAccess oIndexSheets = xSheets.guno(XIndexAccess.class)
Expand Down
32 changes: 15 additions & 17 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ <h1>GUNO Extension Documentation</h1>
<li><a href="#trueintroduction">Introduction</a></li>
<li><a href="#trueusage">Usage</a>
<ul class="sectlevel2">
<li><a href="#truepreface">Preface</a></li>
<li><a href="#trueget-an-xcomponentloader">Get an XComponentLoader</a></li>
<li><a href="#trueunoruntime-queryinterface">UnoRuntime.queryInterface</a></li>
</ul>
Expand All @@ -463,16 +462,16 @@ <h1>GUNO Extension Documentation</h1>
<h2 id="trueintroduction"><a class="anchor" href="#trueintroduction"></a>Introduction</h2>
<div class="sectionbody">
<div class="paragraph">
<p>UNO stands for Universal Network Objects and is the base component technology for Apache OpenOffice.</p>
<p><strong>UNO</strong> stands for <strong>Universal Network Objects</strong> and is the base component technology for <strong>Apache OpenOffice</strong>.</p>
</div>
<div class="paragraph">
<p>GUNO stands for Groovy UNO and is an Apache Groovy language extension of the Java UNO API&#8217;s. The artifact of this extension is a Java jar file that when used in a Groovy script or class adds convenience methods to the regular Java UNO API&#8217;s.</p>
<p><strong>GUNO</strong> stands for <strong>Groovy UNO</strong> and is an <strong>Apache Groovy</strong> language extension of the <strong>Java UNO API&#8217;s</strong>. The artifact of this extension is a Java jar file that when used in a Groovy script or class adds convenience methods to the regular Java UNO API&#8217;s.</p>
</div>
<div class="paragraph">
<p>The goal of the Groovy UNO Extension is to allow UNO programming that is less verbose than using the Java UNO API&#8217;s alone.</p>
<p><strong>The goal of the Groovy UNO Extension is to allow UNO programming that is less verbose than using the Java UNO API&#8217;s alone.</strong></p>
</div>
<div class="paragraph">
<p>These methods are implemented using Groovy Extension Modules. An extension module allows you to add new methods to existing classes, including classes which are precompiled, like classes from the JDK or in this case Java UNO classes. These new methods, unlike those defined through a metaclass or using a category, are available globally.</p>
<p>These methods are implemented using <strong>Groovy Extension Modules</strong>. An extension module allows you to <strong>add new methods to existing classes</strong>, including classes which are precompiled, like classes from the JDK or in this case Java UNO classes. These new methods, unlike those defined through a metaclass or using a category, are available globally.</p>
</div>
<div class="paragraph">
<p>Aside from a few general methods, initial efforts have been on enhancing the spreadsheet API&#8217;s and future work will be on enhancing the other applications.</p>
Expand All @@ -482,16 +481,13 @@ <h2 id="trueintroduction"><a class="anchor" href="#trueintroduction"></a>Introdu
<div class="sect1">
<h2 id="trueusage"><a class="anchor" href="#trueusage"></a>Usage</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="truepreface"><a class="anchor" href="#truepreface"></a>Preface</h3>
<div class="paragraph">
<p>The best way to explain the differences between the Java UNO API&#8217;s and using Groovy with and without the extension is with some example code. Many of the examples are spreadsheet examples are from SCalc.java that is included with the AOO SDK.</p>
</div>
</div>
<div class="sect2">
<h3 id="trueget-an-xcomponentloader"><a class="anchor" href="#trueget-an-xcomponentloader"></a>Get an XComponentLoader</h3>
<div class="paragraph">
<p>Java way (assumes XComponentContext xComponentContext reference)</p>
<p><strong>Java Example</strong> (assumes XComponentContext xComponentContext reference)</p>
</div>
<div class="listingblock">
<div class="content">
Expand All @@ -504,7 +500,7 @@ <h3 id="trueget-an-xcomponentloader"><a class="anchor" href="#trueget-an-xcompon
</div>
</div>
<div class="paragraph">
<p>Groovy Extension way</p>
<p><strong>Groovy Extension Example</strong></p>
</div>
<div class="listingblock">
<div class="content">
Expand All @@ -515,24 +511,26 @@ <h3 id="trueget-an-xcomponentloader"><a class="anchor" href="#trueget-an-xcompon
<div class="sect2">
<h3 id="trueunoruntime-queryinterface"><a class="anchor" href="#trueunoruntime-queryinterface"></a>UnoRuntime.queryInterface</h3>
<div class="paragraph">
<p>The UnoRuntime.queryInterface(ReturnObject.class, FromObject) method can be replaced with the new FromObject.guno(ReturnObject.class) method.
Java way (assumes we have a reference to XSpreadsheetDocument myDoc..)</p>
<p>The UnoRuntime.queryInterface(ReturnObject.class, FromObject) method can be replaced with the new FromObject.guno(ReturnObject.class) method.</p>
</div>
<div class="paragraph">
<p><strong>Java Example</strong> (assumes we have a reference to XSpreadsheetDocument myDoc..)</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">XSpreadsheets xSheets = myDoc.getSheets() ;
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">XSpreadsheets xSheets = myDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSheets);
xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, oIndexSheets.getByIndex(0));</code></pre>
</div>
</div>
<div class="paragraph">
<p>Groovy Extension way [source,java]</p>
<p><strong>Groovy Extension Example</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre>XSpreadsheets xSheets = myDoc.sheets
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">XSpreadsheets xSheets = myDoc.sheets
XIndexAccess oIndexSheets = xSheets.guno(XIndexAccess.class)
xSheet = oIndexSheets.getByIndex(0).guno(XSpreadsheet.class)</pre>
xSheet = oIndexSheets.getByIndex(0).guno(XSpreadsheet.class)</code></pre>
</div>
</div>
</div>
Expand All @@ -541,7 +539,7 @@ <h3 id="trueunoruntime-queryinterface"><a class="anchor" href="#trueunoruntime-q
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020-06-19 19:37:37 -0400
Last updated 2020-06-19 19:54:51 -0400
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css">
Expand Down

0 comments on commit 15b1f80

Please sign in to comment.