Skip to content

Commit bd0f526

Browse files
committed
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 <[email protected]>
1 parent c945eaf commit bd0f526

File tree

70 files changed

+883
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+883
-277
lines changed

Repository.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
401401
deploymentmisc \
402402
$(if $(filter-out MACOSX WNT,$(OS)),desktopbe1) \
403403
$(call gb_Helper_optional,SCRIPTING,dlgprov) \
404+
docmodel \
404405
drawinglayercore \
405406
drawinglayer \
406407
editeng \

RepositoryModule_build.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
6363
configmgr \
6464
connectivity \
6565
cppcanvas \
66+
docmodel \
6667
drawinglayer \
6768
editeng \
6869
emfio \

RepositoryModule_host.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
7474
cui \
7575
desktop \
7676
$(call gb_Helper_optional,DICTIONARIES,dictionaries) \
77+
docmodel\
7778
drawinglayer \
7879
editeng \
7980
embeddedobj \

bin/update_pch

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ DEFAULTS = \
7373
'desktop.deploymentgui' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 5.7
7474
'desktop.deploymentmisc' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 3.4
7575
'desktop.sofficeapp' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 6.5
76+
'docmodel.docmodel' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 3.8
7677
'drawinglayer.drawinglayer' : ( 4, EXCLUDE, EXCLUDE, EXCLUDE), # 7.4
7778
'editeng.editeng' : ( 5, EXCLUDE, INCLUDE, EXCLUDE), # 13.0
7879
'forms.frm' : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), # 14.2
@@ -1191,8 +1192,8 @@ class TestMakefileParser(unittest.TestCase):
11911192

11921193
def test_parse_multiline_eval(self):
11931194
source = """$(eval $(call gb_Library_set_include,sal,\\
1194-
$$(INCLUDE) \\
1195-
-I$(SRCDIR)/sal/inc \\
1195+
$$(INCLUDE) \\
1196+
-I$(SRCDIR)/sal/inc \\
11961197
))
11971198
"""
11981199
lines = source.split('\n')
@@ -1203,9 +1204,9 @@ class TestMakefileParser(unittest.TestCase):
12031204

12041205
def test_parse_multiline_eval_with_if(self):
12051206
source = """$(eval $(call gb_Library_add_defs,sal,\\
1206-
$(if $(filter $(OS),iOS), \\
1207-
-DNO_CHILD_PROCESSES \\
1208-
) \\
1207+
$(if $(filter $(OS),iOS), \\
1208+
-DNO_CHILD_PROCESSES \\
1209+
) \\
12091210
))
12101211
"""
12111212
lines = source.split('\n')
@@ -1216,7 +1217,7 @@ class TestMakefileParser(unittest.TestCase):
12161217

12171218
def test_parse_multiline_add_with_if(self):
12181219
source = """$(eval $(call gb_Library_add_exception_objects,sal,\\
1219-
sal/osl/unx/time \\
1220+
sal/osl/unx/time \\
12201221
$(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \\
12211222
))
12221223
"""
@@ -1230,11 +1231,11 @@ class TestMakefileParser(unittest.TestCase):
12301231
def test_parse_if_else(self):
12311232
source = """ifeq ($(OS),MACOSX)
12321233
$(eval $(call gb_Library_add_exception_objects,sal,\\
1233-
sal/osl/mac/mac \\
1234+
sal/osl/mac/mac \\
12341235
))
12351236
else
12361237
$(eval $(call gb_Library_add_exception_objects,sal,\\
1237-
sal/osl/unx/uunxapi \\
1238+
sal/osl/unx/uunxapi \\
12381239
))
12391240
endif
12401241
"""
@@ -1251,16 +1252,16 @@ endif
12511252
def test_parse_nested_if(self):
12521253
source = """ifeq ($(OS),MACOSX)
12531254
$(eval $(call gb_Library_add_exception_objects,sal,\\
1254-
sal/osl/mac/mac \\
1255+
sal/osl/mac/mac \\
12551256
))
12561257
else
12571258
$(eval $(call gb_Library_add_exception_objects,sal,\\
1258-
sal/osl/unx/uunxapi \\
1259+
sal/osl/unx/uunxapi \\
12591260
))
12601261
12611262
ifeq ($(OS),LINUX)
12621263
$(eval $(call gb_Library_add_exception_objects,sal,\\
1263-
sal/textenc/context \\
1264+
sal/textenc/context \\
12641265
))
12651266
endif
12661267
endif
@@ -1280,16 +1281,16 @@ endif
12801281
def test_parse_exclude_system(self):
12811282
source = """ifeq ($(OS),MACOSX)
12821283
$(eval $(call gb_Library_add_exception_objects,sal,\\
1283-
sal/osl/mac/mac \\
1284+
sal/osl/mac/mac \\
12841285
))
12851286
else
12861287
$(eval $(call gb_Library_add_exception_objects,sal,\\
1287-
sal/osl/unx/uunxapi \\
1288+
sal/osl/unx/uunxapi \\
12881289
))
12891290
12901291
ifeq ($(OS),LINUX)
12911292
$(eval $(call gb_Library_add_exception_objects,sal,\\
1292-
sal/textenc/context \\
1293+
sal/textenc/context \\
12931294
))
12941295
endif
12951296
endif
@@ -1306,7 +1307,7 @@ endif
13061307
def test_parse_filter(self):
13071308
source = """ifneq ($(filter $(OS),MACOSX iOS),)
13081309
$(eval $(call gb_Library_add_exception_objects,sal,\\
1309-
sal/osl/unx/osxlocale \\
1310+
sal/osl/unx/osxlocale \\
13101311
))
13111312
endif
13121313
"""

