[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 16 17:54:32 UTC 2020
sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc |binary
sw/qa/extras/ww8export/ww8export3.cxx | 10 +++++++++
sw/source/filter/ww8/wrtw8esh.cxx | 11 ++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit 38e7e6f348df5d6b37d7e0051fd3b8c227db69e6
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Apr 14 17:39:36 2020 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Thu Apr 16 19:53:55 2020 +0200
tdf#132094 doc: fix export of fill in wrap-through fly frames
This builds on commit 2f13dbac060ae6af7e25ad3eff675cc859cfb3ff
by Miklos Vajna on Fri Jun 15 08:49:46 2012 +0100
n#325936 fix ww8 export of fly frames with transparent bg
where he wisely and cautiously says
Regression from commit ed8b5f2d -- to be safe, reverted only
for fly frames in headers.
because for some unknown reason, way back in 2002, commit
ed8b5f2debac216243930aba0873e0d75de8d0dd forced all
frames to specify a background fill. Typically of
course this is white, and so who notices?
Well, you notice if your frame is transparent, and
now the area fill hides something that it is over top of.
Like for example a transparent image, where the text wraps
through the image.
At first I was going to just try and revert everything.
Then I decided it likely was a difference between how
LO and MSO handled stacking/overlapping things.
After that, I was going to just make an exception for
eShapeType == mso_sptPictureFrame, but that only seems
necessary if there is something underneath. If the something
is just a background, that is handled anyway, so really
it would only be other shapes or (most importantly) text,
so the safest thing is testing wrap through, which there was
already a pre-defined variable to reuse
(and fix the spelling).
Change-Id: I9236579fa692e22205bab5a21c3f9d919f4cf24f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92215
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc
new file mode 100644
index 000000000000..1b8a29e0ecd7
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf132094_transparentPageImage.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index c077dfcb040d..d12eef55f6bd 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -300,6 +300,16 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.o
CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle"));
}
+DECLARE_WW8EXPORT_TEST(testTdf132094_transparentPageImage, "tdf132094_transparentPageImage.doc")
+{
+ uno::Reference<drawing::XShape> image (getShape(1), uno::UNO_QUERY);
+ // Don't add fillstyle when none is set.
+ // Well, ok, at least make it transparent if you do uselessly set a solid color...
+ const bool bFillNone = drawing::FillStyle_NONE == getProperty<drawing::FillStyle>(image, "FillStyle");
+ const bool bTransparent = sal_Int16(0) != getProperty<sal_Int16>(image, "FillTransparence");
+ CPPUNIT_ASSERT_MESSAGE("no background fill", bTransparent || bFillNone);
+}
+
DECLARE_WW8EXPORT_TEST(testTdf112618_textbox_no_bg, "tdf112618_textbox_no_bg.doc")
{
sal_uInt16 nTransparence = getProperty<sal_Int16>(getShape(2), "FillTransparence");
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index ec4810773511..d291a9a63f15 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2026,10 +2026,12 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
// SwWW8ImplReader::Read_GrafLayer() imports these as opaque
// unconditionally, so if both are true, don't export the property.
- bool bIsInHeader = sw::IsFlyFrameFormatInHeader(rFormat);
- bool bIsThrought = rFormat.GetSurround().GetValue() == css::text::WrapTextMode_THROUGH;
+ const bool bIsInHeader = sw::IsFlyFrameFormatInHeader(rFormat);
+ const bool bIsThrough = rFormat.GetSurround().GetValue() == css::text::WrapTextMode_THROUGH;
- if (bIsInHeader)
+ // Anything (like a transparent image) that allows text to wrap through should not force a non-transparent background,
+ // and neither should the commonly seen backgrounds anchored in headers.
+ if (bIsInHeader || bIsThrough)
{
std::shared_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem());
@@ -2040,6 +2042,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
}
else
{
+ // for unknown reasons, force exporting a non-transparent background on fly frames.
std::shared_ptr<SvxBrushItem> aBrush(rWrt.TrueFrameBgBrush(rFormat));
if(aBrush)
@@ -2051,7 +2054,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
const SdrObject* pObj = rFormat.FindRealSdrObject();
if( pObj && (pObj->GetLayer() == GetHellLayerId() ||
- pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrought))
+ pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrough))
{
rPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
}
More information about the Libreoffice-commits
mailing list