Development of Extensions for LibreOffice

Hi,
     I have Eclipse with the OpenOffice plugin to enable development of extensions for Libreoffice. Can someone tell where I can get documentation on the Libreoffice Calc internals and how to interface specifically to things like the Pivot Table dialogue so that it can be extended. I want to work around the fact that Pivot Tables in Calc 3.6.5 are functionally not equivalent to Excel 2002 let alone Excel 2010?
     I was also thinking of developing these extensions in Java, are there any issues with doing so?

regards,
Steve

Hi :slight_smile:
Hopefully one of the links in this wiki-page might be useful
https://wiki.documentfoundation.org/Documentation/Other_Documentation_and_Resources#Programmers

Errr, i thought everyone was moving away from Java due to all the security issues it's been having in the last couple of years?  I thought people were moving to C++, Python or even Qt?
Regards from
Tom :slight_smile:

Via Simon Phipps on Twitter:

    "We're rewriting the LibreOffice wizards in Python
     because we can no longer be sure Java will be there"
      -- Michael Meeks, #FOSDEM

Thankyou for the input guys. I'll search the wiki for information on the internals and hope that its not openoffice specific. I guess given the direction that Libreoffice is heading I'll have to search the internet for documentation and tutorials to learn python.

regards,
Steve

Qt isn't a programming language Tom, it's a UI framework (written in
C++).

Mark Stanton
One small step for mankind...

It has been some time since Qt grown to be much more than simple UI framework.
Right now it's application framework providing abstraction layers for many
parts of operating system, as well as modules that ease development of modern
applications (using Unicode, SQL, XML, SVG etc.).

Hi :slight_smile:
Thanks chaps :)  I am a bit lost.  Well, totally lost tbh.

This Qt issue is a bit of a tangent really.  I was just trying to say that there are a lot of better alternatives that are far less likely to get the users machines compromised.  Writing stuff in Java forces people that want to use your programs to have java installed and active.  So, you would basically be forcing your customers/clients/colleagues to run vulnerable systems in order to run your code, if you code in java.  Hence lots of people are moving away from java.  Not just the entire LibreOffice project but also others.

Of course a lot of companies are going to take a long time to steer away from Java and there will be a lot of resistance from people that prefer to help pepople get infected rather than use their current skills set to enable them to learn alternatives faster.  A lot of companies are going to have to start paying for Oracle's new "professional" or "enterprise" versions of Java if/when they create those.  Oracle can't keep providing java for free and so far they are right on-track for monetising it. 
Regards from
Tom :slight_smile:

________________________________
From: Mirosław Zalewski <miniopl@poczta.onet.pl>
To: users@global.libreoffice.org
Sent: Monday, 4 February 2013, 9:32
Subject: Re: [libreoffice-users] Development of Extensions for LibreOffice

Qt