cui/Library_cui.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,cui,\
3838
comphelper \
3939
cppu \
4040
cppuhelper \
41+
docmodel \
4142
drawinglayer \
4243
editeng \
4344
i18nlangtag \

cui/inc/pch/precompiled_cui.hxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
manual changes will be rewritten by the next run of update_pch.sh (which presumably
1414
also fixes all possible problems, so it's usually better to use it).
1515
16-
Generated on 2022-08-13 18:00:55 using:
16+
Generated on 2023-01-10 23:29:57 using:
1717
./bin/update_pch cui cui --cutoff=8 --exclude:system --include:module --exclude:local
1818
1919
If after updating build fails, use the following command to locate conflicting headers:
@@ -53,6 +53,7 @@
5353
#include <string>
5454
#include <string_view>
5555
#include <type_traits>
56+
#include <typeinfo>
5657
#include <unordered_map>
5758
#include <unordered_set>
5859
#include <utility>
@@ -114,7 +115,6 @@
114115
#include <vcl/customweld.hxx>
115116
#include <vcl/devicecoordinate.hxx>
116117
#include <vcl/dllapi.h>
117-
#include <comphelper/errcode.hxx>
118118
#include <vcl/event.hxx>
119119
#include <vcl/fntstyle.hxx>
120120
#include <vcl/font.hxx>
@@ -125,6 +125,7 @@
125125
#include <vcl/image.hxx>
126126
#include <vcl/imap.hxx>
127127
#include <vcl/imapobj.hxx>
128+
#include <vcl/kernarray.hxx>
128129
#include <vcl/keycod.hxx>
129130
#include <vcl/keycodes.hxx>
130131
#include <vcl/mapmod.hxx>
@@ -177,6 +178,7 @@
177178
#include <basegfx/range/b2drange.hxx>
178179
#include <basegfx/range/b2drectangle.hxx>
179180
#include <basegfx/range/basicrange.hxx>
181+
#include <basegfx/tuple/Size2D.hxx>
180182
#include <basegfx/tuple/Tuple2D.hxx>
181183
#include <basegfx/tuple/Tuple3D.hxx>
182184
#include <basegfx/tuple/b2dtuple.hxx>
@@ -186,6 +188,7 @@
186188
#include <basegfx/vector/b2dsize.hxx>
187189
#include <basegfx/vector/b2dvector.hxx>
188190
#include <basegfx/vector/b2enums.hxx>
191+
#include <basegfx/vector/b2isize.hxx>
189192
#include <basegfx/vector/b2ivector.hxx>
190193
#include <basic/basicdllapi.h>
191194
#include <basic/sbxdef.hxx>
@@ -261,6 +264,8 @@
261264
#include <com/sun/star/util/XAccounting.hpp>
262265
#include <comphelper/compbase.hxx>
263266
#include <comphelper/comphelperdllapi.h>
267+
#include <comphelper/diagnose_ex.hxx>
268+
#include <comphelper/errcode.hxx>
264269
#include <comphelper/interfacecontainer4.hxx>
265270
#include <comphelper/lok.hxx>
266271
#include <comphelper/processfactory.hxx>
@@ -276,6 +281,7 @@
276281
#include <cppuhelper/queryinterface.hxx>
277282
#include <cppuhelper/weak.hxx>
278283
#include <cppuhelper/weakref.hxx>
284+
#include <docmodel/theme/ThemeColorType.hxx>
279285
#include <drawinglayer/drawinglayerdllapi.h>
280286
#include <drawinglayer/geometry/viewinformation2d.hxx>
281287
#include <drawinglayer/primitive2d/CommonTypes.hxx>
@@ -297,6 +303,7 @@
297303
#include <editeng/svxfont.hxx>
298304
#include <i18nlangtag/lang.h>
299305
#include <i18nlangtag/languagetag.hxx>
306+
#include <i18nutil/i18nutildllapi.h>
300307
#include <i18nutil/searchopt.hxx>
301308
#include <i18nutil/transliteration.hxx>
302309
#include <o3tl/cow_wrapper.hxx>
@@ -401,7 +408,6 @@
401408
#include <tools/datetime.hxx>
402409
#include <tools/debug.hxx>
403410
#include <tools/degree.hxx>
404-
#include <comphelper/diagnose_ex.hxx>
405411
#include <tools/fldunit.hxx>
406412
#include <tools/fontenum.hxx>
407413
#include <tools/fract.hxx>
@@ -420,7 +426,6 @@
420426
#include <tools/toolsdllapi.h>
421427
#include <tools/urlobj.hxx>
422428
#include <tools/weakbase.h>
423-
#include <tools/weakbase.hxx>
424429
#include <typelib/typeclass.h>
425430
#include <typelib/typedescription.h>
426431
#include <typelib/uik.h>
@@ -434,6 +439,7 @@
434439
#include <unotools/resmgr.hxx>
435440
#include <unotools/syslocale.hxx>
436441
#include <unotools/unotoolsdllapi.h>
442+
#include <unotools/weakref.hxx>
437443
#endif // PCH_LEVEL >= 3
438444
#if PCH_LEVEL >= 4
439445
#include <cfgutil.hxx>

cui/source/tabpages/chardlg.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,12 +1596,14 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
15961596
{
15971597
SvxColorItem aItem( aSelectedColor.m_aColor, nWhich );
15981598

1599-
if (aSelectedColor.m_nThemeIndex != -1)
1599+
// The color was picked from the theme palette, remember its index.
1600+
model::ThemeColorType eType = model::convertToThemeColorType(aSelectedColor.m_nThemeIndex);
1601+
if (eType != model::ThemeColorType::Unknown)
16001602
{
1601-
// The color was picked from the theme palette, remember its index.
1602-
aItem.GetThemeColor().SetThemeIndex(aSelectedColor.m_nThemeIndex);
1603-
aItem.GetThemeColor().SetLumMod(aSelectedColor.m_nLumMod);
1604-
aItem.GetThemeColor().SetLumOff(aSelectedColor.m_nLumOff);
1603+
aItem.GetThemeColor().setType(eType);
1604+
aItem.GetThemeColor().clearTransformations();
1605+
aItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, aSelectedColor.m_nLumMod});
1606+
aItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, aSelectedColor.m_nLumOff});
16051607
}
16061608

