office-gobmx/svtools
Miklos Vajna 24231f2a33 svtools: fix lost replacement non-rendered graphic when updating it fails
This is similar to commit 8780fa41dc
(svtools: fix lost replacement grpahic when updating it via OLE fails,
2018-10-30), but that case was when we already had an old
mpImpl->pGraphic, the updated failed and then we already lost the old
one but didn't have a new one.

Here what happened is that in case tools -> update -> update-all was
used for an OLE object which had bad native data but a good preview,
then the result was bad preview, depending on if you first scrolled to
the OLE object to trigger rendering (good) or not (bad).

The reason for this is that scrolling to the object calls GetGraphic(),
which sets mpImpl->pGraphic using GetReplacement(bUpdate=false), which
works, but svt::EmbeddedObjectRef::UpdateReplacement() calls
GetReplacement(bUpdate=true). That explains why the update breaks the
preview, but not when scrolling to it first.

Fix the problem by improving svt::EmbeddedObjectRef::GetReplacement():
if getting an updated graphic fails, try to get a non-updated graphic.

The result is that GetGraphic() after an UpdateReplacement() not only
always return a non-nullptr Graphic, but also it's no longer of type
None.

Change-Id: I8e5ff4aaaefdc58e032b325bb4001f2a604ccc8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130086
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-02-17 19:07:32 +01:00
..
inc
langsupport
qa
source svtools: fix lost replacement non-rendered graphic when updating it fails 2022-02-17 19:07:32 +01:00
uiconfig/ui
util
AllLangMoTarget_svt.mk
CppunitTest_svtools_dialogs_test.mk
CppunitTest_svtools_graphic.mk
CppunitTest_svtools_html.mk
Executable_langsupport.mk
IwyuFilter_svtools.yaml
JunitTest_svtools_unoapi.mk
Library_svt.mk
Makefile
Module_svtools.mk
README.md
UIConfig_svt.mk

Tools on the Top of VCL

Common dialogs, file and print dialogs, wizards, vcl filters, lots of helper code.