isn't a programming language Tom, it's a UI framework (written in

Via Simon Phipps on Twitter:

    "We're rewriting the LibreOffice wizards in Python
     because we can no longer be sure Java will be there"
      -- Michael Meeks, #FOSDEM

Hopefully then Python will replace Basic too. And maybe there might even
be some documentation for LO/Python some day.

Sincerely,

Wolfgang

JFYI due to the joys of twitter - this is rather an horrible mis-quote
due to truncation. I can't remember exactly what I said, the video will
show as/when published but something like:

  "we can no longer be sure Java will be there on Windows".

  ie. having our UI bomb out with horrible dialogs suggesting people
download a JRE to make File->Wizards work is really not ideal;
especially since we bundle a (tiny) python run-time already.

  Java is still a really great way to write cross-platform extensions for
LibreOffice, and we still ship a load of java enablement pieces: they
just require a working JRE to be on the system (nothing new there).

  HTH,

    Michael.

Hi Stephen,

     I have Eclipse with the OpenOffice plugin to enable development of
extensions for Libreoffice. Can someone tell where I can get
documentation on the Libreoffice Calc internals and how to interface
specifically to things like the Pivot Table dialogue so that it can be
extended. I want to work around the fact that Pivot Tables in Calc 3.6.5
are functionally not equivalent to Excel 2002 let alone Excel 2010?

  Oh - that's bad :slight_smile:

     I was also thinking of developing these extensions in Java, are
there any issues with doing so?

  Well - if you develop this in Java then it's unlikely to get into the
code code. Also - you'll have a rather grim time trying to get
everything you want, and (I suspect) you'll find embedding into
arbitrary dialogs is not really easy at all.

  So - I -strongly- recommend just checking out the code, compiling it
and poking the developers list for some code pointers to that dialog.

  Adding the features you need to the core, so everyone can enjoy them
out of the box is almost certainly the best way to achieve your goals -
and (after all) C++ is not so distantly related to Java :slight_smile:

  Does that make sense ?

  Thanks !

    Michael.

Hi Stephen,

      I have Eclipse with the OpenOffice plugin to enable development of
extensions for Libreoffice. Can someone tell where I can get
documentation on the Libreoffice Calc internals and how to interface
specifically to things like the Pivot Table dialogue so that it can be
extended. I want to work around the fact that Pivot Tables in Calc 3.6.5
are functionally not equivalent to Excel 2002 let alone Excel 2010?

  Oh - that's bad :slight_smile:

      I was also thinking of developing these extensions in Java, are
there any issues with doing so?

  Well - if you develop this in Java then it's unlikely to get into the
code code. Also - you'll have a rather grim time trying to get
everything you want, and (I suspect) you'll find embedding into
arbitrary dialogs is not really easy at all.

  So - I -strongly- recommend just checking out the code, compiling it
and poking the developers list for some code pointers to that dialog.

  Adding the features you need to the core, so everyone can enjoy them
out of the box is almost certainly the best way to achieve your goals -
and (after all) C++ is not so distantly related to Java :slight_smile:

Hi Michael,
     I have already downloaded to source code and had considered modifying the code directly, but thought and extension might be easier and simpler, but if writing an extension means that it won't be guaranteed of making the product then modifying the code is the better way to go. I haven't looked at C++ in a long time but it shouldn't be that difficult to pick up again, and it should be easy to get the code suite into my Eclipse development environment once I update it for C++. I'm also running out of time for relating Calc's compatibility to Excel 2002 as in April/May the organisation I work for is upgrading to 2010, so I may just have to develop for compatibilty with that. I have 2010 installed on this machine at home, but it is running under Windows and I'll be doing my development work under Linux, and last time I looked Office 2010 doesn't run under Wine nor CrossOver Office.

regards,
Steve

Hi Stephen,

> Adding the features you need to the core, so everyone can enjoy them
> out of the box is almost certainly the best way to achieve your goals -
> and (after all) C++ is not so distantly related to Java :slight_smile:

     I have already downloaded to source code and had considered
modifying the code directly, but thought and extension might be easier
and simpler, but if writing an extension means that it won't be
guaranteed of making the product then modifying the code is the better
way to go.

  Right ! in my experience it's almost always -much- simpler to edit the
core code directly :slight_smile:

I haven't looked at C++ in a long time but it shouldn't be
that difficult to pick up again, and it should be easy to get the code
suite into my Eclipse development environment once I update it for C++.

  Sounds great.

I'm also running out of time for relating Calc's compatibility to Excel
2002 as in April/May the organisation I work for is upgrading to 2010,
so I may just have to develop for compatibilty with that.

  :-)

I have 2010 installed on this machine at home, but it is running
under Windows and I'll be doing my development work under Linux, and
last time I looked Office 2010 doesn't run under Wine nor CrossOver Office.

  So - often transferring files to/from a virtual-machine works; I use
Office 2007 under Codeweavers Wine just fine (well a few rendering
glitches from time to time but good for quick interop. testing).

  Out of interest do you have a bug or two you want to hack on there ?
the Pivot table code is in:

  sc/source/core/data/dp*.cxx (last I looked)

  and the UI pieces in places like:

  sc/source/ui/dbgui/dpgroupdlg.cxx

  Better than that - we have unit tests for this stuff which live in:

  sc/qa/unit/ucalc.cxx /testPivotTable/

  and other bits there. I'd recommend getting some sample documents setup
that expose the new core features you want - and play with the master
branch there. Of course this is best discussed on the developers list
(no subscription required) which I've CC'd.

  HTH,

    Michael.

Hi :slight_smile:
WoooHooo, C++ is much better and working with the devs in LO means the code can be tested more widely than if it was just written as a purely in-house Extension.  Hopefully resulting in better code and better support for that code for whatever the company needed. 
Regards from
Tom :slight_smile:

Hi Michael,
     That sounds great. I will probably need help when writing and designing the solution, as having not looked at the source code before I'm not sure how easy it will be to write it platform independent. Also, what I'm not sure about, which is more critical, is that if implement the functionality in a similar way to excel, am I breaching Microsoft copywrite and patents?

