[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 30 13:14:56 UTC 2019
sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc |binary
sw/qa/extras/ww8export/ww8export3.cxx | 10 ++++
sw/source/filter/ww8/ww8graf.cxx | 27 ++++++++++++-
3 files changed, 35 insertions(+), 2 deletions(-)
New commits:
commit cc899c6967238877f0094bcf00627145e484ffec
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Mon Jan 14 22:18:46 2019 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Apr 30 15:13:42 2019 +0200
tdf#101826 ww8import: Fly - don't convert XATTR back and forth
In this case we are explicitly interested in textboxes,
but any fly that accepts XATTR will now use that and skip
the old RES_BACKGROUND.
In the case of textbox import, the properties were being
converted into RES_BACKGROUND and then back to XATTR again.
Just copy the XATTR properties to the new FlySet instead.
The ability to import XATTRs into a textbox was added to LO6.3
with commit 15819181772d95963d16c1c2eaa9e51af81f7f68
Change-Id: Ib65b3d9097d0a56dbe205b419d052af53d0132c8
Reviewed-on: https://gerrit.libreoffice.org/66331
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc
new file mode 100755
index 000000000000..206f4830958a
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf101826_xattrTextBoxFill.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 239ce2bcbf2e..339ebd17e440 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -179,6 +179,16 @@ DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.doc
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xText, "FillStyle"));
}
+DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, "tdf101826_xattrTextBoxFill.doc")
+{
+ //Basic 1 Color Fill: gradient from yellow(FFFF00) to brown(767600) currently saves as mid-color
+ CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(1), "BackColor"));
+ //Basic 2 Color Fill: gradient from yellow(FFFF00) to green(00B050) currently saves as mid-color
+ CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty<Color>(getShape(4), "BackColor"));
+ //Basic Picture Fill: Tux image
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", drawing::FillStyle_BITMAP, getProperty<drawing::FillStyle>(getShape(5), "FillStyle"));
+}
+
DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc")
{
uno::Reference<text::XTextRange> xText(getParagraph(12));
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 49440291710a..551376439e05 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1691,6 +1691,29 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
rFlySet.Put( *pPoolItem );
}
+ // take new XATTR items directly. Skip old RES_BACKGROUND if new FILLSTYLE taken.
+ bool bSkipResBackground = false;
+ SfxItemPool* pPool = rFlySet.GetPool();
+ if ( pPool )
+ {
+ for ( sal_uInt16 i = XATTR_START; i < XATTR_END; ++i )
+ {
+ // Not all Fly types support XATTRs - skip unsupported attributes
+ SfxItemPool* pAttrPool = pPool->GetMasterPool();
+ while ( pAttrPool && !pAttrPool->IsInRange(i) )
+ pAttrPool = pAttrPool->GetSecondaryPool();
+ if ( !pAttrPool )
+ continue;
+
+ if ( SfxItemState::SET == rOldSet.GetItemState(i, false, &pPoolItem) )
+ {
+ rFlySet.Put( *pPoolItem );
+ if ( i == XATTR_FILLSTYLE )
+ bSkipResBackground = true;
+ }
+ }
+ }
+
// now calculate the borders and build the box: The unit is needed for the
// frame SIZE!
SvxBoxItem aBox(sw::util::ItemGet<SvxBoxItem>(rFlySet, RES_BOX));
@@ -1817,7 +1840,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
// Separate transparency
eState = rOldSet.GetItemState(XATTR_FILLTRANSPARENCE, true, &pItem);
- if (eState == SfxItemState::SET)
+ if (!bSkipResBackground && eState == SfxItemState::SET)
{
sal_uInt16 nRes = WW8ITEMVALUE(rOldSet, XATTR_FILLTRANSPARENCE,
XFillTransparenceItem);
@@ -1828,7 +1851,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
// Background: SvxBrushItem
eState = rOldSet.GetItemState(XATTR_FILLSTYLE, true, &pItem);
- if (eState == SfxItemState::SET)
+ if (!bSkipResBackground && eState == SfxItemState::SET)
{
const drawing::FillStyle eFill = static_cast<const XFillStyleItem*>(pItem)->GetValue();
More information about the Libreoffice-commits
mailing list