diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-28 09:43:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-12 23:15:58 +0000 |
commit | bd0f526f2d3e1ffe43a74672485815768eee6e9e (patch) | |
tree | fcb675aa06dcc3251f2c23961520ee317483a225 /sw | |
parent | c945eafc99856f0bcd0a99195e2c5164c2a6d24a (diff) |
introduce docmodel comp., model::ThemeColor, use it in SvxColorItem
Added a new component docmodel, that has the document model types,
which only depend on other basic components. This is needed so the
types can be used in every relevant component - xmloff, oox, svx,
editeng,...
Introduces model::ThemeColor, which is a class used to store the
theme color data, including transformations (svx::Transformation).
For UNO use XThemeColor is added, and the implementation UnoThemeColor
which wraps svx::ThemeColor, so it can be tranported around.
Reactor all the code and tests to accomodate for this change.
Change-Id: I7ce6752cdfaf5e4d3b8e4d90314afa469dd65cfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144847
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_apitests.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_core_draw.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_core_theme.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_macros_test.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_ooxmlimport.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_ooxmlimport2.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_tiledrendering.mk | 1 | ||||
-rw-r--r-- | sw/CppunitTest_sw_uwriter.mk | 1 | ||||
-rw-r--r-- | sw/Library_sw.mk | 1 | ||||
-rw-r--r-- | sw/layoutwriter_setup.mk | 1 | ||||
-rw-r--r-- | sw/ooxmlexport_setup.mk | 1 | ||||
-rw-r--r-- | sw/qa/core/theme/ThemeTest.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 13 | ||||
-rw-r--r-- | sw/uiwriter_setup.mk | 1 | ||||
-rw-r--r-- | sw/ww8export_setup.mk | 1 |
15 files changed, 30 insertions, 16 deletions
diff --git a/sw/CppunitTest_sw_apitests.mk b/sw/CppunitTest_sw_apitests.mk index 9af8873079d3..716607dbe404 100644 --- a/sw/CppunitTest_sw_apitests.mk +++ b/sw/CppunitTest_sw_apitests.mk @@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_apitests, \ cppu \ cppuhelper \ drawinglayer \ + docmodel \ editeng \ for \ forui \ diff --git a/sw/CppunitTest_sw_core_draw.mk b/sw/CppunitTest_sw_core_draw.mk index 63dfd5f828b9..0267fc60e2d5 100644 --- a/sw/CppunitTest_sw_core_draw.mk +++ b/sw/CppunitTest_sw_core_draw.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_draw, \ comphelper \ cppu \ cppuhelper \ + docmodel \ sal \ sfx \ subsequenttest \ diff --git a/sw/CppunitTest_sw_core_theme.mk b/sw/CppunitTest_sw_core_theme.mk index 84b462ea8245..03b42a32e666 100644 --- a/sw/CppunitTest_sw_core_theme.mk +++ b/sw/CppunitTest_sw_core_theme.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_theme, \ comphelper \ cppu \ cppuhelper \ + docmodel \ sal \ sfx \ subsequenttest \ diff --git a/sw/CppunitTest_sw_macros_test.mk b/sw/CppunitTest_sw_macros_test.mk index a0be4e6cd27f..9cc9b597c9ce 100644 --- a/sw/CppunitTest_sw_macros_test.mk +++ b/sw/CppunitTest_sw_macros_test.mk @@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_macros_test, \ cppu \ cppuhelper \ drawinglayer \ + docmodel \ editeng \ for \ forui \ diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk index 93ecf2324477..0df45a3b11c5 100644 --- a/sw/CppunitTest_sw_ooxmlimport.mk +++ b/sw/CppunitTest_sw_ooxmlimport.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport, \ comphelper \ cppu \ cppuhelper \ + docmodel \ sal \ sfx \ subsequenttest \ diff --git a/sw/CppunitTest_sw_ooxmlimport2.mk b/sw/CppunitTest_sw_ooxmlimport2.mk index ed8d2a92e514..89dd74ff40d1 100644 --- a/sw/CppunitTest_sw_ooxmlimport2.mk +++ b/sw/CppunitTest_sw_ooxmlimport2.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport2, \ comphelper \ cppu \ cppuhelper \ + docmodel \ sal \ sfx \ subsequenttest \ diff --git a/sw/CppunitTest_sw_tiledrendering.mk b/sw/CppunitTest_sw_tiledrendering.mk index 198fc04a0028..830167ca21d3 100644 --- a/sw/CppunitTest_sw_tiledrendering.mk +++ b/sw/CppunitTest_sw_tiledrendering.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_tiledrendering, \ cppu \ cppuhelper \ editeng \ + docmodel \ sal \ sfx \ subsequenttest \ diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk index 2c2361d199b6..7b328c998fe3 100644 --- a/sw/CppunitTest_sw_uwriter.mk +++ b/sw/CppunitTest_sw_uwriter.mk @@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uwriter, \ cppuhelper \ $(call gb_Helper_optional,DBCONNECTIVITY, \ dbtools) \ + docmodel \ drawinglayer \ drawinglayercore \ editeng \ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 19cb6baeac74..478136e50f54 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,sw,\ cppuhelper \ $(call gb_Helper_optional,DBCONNECTIVITY, \ dbtools) \ + docmodel \ drawinglayercore \ drawinglayer \ editeng \ diff --git a/sw/layoutwriter_setup.mk b/sw/layoutwriter_setup.mk index e151bcf75509..bfc9548fceef 100644 --- a/sw/layoutwriter_setup.mk +++ b/sw/layoutwriter_setup.mk @@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_layoutwriter$(1), \ comphelper \ cppu \ cppuhelper \ + docmodel \ editeng \ msword \ sal \ diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk index 8f45d30be7c3..e124ee3b6a12 100644 --- a/sw/ooxmlexport_setup.mk +++ b/sw/ooxmlexport_setup.mk @@ -13,6 +13,7 @@ define sw_ooxmlexport_libraries comphelper \ cppu \ cppuhelper \ + docmodel \ editeng \ sal \ sfx \ diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx index 2ab9072469c0..a6591c6b77db 100644 --- a/sw/qa/core/theme/ThemeTest.cxx +++ b/sw/qa/core/theme/ThemeTest.cxx @@ -50,16 +50,16 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExists) CPPUNIT_ASSERT(pColorSet); CPPUNIT_ASSERT_EQUAL(OUString(u"Orange"), pColorSet->getName()); - CPPUNIT_ASSERT_EQUAL(Color(0xE48312), pTheme->GetColor(svx::ThemeColorType::Accent1)); - CPPUNIT_ASSERT_EQUAL(Color(0xBD582C), pTheme->GetColor(svx::ThemeColorType::Accent2)); - CPPUNIT_ASSERT_EQUAL(Color(0x865640), pTheme->GetColor(svx::ThemeColorType::Accent3)); - CPPUNIT_ASSERT_EQUAL(Color(0x9B8357), pTheme->GetColor(svx::ThemeColorType::Accent4)); - CPPUNIT_ASSERT_EQUAL(Color(0xC2BC80), pTheme->GetColor(svx::ThemeColorType::Accent5)); - CPPUNIT_ASSERT_EQUAL(Color(0x94A088), pTheme->GetColor(svx::ThemeColorType::Accent6)); - CPPUNIT_ASSERT_EQUAL(Color(0x000000), pTheme->GetColor(svx::ThemeColorType::Dark1)); - CPPUNIT_ASSERT_EQUAL(Color(0x637052), pTheme->GetColor(svx::ThemeColorType::Dark2)); - CPPUNIT_ASSERT_EQUAL(Color(0xFFFFFF), pTheme->GetColor(svx::ThemeColorType::Light1)); - CPPUNIT_ASSERT_EQUAL(Color(0xCCDDEA), pTheme->GetColor(svx::ThemeColorType::Light2)); + CPPUNIT_ASSERT_EQUAL(Color(0xE48312), pTheme->GetColor(model::ThemeColorType::Accent1)); + CPPUNIT_ASSERT_EQUAL(Color(0xBD582C), pTheme->GetColor(model::ThemeColorType::Accent2)); + CPPUNIT_ASSERT_EQUAL(Color(0x865640), pTheme->GetColor(model::ThemeColorType::Accent3)); + CPPUNIT_ASSERT_EQUAL(Color(0x9B8357), pTheme->GetColor(model::ThemeColorType::Accent4)); + CPPUNIT_ASSERT_EQUAL(Color(0xC2BC80), pTheme->GetColor(model::ThemeColorType::Accent5)); + CPPUNIT_ASSERT_EQUAL(Color(0x94A088), pTheme->GetColor(model::ThemeColorType::Accent6)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), pTheme->GetColor(model::ThemeColorType::Dark1)); + CPPUNIT_ASSERT_EQUAL(Color(0x637052), pTheme->GetColor(model::ThemeColorType::Dark2)); + CPPUNIT_ASSERT_EQUAL(Color(0xFFFFFF), pTheme->GetColor(model::ThemeColorType::Light1)); + CPPUNIT_ASSERT_EQUAL(Color(0xCCDDEA), pTheme->GetColor(model::ThemeColorType::Light2)); svx::FontScheme const& rFontScheme = pTheme->getFontScheme(); CPPUNIT_ASSERT_EQUAL(OUString(u"Calibri Light"), rFontScheme.getMajorLatin().maTypeface); diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index ad0d74e2b678..83a09d092dbf 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -223,11 +223,12 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet const * pStyle, FontSet const void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const& rColorSet, StyleRedefinition* /*pRedefinition*/) { SvxColorItem aColorItem(pCollection->GetColor()); - auto nThemeIndex = aColorItem.GetThemeColor().GetThemeIndex(); - if (nThemeIndex >= 0) + model::ThemeColor const& rThemeColor = aColorItem.GetThemeColor(); + auto eThemeType = rThemeColor.getType(); + if (eThemeType != model::ThemeColorType::Unknown) { - Color aColor = rColorSet.getColor(svx::convertToThemeColorType(nThemeIndex)); - aColor.ApplyTintOrShade(aColorItem.GetThemeColor().GetTintOrShade()); + Color aColor = rColorSet.getColor(eThemeType); + aColor = rThemeColor.applyTransformations(aColor); aColorItem.SetValue(aColor); pCollection->SetFormatAttr(aColorItem); } @@ -399,10 +400,10 @@ BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet) for (sal_uInt32 i = 0; i < 12; i += 2) { - pVirtualDev->SetFillColor(rColorSet.getColor(svx::convertToThemeColorType(i))); + pVirtualDev->SetFillColor(rColorSet.getColor(model::convertToThemeColorType(i))); pVirtualDev->DrawRect(tools::Rectangle(x, y1, x + SIZE, y1 + SIZE)); - pVirtualDev->SetFillColor(rColorSet.getColor(svx::convertToThemeColorType(i + 1))); + pVirtualDev->SetFillColor(rColorSet.getColor(model::convertToThemeColorType(i + 1))); pVirtualDev->DrawRect(tools::Rectangle(x, y2, x + SIZE, y2 + SIZE)); x += SIZE + BORDER; diff --git a/sw/uiwriter_setup.mk b/sw/uiwriter_setup.mk index 37c506149e7e..013cb3e29953 100644 --- a/sw/uiwriter_setup.mk +++ b/sw/uiwriter_setup.mk @@ -13,6 +13,7 @@ define sw_uiwriter_libraries comphelper \ cppu \ cppuhelper \ + docmodel \ editeng \ i18nlangtag \ msword \ diff --git a/sw/ww8export_setup.mk b/sw/ww8export_setup.mk index 26a58ad41191..daa726c1b667 100644 --- a/sw/ww8export_setup.mk +++ b/sw/ww8export_setup.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export$(1), \ comphelper \ cppu \ cppuhelper \ + docmodel \ editeng \ emboleobj \ sal \ |