Bug 30508

Summary: Feature Wish: "Edit in external editor"
Product: LibreOffice Reporter: Tobias Florek <me>
Component: LibreofficeAssignee: Suren <surenspost>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: low CC: acdrferreira, s.mehrbrodt, surenspost, thb
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: EasyHack
i915 platform: i915 features:
Attachments: Snippet for saving to a temporary file

Description Tobias Florek 2010-09-30 10:27:04 UTC
A feature as the following would have saved me an hour or more yesterday.

for any image you have included in a document, have a contextmenu item, which says "Edit in external editor", which does just that. copies the image to /tmp and open an external editor (say gimp, should maybe be a preference somewhere), afterwards the image in the document should be replaced by the edited one.

maybe use inotify or something similar to detect changes to the editable copy.
Comment 1 Jan Holesovsky 2010-10-14 05:01:11 UTC
Sounds nice - Thorsten, anything we could easily achieve?
Comment 2 Thorsten Behrens 2010-10-14 05:49:59 UTC
Nice idea, and not too hard to implement - adding easy2dev keyword - Tobias, would you even want to have a shot at it, we'll help with pointing to the right places of course?
Comment 3 Suren 2010-11-01 10:36:22 UTC
Thorsten, I can take this up. There is a query though. /tmp method will be only for Linux/Mac. How can we standardize the temp file creation across all platforms? 

Thanks !
Comment 4 Thorsten Behrens 2010-11-02 02:47:27 UTC
Use osl::FileBase::createTempFile() for that (from osl/file.hxx)
Comment 5 Suren 2010-11-05 10:02:27 UTC
Hi Thorsten,

I am taking this bug. Thanks for the Temporary file suggestion. Will submit a first cuts patch soon enough.

Thanks,
~Suren
Comment 6 Suren 2010-11-07 05:42:56 UTC
Hi Thorsten,

I have attached a code snippet with which I have saved the Graphic to a temp file from your suggestion. Going further I was going to implement some thing like this, 

0. Lock the Graphic ( un-editable)
1. create a new writer thread
2. From the thread open the temporary file external application via osl_executeProcess from osl/process.h and wait for applicaton termination on that thread.
3. On thread completion, update graphic with new file and join the thread
4. Unlock the graphic.

I wanted to know if this is the recommended way of doing it. Please advice :) 

Thanks,
~Suren
Comment 7 Suren 2010-11-07 05:48:19 UTC
Created attachment 40087 [details]
Snippet for saving to a temporary file

I have also added "Edit with External tool" to the Graphic's Pop Up menu and called the method in this snippet in the Menu Item's ExecMethod. Works fine for me.
Comment 8 Thorsten Behrens 2010-11-09 04:20:37 UTC
Suren, approach looks good to me - would you attach a more complete patch so I could have a try? Alternatively, you can post it to libreoffice@lists.freedesktop.org for broader discussion. Thanks!
Comment 9 Samuel Mehrbrodt 2013-04-21 16:17:56 UTC
This is already done.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.