Apache OpenOffice (AOO) Bugzilla – Issue 123922
Insert - Picture - From file does not replace the selected picture
Last modified: 2014-03-15 12:17:26 UTC
This is a spin-off of bug 122726 since that issue discussed other problems too. 1. Create an empty Impress presentation 2. Insert - Picture - From File, insert a picture 3. Select the picture inserted in step 2 4. Insert - Picture - From File, insert another picture Old OpenOffice behavior (up to 3.2): The new picture replaces the old one, keeping its size and settings. Very handy if you had multiple slides and wanted to have the same image size on each. New OpenOffice behavior (3.3 and later): The new picture is inserted in addition to the old one. Of course, whether this is a bug or not is questionable; but the old behavior seems to make much more sense to me and it should be restored if possible.
Description confirmed with AOO410m1(Build:9750) - Rev. 1552994 Rev.1552994 OpenOffice.org 3.0.1 Win 7 User intention old behavior new behavior add click to deselect just insert replace just insert press delete Click < press -> bug :)
Taking a look. Writer: Inserted picture. Keeping selected, another insert pic from file (IPFF from now on) brings up the pic dialog, so cannot check. Writer: Copy/paste pic from Draw to get a draw-object based pic in Writer. When selected, IPFF is grayed out, cannot check. Calc: IPFF. Keep selected, IPFF dialog is possible, inserts new file as new pic. When not selected, too. Draw/Impress: As known, same as calc. Thus, currently no AOO app supports the replacement of the current pic. Should we really do that...? If yes, would it make sense to do it for Draw/Impress, but not for the other apps?
+1 to restore the old behavior. Without the auto-replace function you have delete the old graphic, insert the new one and then start to find the old position. Have fun. ;-) IMHO the most common use case is to exchange a graphic with a newer version *with the same size* and therefore to use exactly *the same position* in the document. So, the positioning of the new file is then absolut simple. Of course this should be valid for all application modules.
I see the point and I agree. I can remember slightly that it was that way once in draw/impress. BTW: D&D does what is wanted in draw/impress and writer (but not in calc), so there *is* an intuitive way to do what you want. To do this for all apps for 4.1 would be much effort. For after 4.1 I can imagine that. So, why the regression flag, regression to what version?
Regression in the sense that in Draw/Impress we used (in some ancient version) to be able to have a desired behaviour (replace on insert) that now isn't there any longer.
Checking why Calc cannot D&D new graphics...
Calc simply had no support yet, adding for - D&D on GraphicObject: new content for GraphicObject - D&D on GraphicObject with Link (CTRL+SHIFT): new linked content for GraphicObject - D&D on filled SdrObject (not OLE): new FillStyle for SdrObject Checking how far this is unified in Draw/Impress...
Looking for the executors of insert/from_file...
IPFF handling in draw/impress (every app does this differently currently): - no object selected: Button choosable, selected graphic inserted centered on page, selected after action, link supported - GraphicObject selected: Button choosable, selected graphic replaces selected one, selected after action, link supported - DrawObject selected (fillable, not OLE): Button choosable, selected graphic used as FillStyle, selected after action, no link support This is compatible with D&D behaviour and should be what Andrea wanted, extended by FillStyle support for fillable, non-OLE DrawObjects. Checking Calc...
Trying to unify tooling in Calc, D&D and IPFF use no common code yet, but they should...
In Calc I have now the same logic working, looks good. Checking Writer...
Writer supports currently IPFF when no selection exists and inserts pic from file as linked or not linked. When a writer graphic is selected, the IPFF button is available, but pressing it opens the 'Picture" Dialog. I fould no way in that dialog to replace the current picture with a new one from file. The same dialog comes up when double-clicking on the Picture. Thus I think replacing the klick on the IPFF button with a selected picture to get to the Insert Picture file dialog is adequate. Checking what happens...
When a Writer Graphic is selected, the IFF leads to SwGrfShell::Execute case SID_INSERT_GRAPHIC which currently has no intention to open the insert pic from file dialog, it is clearly only intended to open the 'Picture' dialog (its the same slot as FN_FORMAT_GRAFIC_DLG and FN_DRAW_WRAP_DLG). The insert from file dialog instead is opened by another shell, in SwView::Execute in case SID_INSERT_GRAPHIC. I do not know if this can easily be changed (or should).
Found a way to call the dialog in Writer when objects are selected, adapted some stuff accordingly. Also is not too dangerous since the usages I changed are controllable, so I am positive with adapting Writer to the new standard behaviour...
Added code to SwWrtShell::Insert to support a replacement mode for graphics, this works well and supports linked and unlinked graphics via IPFF. Saw that when D&D the link is not supported, checking why...
Progressing well in Writer. Found one problem: When the already inserted pic is moved with the mouse and thus has a position left and below anchor I found no way yet to restore this. If it is on default position all works well, the size is preserved in both cases. Need to ask Olli here. The case for inserted draw objects and/or graphic draw objects (the rotatable ones) is more complicated, there is no handling at all for the slot SID_INSERT_GRAPHIC currently in SwDrawShell, it simply all gets deactivated (see SID_INSERT_GRAPHIC in drawsh.sdi, the slot is defined to call StateDisableItems. Need to add Exec and State methods here...
Added Exec and State methods and implemented. Checked all object types (thee with Writer) with D&D and IPFF, links and no links, looks good. Also checked the break link, replace link stuff in the edit/links... dialog. Also checked (available for Sw-Graphics only) in the 'picture' Dialog in the 'Picture' tab the replacements of linked graphics by double-click and/or the small dialog button. Also checked Undo/Redo and the texts for these. Last remaining problem is the moving writer graphic frame when it is not in default position...
As so often and after a long search - something is done *after* all was correctly executed. Found that, and got a more simple, yet existing way of exchanging graphic for existing writer graphic frame. Checking...
Works now as expected for all three object types in Writer, complete with link support and undo. Doing some last tests, preparing commit. No ressource changes were needed.
"alg" committed SVN revision 1565510 into trunk: i123922 Refactored D&D and insert picture from file in all apps for all objec...
Okay, done. All D&D and IPFF work on all apps (Writer, Calc, Draw/Impress) on all object types ((a) writer graphic object, (b) draw graphic object, (c) fillable, non-OLE graphic object) the same. All add undos, all will keep the object selected. D&D: - no object on drop pos: insert new - (a) or (b) on drop pos: change content, keep pos/size, on CTRL+SHIFT insert link - (c) on drop pos: change fill style, keep pos/size IPFF: - no object selected: insert new - (a) or (b) selected: change content, keep pos/size, on CTRL+SHIFT insert link - (c) selected: change fill style, keep pos/size
That's great, thanks Armin. :-)
Thank you Armin! Works very nicely in OpenOffice 4.1.0-beta.