Issue 123922 - Insert - Picture - From file does not replace the selected picture
Summary: Insert - Picture - From file does not replace the selected picture
Status: CLOSED FIXED
Alias: None
Product: Impress
Classification: Application
Component: editing (show other issues)
Version: 3.4.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.1.0
Assignee: Armin Le Grand
QA Contact:
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-12-27 12:51 UTC by Andrea Pescetti
Modified: 2014-03-15 12:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.0.1
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrea Pescetti 2013-12-27 12:51:50 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.
Comment 1 Edwin Sharp 2013-12-27 13:28:13 UTC
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 :)
Comment 2 Armin Le Grand 2014-01-29 21:47:17 UTC
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?
Comment 3 Marcus 2014-01-29 22:05:01 UTC
+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.
Comment 4 Armin Le Grand 2014-01-31 17:52:06 UTC
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?
Comment 5 Andrea Pescetti 2014-01-31 18:13:35 UTC
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.
Comment 6 Armin Le Grand 2014-02-04 21:15:42 UTC
Checking why Calc cannot D&D new graphics...
Comment 7 Armin Le Grand 2014-02-04 23:11:42 UTC
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...
Comment 8 Armin Le Grand 2014-02-05 00:27:43 UTC
Looking for the executors of insert/from_file...
Comment 9 Armin Le Grand 2014-02-05 14:40:42 UTC
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...
Comment 10 Armin Le Grand 2014-02-05 15:56:39 UTC
Trying to unify tooling in Calc, D&D and IPFF use no common code yet, but they should...
Comment 11 Armin Le Grand 2014-02-05 16:53:13 UTC
In Calc I have now the same logic working, looks good. Checking Writer...
Comment 12 Armin Le Grand 2014-02-05 16:59:24 UTC
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...
Comment 13 Armin Le Grand 2014-02-05 17:20:24 UTC
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).
Comment 14 Armin Le Grand 2014-02-05 20:43:36 UTC
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...
Comment 15 Armin Le Grand 2014-02-05 23:25:10 UTC
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...
Comment 16 Armin Le Grand 2014-02-06 18:26:26 UTC
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...
Comment 17 Armin Le Grand 2014-02-06 20:55:02 UTC
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...
Comment 18 Armin Le Grand 2014-02-06 22:23:01 UTC
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...
Comment 19 Armin Le Grand 2014-02-06 22:52:28 UTC
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.
Comment 20 SVN Robot 2014-02-07 01:26:23 UTC
"alg" committed SVN revision 1565510 into trunk:
i123922 Refactored D&D and insert picture from file in all apps for all objec...
Comment 21 Armin Le Grand 2014-02-07 01:35:06 UTC
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
Comment 22 Marcus 2014-02-07 19:58:05 UTC
That's great, thanks Armin. :-)
Comment 23 Andrea Pescetti 2014-03-15 12:17:26 UTC
Thank you Armin! Works very nicely in OpenOffice 4.1.0-beta.