From 4002a399af823055b6ba59db18ded1caba4969c9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 4 Jul 2022 13:05:08 +0200 Subject: sw content control, picture, lok: fix change of placeholder after insert Commit c769c369c87a46ec877b7eefee27988044a2798f (sw content controls: fix picture placeholders, 2022-07-01) fixed picture placeholders on the desktop, but left the LOK case still broken. This is a problem since picture placeholders are protected (which is wanted), and these only allow SID_CHANGE_PICTURE, not SID_INSERT_GRAPHIC. Fix the problem by adapting SwXTextDocument::executeContentControlEvent() to dispatch SID_CHANGE_PICTURE (and not SID_INSERT_GRAPHIC), but do keep the slot ID of the argument as SID_INSERT_GRAPHIC, since SwView::InsertGraphicDlg() looks for a non-interactive URL as SID_INSERT_GRAPHIC even if we're changing an image, not inserting a new one. This means that LOK clients can't use SID_INSERT_GRAPHIC to change picture placeholders, they have to go via SwXTextDocument::executeContentControlEvent(), which is what gtktiledviewer does already. Change-Id: Ica42939f6564da3d59396a4b302be826d3968f8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136797 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/uibase/uno/unotxdoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index b3f6e2e7487f..b59795d3c2a4 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3423,7 +3423,7 @@ void SwXTextDocument::executeContentControlEvent(const StringMap& rArguments) // The current placeholder is selected, so this will replace, not insert. SfxStringItem aItem(SID_INSERT_GRAPHIC, it->second); - pView->GetViewFrame()->GetDispatcher()->ExecuteList(SID_INSERT_GRAPHIC, + pView->GetViewFrame()->GetDispatcher()->ExecuteList(SID_CHANGE_PICTURE, SfxCallMode::SYNCHRON, { &aItem }); } else if (it->second == "date") -- cgit