Bug 69407 - FILE OPEN: DOC frame background are transparent,shadow comes in foreground
Summary: FILE OPEN: DOC frame background are transparent,shadow comes in foreground
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
3.5 all versions
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
Keywords: filter:doc
Depends on:
Blocks: DOC-Frames
  Show dependency treegraph
Reported: 2013-09-16 09:16 UTC by Matthieu
Modified: 2019-01-30 08:34 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:

File describing the problem (25.50 KB, application/msword)
2013-09-16 09:16 UTC, Matthieu
Proposed patch (540 bytes, patch)
2013-09-16 09:17 UTC, Matthieu
example that shows the background has to be transparent (632.50 KB, application/msword)
2013-09-19 12:06 UTC, Caolán McNamara

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu 2013-09-16 09:16:09 UTC
Created attachment 85897 [details]
File describing the problem


If you read the attached file with Writer, you'll see the shadow came to the foreground.

The reason is that the frame is initialised with transparency colour in writer.

With my patch I put the white colour by default.
Comment 1 Matthieu 2013-09-16 09:17:16 UTC
Created attachment 85898 [details]
Proposed patch
Comment 2 Arnaud Versini 2013-09-17 10:13:35 UTC
No body confirmed the bug for now
Comment 3 Miklos Vajna 2013-09-17 10:15:13 UTC
Also, please submit the patch to gerrit for review:


Comment 4 Pierre-Eric Pelloux-Prayer 2013-09-17 10:17:00 UTC
Quickly tested here: no regression found by 'make sw.check' and rendering is correct.

2 suggestions though:
  - change the "//Transparent by default" comment
  - attach a proper patch with authorship info (or even better, submit the patch to gerrit, with a reference to fdo#69407)
Comment 5 sophie 2013-09-17 11:56:27 UTC
added version and plateform - Sophie
Comment 6 Matthieu 2013-09-18 14:11:59 UTC
See the gerrit here:
Comment 7 sophie 2013-09-18 14:20:49 UTC
Hi Matthieu, please do not change the version, it's important for QA, see
https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Version, I put it back to the version the bug has been reported to you - Sophie
Comment 8 Caolán McNamara 2013-09-19 12:06:27 UTC
Created attachment 86144 [details]
example that shows the background has to be transparent
Comment 9 Caolán McNamara 2013-09-19 12:08:12 UTC
see the above attachment example also though. That shows in word and writer at the moment the same way, i.e. graphic is visible through the transparent frame. If you set it to no-fill then that breaks.

I think the problem instead is the drawing of the shadow. I reckon it should be clipped to draw only outside the frame area, and not "underneath" it.
Comment 10 Pierre-Eric Pelloux-Prayer 2013-09-19 15:35:43 UTC
@caolan: you're right - sorry I didn't think at this use case.

After looking quickly at the code, it seems this isn't a bug, but a feature...
See: void SwFrm::PaintShadow in paintfrm.cxx

/// OD 23.08.2002 #99657#
///     draw full shadow rectangle for frames with transparent drawn backgrounds.

And if the last line of this function is changed from:
    lcl_PaintShadow(rRect, rOutRect, rShadow, bDrawFullShadowRectangle, bTop, bBottom, true, true);
    lcl_PaintShadow(rRect, rOutRect, rShadow, false, bTop, bBottom, true, true);

Both test documents are rendered properly - of course this change could have other implications but hopefully it's a hint toward a better fix.
Comment 11 Matthieu 2013-10-15 15:01:00 UTC

I would like to test the code you write, but I need to build a 4.0.5/4.0.6 version and the code is very different from the branch 4.1.

Do you have any hint about correcting this bug in branch 4.0?

Thanks very much.

Comment 12 Matthieu 2013-10-15 15:16:34 UTC
To be more precise in the code I have

/// OD 23.08.2002 #99657# - determine, if full shadow rectangle have to
    ///     be drawn or only two shadow rectangles beside the frame.
    ///     draw full shadow rectangle, if frame background is drawn transparent.
    ///     Status Quo:
    ///         SwLayoutFrm can have transparent drawn backgrounds. Thus,
    ///         "asked" their frame format.
    bool bDrawFullShadowRectangle =
            ( IsLayoutFrm() &&
              (static_cast<const SwLayoutFrm*>(this))->GetFmt()->IsBackgroundTransparent()


                if ( bDrawFullShadowRectangle )
                    /// OD 06.08.2002 #99657# - draw full shadow rectangle


For me it should be :

if (! bDrawFullShadowRectangle )
                    /// OD 06.08.2002 #99657# - draw full shadow rectangle

Because if the background is transparent it shouldn't be a full shadow rectangle

When I test it's good for both files.
Comment 13 Matthieu 2013-10-18 11:21:21 UTC

The previous code was not good, I made this gerrit


with a better without any regression.
Comment 14 Mohamed-Ali BEN MANSOUR 2013-12-06 14:00:29 UTC
Hi everyone,

The bug is fixed. Please take in consideration this last commit: https://gerrit.libreoffice.org/#/c/6959/

Comment 15 retired 2013-12-12 11:06:16 UTC
So setting to FIXED as of comment14.
Comment 16 Cor Nouws 2014-02-19 10:52:50 UTC
fix has not landed in git ... si pending that, reopening
Comment 17 Soufiane 2015-01-08 10:50:23 UTC

Is this bug has been fixed in version 4.3?

Thanks Soufiane.
Comment 18 Björn Michaelsen 2015-07-06 16:17:39 UTC
Comment on attachment 85898 [details]
Proposed patch

Marking patch obsolete as there is newer work on gerrit:

None of which could be merged apparently, so leaving bug open.