sd/qa/unit/uiimpress.cxx | 5 - sd/source/ui/func/fuconstr.cxx | 36 -------- sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx |binary sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx | 43 ++++++++++ 4 files changed, 46 insertions(+), 38 deletions(-)
New commits: commit 2afff27c5327bcb30f894d9a507131f2ad8f1dc6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 19 15:28:40 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jun 19 13:36:37 2023 +0200 tdf#155086 remove code that sets theme color to shapes as DF Remove this functionallity for now until we support theme colors in shape styles. Then we can do it for the default style, and not as a direct format for each inserted shape. Change-Id: Ib042072954a79cadc750372333c40269fbe4ca40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153244 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index e3a9c86e91d1..c4cdc0a5e338 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -1144,7 +1144,8 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696) CPPUNIT_ASSERT(bContoured); } -CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testThemeShapeInsert) +// TODO - Readd when we implement style level fill color and set that for default style +/*CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testThemeShapeInsert) { // Given a document with a theme, accent1 color is set to 0x000004: createSdImpressDoc(); @@ -1188,7 +1189,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testThemeShapeInsert) // - Expected: 0 / 0x000004 (~black) // - Actual : 7512015 / 0x729fcf (~blue) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x4), nFillColor); -} +}*/ CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index 4db1f4042dc9..fd93a3ce7c94 100644 --- a/sd/source/ui/func/fuconstr.cxx +++ b/sd/source/ui/func/fuconstr.cxx @@ -371,42 +371,6 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, pObj->SetMergedItemSet(aAttr); } } - else - { - // Creating an object with fill. - SdrPage* pThemePage = pPage; - if (pThemePage->TRG_HasMasterPage()) - { - pThemePage = &pThemePage->TRG_GetMasterPage(); - } - - auto const& pTheme = pThemePage->getSdrPageProperties().GetTheme(); - if (pTheme) - { - // We construct an object on a page where the master page has a theme. Take the - // accent1 color from that theme, make sure it has priority over the shape's - // document-global style. - SfxItemSet aAttr(mpView->GetDefaultAttr()); - - aAttr.Put(XFillStyleItem(css::drawing::FillStyle_SOLID)); - - model::ThemeColorType eColorType = model::ThemeColorType::Accent1; - Color aColor = pTheme->GetColor(eColorType); - XFillColorItem aFillColorItem("", aColor); - aFillColorItem.getComplexColor().setSchemeColor(eColorType); - aAttr.Put(aFillColorItem); - - aAttr.Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); - - // Line color is 50% darker than the fill color. - aColor.ApplyTintOrShade(-5000); - XLineColorItem aLineColorItem("", aColor); - // TODO no theme or theme effect for line colors yet. - aAttr.Put(aLineColorItem); - - pObj->SetMergedItemSet(aAttr); - } - } } } commit 703c28d76924bcbda3f492de8a14cc9c30ee1dfb Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 19 15:48:56 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jun 19 13:36:28 2023 +0200 sw: Test paragraph level text background Change-Id: Icea365ae036cae49749dd24bb8412775fafbd6c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153247 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx b/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx new file mode 100644 index 000000000000..5b012f01333b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx index f9e7155859ea..45bd8014f1d3 100644 --- a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx @@ -97,6 +97,49 @@ DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeC CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue); } +DECLARE_SW_ROUNDTRIP_TEST(testParaBackgroundTheme_DOCX, "Test_ThemeTextParaBackgroundColor.docx", + nullptr, Test) +{ + { + auto xParagraph = getParagraph(1); + CPPUNIT_ASSERT(xParagraph.is()); + auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>( + xParagraph, "ParaBackgroundComplexColor"); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); + auto const& rTransforms = aComplexColor.getTransformations(); + CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size()); + CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType); + CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), rTransforms[0].mnValue); + } + + { + auto xParagraph = getParagraph(2); + CPPUNIT_ASSERT(xParagraph.is()); + auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>( + xParagraph, "ParaBackgroundComplexColor"); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aComplexColor.getSchemeType()); + auto const& rTransforms = aComplexColor.getTransformations(); + CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size()); + CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType); + CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), rTransforms[0].mnValue); + } + + { + auto xParagraph = getParagraph(3); + CPPUNIT_ASSERT(xParagraph.is()); + auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>( + xParagraph, "ParaBackgroundComplexColor"); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); + auto const& rTransforms = aComplexColor.getTransformations(); + CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size()); + CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType); + CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), rTransforms[0].mnValue); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */