Bug 125969 - Background image, previously imported by user as area fill, not visible as a bitmap thumbnail when file reopened
Summary: Background image, previously imported by user as area fill, not visible as a ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium minor
Assignee: Justin L
URL:
Whiteboard: target:25.8.0
Keywords: implementationError
: 108905 130543 134259 (view as bug list)
Depends on: 157467 163812 163824
Blocks: Area-Fill-Tab-Image
  Show dependency treegraph
 
Reported: 2019-06-17 16:31 UTC by Volga
Modified: 2025-01-18 12:53 UTC (History)
15 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (225.89 KB, application/vnd.oasis.opendocument.text)
2019-06-17 16:33 UTC, Volga
Details
My snapshot (398.70 KB, image/png)
2019-06-17 16:35 UTC, Volga
Details
My autogen.input (1.49 KB, text/plain)
2024-12-16 21:19 UTC, Jean-Baptiste Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volga 2019-06-17 16:31:02 UTC
Description:
While Writer load background image from document, open the Page Style dialog, click Area tab, the image can be seen at the Preview area, but can’t be seen at the Bitmap list, making it impossible to switch back if this image is replaced by other image and before the document is saved.

Steps to Reproduce:
1. Open Wood.odt from my attachment
2. Click Format -> Page -> Area

Actual Results:
The wooden background can be seen at the Preview, but it can’t be seen at the Bitmap list.

Expected Results:
The wooden background should also available at the Bitmap list. If this image is replaced by another image, the document is saved, and Writer is closed, this image can be dropped from the Bitmap list.


Reproducible: Always


User Profile Reset: No



Additional Info:
版本: 6.3.0.0.beta1 (x64)
Build ID: a187af327633f5f00363be5131bd21a13e0f1a7b
CPU 线程: 4; 操作系统: Windows 10.0; UI 渲染: 默认; VCL: win; 
区域语言: zh-CN (zh_CN); UI 语言: zh-CN
Calc: threaded
Comment 1 Volga 2019-06-17 16:33:36 UTC
Created attachment 152249 [details]
Sample file
Comment 2 Volga 2019-06-17 16:35:56 UTC
Created attachment 152250 [details]
My snapshot

This is my snapshot, notice that the Page Style dialog is resized to larger size.
Comment 3 Julien Nabet 2019-06-17 19:41:47 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I suppose a good start should be in this file:
https://opengrok.libreoffice.org/xref/core/cui/source/tabpages/tpbitmap.cxx
Comment 4 Xisco Faulí 2019-06-28 14:54:19 UTC Comment hidden (obsolete)
Comment 5 duuxixu 2020-04-13 08:32:38 UTC Comment hidden (obsolete)
Comment 6 Timur 2020-06-25 12:35:14 UTC
*** Bug 134259 has been marked as a duplicate of this bug. ***
Comment 7 R. Green 2020-08-08 12:51:14 UTC
Version: 7.0.0.3 (x64)
Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded

Bug still present in this version.
Comment 8 Xisco Faulí 2021-02-09 14:42:27 UTC Comment hidden (obsolete)
Comment 9 Tushar Kumar Rai 2021-02-26 16:32:16 UTC
Hello
I want to work on this bug.
Progress made in solving the bug-
 
In file cui/source/tabpages/tpbitmap.cxx
 
SvxBitmapTabPage::Reset performs the actions when user clicks on the bitmap section in Format->PageStyle->Area tab .
 
IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) performs actions when user clicks on the default bitmaps present and add the bitmap into the preview .
 
IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, weld::Button&, void) performs actions when user clicks on add/import button and new image is added in the bitmaps.
 
The idea to solve the bug is to get the image from the background and add it into the bitmaps and into the preview which can't be done in the file cui/source/tabpages/tpbitmap.cxx
because no idea of how to retrieve the background image.

This is the idea i could think of with the pointers(cui/source/tabpages/tpbitmap.cxx) provided in the bug.
Correct me if i am wrong at any point and please provide more pointers or some guidance to solve the bug.
Comment 10 Julien Nabet 2021-04-07 09:11:30 UTC Comment hidden (obsolete)
Comment 11 Tushar Kumar Rai 2021-04-19 18:03:03 UTC Comment hidden (obsolete)
Comment 12 Regina Henschel 2022-06-15 18:10:24 UTC
The page area dialog does not work as the dialog used for shapes, see bug 103916.
Comment 13 Stéphane Guillou (stragu) 2023-10-01 20:55:07 UTC
Started in 5.3, when the dialog was redone to add new images to the list, and allow naming them. (libreoffice-5.3.0.0.alpha1 in linux-64-releases bibisect repo.)

Same happens with e.g. Draw's Page > Page Properties > Background > Image.

Still reproduced in recent trunk build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e9a0c97de95688b2f86bbb4dd8c823af5442401c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 14 Stéphane Guillou (stragu) 2023-10-01 21:30:51 UTC
*** Bug 130543 has been marked as a duplicate of this bug. ***
Comment 15 Stéphane Guillou (stragu) 2023-10-01 21:34:54 UTC
This is also true for the dropdowns in the Properties (for Draw/Impress) or Page (for Writer) sidebar decks, as mentioned in bug 130543 comment 5.
Comment 16 Stéphane Guillou (stragu) 2023-10-03 14:22:22 UTC
*** Bug 108905 has been marked as a duplicate of this bug. ***
Comment 17 Stéphane Guillou (stragu) 2023-10-03 14:32:23 UTC
Setting priority back to "normal": 3 duplicates; functionality seems broken; it affects more than Writer; and more than page background (e.g. paragraph styles too).
Comment 18 Justin L 2024-11-10 02:07:54 UTC
WIP fix at https://gerrit.libreoffice.org/c/core/+/176253.

