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-16 08:03:14 +0000 |
commit | 5be810bca2e5701d8451b4bf4e9e88e3f7b3a56d (patch) | |
tree | 8e646f4c7a7023e00a3570ef57c93f27ec315ac7 | |
parent | 7169596baf030d89d95db63bd78d55dc8072d22b (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>
(cherry picked from commit bd0f526f2d3e1ffe43a74672485815768eee6e9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145528
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
70 files changed, 841 insertions, 260 deletions
diff --git a/Repository.mk b/Repository.mk index 640e7ea62902..73c1da87d530 100644 --- a/Repository.mk +++ b/Repository.mk @@ -354,6 +354,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(call gb_Helper_optional,SCRIPTING,dlgprov) \ $(if $(filter WNT,$(OS)),directx9canvas) \ $(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \ + docmodel \ drawinglayer \ editeng \ $(if $(filter WNT,$(OS)),emser) \ diff --git a/RepositoryModule_build.mk b/RepositoryModule_build.mk index de906d605c53..68519617b1e5 100644 --- a/RepositoryModule_build.mk +++ b/RepositoryModule_build.mk @@ -63,6 +63,7 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\ configmgr \ connectivity \ cppcanvas \ + docmodel \ drawinglayer \ editeng \ emfio \ diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index a13278563270..61efbfb5ad2b 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -47,6 +47,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ dbaccess \ desktop \ $(call gb_Helper_optional,DICTIONARIES,dictionaries) \ + docmodel\ drawinglayer \ editeng \ embeddedobj \ diff --git a/bin/update_pch b/bin/update_pch index eb9631e80d80..cfbeb862db49 100755 --- a/bin/update_pch +++ b/bin/update_pch @@ -73,6 +73,7 @@ DEFAULTS = \ 'desktop.deploymentgui' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 5.7 'desktop.deploymentmisc' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 3.4 'desktop.sofficeapp' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 6.5 + 'docmodel.docmodel' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 3.8 'drawinglayer.drawinglayer' : ( 4, EXCLUDE, EXCLUDE, EXCLUDE), # 7.4 'editeng.editeng' : ( 5, EXCLUDE, INCLUDE, EXCLUDE), # 13.0 'forms.frm' : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), # 14.2 @@ -1193,8 +1194,8 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_eval(self): source = """$(eval $(call gb_Library_set_include,sal,\\ - $$(INCLUDE) \\ - -I$(SRCDIR)/sal/inc \\ + $$(INCLUDE) \\ + -I$(SRCDIR)/sal/inc \\ )) """ lines = source.split('\n') @@ -1205,9 +1206,9 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_eval_with_if(self): source = """$(eval $(call gb_Library_add_defs,sal,\\ - $(if $(filter $(OS),iOS), \\ - -DNO_CHILD_PROCESSES \\ - ) \\ + $(if $(filter $(OS),iOS), \\ + -DNO_CHILD_PROCESSES \\ + ) \\ )) """ lines = source.split('\n') @@ -1218,7 +1219,7 @@ class TestMakefileParser(unittest.TestCase): def test_parse_multiline_add_with_if(self): source = """$(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/time \\ + sal/osl/unx/time \\ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \\ )) """ @@ -1232,11 +1233,11 @@ class TestMakefileParser(unittest.TestCase): def test_parse_if_else(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) endif """ @@ -1253,16 +1254,16 @@ endif def test_parse_nested_if(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/textenc/context \\ + sal/textenc/context \\ )) endif endif @@ -1282,16 +1283,16 @@ endif def test_parse_exclude_system(self): source = """ifeq ($(OS),MACOSX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/mac/mac \\ + sal/osl/mac/mac \\ )) else $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/uunxapi \\ + sal/osl/unx/uunxapi \\ )) ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/textenc/context \\ + sal/textenc/context \\ )) endif endif @@ -1308,7 +1309,7 @@ endif def test_parse_filter(self): source = """ifneq ($(filter $(OS),MACOSX iOS),) $(eval $(call gb_Library_add_exception_objects,sal,\\ - sal/osl/unx/osxlocale \\ + sal/osl/unx/osxlocale \\ )) endif """ diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index c4c0a52b2ef4..d1fa15964d11 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_libraries,cui,\ comphelper \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ i18nlangtag \ diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx index ddc40646e39d..906cca95a871 100644 --- a/cui/inc/pch/precompiled_cui.hxx +++ b/cui/inc/pch/precompiled_cui.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2021-09-28 05:29:25 using: + Generated on 2023-01-16 00:08:03 using: ./bin/update_pch cui cui --cutoff=8 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -151,7 +151,6 @@ #include <vcl/scopedbitmapaccess.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <vcl/syswin.hxx> #include <vcl/task.hxx> #include <vcl/timer.hxx> #include <vcl/transfer.hxx> @@ -164,7 +163,6 @@ #include <vcl/wall.hxx> #include <vcl/weld.hxx> #include <vcl/window.hxx> -#include <vcl/windowstate.hxx> #endif // PCH_LEVEL >= 2 #if PCH_LEVEL >= 3 #include <basegfx/basegfxdllapi.h> @@ -246,7 +244,6 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/RuntimeException.hpp> @@ -269,6 +266,7 @@ #include <comphelper/dispatchcommand.hxx> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> #include <comphelper/weak.hxx> #include <cppu/cppudllapi.h> @@ -280,6 +278,7 @@ #include <cppuhelper/implbase_ex_pre.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakref.hxx> +#include <docmodel/theme/ThemeColorType.hxx> #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/primitive2d/CommonTypes.hxx> #include <drawinglayer/primitive2d/Primitive2DContainer.hxx> @@ -299,14 +298,13 @@ #include <editeng/svxfont.hxx> #include <i18nlangtag/lang.h> #include <i18nlangtag/languagetag.hxx> -#include <i18nutil/i18nutildllapi.h> #include <i18nutil/searchopt.hxx> #include <i18nutil/transliteration.hxx> #include <o3tl/cow_wrapper.hxx> -#include <o3tl/deleter.hxx> #include <o3tl/enumarray.hxx> #include <o3tl/safeint.hxx> #include <o3tl/sorted_vector.hxx> +#include <o3tl/span.hxx> #include <o3tl/strong_int.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/underlyingenumvalue.hxx> @@ -352,6 +350,7 @@ #include <svtools/unitconv.hxx> #include <svtools/valueset.hxx> #include <svx/DiagramDataInterface.hxx> +#include <svx/colorbox.hxx> #include <svx/dialmgr.hxx> #include <svx/dlgutil.hxx> #include <svx/ipolypolygoneditorcontroller.hxx> @@ -432,6 +431,7 @@ #include <uno/data.h> #include <uno/sequence2.h> #include <unotools/charclass.hxx> +#include <unotools/configitem.hxx> #include <unotools/fontdefs.hxx> #include <unotools/options.hxx> #include <unotools/pathoptions.hxx> diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 26734cb66247..28c4c89d3cc6 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1597,12 +1597,14 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) { SvxColorItem aItem( aSelectedColor.m_aColor, nWhich ); - if (aSelectedColor.m_nThemeIndex != -1) + // The color was picked from the theme palette, remember its index. + model::ThemeColorType eType = model::convertToThemeColorType(aSelectedColor.m_nThemeIndex); + if (eType != model::ThemeColorType::Unknown) { - // The color was picked from the theme palette, remember its index. - aItem.GetThemeColor().SetThemeIndex(aSelectedColor.m_nThemeIndex); - aItem.GetThemeColor().SetLumMod(aSelectedColor.m_nLumMod); - aItem.GetThemeColor().SetLumOff(aSelectedColor.m_nLumOff); + aItem.GetThemeColor().setType(eType); + aItem.GetThemeColor().clearTransformations(); + aItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, aSelectedColor.m_nLumMod}); + aItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, aSelectedColor.m_nLumOff}); } rSet.Put(aItem); diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 64c8c725d999..23a383495c70 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -247,17 +247,19 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) sColorName = "#" + aCurrentColor.m_aColor.AsRGBHexString().toAsciiUpperCase(); maPaletteManager.AddRecentColor( aCurrentColor.m_aColor, sColorName ); XFillColorItem aColorItem( sColorName, aCurrentColor.m_aColor ); - if (aCurrentColor.m_nThemeIndex != -1) + model::ThemeColorType eType = model::convertToThemeColorType(aCurrentColor.m_nThemeIndex); + if (eType != model::ThemeColorType::Unknown) { - aColorItem.GetThemeColor().SetThemeIndex(aCurrentColor.m_nThemeIndex); + aColorItem.GetThemeColor().setType(eType); } + aColorItem.GetThemeColor().clearTransformations(); if (aCurrentColor.m_nLumMod != 10000) { - aColorItem.GetThemeColor().SetLumMod(aCurrentColor.m_nLumMod); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, aCurrentColor.m_nLumMod}); } if (aCurrentColor.m_nLumOff != 0) { - aColorItem.GetThemeColor().SetLumOff(aCurrentColor.m_nLumOff); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, aCurrentColor.m_nLumOff}); } rSet->Put( aColorItem ); rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); diff --git a/docmodel/Library_docmodel.mk b/docmodel/Library_docmodel.mk new file mode 100644 index 000000000000..3e0d28dfda28 --- /dev/null +++ b/docmodel/Library_docmodel.mk @@ -0,0 +1,39 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,docmodel)) + +$(eval $(call gb_Library_add_exception_objects,docmodel,\ + docmodel/source/uno/UnoThemeColor \ +)) + +$(eval $(call gb_Library_set_include,docmodel,\ + $$(INCLUDE) \ + -I$(SRCDIR)/docmodel/inc \ +)) + +$(eval $(call gb_Library_add_defs,docmodel,\ + -DDOCMODEL_DLLIMPLEMENTATION \ +)) + +$(eval $(call gb_Library_set_precompiled_header,docmodel,docmodel/inc/pch/precompiled_docmodel)) + +$(eval $(call gb_Library_use_sdk_api,docmodel)) + +$(eval $(call gb_Library_use_libraries,docmodel,\ + basegfx \ + comphelper \ + cppuhelper \ + cppu \ + sal \ + vcl \ + tl \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/docmodel/Makefile b/docmodel/Makefile new file mode 100644 index 000000000000..ccb1c85a04da --- /dev/null +++ b/docmodel/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/docmodel/Module_docmodel.mk b/docmodel/Module_docmodel.mk new file mode 100644 index 000000000000..7e55ff74ad60 --- /dev/null +++ b/docmodel/Module_docmodel.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,docmodel)) + +$(eval $(call gb_Module_add_targets,docmodel,\ + Library_docmodel \ +)) + + + +# vim: set noet sw=4 ts=4: diff --git a/docmodel/README.md b/docmodel/README.md new file mode 100644 index 000000000000..c8d08b133b1e --- /dev/null +++ b/docmodel/README.md @@ -0,0 +1,5 @@ +# Document Model Types and Objects + +Contains document model types, that don't require many depenencies except +basic types found in basegfx and tools. The purpose of this types and +objects is to be available in all common components. diff --git a/docmodel/inc/pch/precompiled_docmodel.cxx b/docmodel/inc/pch/precompiled_docmodel.cxx new file mode 100644 index 000000000000..f8a84e17d6c3 --- /dev/null +++ b/docmodel/inc/pch/precompiled_docmodel.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_docmodel.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/docmodel/inc/pch/precompiled_docmodel.hxx b/docmodel/inc/pch/precompiled_docmodel.hxx new file mode 100644 index 000000000000..1942b8737a17 --- /dev/null +++ b/docmodel/inc/pch/precompiled_docmodel.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2023-01-10 23:20:14 using: + bin/update_pch docmodel docmodel --cutoff=3 --exclude:system --exclude:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./docmodel/inc/pch/precompiled_docmodel.hxx "make docmodel.build" --find-conflicts +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <sal/types.h> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/docmodel/source/uno/UnoThemeColor.cxx b/docmodel/source/uno/UnoThemeColor.cxx new file mode 100644 index 000000000000..f6374b54933b --- /dev/null +++ b/docmodel/source/uno/UnoThemeColor.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <docmodel/uno/UnoThemeColor.hxx> +#include <cppuhelper/queryinterface.hxx> + +using namespace css; + +// css::lang::XUnoTunnel +UNO3_GETIMPLEMENTATION_IMPL(UnoThemeColor); + +sal_Int16 UnoThemeColor::getType() { return sal_uInt16(maThemeColor.getType()); } + +namespace model::theme +{ +uno::Reference<util::XThemeColor> createXThemeColor(model::ThemeColor const& rThemeColor) +{ + return new UnoThemeColor(rThemeColor); +} + +void setFromXThemeColor(model::ThemeColor& rThemeColor, + uno::Reference<util::XThemeColor> const& rxColorTheme) +{ + UnoThemeColor* pUnoThemeColor = comphelper::getFromUnoTunnel<UnoThemeColor>(rxColorTheme); + if (pUnoThemeColor) + { + rThemeColor = pUnoThemeColor->getThemeColor(); + } +} + +} // end model::theme + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk index 3b3a999e8fa0..9b79048b637a 100644 --- a/editeng/CppunitTest_editeng_core.mk +++ b/editeng/CppunitTest_editeng_core.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,editeng_core, \ comphelper \ cppu \ cppuhelper \ + docmodel \ i18nlangtag \ i18nutil \ lng \ diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 1237954ad6e9..e81dcbaaf6c5 100644 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -133,6 +133,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\ $(eval $(call gb_Library_use_libraries,editeng,\ xo \ basegfx \ + docmodel \ lng \ svt \ tk \ diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index b37710e161e2..bd08d9c3510c 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2021-07-28 20:17:03 using: + Generated on 2023-01-16 00:08:47 using: ./bin/update_pch editeng editeng --cutoff=5 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -37,11 +37,13 @@ #include <functional> #include <initializer_list> #include <iomanip> +#include <iterator> #include <limits.h> #include <limits> #include <map> #include <math.h> #include <memory> +#include <mutex> #include <new> #include <numeric> #include <optional> @@ -53,6 +55,7 @@ #include <string_view> #include <type_traits> #include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> #include <boost/property_tree/json_parser.hpp> @@ -77,6 +80,7 @@ #include <rtl/math.hxx> #include <rtl/ref.hxx> #include <rtl/strbuf.h> +#include <rtl/strbuf.hxx> #include <rtl/string.h> #include <rtl/string.hxx> #include <rtl/stringconcat.hxx> @@ -150,10 +154,21 @@ #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/awt/KeyGroup.hpp> +#include <com/sun/star/i18n/Calendar2.hpp> +#include <com/sun/star/i18n/DirectionProperty.hpp> +#include <com/sun/star/i18n/ForbiddenCharacters.hpp> +#include <com/sun/star/i18n/KCharacterType.hpp> +#include <com/sun/star/i18n/LanguageCountryInfo.hpp> +#include <com/sun/star/i18n/LocaleDataItem2.hpp> +#include <com/sun/star/i18n/LocaleItem.hpp> +#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp> +#include <com/sun/star/i18n/ParseResult.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> #include <com/sun/star/i18n/TransliterationModulesExtra.hpp> +#include <com/sun/star/i18n/UnicodeScript.hpp> #include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/reservedWords.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -186,6 +201,7 @@ #include <com/sun/star/xml/sax/XFastTokenHandler.hpp> #include <comphelper/accessiblecomponenthelper.hxx> #include <comphelper/accessiblecontexthelper.hxx> +#include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/comphelperdllapi.h> #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> @@ -253,6 +269,7 @@ #include <tools/link.hxx> #include <tools/long.hxx> #include <tools/mapunit.hxx> +#include <tools/poly.hxx> #include <tools/ref.hxx> #include <tools/solar.h> #include <tools/stream.hxx> @@ -266,6 +283,7 @@ #include <uno/data.h> #include <uno/sequence2.h> #include <unotools/options.hxx> +#include <unotools/syslocale.hxx> #include <unotools/unotoolsdllapi.h> #include <xmloff/dllapi.h> #include <xmloff/families.hxx> diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 329af5edb076..07c131e98307 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1352,38 +1352,6 @@ bool SvxContourItem::GetPresentation return true; } -SvxThemeColor::SvxThemeColor() - : maThemeIndex(-1) - , mnLumMod(10000) - , mnLumOff(0) - , mnTintOrShade(0) -{ -} - -bool SvxThemeColor::operator==(const SvxThemeColor& rThemeColor) const -{ - return maThemeIndex == rThemeColor.maThemeIndex && - mnLumMod == rThemeColor.mnLumMod && - mnLumOff == rThemeColor.mnLumOff && - mnTintOrShade == rThemeColor.mnTintOrShade; -} - -void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const -{ - (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxThemeColor")); - - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("theme-index"), - BAD_CAST(OString::number(maThemeIndex).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-mod"), - BAD_CAST(OString::number(mnLumMod).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"), - BAD_CAST(OString::number(mnLumOff).getStr())); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"), - BAD_CAST(OString::number(mnTintOrShade).getStr())); - - (void)xmlTextWriterEndElement(pWriter); -} - // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : SfxPoolItem(nId), @@ -1428,22 +1396,42 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } case MID_COLOR_THEME_INDEX: { - rVal <<= maThemeColor.GetThemeIndex(); + rVal <<= sal_Int16(maThemeColor.getType()); break; } case MID_COLOR_TINT_OR_SHADE: { - rVal <<= maThemeColor.GetTintOrShade(); + sal_Int16 nValue = 0; + for (auto const& rTransform : maThemeColor.getTransformations()) + { + if (rTransform.meType == model::TransformationType::Tint) + nValue = rTransform.mnValue; + else if (rTransform.meType == model::TransformationType::Shade) + nValue = -rTransform.mnValue; + } + rVal <<= nValue; break; } case MID_COLOR_LUM_MOD: { - rVal <<= maThemeColor.GetLumMod(); + sal_Int16 nValue = 10000; + for (auto const& rTransform : maThemeColor.getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nValue = rTransform.mnValue; + } + rVal <<= nValue; break; } case MID_COLOR_LUM_OFF: { - rVal <<= maThemeColor.GetLumOff(); + sal_Int16 nValue = 0; + for (auto const& rTransform : maThemeColor.getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nValue = rTransform.mnValue; + } + rVal <<= nValue; break; } default: @@ -1481,31 +1469,43 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nIndex = -1; if (!(rVal >>= nIndex)) return false; - maThemeColor.SetThemeIndex(nIndex); + maThemeColor.setType(model::convertToThemeColorType(nIndex)); } break; case MID_COLOR_TINT_OR_SHADE: { - sal_Int16 nTintShade = -1; + sal_Int16 nTintShade = 0; if (!(rVal >>= nTintShade)) return false; - maThemeColor.SetTintOrShade(nTintShade); + + maThemeColor.removeTransformations(model::TransformationType::Tint); + maThemeColor.removeTransformations(model::TransformationType::Shade); + + if (nTintShade > 0) + maThemeColor.addTransformation({model::TransformationType::Tint, nTintShade}); + else if (nTintShade < 0) + { + sal_Int16 nShade = o3tl::narrowing<sal_Int16>(-nTintShade); + maThemeColor.addTransformation({model::TransformationType::Shade, nShade}); + } } break; case MID_COLOR_LUM_MOD: { - sal_Int16 nLumMod = -1; + sal_Int16 nLumMod = 10000; if (!(rVal >>= nLumMod)) return false; - maThemeColor.SetLumMod(nLumMod); + maThemeColor.removeTransformations(model::TransformationType::LumMod); + maThemeColor.addTransformation({model::TransformationType::LumMod, nLumMod}); } break; case MID_COLOR_LUM_OFF: { - sal_Int16 nLumOff = -1; + sal_Int16 nLumOff = 0; if (!(rVal >>= nLumOff)) return false; - maThemeColor.SetLumOff(nLumOff); + maThemeColor.removeTransformations(model::TransformationType::LumOff); + maThemeColor.addTransformation({model::TransformationType::LumOff, nLumOff}); } break; default: @@ -1548,12 +1548,25 @@ void SvxColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, aStr, aIntlWrapper); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr())); - maThemeColor.dumpAsXml(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("theme-color")); - (void)xmlTextWriterEndElement(pWriter); -} + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("theme-index"), + BAD_CAST(OString::number(sal_Int16(maThemeColor.getType())).getStr())); + + for (auto const& rTransform : maThemeColor.getTransformations()) + { + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("transformation")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), + BAD_CAST(OString::number(sal_Int16(rTransform.meType)).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::number(rTransform.mnValue).getStr())); + (void)xmlTextWriterEndElement(pWriter); + } + (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterEndElement(pWriter); +} void SvxColorItem::SetValue( const Color& rNewCol ) { diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 8a21d6c28d42..f3be510b610d 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1141,23 +1141,39 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf switch (pMap->nMemberId) { case MID_COLOR_THEME_INDEX: - if (pColor->GetThemeColor().GetThemeIndex() == -1) + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) { eItemState = SfxItemState::DEFAULT; } break; case MID_COLOR_LUM_MOD: - if (pColor->GetThemeColor().GetLumMod() == 10000) + { + sal_Int16 nLumMod = 10000; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nLumMod = rTransform.mnValue; + } + if (nLumMod == 10000) { eItemState = SfxItemState::DEFAULT; } break; + } case MID_COLOR_LUM_OFF: - if (pColor->GetThemeColor().GetLumOff() == 0) + { + sal_Int16 nLumOff = 0; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nLumOff = rTransform.mnValue; + } + if (nLumOff == 0) { eItemState = SfxItemState::DEFAULT; } break; + } } } diff --git a/include/docmodel/dllapi.h b/include/docmodel/dllapi.h new file mode 100644 index 000000000000..f90b7cc4c08e --- /dev/null +++ b/include/docmodel/dllapi.h @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/types.h> + +#if defined(DOCMODEL_DLLIMPLEMENTATION) +#define DOCMODEL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define DOCMODEL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define DOCMODEL_DLLPRIVATE SAL_DLLPRIVATE + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/theme/ThemeColor.hxx b/include/docmodel/theme/ThemeColor.hxx new file mode 100644 index 000000000000..2069594713d8 --- /dev/null +++ b/include/docmodel/theme/ThemeColor.hxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <docmodel/dllapi.h> +#include <vector> +#include <docmodel/theme/ThemeColorType.hxx> +#include <tools/color.hxx> + +namespace model +{ +/** Color transfomation type */ +enum class TransformationType +{ + Undefined, + Red, + RedMod, + RedOff, + Green, + GreenMod, + GreenOff, + Blue, + BlueMod, + BlueOff, + Alpha, + AlphaMod, + AlphaOff, + Hue, + HueMod, + HueOff, + Sat, + SatMod, + SatOff, + Lum, + LumMod, + LumOff, + Shade, + Tint, + Gray, + Comp, + Inv, + Gamma, + InvGamma +}; + +/** Definition of a color transformation. + * + * This just defines how a color should be transformed (changed). The + * type defines what kind of transformation should occur and the value + * defines by how much. + */ +struct DOCMODEL_DLLPUBLIC Transformation +{ + TransformationType meType = TransformationType::Undefined; + sal_Int16 mnValue = 0; /// percentage value -10000 to +10000 + + bool operator==(const Transformation& rTransformation) const + { + return meType == rTransformation.meType && mnValue == rTransformation.mnValue; + } +}; + +/** Definition of a theme color + * + * A theme color is defined by the type of theme color and a set of + * transformations that in addition manipulate the resulting color + * (i.e. tints, shades). + */ +class DOCMODEL_DLLPUBLIC ThemeColor +{ + ThemeColorType meType = ThemeColorType::Unknown; + std::vector<Transformation> maTransformations; + +public: + ThemeColor() = default; + + ThemeColorType getType() const { return meType; } + + void setType(ThemeColorType eType) { meType = eType; } + + void clearTransformations() { maTransformations.clear(); } + + void addTransformation(Transformation const& rTransform) + { + maTransformations.push_back(rTransform); + } + + void removeTransformations(TransformationType eType) + { + maTransformations.erase(std::remove_if(maTransformations.begin(), maTransformations.end(), + [eType](Transformation const& rTransform) { + return rTransform.meType == eType; + }), + maTransformations.end()); + } + + std::vector<Transformation> const& getTransformations() const { return maTransformations; } + + /** Applies the defined trasformations to the input color */ + Color applyTransformations(Color const& rColor) const + { + Color aColor(rColor); + + for (auto const& rTransform : maTransformations) + { + switch (rTransform.meType) + { + case TransformationType::Tint: + aColor.ApplyTintOrShade(rTransform.mnValue); + break; + case TransformationType::Shade: + aColor.ApplyTintOrShade(-rTransform.mnValue); + break; + case TransformationType::LumMod: + aColor.ApplyLumModOff(rTransform.mnValue, 0); + break; + case TransformationType::LumOff: + aColor.ApplyLumModOff(10000, rTransform.mnValue); + break; + default: + break; + } + } + return aColor; + } + + bool operator==(const ThemeColor& rThemeColor) const + { + return meType == rThemeColor.meType + && maTransformations.size() == rThemeColor.maTransformations.size() + && std::equal(maTransformations.begin(), maTransformations.end(), + rThemeColor.maTransformations.begin()); + } +}; + +} // end of namespace model + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/theme/ThemeColorType.hxx b/include/docmodel/theme/ThemeColorType.hxx new file mode 100644 index 000000000000..a8ed9a56a6dc --- /dev/null +++ b/include/docmodel/theme/ThemeColorType.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +namespace model +{ +/// Offsets into the color list of a theme. +enum class ThemeColorType : sal_Int32 +{ + Unknown = -1, + Dark1 = 0, + Light1 = 1, + Dark2 = 2, + Light2 = 3, + Accent1 = 4, + Accent2 = 5, + Accent3 = 6, + Accent4 = 7, + Accent5 = 8, + Accent6 = 9, + Hyperlink = 10, + FollowedHyperlink = 11, + LAST = FollowedHyperlink +}; + +constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) +{ + if (nIndex < 0 || nIndex > 11) + return ThemeColorType::Unknown; + return static_cast<ThemeColorType>(nIndex); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/docmodel/uno/UnoThemeColor.hxx b/include/docmodel/uno/UnoThemeColor.hxx new file mode 100644 index 000000000000..50063ab981dd --- /dev/null +++ b/include/docmodel/uno/UnoThemeColor.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <comphelper/servicehelper.hxx> + +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/util/XThemeColor.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <utility> +#include <docmodel/dllapi.h> +#include <docmodel/theme/ThemeColor.hxx> + +class DOCMODEL_DLLPUBLIC UnoThemeColor final + : public cppu::WeakImplHelper<css::util::XThemeColor, css::lang::XUnoTunnel> +{ +private: + model::ThemeColor maThemeColor; + +public: + UnoThemeColor(model::ThemeColor const& rThemeColor) + : maThemeColor(rThemeColor) + { + } + + model::ThemeColor const& getThemeColor() const { return maThemeColor; } + + // XThemeColor + sal_Int16 SAL_CALL getType() override; + + UNO3_GETIMPLEMENTATION_DECL(UnoThemeColor) +}; + +namespace model::theme +{ +DOCMODEL_DLLPUBLIC css::uno::Reference<css::util::XThemeColor> +createXThemeColor(model::ThemeColor const& rThemeColor); + +DOCMODEL_DLLPUBLIC void +setFromXThemeColor(model::ThemeColor& rThemeColor, + css::uno::Reference<css::util::XThemeColor> const& rxThemeColor); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 05a7183c8582..d4090eb9e7eb 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -22,63 +22,17 @@ #include <svl/poolitem.hxx> #include <tools/color.hxx> #include <editeng/editengdllapi.h> +#include <docmodel/theme/ThemeColor.hxx> #define VERSION_USEAUTOCOLOR 1 -/// Represents theme metadata for a (tools) Color. -class EDITENG_DLLPUBLIC SvxThemeColor -{ - sal_Int16 maThemeIndex; - /// Luminance Modulation: 100th percentage, defaults to 100%. - sal_Int16 mnLumMod; - /// Luminance Offset: 100th percentage, defaults to 0%. - sal_Int16 mnLumOff; - - sal_Int16 mnTintOrShade; - -public: - explicit SvxThemeColor(); - bool operator==(const SvxThemeColor& rThemeColor) const; - - sal_Int16 GetThemeIndex() const - { - return maThemeIndex; - } - - void SetThemeIndex(sal_Int16 nIndex) - { - maThemeIndex = nIndex; - - } - void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; } - - sal_Int16 GetLumMod() const { return mnLumMod; } - - void SetLumOff(sal_Int16 nLumOff) { mnLumOff = nLumOff; } - - sal_Int16 GetLumOff() const { return mnLumOff; } - - sal_Int16 GetTintOrShade() const - { - return mnTintOrShade; - } - - void SetTintOrShade(sal_Int16 nTintOrShade) - { - mnTintOrShade = nTintOrShade; - } - - void dumpAsXml(xmlTextWriterPtr pWriter) const; -}; - /** SvxColorItem item describes a color. */ class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem { private: Color mColor; - SvxThemeColor maThemeColor; - + model::ThemeColor maThemeColor; public: static SfxPoolItem* CreateDefault(); @@ -105,9 +59,9 @@ public: } void SetValue(const Color& rNewColor); - SvxThemeColor& GetThemeColor() { return maThemeColor; } + model::ThemeColor& GetThemeColor() { return maThemeColor; } - const SvxThemeColor& GetThemeColor() const { return maThemeColor; } + const model::ThemeColor& GetThemeColor() const { return maThemeColor; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index fc727fc529f0..030ee8bf934f 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -16,7 +16,9 @@ #include <rtl/ustring.hxx> #include <sal/types.h> +#include <sal/log.hxx> #include <svx/svxdllapi.h> +#include <docmodel/theme/ThemeColorType.hxx> #include <tools/color.hxx> typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -25,31 +27,6 @@ class SdrPage; namespace svx { -/// Offsets into the color list of a theme. -enum class ThemeColorType : sal_Int32 -{ - Unknown = -1, - Dark1 = 0, - Light1 = 1, - Dark2 = 2, - Light2 = 3, - Accent1 = 4, - Accent2 = 5, - Accent3 = 6, - Accent4 = 7, - Accent5 = 8, - Accent6 = 9, - Hyperlink = 10, - FollowedHyperlink = 11, - LAST = FollowedHyperlink -}; - -constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) -{ - if (nIndex < 0 || nIndex > 11) - return ThemeColorType::Unknown; - return static_cast<ThemeColorType>(nIndex); -} class SVXCORE_DLLPUBLIC ColorSet { @@ -66,8 +43,13 @@ public: return maName; } - Color getColor(ThemeColorType nType) const + Color getColor(model::ThemeColorType nType) const { + if (nType == model::ThemeColorType::Unknown) + { + SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown"); + return COL_AUTO; + } return maColors[size_t(nType)]; } @@ -273,7 +255,7 @@ public: std::vector<Color> GetColors() const; - Color GetColor(ThemeColorType eType) const; + Color GetColor(model::ThemeColorType eType) const; }; } // end of namespace svx diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx index 1c9e249bfccb..e3241016211e 100644 --- a/include/svx/xcolit.hxx +++ b/include/svx/xcolit.hxx @@ -22,18 +22,17 @@ #include <tools/color.hxx> #include <editeng/colritem.hxx> +#include <docmodel/theme/ThemeColor.hxx> #include <svx/svxdllapi.h> #include <svx/xit.hxx> class XColorList; - - class SVXCORE_DLLPUBLIC XColorItem : public NameOrIndex { Color aColor; - SvxThemeColor maThemeColor; + model::ThemeColor maThemeColor; public: static SfxPoolItem* CreateDefault(); @@ -53,8 +52,8 @@ public: const Color& GetColorValue() const; void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); } - SvxThemeColor& GetThemeColor() { return maThemeColor; } - const SvxThemeColor& GetThemeColor() const { return maThemeColor; } + model::ThemeColor& GetThemeColor() { return maThemeColor; } + const model::ThemeColor& GetThemeColor() const { return maThemeColor; } virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 52d517290347..823308db273a 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -4167,6 +4167,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/util,\ XCloseBroadcaster \ XCloseListener \ XCloseable \ + XThemeColor \ XDataEditor \ XDataEditorListener \ XFlushListener \ diff --git a/offapi/com/sun/star/util/XThemeColor.idl b/offapi/com/sun/star/util/XThemeColor.idl new file mode 100644 index 000000000000..7da38c4850a2 --- /dev/null +++ b/offapi/com/sun/star/util/XThemeColor.idl @@ -0,0 +1,26 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +module com { module sun { module star { module util { + + +/** Theme Color interface + + @since LibreOffice 7.6 +*/ +interface XThemeColor +{ + /** Type of the theme color */ + short getType(); +}; + +}; }; }; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/CppunitTest_oox_drawingml.mk b/oox/CppunitTest_oox_drawingml.mk index c77070b30719..4d9a48806e0e 100644 --- a/oox/CppunitTest_oox_drawingml.mk +++ b/oox/CppunitTest_oox_drawingml.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,oox_drawingml, \ $(eval $(call gb_CppunitTest_use_libraries,oox_drawingml, \ comphelper \ cppu \ + docmodel \ oox \ sal \ test \ diff --git a/oox/CppunitTest_oox_shape.mk b/oox/CppunitTest_oox_shape.mk index 9b910f249160..2a7bca6e63aa 100644 --- a/oox/CppunitTest_oox_shape.mk +++ b/oox/CppunitTest_oox_shape.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,oox_shape, \ $(eval $(call gb_CppunitTest_use_libraries,oox_shape, \ comphelper \ cppu \ + docmodel \ oox \ sal \ svx \ diff --git a/oox/CppunitTest_oox_tokenmap.mk b/oox/CppunitTest_oox_tokenmap.mk index 8019da7a2301..63fbb0b4ca47 100644 --- a/oox/CppunitTest_oox_tokenmap.mk +++ b/oox/CppunitTest_oox_tokenmap.mk @@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_libraries,oox_tokenmap,\ comphelper \ cppu \ cppuhelper \ + docmodel \ editeng \ expwrap \ drawinglayer \ diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 4f6a538860ef..1f0f5d7f6810 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -46,6 +46,7 @@ $(eval $(call gb_Library_use_libraries,oox,\ editeng \ expwrap \ drawinglayer \ + docmodel \ msfilter \ sal \ i18nlangtag \ diff --git a/oox/inc/pch/precompiled_oox.hxx b/oox/inc/pch/precompiled_oox.hxx index 691c0fc5c226..1cc7a4c0e76f 100644 --- a/oox/inc/pch/precompiled_oox.hxx +++ b/oox/inc/pch/precompiled_oox.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2021-09-28 05:37:38 using: + Generated on 2023-01-16 00:09:09 using: ./bin/update_pch oox oox --cutoff=6 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -47,13 +47,12 @@ #include <utility> #include <vector> #include <boost/algorithm/string.hpp> +#include <boost/property_tree/ptree_fwd.hpp> #endif // PCH_LEVEL >= 1 #if PCH_LEVEL >= 2 #include <osl/diagnose.h> -#include <osl/doublecheckedlocking.h> #include <osl/endian.h> #include <osl/file.hxx> -#include <osl/getglobalmutex.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> #include <osl/thread.h> @@ -113,7 +112,11 @@ #include <basegfx/color/bcolor.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/tuple/Tuple2D.hxx> +#include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b3dtuple.hxx> #include <basegfx/vector/b2enums.hxx> #include <com/sun/star/awt/DeviceInfo.hpp> @@ -122,15 +125,20 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/Hatch.hpp> #include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/drawing/TextFitToSizeType.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> @@ -168,6 +176,7 @@ #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp> #include <comphelper/comphelperdllapi.h> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/storagehelper.hxx> @@ -178,6 +187,8 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakref.hxx> +#include <docmodel/theme/ThemeColorType.hxx> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> #include <drawingml/chart/chartcontextbase.hxx> #include <drawingml/chart/chartspacemodel.hxx> #include <drawingml/chart/converterbase.hxx> @@ -187,6 +198,7 @@ #include <drawingml/customshapeproperties.hxx> #include <drawingml/fillproperties.hxx> #include <drawingml/lineproperties.hxx> +#include <drawingml/linepropertiescontext.hxx> #include <drawingml/misccontexts.hxx> #include <drawingml/shapepropertiescontext.hxx> #include <drawingml/table/tablestylepart.hxx> @@ -200,25 +212,42 @@ #include <i18nlangtag/lang.h> #include <o3tl/cow_wrapper.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/span.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/unit_conversion.hxx> #include <sax/fastattribs.hxx> #include <sax/fshelper.hxx> #include <sax/saxdllapi.h> +#include <svl/eitem.hxx> +#include <svl/itemset.hxx> #include <svl/poolitem.hxx> +#include <svl/style.hxx> #include <svl/svldllapi.h> #include <svl/typedwhich.hxx> +#include <svl/whichranges.hxx> +#include <svx/ColorSets.hxx> +#include <svx/itextprovider.hxx> #include <svx/msdffdef.hxx> +#include <svx/sdtaditm.hxx> +#include <svx/sdtaitm.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/svddef.hxx> +#include <svx/svdoattr.hxx> #include <svx/svdobjkind.hxx> +#include <svx/svdotext.hxx> +#include <svx/svdtext.hxx> +#include <svx/svdtrans.hxx> #include <svx/svdtypes.hxx> #include <svx/svxdllapi.h> #include <tools/color.hxx> +#include <tools/datetime.hxx> #include <tools/degree.hxx> #include <tools/diagnose_ex.h> #include <tools/fldunit.hxx> #include <tools/fontenum.hxx> #include <tools/fract.hxx> #include <tools/gen.hxx> +#include <tools/helpers.hxx> #include <tools/link.hxx> #include <tools/long.hxx> #include <tools/mapunit.hxx> diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index f11b894f924a..b1684986f028 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -224,19 +224,19 @@ bool ThemeExport::writeFormatScheme(sax_fastparser::FSHelperPtr pFS) bool ThemeExport::writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme const& rTheme) { - static std::unordered_map<sal_Int32, svx::ThemeColorType> constTokenMap - = { { XML_dk1, svx::ThemeColorType::Dark1 }, - { XML_lt1, svx::ThemeColorType::Light1 }, - { XML_dk2, svx::ThemeColorType::Dark2 }, - { XML_lt2, svx::ThemeColorType::Light2 }, - { XML_accent1, svx::ThemeColorType::Accent1 }, - { XML_accent2, svx::ThemeColorType::Accent2 }, - { XML_accent3, svx::ThemeColorType::Accent3 }, - { XML_accent4, svx::ThemeColorType::Accent4 }, - { XML_accent5, svx::ThemeColorType::Accent5 }, - { XML_accent6, svx::ThemeColorType::Accent6 }, - { XML_hlink, svx::ThemeColorType::Hyperlink }, - { XML_folHlink, svx::ThemeColorType::FollowedHyperlink } }; + static std::unordered_map<sal_Int32, model::ThemeColorType> constTokenMap + = { { XML_dk1, model::ThemeColorType::Dark1 }, + { XML_lt1, model::ThemeColorType::Light1 }, + { XML_dk2, model::ThemeColorType::Dark2 }, + { XML_lt2, model::ThemeColorType::Light2 }, + { XML_accent1, model::ThemeColorType::Accent1 }, + { XML_accent2, model::ThemeColorType::Accent2 }, + { XML_accent3, model::ThemeColorType::Accent3 }, + { XML_accent4, model::ThemeColorType::Accent4 }, + { XML_accent5, model::ThemeColorType::Accent5 }, + { XML_accent6, model::ThemeColorType::Accent6 }, + { XML_hlink, model::ThemeColorType::Hyperlink }, + { XML_folHlink, model::ThemeColorType::FollowedHyperlink } }; static std::array<sal_Int32, 12> constTokenArray = { XML_dk1, XML_lt1, XML_dk2, XML_lt2, XML_accent1, XML_accent2, @@ -248,7 +248,7 @@ bool ThemeExport::writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme cons for (auto nToken : constTokenArray) { - svx::ThemeColorType eColorType = constTokenMap[nToken]; + model::ThemeColorType eColorType = constTokenMap[nToken]; Color aColor = pColorSet->getColor(eColorType); pFS->startElementNS(XML_a, nToken); pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(sal_Int32(aColor))); diff --git a/sd/CppunitTest_sd_uiimpress.mk b/sd/CppunitTest_sd_uiimpress.mk index 4d06c52db024..dab2a0579043 100644 --- a/sd/CppunitTest_sd_uiimpress.mk +++ b/sd/CppunitTest_sd_uiimpress.mk @@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uiimpress, \ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ for \ diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index 93426dfc3a55..916f26d573ef 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -26,6 +26,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ i18nlangtag \ diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 8d143aaa6f5f..e07dc8090ca9 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,sd,\ cppcanvas \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ i18nlangtag \ diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 9605feceaf21..92c1224c79df 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2021-04-08 13:51:32 using: + Generated on 2023-01-16 00:10:01 using: ./bin/update_pch sd sd --cutoff=4 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -25,18 +25,20 @@ #include <algorithm> #include <cassert> #include <cstddef> -#include <cstdlib> #include <functional> #include <initializer_list> #include <iomanip> +#include <iterator> #include <locale> #include <map> #include <memory> +#include <mutex> #include <new> #include <optional> #include <ostream> #include <set> #include <stddef.h> +#include <string> #include <string_view> #include <type_traits> #include <unordered_map> @@ -68,6 +70,7 @@ #include <rtl/tencinfo.h> #include <rtl/textenc.h> #include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <sal/backtrace.hxx> #include <sal/log.hxx> @@ -87,6 +90,7 @@ #include <vcl/event.hxx> #include <vcl/fntstyle.hxx> #include <vcl/font.hxx> +#include <vcl/gradient.hxx> #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/help.hxx> @@ -96,6 +100,7 @@ #include <vcl/keycod.hxx> #include <vcl/outdev.hxx> #include <vcl/ptrstyle.hxx> +#include <vcl/region.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -112,7 +117,6 @@ #include <vcl/wrkwin.hxx> #endif // PCH_LEVEL >= 2 #if PCH_LEVEL >= 3 -#include <avmedia/avmediadllapi.h> #include <avmedia/mediaplayer.hxx> #include <avmedia/mediawindow.hxx> #include <basegfx/basegfxdllapi.h> @@ -190,6 +194,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/i18n/UnicodeScript.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -213,7 +218,6 @@ #include <com/sun/star/text/XTextRangeCompare.hpp> #include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/RuntimeException.hpp> @@ -235,6 +239,7 @@ #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -312,10 +317,11 @@ #include <o3tl/deleter.hxx> #include <o3tl/safeint.hxx> #include <o3tl/sorted_vector.hxx> +#include <o3tl/string_view.hxx> #include <o3tl/strong_int.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/underlyingenumvalue.hxx> -#include <officecfg/Office/Impress.hxx> +#include <officecfg/Office/Common.hxx> #include <salhelper/simplereferenceobject.hxx> #include <salhelper/thread.hxx> #include <sfx2/app.hxx> @@ -356,6 +362,7 @@ #include <sot/exchange.hxx> #include <sot/formats.hxx> #include <svl/SfxBroadcaster.hxx> +#include <svl/cjkoptions.hxx> #include <svl/eitem.hxx> #include <svl/hint.hxx> #include <svl/intitem.hxx> @@ -402,6 +409,7 @@ #include <svx/rulritem.hxx> #include <svx/scene3d.hxx> #include <svx/sdmetitm.hxx> +#include <svx/sdooitm.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/overlay/overlayobject.hxx> @@ -447,6 +455,7 @@ #include <svx/xlnedit.hxx> #include <svx/xlnstit.hxx> #include <svx/xlnwtit.hxx> +#include <svx/xpoly.hxx> #include <svx/xtable.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/UnitConversion.hxx> @@ -462,6 +471,7 @@ #include <tools/link.hxx> #include <tools/long.hxx> #include <tools/mapunit.hxx> +#include <tools/poly.hxx> #include <tools/ref.hxx> #include <tools/solar.h> #include <tools/stream.hxx> @@ -479,8 +489,10 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/options.hxx> +#include <unotools/resmgr.hxx> #include <unotools/saveopt.hxx> #include <unotools/streamwrap.hxx> +#include <unotools/syslocale.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/unotoolsdllapi.h> #include <unotools/useroptions.hxx> diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 55b89637c6d1..1276365d1751 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1321,7 +1321,7 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN if (pEntry->nMemberId == MID_COLOR_THEME_INDEX) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetThemeIndex() == -1) + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) { eState = PropertyState_DEFAULT_VALUE; } @@ -1329,7 +1329,13 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN else if (pEntry->nMemberId == MID_COLOR_LUM_MOD) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetLumMod() == 10000) + sal_Int16 nLumMod = 10000; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nLumMod = rTransform.mnValue; + } + if (nLumMod == 10000) { eState = PropertyState_DEFAULT_VALUE; } @@ -1337,7 +1343,13 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyN else if (pEntry->nMemberId == MID_COLOR_LUM_OFF) { const XFillColorItem* pColor = rStyleSet.GetItem<XFillColorItem>(pEntry->nWID); - if (pColor->GetThemeColor().GetLumOff() == 0) + sal_Int16 nLumOff = 0; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nLumOff = rTransform.mnValue; + } + if (nLumOff == 0) { eState = PropertyState_DEFAULT_VALUE; } diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 41f9d1e90438..f4fab7ef1b52 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -2197,7 +2197,7 @@ bool PowerPointExport::WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme { sal_Int32 nToken = aPredefinedClrTokens[static_cast<PredefinedClrSchemeId>(nId)]; pFS->startElementNS(XML_a, nToken); - svx::ThemeColorType eType = svx::convertToThemeColorType(nId); + model::ThemeColorType eType = model::convertToThemeColorType(nId); pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(static_cast<sal_Int32>(pColorSet->getColor(eType)))); pFS->endElementNS(XML_a, nToken); } diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index 25e80cfcdba3..f3ddaa47154b 100644 --- a/sd/source/ui/func/fuconstr.cxx +++ b/sd/source/ui/func/fuconstr.cxx @@ -389,10 +389,10 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj, aAttr.Put(XFillStyleItem(css::drawing::FillStyle_SOLID)); - svx::ThemeColorType eColorType = svx::ThemeColorType::Accent1; + model::ThemeColorType eColorType = model::ThemeColorType::Accent1; Color aColor = pTheme->GetColor(eColorType); XFillColorItem aFillColorItem("", aColor); - aFillColorItem.GetThemeColor().SetThemeIndex(static_cast<sal_Int16>(eColorType)); + aFillColorItem.GetThemeColor().setType(eColorType); aAttr.Put(aFillColorItem); aAttr.Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 9fe92adf409e..53ed9fabd1dd 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -822,25 +822,22 @@ void TextObjectBar::Execute( SfxRequest &rReq ) if (nSlot == SID_ATTR_CHAR_COLOR) { pColorItem = std::make_unique<SvxColorItem>(pNewArgs->Get(EE_CHAR_COLOR)); - } - const SfxPoolItem* pItem = nullptr; - if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - pColorItem->GetThemeColor().SetThemeIndex(pIntItem->GetValue()); - } - if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - pColorItem->GetThemeColor().SetLumMod(pIntItem->GetValue()); - } - if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET) - { - auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - pColorItem->GetThemeColor().SetLumOff(pIntItem->GetValue()); - } - if (pColorItem) - { + const SfxPoolItem* pItem = nullptr; + if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET) + { + auto pIntItem = static_cast<const SfxInt16Item*>(pItem); + pColorItem->GetThemeColor().setType(model::convertToThemeColorType(pIntItem->GetValue())); + } + if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET) + { + auto pIntItem = static_cast<const SfxInt16Item*>(pItem); + pColorItem->GetThemeColor().addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); + } + if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET) + { + auto pIntItem = static_cast<const SfxInt16Item*>(pItem); + pColorItem->GetThemeColor().addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); + } pNewArgs->Put(*pColorItem); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 5ca1f2d9c50a..83b8bd002812 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -601,20 +601,21 @@ public: if (pColorItem) { XFillColorItem aColorItem(*pColorItem); + aColorItem.GetThemeColor().clearTransformations(); if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetThemeIndex(pIntItem->GetValue()); + aColorItem.GetThemeColor().setType(model::convertToThemeColorType(pIntItem->GetValue())); } if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetLumMod(pIntItem->GetValue()); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, pIntItem->GetValue()}); } if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET) { auto pIntItem = static_cast<const SfxInt16Item*>(pItem); - aColorItem.GetThemeColor().SetLumOff(pIntItem->GetValue()); + aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, pIntItem->GetValue()}); } pArgs->Put(aColorItem); } diff --git a/solenv/gbuild/extensions/pre_MergedLibsList.mk b/solenv/gbuild/extensions/pre_MergedLibsList.mk index 12fd14edf522..1e135f1c31c5 100644 --- a/solenv/gbuild/extensions/pre_MergedLibsList.mk +++ b/solenv/gbuild/extensions/pre_MergedLibsList.mk @@ -29,6 +29,7 @@ MERGE_LIBRARY_LIST := \ $(if $(filter-out MACOSX WNT,$(OS)),desktopbe1) \ $(if $(USING_X11),desktop_detector) \ $(if $(filter WNT,$(OS)),directx9canvas) \ + docmodel \ drawinglayer \ editeng \ emfio \ diff --git a/solenv/qa/python/gbuildtojson.py b/solenv/qa/python/gbuildtojson.py index b54c901e9974..1a3f5b889950 100644 --- a/solenv/qa/python/gbuildtojson.py +++ b/solenv/qa/python/gbuildtojson.py @@ -124,7 +124,7 @@ class CheckGbuildToJsonModules(unittest.TestCase): shutil.rmtree(self.tempwork) def test_gbuildtojson(self): - modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'drawinglayer', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'idlc', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'onlineupdate', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'emfio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity'] + modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'docmodel', 'drawinglayer', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'idlc', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'onlineupdate', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'emfio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity'] if os.environ['OS'] == 'WNT': # for now, use a limited subset for testing on windows as it is so annoyingly slow on this modules = ['chart2', 'cui', 'dbaccess', 'framework', 'oox', 'sfx2', 'svl', 'svtools', 'svx', 'toolkit', 'vcl', 'xmloff'] diff --git a/svx/CppunitTest_svx_removewhichrange.mk b/svx/CppunitTest_svx_removewhichrange.mk index 95f958a39e5f..c5037e9988d3 100644 --- a/svx/CppunitTest_svx_removewhichrange.mk +++ b/svx/CppunitTest_svx_removewhichrange.mk @@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svx_removewhichrange, \ comphelper \ cppu \ cppuhelper \ + docmodel \ drawinglayer \ editeng \ fwk \ diff --git a/svx/CppunitTest_svx_styles.mk b/svx/CppunitTest_svx_styles.mk index f617668ad705..2235826be06e 100644 --- a/svx/CppunitTest_svx_styles.mk +++ b/svx/CppunitTest_svx_styles.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svx_styles, \ $(eval $(call gb_CppunitTest_use_libraries,svx_styles, \ comphelper \ cppu \ + docmodel \ svx \ sal \ test \ diff --git a/svx/CppunitTest_svx_unit.mk b/svx/CppunitTest_svx_unit.mk index 5595d70ea8e9..1fdb36ec927e 100644 --- a/svx/CppunitTest_svx_unit.mk +++ b/svx/CppunitTest_svx_unit.mk @@ -38,6 +38,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svx_unit, \ $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \ basegfx \ + docmodel \ drawinglayer \ editeng \ sal \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 0c3adee945c3..619ac13decbc 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -57,6 +57,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\ cppu \ $(call gb_Helper_optional,DBCONNECTIVITY, \ dbtools) \ + docmodel \ drawinglayer \ editeng \ fwk \ diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 905ebede5f2b..6e94126ed03b 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2021-04-11 19:48:23 using: + Generated on 2023-01-16 00:10:07 using: ./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -28,11 +28,15 @@ #include <climits> #include <cstddef> #include <cstdlib> +#include <deque> #include <functional> #include <iomanip> +#include <iterator> #include <limits.h> #include <map> #include <memory> +#include <mutex> +#include <numeric> #include <optional> #include <ostream> #include <set> @@ -48,10 +52,8 @@ #endif // PCH_LEVEL >= 1 #if PCH_LEVEL >= 2 #include <osl/diagnose.h> -#include <osl/doublecheckedlocking.h> #include <osl/endian.h> #include <osl/file.hxx> -#include <osl/getglobalmutex.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> #include <osl/thread.h> @@ -61,6 +63,7 @@ #include <rtl/instance.hxx> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> #include <rtl/string.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> @@ -79,6 +82,7 @@ #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/bitmapex.hxx> +#include <vcl/canvastools.hxx> #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/customweld.hxx> @@ -114,16 +118,13 @@ #if PCH_LEVEL >= 3 #include <basegfx/basegfxdllapi.h> #include <basegfx/color/bcolor.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2ipoint.hxx> #include <basegfx/point/b3dpoint.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <basegfx/range/b2irectangle.hxx> #include <basegfx/tuple/b2dtuple.hxx> -#include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b3dvector.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> @@ -216,10 +217,12 @@ #include <comphelper/broadcasthelper.hxx> #include <comphelper/comphelperdllapi.h> #include <comphelper/lok.hxx> +#include <comphelper/multicontainer2.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/string.hxx> @@ -234,16 +237,17 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/interfacecontainer.h> -#include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/propshlp.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> #include <cppuhelper/weakref.hxx> +#include <docmodel/theme/ThemeColor.hxx> #include <drawinglayer/drawinglayerdllapi.h> -#include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/Primitive2DContainer.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <editeng/borderline.hxx> #include <editeng/brushitem.hxx> #include <editeng/colritem.hxx> @@ -262,6 +266,7 @@ #include <editeng/numitem.hxx> #include <editeng/outliner.hxx> #include <editeng/outlobj.hxx> +#include <editeng/overflowingtxt.hxx> #include <editeng/paragraphdata.hxx> #include <editeng/postitem.hxx> #include <editeng/sizeitem.hxx> @@ -293,6 +298,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/dllapi.h> #include <sfx2/dockwin.hxx> +#include <sfx2/filedlghelper.hxx> #include <sfx2/module.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> @@ -309,6 +315,8 @@ #include <sot/sotdllapi.h> #include <svl/SfxBroadcaster.hxx> #include <svl/cenumitm.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <svl/eitem.hxx> #include <svl/hint.hxx> #include <svl/intitem.hxx> @@ -327,6 +335,7 @@ #include <svl/svldllapi.h> #include <svl/typedwhich.hxx> #include <svl/undo.hxx> +#include <svl/whiter.hxx> #include <svl/zforlist.hxx> #include <svtools/colorcfg.hxx> #include <svtools/ehdl.hxx> @@ -367,8 +376,8 @@ #include <unotools/accessiblestatesethelper.hxx> #include <unotools/fontcvt.hxx> #include <unotools/localedatawrapper.hxx> -#include <unotools/options.hxx> #include <unotools/pathoptions.hxx> +#include <unotools/resmgr.hxx> #include <unotools/syslocale.hxx> #include <unotools/unotoolsdllapi.h> #include <unotools/viewoptions.hxx> @@ -433,6 +442,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdtext.hxx> #include <svx/svdtrans.hxx> +#include <svx/svdtypes.hxx> #include <svx/svdview.hxx> #include <svx/svx3ditems.hxx> #include <svx/svxdlg.hxx> @@ -455,6 +465,7 @@ #include <svx/xlnclit.hxx> #include <svx/xlntrit.hxx> #include <svx/xlnwtit.hxx> +#include <svx/xpoly.hxx> #include <svx/xtable.hxx> #include <uiobject.hxx> #endif // PCH_LEVEL >= 4 diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 206f4deda6b0..7e258f7d4b4c 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -41,9 +41,9 @@ void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& xPorti { sal_Int16 nCharColorTheme = -1; xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME) >>= nCharColorTheme; - svx::ThemeColorType eColorThemeType = svx::convertToThemeColorType(nCharColorTheme); + model::ThemeColorType eColorThemeType = model::convertToThemeColorType(nCharColorTheme); - if (eColorThemeType == svx::ThemeColorType::Unknown) + if (eColorThemeType == model::ThemeColorType::Unknown) return; Color aColor = rColorSet.getColor(eColorThemeType); @@ -76,8 +76,8 @@ void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, svx:: sal_Int16 nFillColorTheme = -1; xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME) >>= nFillColorTheme; - svx::ThemeColorType eColorThemeType = svx::convertToThemeColorType(nFillColorTheme); - if (eColorThemeType == svx::ThemeColorType::Unknown) + model::ThemeColorType eColorThemeType = model::convertToThemeColorType(nFillColorTheme); + if (eColorThemeType == model::ThemeColorType::Unknown) return; Color aColor = rColorSet.getColor(eColorThemeType); @@ -283,7 +283,7 @@ void Theme::ToAny(css::uno::Any& rVal) const if (mpColorSet) { std::vector<util::Color> aColorScheme; - for (auto eThemeColorType : o3tl::enumrange<svx::ThemeColorType>()) + for (auto eThemeColorType : o3tl::enumrange<model::ThemeColorType>()) { Color aColor = mpColorSet->getColor(eThemeColorType); aColorScheme.push_back(sal_Int32(aColor)); @@ -364,14 +364,14 @@ std::vector<Color> Theme::GetColors() const return {}; std::vector<Color> aColors; - for (auto eThemeColorType : o3tl::enumrange<svx::ThemeColorType>()) + for (auto eThemeColorType : o3tl::enumrange<model::ThemeColorType>()) { aColors.push_back(mpColorSet->getColor(eThemeColorType)); } return aColors; } -Color Theme::GetColor(ThemeColorType eType) const +Color Theme::GetColor(model::ThemeColorType eType) const { if (!mpColorSet) return {}; diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index a156174f56d6..99f53a7c127f 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1444,10 +1444,11 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) } break; case XATTR_FILLCOLOR: + if (pMap->nMemberId == MID_COLOR_THEME_INDEX) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetThemeIndex() == -1) + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) { eState = PropertyState_DEFAULT_VALUE; } @@ -1455,7 +1456,13 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) else if (pMap->nMemberId == MID_COLOR_LUM_MOD) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetLumMod() == 10000) + sal_Int16 nLumMod = 10000; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nLumMod = rTransform.mnValue; + } + if (nLumMod == 10000) { eState = PropertyState_DEFAULT_VALUE; } @@ -1463,7 +1470,13 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) else if (pMap->nMemberId == MID_COLOR_LUM_OFF) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetLumOff() == 0) + sal_Int16 nLumOff = 0; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nLumOff = rTransform.mnValue; + } + if (nLumOff == 0) { eState = PropertyState_DEFAULT_VALUE; } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 4d7e00b42cdc..128785341c6d 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2044,7 +2044,7 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) if (pMap->nMemberId == MID_COLOR_THEME_INDEX) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetThemeIndex() == -1) + if (pColor->GetThemeColor().getType() == model::ThemeColorType::Unknown) { eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2052,7 +2052,13 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) else if (pMap->nMemberId == MID_COLOR_LUM_MOD) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetLumMod() == 10000) + sal_Int16 nLumMod = 10000; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nLumMod = rTransform.mnValue; + } + if (nLumMod == 10000) { eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2060,7 +2066,13 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) else if (pMap->nMemberId == MID_COLOR_LUM_OFF) { const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID); - if (pColor->GetThemeColor().GetLumOff() == 0) + sal_Int16 nLumOff = 0; + for (auto const& rTransform : pColor->GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nLumOff = rTransform.mnValue; + } + if (nLumOff == 0) { eState = beans::PropertyState_DEFAULT_VALUE; } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 9b4227ae458d..ebecbbbd41ef 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -334,7 +334,22 @@ void XColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const NameOrIndex::dumpAsXml(pWriter); - maThemeColor.dumpAsXml(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("theme-color")); + + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("theme-index"), + BAD_CAST(OString::number(sal_Int16(maThemeColor.getType())).getStr())); + + for (auto const& rTransform : maThemeColor.getTransformations()) + { + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("transformation")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), + BAD_CAST(OString::number(sal_Int16(rTransform.meType)).getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::number(rTransform.mnValue).getStr())); + (void)xmlTextWriterEndElement(pWriter); + } + + (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterEndElement(pWriter); } @@ -1907,17 +1922,29 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons { case MID_COLOR_THEME_INDEX: { - rVal <<= GetThemeColor().GetThemeIndex(); + rVal <<= sal_Int16(GetThemeColor().getType()); break; } case MID_COLOR_LUM_MOD: { - rVal <<= GetThemeColor().GetLumMod(); + sal_Int16 nValue = 10000; + for (auto const& rTransform : GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumMod) + nValue = rTransform.mnValue; + } + rVal <<= nValue; break; } case MID_COLOR_LUM_OFF: { - rVal <<= GetThemeColor().GetLumOff(); + sal_Int16 nValue = 0; + for (auto const& rTransform : GetThemeColor().getTransformations()) + { + if (rTransform.meType == model::TransformationType::LumOff) + nValue = rTransform.mnValue; + } + rVal <<= nValue; break; } default: @@ -1940,23 +1967,25 @@ bool XFillColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nIndex = -1; if (!(rVal >>= nIndex)) return false; - GetThemeColor().SetThemeIndex(nIndex); + GetThemeColor().setType(model::convertToThemeColorType(nIndex)); break; } case MID_COLOR_LUM_MOD: { - sal_Int16 nLumMod = -1; + sal_Int16 nLumMod = 10000; if (!(rVal >>= nLumMod)) return false; - GetThemeColor().SetLumMod(nLumMod); + GetThemeColor().removeTransformations(model::TransformationType::LumMod); + GetThemeColor().addTransformation({model::TransformationType::LumMod, nLumMod}); } break; case MID_COLOR_LUM_OFF: { - sal_Int16 nLumOff = -1; + sal_Int16 nLumOff = 0; if (!(rVal >>= nLumOff)) return false; - GetThemeColor().SetLumOff(nLumOff); + GetThemeColor().removeTransformations(model::TransformationType::LumOff); + GetThemeColor().addTransformation({model::TransformationType::LumOff, nLumOff}); } break; default: 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 7e38fbce1386..b1b32169514e 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 \ svxcore \ 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 805242613b58..a3024928e021 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 f4273f909e18..116520dc0c87 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 \ test \ diff --git a/sw/CppunitTest_sw_ooxmlimport2.mk b/sw/CppunitTest_sw_ooxmlimport2.mk index 67c4077fcecd..5a67cab8f901 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 \ test \ diff --git a/sw/CppunitTest_sw_tiledrendering.mk b/sw/CppunitTest_sw_tiledrendering.mk index 8697cbf11209..1508770ddb7d 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 \ svl \ diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk index aad626119569..5cef990520e3 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 \ editeng \ i18nlangtag \ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 52f2d55bf64a..999c2e7a0419 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 \ drawinglayer \ editeng \ i18nlangtag \ diff --git a/sw/layoutwriter_setup.mk b/sw/layoutwriter_setup.mk index 0fb848f106de..9b249678ff44 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 404ee5153438..8c17689b9077 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 0d3816e9a623..63291150d80d 100644 --- a/sw/qa/core/theme/ThemeTest.cxx +++ b/sw/qa/core/theme/ThemeTest.cxx @@ -45,16 +45,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 2f5793b8073c..e6a7f339cc2c 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -222,11 +222,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); } @@ -398,10 +399,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 a4def8e80120..88571a9640e3 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 f2fdd0a5aa9c..6df79b02011d 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 \ |