16071609
rSet.Put(aItem);

cui/source/tabpages/tpcolor.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,19 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet )
245245
sColorName = "#" + aCurrentColor.m_aColor.AsRGBHexString().toAsciiUpperCase();
246246
maPaletteManager.AddRecentColor( aCurrentColor.m_aColor, sColorName );
247247
XFillColorItem aColorItem( sColorName, aCurrentColor.m_aColor );
248-
if (aCurrentColor.m_nThemeIndex != -1)
248+
model::ThemeColorType eType = model::convertToThemeColorType(aCurrentColor.m_nThemeIndex);
249+
if (eType != model::ThemeColorType::Unknown)
249250
{
250-
aColorItem.GetThemeColor().SetThemeIndex(aCurrentColor.m_nThemeIndex);
251+
aColorItem.GetThemeColor().setType(eType);
251252
}
253+
aColorItem.GetThemeColor().clearTransformations();
252254
if (aCurrentColor.m_nLumMod != 10000)
253255
{
254-
aColorItem.GetThemeColor().SetLumMod(aCurrentColor.m_nLumMod);
256+
aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, aCurrentColor.m_nLumMod});
255257
}
256258
if (aCurrentColor.m_nLumOff != 0)
257259
{
258-
aColorItem.GetThemeColor().SetLumOff(aCurrentColor.m_nLumOff);
260+
aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, aCurrentColor.m_nLumOff});
259261
}
260262
rSet->Put( aColorItem );
261263
rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) );