The biggest problem is that these auto-added backgrounds should NOT persist beyond the document itself. The big test for this would be to auto-add a background from an imported file, and then (using a textbox) to deliberately add/import a JPG. While that intentionally added JPG should be permanent, the auto-added one should not be permanent.

Note that prior to bug 163824, non-editeng backgrounds works "as hoped for" - i.e. they only existed in the current document. So it SHOULD be enough to simply never write these bitmaps to the user profile. I say simply...

I wonder if it can be filtered out by URL?
Comment 19 Justin L 2024-11-12 15:56:30 UTC
(In reply to Justin L from comment #18)
> I wonder if it can be filtered out by URL?
No - none of the predefined items have a getOriginURL.

At this point I have no idea how this could be possible. The only point that "save" iterates through the individual items is in svx/source/xml/xmlxtexp.cxx where everything is already reduced to a simplistic XNameContainer.

This is not an easyHack.
Comment 20 Commit Notification 2024-12-09 23:08:15 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a366cd34a85a21210939482d229d6d2dd9c1087c

tdf#125969 cui: add in-use area image to bitmap list

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Jean-Baptiste Faure 2024-12-16 08:41:19 UTC
(In reply to Commit Notification from comment #20)
> Justin Luth committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> a366cd34a85a21210939482d229d6d2dd9c1087c
> 
> tdf#125969 cui: add in-use area image to bitmap list
> 
> It will be available in 25.8.0.
> 
> The patch should be included in the daily builds available at
> https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> https://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.

I Justin,

This commit breaks the test test_tdf145158 associated to the fix for bug #145158.
Git does not accept to revert your commit to check, but at the parent commit the test passes and from your commit the test fails.

My build is done on Ubuntu 22.04 x86-64 with gcc-13.

Please, could you have a look ?

Best regards.
JBF
Comment 22 Justin L 2024-12-16 14:32:46 UTC
I could not reproduce the UITest failure on my Ubuntu 24.04 machine (testing with a clean profile).

In one terminal I ran: LANG=C SAL_USE_VCLPLUGIN=gen make debugrun
In the other terminal, I ran
  - make gb_UITest_DEBUGRUN=T UITest_writer_tests8 UITEST_TEST_NAME=tdf125969.tdf125969.test_tdf125969
  - then make gb_UITest_DEBUGRUN=T UITest_writer_tests8 UITEST_TEST_NAME=tdf145158.tdf145158.test_tdf145158

both passed.
It also passed when I did all of the writer8 tests.
  - make gb_UITest_DEBUGRUN=T UITest_writer_tests8 

I'll test again on an Ubuntu 20.04 box, once it finishes compiling (I saw the failure, but it was in a very dirty environment - without this bug's patch, but WITH this bug's unit test...).
I don't see any possible relation between these two tests. I don't open the character dialog...

Things to try for those having a problem.
-run my test after tdf145158 (I believe they run based on alphabetical sort)

(In reply to Jean-Baptiste Faure from comment #21)
> Git does not accept to revert your commit to check,
It should work if you first revert ab314514f9cc422c6018ec3b387c730afa1de817
Comment 23 Justin L 2024-12-16 17:57:24 UTC
(In reply to Justin L from comment #22)
> I'll test again on an Ubuntu 20.04 box
I can't reproduce here either. All uiwriter8 unit tests pass for me.
Comment 24 Arnaud Versini 2024-12-16 18:11:46 UTC
Same issue on my build on openSUSE tumbleweed up to date fyi
Comment 25 Jean-Baptiste Faure 2024-12-16 21:19:47 UTC
Created attachment 198147 [details]
My autogen.input

Hi,

I just attached my autogen.input with which the test fails.

Best regards. JBF
Comment 26 Justin L 2024-12-17 00:30:10 UTC
(In reply to Jean-Baptiste Faure from comment #25)
Well, the code shouldn't be too hard to follow. Since you can reproduce it, you can just start disabling parts and see what part breaks it.

The first thing I would do would be to simply delete the .py unit test.
My suspicion is that the mere presence of the test must be altering the expected environment somehow.

If it is affected by the actual code changes, I'd start with 
-    if (!pEntry->GetSavingAllowed())
+    if (!pEntry->GetSavingAllowed() && false)

and then 
-    if (nPos == -1)
+    if (nPos == -1 && false)
Comment 27 Arnaud Versini 2024-12-22 16:06:01 UTC
Justin I've not done the test you mentionned but FYI the problem seems to occur only on french people, perhaps an issue related to locale
Comment 28 Volga 2025-01-18 03:52:53 UTC Comment hidden (off-topic)
Comment 29 Volga 2025-01-18 05:52:45 UTC
Is it possible to backport to 25.2 release channel?
Comment 30 Justin L 2025-01-18 12:53:11 UTC
(In reply to Volga from comment #29)
> Is it possible to backport to 25.2 release channel?
based on comment 21, that doesn't sound like a good idea.