regards,
Steve

Hi,
    I am having all sorts of problems with the source code in Eclipse. I have created a new blank C++ project in Eclipse and imported the entire sc directory into that project. Subsequently I have opened dpgroupdlg.cxx in the editor (I'm also not sure why Eclipse displays all directories duplicated) and Eclipse is displaying errors on just about every statement in that file.
    I think the first thing I need to do is to find all the include files and add those directories into the include file path in the project properties. One of the problems I have is that the statement "com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS," is producing an error complaining that symbol SECONDS is not found. In the include list there is an include of "<com/sun/star/sheet/DataPilotFieldGroupBy.hpp>" and I have found a directory of that name in the offapi subdirectory of libreoffice, but that path does not contain DataPilotFieldGroupBy.hpp it contains instead DataPilotFiedlGroupBy.idl which contains a definition of SECONDS and the other time symbols specific in the code. How I configure eclipse to consider the idl file to be the same as the hpp file so that these symbols get resolved?
    I am also having difficulty determining which dp module equates to the dialog that gets displayed for variables that are dragged to the pivot table layout areas, to specify the attributes of those variables. Is there any documentation anywhere that explains what each module within the suite actually does and how they relate to what is actually displayed by Libreoffice for each function it performs?

regards,
Steve

Hi Stephen,

    I am having all sorts of problems with the source code in Eclipse. I
have created a new blank C++ project in Eclipse and imported the entire
sc directory into that project. Subsequently I have opened
dpgroupdlg.cxx in the editor (I'm also not sure why Eclipse displays all
directories duplicated) and Eclipse is displaying errors on just about
every statement in that file.

  Well - that's really Eclipse' problem :slight_smile: can you turn off it's bogus
error display ? I guess getting help with Eclipse would be a good thing
to do. Potentially you don't want to create a project - but just use it
to edit the specific files.

    I think the first thing I need to do is to find all the include
files and add those directories into the include file path in the
project properties. One of the problems I have is that the statement
"com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS," is producing an
error complaining that symbol SECONDS is not found.

  This is from an UNO / generated header. It seems highly unlikely that
Eclipse is going to do a perfect job of building LibreOffice. As such, I
would use it as a syntax-colouring text editor - not in it's all-seeing
monster mode :wink:

How I configure eclipse to consider the idl file to be the same as
the hpp file so that these symbols get resolved?

  I have no idea. You need to edit the code with some sort of source code
editor, Elipse is one option. If it can't control it's urges to try to
understand the entire (apparently not built) code-base then I'd
recommend using something else :wink:

    I am also having difficulty determining which dp module equates to
the dialog that gets displayed for variables that are dragged to the
pivot table layout areas, to specify the attributes of those variables.
Is there any documentation anywhere that explains what each module
within the suite actually does and how they relate to what is actually
displayed by Libreoffice for each function it performs?

  Each module ? each top-level directory has README - patches to improve
them appreciated. Sadly there is no further good structural
documentation at all.

  In general - if you want to go from the UI -> the source code, you need
to go via the .src files - which you can grok for user-visible strings,
and then look for the defined names of those in the .hrc files - which
are shared between resources and C++ and hence into the relevant source
code and down to a widget.

  Hope that helps :slight_smile:

    Michael.

Hi :) 
Thanks for the answer.  I think the question was beyond the scope of the Users List and i don't know if anyone got around to pointing the person to the devs lists.

Err, was there a slight typo in the last paragraph?  Seems like grep got typed as grok? 
"which you can grok for user-visible strings"
Perhaps would have been more generic as "look for"?

Regards from
Tom :slight_smile:

Tom,

No typo, http://opengrok.libreoffice.org/

Yes it is a nod to Heinlein's Stranger in a Strange Land...

Stuart

Hi :slight_smile:
Thanks Stuart.  Ouch!  That is annoying!  When i see "grok" i read it as meaning "a deep and thorough understanding of".  I wouldn't have thought of it being a specialist search engine.

Thanks for letting me know tho :) 
Thanks and regards from
Tom :slight_smile:

Hi :slight_smile:
Thanks for the answer. I think the question was beyond the scope of the Users List and i don't know if anyone got around to pointing the person to the devs lists.

Hi Tom,
    Michael did point me at the developers list and when I sent my last mail through I cced the developers list, but as yet I haven't had a response. Michael has provided me with some more info that should help with what I am trying to do.

regards,
Steve