docmodel/Library_docmodel.mk

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
2+
#
3+
# This file is part of the LibreOffice project.
4+
#
5+
# This Source Code Form is subject to the terms of the Mozilla Public
6+
# License, v. 2.0. If a copy of the MPL was not distributed with this
7+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8+
#
9+
10+
$(eval $(call gb_Library_Library,docmodel))
11+
12+
$(eval $(call gb_Library_add_exception_objects,docmodel,\
13+
docmodel/source/uno/UnoThemeColor \
14+
))
15+
16+
$(eval $(call gb_Library_set_include,docmodel,\
17+
$$(INCLUDE) \
18+
-I$(SRCDIR)/docmodel/inc \
19+
))
20+
21+
$(eval $(call gb_Library_add_defs,docmodel,\
22+
-DDOCMODEL_DLLIMPLEMENTATION \
23+
))
24+
25+
$(eval $(call gb_Library_set_precompiled_header,docmodel,docmodel/inc/pch/precompiled_docmodel))
26+
27+
$(eval $(call gb_Library_use_sdk_api,docmodel))
28+
29+
$(eval $(call gb_Library_use_libraries,docmodel,\
30+
basegfx \
31+
comphelper \
32+
cppuhelper \
33+
cppu \
34+
sal \
35+
vcl \
36+
tl \
37+
))
38+
39+
# vim: set noet sw=4 ts=4:

docmodel/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2+
3+
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
4+
5+
include $(module_directory)/../solenv/gbuild/partial_build.mk
6+
7+
# vim: set noet sw=4 ts=4:

docmodel/Module_docmodel.mk

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2+
#
3+
# This file is part of the LibreOffice project.
4+
#
5+
# This Source Code Form is subject to the terms of the Mozilla Public
6+
# License, v. 2.0. If a copy of the MPL was not distributed with this
7+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8+
#
9+
10+
$(eval $(call gb_Module_Module,docmodel))
11+
12+
$(eval $(call gb_Module_add_targets,docmodel,\
13+
Library_docmodel \
14+
))
15+
16+
17+
18+
# vim: set noet sw=4 ts=4:

docmodel/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Document Model Types and Objects
2+
3+
Contains document model types, that don't require many depenencies except
4+
basic types found in basegfx and tools. The purpose of this types and
5+
objects is to be available in all common components.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2+
/*
3+
* This file is part of the LibreOffice project.
4+
*
5+
* This Source Code Form is subject to the terms of the Mozilla Public
6+
* License, v. 2.0. If a copy of the MPL was not distributed with this
7+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
8+
*/
9+
10+
#include "precompiled_docmodel.hxx"
11+
12+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2+
/*
3+
* This file is part of the LibreOffice project.
4+
*
5+
* This Source Code Form is subject to the terms of the Mozilla Public
6+
* License, v. 2.0. If a copy of the MPL was not distributed with this
7+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
8+
*/
9+
10+
/*
11+
This file has been autogenerated by update_pch.sh. It is possible to edit it
12+
manually (such as when an include file has been moved/renamed/removed). All such
13+
manual changes will be rewritten by the next run of update_pch.sh (which presumably
14+
also fixes all possible problems, so it's usually better to use it).
15+
16+
Generated on 2023-01-10 23:20:14 using:
17+
bin/update_pch docmodel docmodel --cutoff=3 --exclude:system --exclude:module --include:local
18+
19+
If after updating build fails, use the following command to locate conflicting headers:
20+
./bin/update_pch_bisect ./docmodel/inc/pch/precompiled_docmodel.hxx "make docmodel.build" --find-conflicts
21+
*/
22+
23+
#include <sal/config.h>
24+
#if PCH_LEVEL >= 1
25+
#endif // PCH_LEVEL >= 1
26+
#if PCH_LEVEL >= 2
27+
#include <sal/types.h>
28+
#endif // PCH_LEVEL >= 2
29+
#if PCH_LEVEL >= 3
30+
#endif // PCH_LEVEL >= 3
31+
#if PCH_LEVEL >= 4
32+
#endif // PCH_LEVEL >= 4
33+
34+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

0 commit comments

Comments
 (0)