examples to manage docs using LibreOffice as a major component

Michael Meeks michael.meeks at collabora.com
Tue Sep 30 13:48:37 PDT 2014


Hi Nicholas,

On Tue, 2014-09-30 at 16:27 -0400, nicholas ferguson wrote:
> Most open source code repositories, would upload to a github, samples.

	Great - you've identified a hole you can help fill. Please don't feel
there is some them vs. us here; you are one of us. The reason there are
no good samples on github is because -you- Nicholas Ferguson have not
up-loaded any. Why not ! I'm waiting ... ;-)

	Seriously - this project depends on people getting involved an having a
go. Personally I find the people working on it together in a
constructive way really fun to work with =) I try to listen to their
good advice (when I can); I get motivated by being told something cannot
be done (that's the engineer in my); together we try to make the project
incrementally better.

	Sure its easy to moan about what is not there; but its also good to
focus on what is there and how to improve it.

	If you don't like my advice on how best to achieve your goal, and my
gently warning you off from more difficult approaches - that is just
fine; prove me wrong - I'm used to being wrong frequently. Don't assume
that your problem / frustration is particularly interesting to me
though, I'm writing to try to do you a favour.

> So it can be done, and I won't send you samples, because you would ask
> me questions

	Do you actually read my mails ? =) I usually do that before I send them
and while I'm trying to tone them down. I wrote:

> 	All the code is there in public, in front of you; I've given
> you pointers into it too for the bits you want.

	As a special service I've dug out some of those fragments again and
append them for you in one place.

	Finally lets be totally clear - you are personally responsible for not
having up-loaded some sample apps for LibreOffice to github - at least
in just the same way that all of the rest of us are =)

	All the best,

		Michael.

[snip]
        You might think that an easy approach to start here is to
copy/paste the desktop/source/lib/init.cxx code that does this - but
(almost certainly) you'd be fooling yourself.
[/snip]

[snip]
        Please try using LibreOfficeKit - that should be reasonably
trivial with a recent master Windows install and the headers copy/pasted
from include/LibreOfficeKit. If you pass the path of your install into
that, it should do all that bootstrapping logic for you.
[/snip]

[snip]
        I would instead write a small built-in tool that just dumps this
data
through a custom API; perhaps we can add some statistics API to
liblibreoffice/ that could be used to trigger this lot. Once you hit the
UNO API you're often dealing with un-parsed forms of formulae again.

        So - what I'd do is just hack on calc in some crazy way; steal
some button or other [ incidentally do you want this for an automated
service or a UI spreadsheet debugging tool ? ] - and use that to walk
over all the formulae. So eg. steal the Number format currency button
(this is New York right ? ;-)

sc/source/ui/view/formatsh.cxx:        case SID_NUMBER_CURRENCY:

        You want the 2nd hit of that; the first is for whether it is
enabled or
not.

        Now work your way around to the ScDocument:

    ScDocument* pDoc = GetViewData()->GetDocument();

        And wander over the sheets / formulae etc. If you read
sc/inc/document.hxx  one trick - when you get to column.hxx - you should
really operate on FormulaGroups - since they represent repeated formulae
which will save you a ton of time with columns of big sheets. You also
have methods like this:
[/snip]

-- 
 michael.meeks at collabora.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list