You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by Carl Marcum <cm...@apache.org> on 2015/12/18 02:58:39 UTC

[DISCUSS] Groovy UNO Extensions

Hi All,

I have started work on two AOO related projects using the now TLP Apache 
Groovy language.

I would like to see if there is interest and if so, then seek consensus 
to develop them further in the devtools area like the NetBeans plugin.

The first project is a Gradle build based Groovy UNO Client that would 
be comparable to the Ant build based projects the NetBeans AOO plugin 
generates but with a much simplified build script and compatible with 
any IDE that supports Gradle.

I have working code for this that builds, jars, and runs that includes 
the standard Loader mechanism.

I would like to extend this to also include AddOns, AddIns, etc.

The second project uses Groovy extensions that can add convenience 
methods to existing Java UNO classes to simplify coding by doing all the 
UnoRuntime.queryInterface bits in the new methods. These would be 
compiled into a library jar and then made available in the Maven repository.

For example code:

leaving out try/catch for brevity and assumes we have a reference to 
XSpreadsheetDocument myDoc..

current Java way....

// get the first sheet in the spreadsheet
XSpreadsheets xSheets = myDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(
     XIndexAccess.class, xSheets);
xSheet = (XSpreadsheet) UnoRuntime.queryInterface(
    XSpreadsheet.class, oIndexSheets.getByIndex(0));

// insert data into a cell
xCell = xSheet.getCellByPosition(1,0);
xCell.setFormula("Sample");


Groovy Extension way...(method names subject to change)

// get the first sheet in the spreadsheet
XSpreadsheet xSheet = myDoc.getSheetByIndex(0)

// insert data into the cell
xSheet.setTextToCell(1,0,"Sample")

I have working code for a few methods that compile, jar and are usable 
by the first project but it needs a community effort.

So far all the code is written by me or borrowed from AOO SDK examples 
or the Developer Guide.

There are a few Groovy UNO projects out there that do similar things 
that are either unlicensed or incompatible and I would like work on a 
clean Apache one from scratch and maybe get some help along the way.

What do you think?

Thanks,
Carl


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: [DISCUSS] Groovy UNO Extensions

Posted by "Rony G. Flatscher (Apache)" <ro...@apache.org>.
On 18.12.2015 02:58, Carl Marcum wrote:
> Hi All,
>
> I have started work on two AOO related projects using the now TLP Apache Groovy language.
>
> I would like to see if there is interest and if so, then seek consensus to develop them further in
> the devtools area like the NetBeans plugin.
>
> The first project is a Gradle build based Groovy UNO Client that would be comparable to the Ant
> build based projects the NetBeans AOO plugin generates but with a much simplified build script and
> compatible with any IDE that supports Gradle.
>
> I have working code for this that builds, jars, and runs that includes the standard Loader mechanism.
>
> I would like to extend this to also include AddOns, AddIns, etc.
>
> The second project uses Groovy extensions that can add convenience methods to existing Java UNO
> classes to simplify coding by doing all the UnoRuntime.queryInterface bits in the new methods.
> These would be compiled into a library jar and then made available in the Maven repository.
>
> For example code:
>
> leaving out try/catch for brevity and assumes we have a reference to XSpreadsheetDocument myDoc..
>
> current Java way....
>
> // get the first sheet in the spreadsheet
> XSpreadsheets xSheets = myDoc.getSheets() ;
> XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(
>     XIndexAccess.class, xSheets);
> xSheet = (XSpreadsheet) UnoRuntime.queryInterface(
>    XSpreadsheet.class, oIndexSheets.getByIndex(0));
>
> // insert data into a cell
> xCell = xSheet.getCellByPosition(1,0);
> xCell.setFormula("Sample");
>
>
> Groovy Extension way...(method names subject to change)
>
> // get the first sheet in the spreadsheet
> XSpreadsheet xSheet = myDoc.getSheetByIndex(0)
>
> // insert data into the cell
> xSheet.setTextToCell(1,0,"Sample")
>
> I have working code for a few methods that compile, jar and are usable by the first project but it
> needs a community effort.
>
> So far all the code is written by me or borrowed from AOO SDK examples or the Developer Guide.
>
> There are a few Groovy UNO projects out there that do similar things that are either unlicensed or
> incompatible and I would like work on a clean Apache one from scratch and maybe get some help
> along the way.
>
> What do you think?
Sounds great, interesting and helpful, go for it !!!

---rony


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org