summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/odfexport/data/tdf92379.fodt26
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx43
-rw-r--r--sw/source/core/unocore/unostyle.cxx6
3 files changed, 73 insertions, 2 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf92379.fodt b/sw/qa/extras/odfexport/data/tdf92379.fodt
index 280dc5ad893c..8aeb9c45187c 100644
--- a/sw/qa/extras/odfexport/data/tdf92379.fodt
+++ b/sw/qa/extras/odfexport/data/tdf92379.fodt
@@ -37,6 +37,32 @@
</style:graphic-properties>
</style:style>
+ <!-- "Titre Avis expert" and derived styles from bugdoc -->
+ <style:style style:name="Titre_20_Avis_20_expert" style:display-name="Titre Avis expert" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="">
+ <style:paragraph-properties fo:text-align="start" style:justify-single-word="false" style:page-number="auto" fo:background-color="#661900">
+ <style:background-image/>
+ </style:paragraph-properties>
+ <style:text-properties fo:color="#ffffff" />
+ </style:style>
+ <style:style style:name="Avis_20_expert_20_questions" style:display-name="Avis expert questions" style:family="paragraph" style:parent-style-name="Titre_20_Avis_20_expert" style:master-page-name="">
+ <style:paragraph-properties fo:line-height="100%" fo:text-align="start" style:justify-single-word="false" style:page-number="auto" fo:background-color="transparent">
+ <style:background-image/>
+ </style:paragraph-properties>
+ <style:text-properties fo:color="#661900" />
+ </style:style>
+ <style:style style:name="avis_20_expert_20_questions_20_non_20_cadres" style:display-name="avis expert questions non cadres" style:family="paragraph" style:parent-style-name="Avis_20_expert_20_questions" style:master-page-name="">
+ <style:paragraph-properties style:page-number="auto" fo:background-color="#801900" style:shadow="none">
+ <style:tab-stops/>
+ <style:background-image/>
+ </style:paragraph-properties>
+ </style:style>
+ <style:style style:name="Avis_20_expert_20_rXponses" style:display-name="Avis expert rXponses" style:family="paragraph" style:parent-style-name="Avis_20_expert_20_questions" style:master-page-name="">
+ <style:paragraph-properties fo:line-height="100%" fo:text-align="justify" style:justify-single-word="false" fo:orphans="0" fo:widows="0" fo:hyphenation-ladder-count="1" style:page-number="auto" fo:background-color="transparent">
+ <style:background-image/>
+ </style:paragraph-properties>
+ <style:text-properties fo:color="#461900" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+ </style:style>
+
</office:styles>
<office:automatic-styles>
<style:page-layout style:name="pm1">
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 69f97ee0b268..94fbd5b04f01 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -242,7 +242,48 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "BackColorTransparency"));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffcc99), getProperty<sal_Int32>(xStyle, "FillColor"));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xStyle, "FillTransparence"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence"));
+
+ // paragraph style fo:background-color was wrongly inherited despite being
+ // overridden in derived style
+ uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles"));
+ uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName(
+ "Titre Avis expert"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle1, "ParaBackColor"));
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle1, "ParaBackTransparent"));
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle1, "FillStyle"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle1, "FillColor"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle1, "FillTransparence"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle1, "CharColor"));
+
+ uno::Reference<beans::XPropertySet> xStyle2(xParaStyles->getByName(
+ "Avis expert questions"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xStyle2, "ParaBackColor"));
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle2, "ParaBackTransparent"));
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle2, "FillStyle"));
+// unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE
+// CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle2, "FillColor"));
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle2, "FillTransparence"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle2, "CharColor"));
+
+ uno::Reference<beans::XPropertySet> xStyle31(xParaStyles->getByName(
+ "avis expert questions non cadres"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x801900), getProperty<sal_Int32>(xStyle31, "ParaBackColor"));
+ CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xStyle31, "ParaBackTransparent"));
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle31, "FillStyle"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x801900), getProperty<sal_Int32>(xStyle31, "FillColor"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle31, "FillTransparence"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x661900), getProperty<sal_Int32>(xStyle31, "CharColor"));
+
+ uno::Reference<beans::XPropertySet> xStyle32(xParaStyles->getByName(
+ "Avis expert rXponses"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_TRANSPARENT), getProperty<sal_Int32>(xStyle32, "ParaBackColor"));
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle32, "ParaBackTransparent"));
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle32, "FillStyle"));
+// unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE
+// CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor"));
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x461900), getProperty<sal_Int32>(xStyle32, "CharColor"));
}
DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt")
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index fd3b27b7a90c..57688c4bbfc0 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1766,7 +1766,11 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
aChangedBrushItem.PutValue(aValue, nMemberId);
- if(!(aChangedBrushItem == aOriginalBrushItem))
+ if (!(aChangedBrushItem == aOriginalBrushItem) ||
+ // 0xff is already the default - but if BackTransparent is set
+ // to true, it must be applied in the item set on ODF import
+ // to potentially override parent style, which is unknown yet
+ (MID_GRAPHIC_TRANSPARENT == nMemberId && aValue.has<bool>() && aValue.get<bool>()))
{
setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
}