[Libreoffice] Suggestion needed for External Edit functionality.

surenspost at gmail.com surenspost at gmail.com
Sun Nov 21 21:20:35 PST 2010

Hi Thorsten,

 Mon, Nov 15, 2010 at 5:40 PM, Thorsten Behrens
<thb at documentfoundation.org> wrote:
> surenspost at gmail.com wrote:
>> 1) Making it work in all OS/platforms:
>> [...]
> Hi Suren,
> wow, great progress! For the editing, one easy way out would be to
> use the SystemShellExecute service, which will pick an app
> registered for the file type at hand. You can e.g. find a usage
> example in sfx2/source/dialog/about.cxx:298
Thanks for the encouraging words :)

I spent quite some time trying to find out how XSystemShellExecute
works (ie) how it gets an application mapped to a specific mime-type,
so that I can use it in my logic. I was in fact done creating a new
interface to get that logic re-factored. But I realised was that,
XSystemShellExecute is only internally calling "gnome-open-url
$filepath" ( which is a shell script which does a xdg-open or
gnome-open ). And for mac, it does a "open $filePath". This is bad for
our purpose because both these functions returns (and not blocks) as
soon as the new external application is opened and _not _ wait until
they are closed.

Here are the few alternatives I can think of :
1) register an event Listener to listen to any change of that
temporary file. And update the graphic in the call-back function of
that event listener. Remove the event listener after graphic update is
done ( Not sure if file based even listeners are available)
2) Give the users an option to choose application ( FIle picker dialog
) and save it in libreoffice's session info (How to save it across
multiple sessions ? )
3) Directly check the availability of certain applications like
Photoshop, Gimp , Preview. ( But this is really bad )

To be honest, I didn't anticipate these many issues when I chose to
work on it, but I am getting to learn a lot about Libreoffice code
base this way. This really is a good beginner bug :)

> A smallish nit regarding the move of lcl_GetPreferedExtension to a
> header - better rename it GetPreferedExtension, remove the static,
> have the declaration in the header - but keep the code inside a cxx.

This is Done :)

>> 3) Window repaint issue:
>> [...]
> A rather blunt method is to call SwWrtShell::InvalidateWindows(),
> that basically forces a repaint of the given rectangular area. Would
> have to dig a bit for the Writer method du jour for this case, maybe
> the code from grfsh.cxx above has the right call already, e.g.
> UpdateFlyFrm() or somesuch.

there is a ReRead method for a SwWrtShell which worked well for this
case. ( Used once in grfsh.hxx)

> Keep going, this starts to look *really* nice! :)
> Cheers,
> -- Thorsten

Thanks again. I really appreciate your help in giving me a lots of
current usages (to an extent of line numbers in specific files to look
for ).

Learning < Doing
Learn By doing.

More information about the LibreOffice mailing list