Bug 153438 - LibreOffice Draw Portable: "Replace" button is not active in Tools->Color Replacer
Summary: LibreOffice Draw Portable: "Replace" button is not active in Tools->Color Rep...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.6 target:7.5.1
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 13:31 UTC by Mikayel84
Modified: 2023-05-28 13:06 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Picture where showing that button is not active (92.86 KB, image/jpeg)
2023-02-07 13:38 UTC, Mikayel84
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikayel84 2023-02-07 13:31:21 UTC
Description:
When I'm trying to change all shapes with same color to another color, "Replace" button is not active in a Tools->Color Replacer

Steps to Reproduce:
1.Opening PDF file via LibreOffice Draw
2.Going to "Tools"
3."Color replacer"
4.Chooxing which color should be change with which color
 

Actual Results:
Replace Button not active

Expected Results:
It should replace the color


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.3.2 (x86) / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_GB); UI: en-US
Calc: CL
Comment 1 Mikayel84 2023-02-07 13:38:47 UTC
Created attachment 185177 [details]
Picture where showing that button is not active
Comment 2 Julien Nabet 2023-02-07 20:11:46 UTC
On pc Debian x86-64 with master sources updated today, I got an assertion with gen rendering when trying to open the dialog box:
warn:vcl.layout:14496:14496:include/vcl/builder.hxx:439: .ui widget "DockingColorReplace" needs to correspond to vcl type 6VclBox
soffice.bin: /home/julien/lo/libreoffice/include/vcl/builder.hxx:440: T *VclBuilder::get(const rtl::OString &) [T = VclBox]: Assertion `!w || dynamic_cast<T*>(w)' failed.
Unspecified Application Error

with gtk3, I got:
(soffice:14769): GLib-GObject-WARNING **: 21:03:32.012: invalid cast from 'GtkGrid' to 'GtkBox'
#3  0x00007f348d5a24f6 in (anonymous namespace)::GtkInstanceBuilder::weld_box(rtl::OString const&) (this=0x562f7bac2600, id="DockingColorReplace") at vcl/unx/gtk3/gtkinst.cxx:24039
#4  0x00007f349b93d547 in SfxDockingWindow::SfxDockingWindow(SfxBindings*, SfxChildWindow*, vcl::Window*, rtl::OString const&, rtl::OUString const&)
     (this=0x562f777cde80, vtt=0x7f349a916dc8 <VTT for SvxBmpMask+8>, pBindinx=0x562f769612a0, pCW=0x562f7714b340, pParent=0x562f76975a70, rID="DockingColorReplace", rUIXMLDescription="svx/ui/dockingcolorreplace.ui")
    at sfx2/source/dialog/dockwin.cxx:769
#5  0x00007f349a516266 in SvxBmpMask::SvxBmpMask(SfxBindings*, SfxChildWindow*, vcl::Window*) (this=0x562f777cde80, pBindinx=0x562f769612a0, pCW=0x562f7714b340, pParent=0x562f76975a70)
    at svx/source/dialog/_bmpmask.cxx:348


Caolán: do we expect a GtkGrid or a GtkBox here?
Comment 3 Caolán McNamara 2023-02-07 21:07:04 UTC
I think it should be a GtkBox, so https://gerrit.libreoffice.org/c/core/+/146646 for that.

For the original report though, I think the Color Replacer only works on images, i.e. png/jpg graphics and doesn't work on shapes/text. We probably need the original pdf, or a similar one, to confirm that the operation was on an element that the Color replacer doesn't work with.

I don't know whether it just can't ever work on whatever the target element was, or if could be somehow enhanced to do whatever the right thing should be.
Comment 4 Commit Notification 2023-02-08 09:01:13 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Related: tdf#153438 this toplevel needs to be a GtkBox

It will be available in 7.6.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 5 Julien Nabet 2023-02-08 10:12:14 UTC
Thank you Caolán for the fix about GtkBox, I don't reproduce the pb with master sources updated today.

Heiko/Xisco: any idea what should be the behavior of Color Replacer?

I mean, if it can't change color of a pdf, a shape, ... the entry menu should be disabled for these cases. No need to enter the dialog if the "Replace" is always disabled in these cases.
Comment 6 Heiko Tietze 2023-02-08 10:29:01 UTC
Yes, we should disable the command if no replacement is possible at all. Not sure whether this is easy hackable or we better wait for the color replacer being able to work on drawing objects as requested in bug 123766.
Comment 7 Commit Notification 2023-02-08 13:16:49 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

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

Related: tdf#153438 this toplevel needs to be a GtkBox

It will be available in 7.4.6.

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 8 Commit Notification 2023-02-08 13:17:52 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

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

Related: tdf#153438 this toplevel needs to be a GtkBox

It will be available in 7.5.1.

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 9 BogdanB 2023-05-25 14:53:06 UTC
Caolan, is this bug solved?
Comment 10 Julien Nabet 2023-05-26 12:45:31 UTC
(In reply to BogdanB from comment #9)
> Caolan, is this bug solved?

I gave a new try on pc Debian x86-64 with master sources updated today, I don't reproduce the assertion but now I reproduce exactly the problem described by Mikayel84
Comment 11 Julien Nabet 2023-05-26 13:03:01 UTC
(In reply to Julien Nabet from comment #10)
> (In reply to BogdanB from comment #9)
> > Caolan, is this bug solved?
> 
> I gave a new try on pc Debian x86-64 with master sources updated today, I
> don't reproduce the assertion but now I reproduce exactly the problem
> described by Mikayel84

Hmm, I began to debug to add some traces and didn't reproduce the pb. Then I remove debug traces and try again, no reproduce too, so forget my previous comment.
Comment 12 Caolán McNamara 2023-05-28 13:06:01 UTC
I solved the warning mentioned in comment #2. The original issue probably is still there. I speculate in comment #3 as to the problem. I suspect the color replacer just only works with bitmaps/pictures and not shapes and the pdf is imported as a collection of shapes.