LibreOffice Module oox (master)  1
predefined-table-styles.cxx
Go to the documentation of this file.
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 #include <oox/token/tokens.hxx>
11 
12 using namespace oox;
13 using namespace oox::drawingml::table;
14 
15 /* tdf#107604
16  * There are predefined table styles that have a
17  * style id (in ppt/slides/slidex.xml) but does not have
18  * corresponding style definition (ppt/tableStyles.xml).
19  * So we should create those styles here for this case.
20  * There are 74 predefined styles and many different
21  * variables. A style map was created by examining all
22  * 74 style properties. And table styles were coded according
23  * to that map. You can see that map in
24  * oox/documentation/predefined-styles-map.ods. We should
25  * define all of these variables to keep the code readable
26  * and change something easily when some styles change.
27  */
28 
29 std::map<OUString, std::pair<OUString, OUString>> mStyleIdMap;
30 
31 // Create style-id map for using similar attributes of the groups.
32 // (style ids used from here: https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/hh273476(v=office.14)?redirectedfrom=MSDN)
33 // and checked all of them.
34 
35 static void createStyleIdMap()
36 {
37  mStyleIdMap[OUString("{2D5ABB26-0587-4C30-8999-92F81FD0307C}")]
38  = std::make_pair(OUString("Themed-Style-1"), OUString(""));
39  mStyleIdMap[OUString("{3C2FFA5D-87B4-456A-9821-1D502468CF0F}")]
40  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent1"));
41  mStyleIdMap[OUString("{284E427A-3D55-4303-BF80-6455036E1DE7}")]
42  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent2"));
43  mStyleIdMap[OUString("{69C7853C-536D-4A76-A0AE-DD22124D55A5}")]
44  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent3"));
45  mStyleIdMap[OUString("{775DCB02-9BB8-47FD-8907-85C794F793BA}")]
46  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent4"));
47  mStyleIdMap[OUString("{35758FB7-9AC5-4552-8A53-C91805E547FA}")]
48  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent5"));
49  mStyleIdMap[OUString("{08FB837D-C827-4EFA-A057-4D05807E0F7C}")]
50  = std::make_pair(OUString("Themed-Style-1"), OUString("Accent6"));
51 
52  mStyleIdMap[OUString("{5940675A-B579-460E-94D1-54222C63F5DA}")]
53  = std::make_pair(OUString("Themed-Style-2"), OUString(""));
54  mStyleIdMap[OUString("{D113A9D2-9D6B-4929-AA2D-F23B5EE8CBE7}")]
55  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent1"));
56  mStyleIdMap[OUString("{18603FDC-E32A-4AB5-989C-0864C3EAD2B8}")]
57  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent2"));
58  mStyleIdMap[OUString("{306799F8-075E-4A3A-A7F6-7FBC6576F1A4}")]
59  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent3"));
60  mStyleIdMap[OUString("{E269D01E-BC32-4049-B463-5C60D7B0CCD2}")]
61  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent4"));
62  mStyleIdMap[OUString("{327F97BB-C833-4FB7-BDE5-3F7075034690}")]
63  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent5"));
64  mStyleIdMap[OUString("{638B1855-1B75-4FBE-930C-398BA8C253C6}")]
65  = std::make_pair(OUString("Themed-Style-2"), OUString("Accent6"));
66 
67  mStyleIdMap[OUString("{9D7B26C5-4107-4FEC-AEDC-1716B250A1EF}")]
68  = std::make_pair(OUString("Light-Style-1"), OUString(""));
69  mStyleIdMap[OUString("{3B4B98B0-60AC-42C2-AFA5-B58CD77FA1E5}")]
70  = std::make_pair(OUString("Light-Style-1"), OUString("Accent1"));
71  mStyleIdMap[OUString("{0E3FDE45-AF77-4B5C-9715-49D594BDF05E}")]
72  = std::make_pair(OUString("Light-Style-1"), OUString("Accent2"));
73  mStyleIdMap[OUString("{C083E6E3-FA7D-4D7B-A595-EF9225AFEA82}")]
74  = std::make_pair(OUString("Light-Style-1"), OUString("Accent3"));
75  mStyleIdMap[OUString("{D27102A9-8310-4765-A935-A1911B00CA55}")]
76  = std::make_pair(OUString("Light-Style-1"), OUString("Accent4"));
77  mStyleIdMap[OUString("{5FD0F851-EC5A-4D38-B0AD-8093EC10F338}")]
78  = std::make_pair(OUString("Light-Style-1"), OUString("Accent5"));
79  mStyleIdMap[OUString("{68D230F3-CF80-4859-8CE7-A43EE81993B5}")]
80  = std::make_pair(OUString("Light-Style-1"), OUString("Accent6"));
81 
82  mStyleIdMap[OUString("{7E9639D4-E3E2-4D34-9284-5A2195B3D0D7}")]
83  = std::make_pair(OUString("Light-Style-2"), OUString(""));
84  mStyleIdMap[OUString("{69012ECD-51FC-41F1-AA8D-1B2483CD663E}")]
85  = std::make_pair(OUString("Light-Style-2"), OUString("Accent1"));
86  mStyleIdMap[OUString("{72833802-FEF1-4C79-8D5D-14CF1EAF98D9}")]
87  = std::make_pair(OUString("Light-Style-2"), OUString("Accent2"));
88  mStyleIdMap[OUString("{F2DE63D5-997A-4646-A377-4702673A728D}")]
89  = std::make_pair(OUString("Light-Style-2"), OUString("Accent3"));
90  mStyleIdMap[OUString("{17292A2E-F333-43FB-9621-5CBBE7FDCDCB}")]
91  = std::make_pair(OUString("Light-Style-2"), OUString("Accent4"));
92  mStyleIdMap[OUString("{5A111915-BE36-4E01-A7E5-04B1672EAD32}")]
93  = std::make_pair(OUString("Light-Style-2"), OUString("Accent5"));
94  mStyleIdMap[OUString("{912C8C85-51F0-491E-9774-3900AFEF0FD7}")]
95  = std::make_pair(OUString("Light-Style-2"), OUString("Accent6"));
96 
97  mStyleIdMap[OUString("{616DA210-FB5B-4158-B5E0-FEB733F419BA}")]
98  = std::make_pair(OUString("Light-Style-3"), OUString(""));
99  mStyleIdMap[OUString("{BC89EF96-8CEA-46FF-86C4-4CE0E7609802}")]
100  = std::make_pair(OUString("Light-Style-3"), OUString("Accent1"));
101  mStyleIdMap[OUString("{5DA37D80-6434-44D0-A028-1B22A696006F}")]
102  = std::make_pair(OUString("Light-Style-3"), OUString("Accent2"));
103  mStyleIdMap[OUString("{8799B23B-EC83-4686-B30A-512413B5E67A}")]
104  = std::make_pair(OUString("Light-Style-3"), OUString("Accent3"));
105  mStyleIdMap[OUString("{ED083AE6-46FA-4A59-8FB0-9F97EB10719F}")]
106  = std::make_pair(OUString("Light-Style-3"), OUString("Accent4"));
107  mStyleIdMap[OUString("{BDBED569-4797-4DF1-A0F4-6AAB3CD982D8}")]
108  = std::make_pair(OUString("Light-Style-3"), OUString("Accent5"));
109  mStyleIdMap[OUString("{E8B1032C-EA38-4F05-BA0D-38AFFFC7BED3}")]
110  = std::make_pair(OUString("Light-Style-3"), OUString("Accent6"));
111 
112  mStyleIdMap[OUString("{793D81CF-94F2-401A-BA57-92F5A7B2D0C5}")]
113  = std::make_pair(OUString("Medium-Style-1"), OUString(""));
114  mStyleIdMap[OUString("{B301B821-A1FF-4177-AEE7-76D212191A09}")]
115  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent1"));
116  mStyleIdMap[OUString("{9DCAF9ED-07DC-4A11-8D7F-57B35C25682E}")]
117  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent2"));
118  mStyleIdMap[OUString("{1FECB4D8-DB02-4DC6-A0A2-4F2EBAE1DC90}")]
119  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent3"));
120  mStyleIdMap[OUString("{1E171933-4619-4E11-9A3F-F7608DF75F80}")]
121  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent4"));
122  mStyleIdMap[OUString("{FABFCF23-3B69-468F-B69F-88F6DE6A72F2}")]
123  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent5"));
124  mStyleIdMap[OUString("{10A1B5D5-9B99-4C35-A422-299274C87663}")]
125  = std::make_pair(OUString("Medium-Style-1"), OUString("Accent6"));
126 
127  mStyleIdMap[OUString("{073A0DAA-6AF3-43AB-8588-CEC1D06C72B9}")]
128  = std::make_pair(OUString("Medium-Style-2"), OUString(""));
129  mStyleIdMap[OUString("{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}")]
130  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent1"));
131  mStyleIdMap[OUString("{21E4AEA4-8DFA-4A89-87EB-49C32662AFE0}")]
132  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent2"));
133  mStyleIdMap[OUString("{F5AB1C69-6EDB-4FF4-983F-18BD219EF322}")]
134  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent3"));
135  mStyleIdMap[OUString("{00A15C55-8517-42AA-B614-E9B94910E393}")]
136  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent4"));
137  mStyleIdMap[OUString("{7DF18680-E054-41AD-8BC1-D1AEF772440D}")]
138  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent5"));
139  mStyleIdMap[OUString("{93296810-A885-4BE3-A3E7-6D5BEEA58F35}")]
140  = std::make_pair(OUString("Medium-Style-2"), OUString("Accent6"));
141 
142  mStyleIdMap[OUString("{8EC20E35-A176-4012-BC5E-935CFFF8708E}")]
143  = std::make_pair(OUString("Medium-Style-3"), OUString(""));
144  mStyleIdMap[OUString("{6E25E649-3F16-4E02-A733-19D2CDBF48F0}")]
145  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent1"));
146  mStyleIdMap[OUString("{85BE263C-DBD7-4A20-BB59-AAB30ACAA65A}")]
147  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent2"));
148  mStyleIdMap[OUString("{EB344D84-9AFB-497E-A393-DC336BA19D2E}")]
149  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent3"));
150  mStyleIdMap[OUString("{EB9631B5-78F2-41C9-869B-9F39066F8104}")]
151  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent4"));
152  mStyleIdMap[OUString("{74C1A8A3-306A-4EB7-A6B1-4F7E0EB9C5D6}")]
153  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent5"));
154  mStyleIdMap[OUString("{2A488322-F2BA-4B5B-9748-0D474271808F}")]
155  = std::make_pair(OUString("Medium-Style-3"), OUString("Accent6"));
156 
157  mStyleIdMap[OUString("{D7AC3CCA-C797-4891-BE02-D94E43425B78}")]
158  = std::make_pair(OUString("Medium-Style-4"), OUString(""));
159  mStyleIdMap[OUString("{69CF1AB2-1976-4502-BF36-3FF5EA218861}")]
160  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent1"));
161  mStyleIdMap[OUString("{8A107856-5554-42FB-B03E-39F5DBC370BA}")]
162  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent2"));
163  mStyleIdMap[OUString("{0505E3EF-67EA-436B-97B2-0124C06EBD24}")]
164  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent3"));
165  mStyleIdMap[OUString("{C4B1156A-380E-4F78-BDF5-A606A8083BF9}")]
166  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent4"));
167  mStyleIdMap[OUString("{22838BEF-8BB2-4498-84A7-C5851F593DF1}")]
168  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent5"));
169  mStyleIdMap[OUString("{16D9F66E-5EB9-4882-86FB-DCBF35E3C3E4}")]
170  = std::make_pair(OUString("Medium-Style-4"), OUString("Accent6"));
171 
172  mStyleIdMap[OUString("{E8034E78-7F5D-4C2E-B375-FC64B27BC917}")]
173  = std::make_pair(OUString("Dark-Style-1"), OUString(""));
174  mStyleIdMap[OUString("{125E5076-3810-47DD-B79F-674D7AD40C01}")]
175  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent1"));
176  mStyleIdMap[OUString("{37CE84F3-28C3-443E-9E96-99CF82512B78}")]
177  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent2"));
178  mStyleIdMap[OUString("{D03447BB-5D67-496B-8E87-E561075AD55C}")]
179  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent3"));
180  mStyleIdMap[OUString("{E929F9F4-4A8F-4326-A1B4-22849713DDAB}")]
181  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent4"));
182  mStyleIdMap[OUString("{8FD4443E-F989-4FC4-A0C8-D5A2AF1F390B}")]
183  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent5"));
184  mStyleIdMap[OUString("{AF606853-7671-496A-8E4F-DF71F8EC918B}")]
185  = std::make_pair(OUString("Dark-Style-1"), OUString("Accent6"));
186 
187  mStyleIdMap[OUString("{5202B0CA-FC54-4496-8BCA-5EF66A818D29}")]
188  = std::make_pair(OUString("Dark-Style-2"), OUString(""));
189  mStyleIdMap[OUString("{0660B408-B3CF-4A94-85FC-2B1E0A45F4A2}")]
190  = std::make_pair(OUString("Dark-Style-2"), OUString("Accent1"));
191  mStyleIdMap[OUString("{91EBBBCC-DAD2-459C-BE2E-F6DE35CF9A28}")]
192  = std::make_pair(OUString("Dark-Style-2"), OUString("Accent3"));
193  mStyleIdMap[OUString("{46F890A9-2807-4EBB-B81D-B2AA78EC7F39}")]
194  = std::make_pair(OUString("Dark-Style-2"), OUString("Accent5"));
195 }
196 
197 static std::map<OUString, sal_Int32> tokens = { { "", XML_dk1 },
198  { "Accent1", XML_accent1 },
199  { "Accent2", XML_accent2 },
200  { "Accent3", XML_accent3 },
201  { "Accent4", XML_accent4 },
202  { "Accent5", XML_accent5 },
203  { "Accent6", XML_accent6 } };
204 
205 void setBorderLineType(const oox::drawingml::LinePropertiesPtr& pLineProp, sal_Int32 nToken)
206 {
207  pLineProp->maLineFill.moFillType.set(nToken);
208 }
209 
210 void insertBorderLine(TableStylePart& aTableStylePart, sal_Int32 nToken,
212 {
213  if (pLineProp->maLineFill.moFillType.has())
214  {
215  aTableStylePart.getLineBorders().insert(
216  std::pair<sal_Int32, ::oox::drawingml::LinePropertiesPtr>(nToken, pLineProp));
217  }
218 }
219 
220 std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
221 {
223  std::unique_ptr<TableStyle> pTableStyle;
224  pTableStyle.reset(new TableStyle());
225 
226  // Text Color definitions for table parts
227 
228  ::oox::drawingml::Color wholeTblTextColor;
229  ::oox::drawingml::Color firstRowTextColor;
230  ::oox::drawingml::Color firstColTextColor;
231  ::oox::drawingml::Color lastRowTextColor;
232  ::oox::drawingml::Color lastColTextColor;
233  ::oox::drawingml::Color band1HTextColor;
234  ::oox::drawingml::Color band1VTextColor;
235  ::oox::drawingml::Color band2HTextColor;
236  ::oox::drawingml::Color band2VTextColor;
237 
238  // Fill properties definitions for table parts
239 
240  oox::drawingml::FillPropertiesPtr pWholeTblFillProperties
241  = std::make_shared<oox::drawingml::FillProperties>();
242  oox::drawingml::FillPropertiesPtr pFirstRowFillProperties
243  = std::make_shared<oox::drawingml::FillProperties>();
244  oox::drawingml::FillPropertiesPtr pFirstColFillProperties
245  = std::make_shared<oox::drawingml::FillProperties>();
246  oox::drawingml::FillPropertiesPtr pLastRowFillProperties
247  = std::make_shared<oox::drawingml::FillProperties>();
248  oox::drawingml::FillPropertiesPtr pLastColFillProperties
249  = std::make_shared<oox::drawingml::FillProperties>();
250  oox::drawingml::FillPropertiesPtr pBand1HFillProperties
251  = std::make_shared<oox::drawingml::FillProperties>();
252  oox::drawingml::FillPropertiesPtr pBand1VFillProperties
253  = std::make_shared<oox::drawingml::FillProperties>();
254  oox::drawingml::FillPropertiesPtr pBand2HFillProperties
255  = std::make_shared<oox::drawingml::FillProperties>();
256  oox::drawingml::FillPropertiesPtr pBand2VFillProperties
257  = std::make_shared<oox::drawingml::FillProperties>();
258  oox::drawingml::FillPropertiesPtr pTblBgFillProperties
259  = std::make_shared<oox::drawingml::FillProperties>();
260 
261  // Start table border line properties definitions for table parts
262 
263  oox::drawingml::LinePropertiesPtr pWholeTblLeftBorder
264  = std::make_shared<oox::drawingml::LineProperties>();
265  oox::drawingml::LinePropertiesPtr pWholeTblRightBorder
266  = std::make_shared<oox::drawingml::LineProperties>();
267  oox::drawingml::LinePropertiesPtr pWholeTblTopBorder
268  = std::make_shared<oox::drawingml::LineProperties>();
269  oox::drawingml::LinePropertiesPtr pWholeTblBottomBorder
270  = std::make_shared<oox::drawingml::LineProperties>();
271  oox::drawingml::LinePropertiesPtr pWholeTblInsideHBorder
272  = std::make_shared<oox::drawingml::LineProperties>();
273  oox::drawingml::LinePropertiesPtr pWholeTblInsideVBorder
274  = std::make_shared<oox::drawingml::LineProperties>();
275 
276  oox::drawingml::LinePropertiesPtr pFirstRowLeftBorder
277  = std::make_shared<oox::drawingml::LineProperties>();
278  oox::drawingml::LinePropertiesPtr pFirstRowRightBorder
279  = std::make_shared<oox::drawingml::LineProperties>();
280  oox::drawingml::LinePropertiesPtr pFirstRowTopBorder
281  = std::make_shared<oox::drawingml::LineProperties>();
282  oox::drawingml::LinePropertiesPtr pFirstRowBottomBorder
283  = std::make_shared<oox::drawingml::LineProperties>();
284  oox::drawingml::LinePropertiesPtr pFirstRowInsideHBorder
285  = std::make_shared<oox::drawingml::LineProperties>();
286  oox::drawingml::LinePropertiesPtr pFirstRowInsideVBorder
287  = std::make_shared<oox::drawingml::LineProperties>();
288 
289  oox::drawingml::LinePropertiesPtr pFirstColLeftBorder
290  = std::make_shared<oox::drawingml::LineProperties>();
291  oox::drawingml::LinePropertiesPtr pFirstColRightBorder
292  = std::make_shared<oox::drawingml::LineProperties>();
293  oox::drawingml::LinePropertiesPtr pFirstColTopBorder
294  = std::make_shared<oox::drawingml::LineProperties>();
295  oox::drawingml::LinePropertiesPtr pFirstColBottomBorder
296  = std::make_shared<oox::drawingml::LineProperties>();
297  oox::drawingml::LinePropertiesPtr pFirstColInsideHBorder
298  = std::make_shared<oox::drawingml::LineProperties>();
299  oox::drawingml::LinePropertiesPtr pFirstColInsideVBorder
300  = std::make_shared<oox::drawingml::LineProperties>();
301 
302  oox::drawingml::LinePropertiesPtr pLastColLeftBorder
303  = std::make_shared<oox::drawingml::LineProperties>();
304  oox::drawingml::LinePropertiesPtr pLastColRightBorder
305  = std::make_shared<oox::drawingml::LineProperties>();
306  oox::drawingml::LinePropertiesPtr pLastColTopBorder
307  = std::make_shared<oox::drawingml::LineProperties>();
308  oox::drawingml::LinePropertiesPtr pLastColBottomBorder
309  = std::make_shared<oox::drawingml::LineProperties>();
310  oox::drawingml::LinePropertiesPtr pLastColInsideHBorder
311  = std::make_shared<oox::drawingml::LineProperties>();
312  oox::drawingml::LinePropertiesPtr pLastColInsideVBorder
313  = std::make_shared<oox::drawingml::LineProperties>();
314 
315  oox::drawingml::LinePropertiesPtr pLastRowLeftBorder
316  = std::make_shared<oox::drawingml::LineProperties>();
317  oox::drawingml::LinePropertiesPtr pLastRowRightBorder
318  = std::make_shared<oox::drawingml::LineProperties>();
319  oox::drawingml::LinePropertiesPtr pLastRowTopBorder
320  = std::make_shared<oox::drawingml::LineProperties>();
321  oox::drawingml::LinePropertiesPtr pLastRowBottomBorder
322  = std::make_shared<oox::drawingml::LineProperties>();
323  oox::drawingml::LinePropertiesPtr pLastRowInsideHBorder
324  = std::make_shared<oox::drawingml::LineProperties>();
325  oox::drawingml::LinePropertiesPtr pLastRowInsideVBorder
326  = std::make_shared<oox::drawingml::LineProperties>();
327 
328  oox::drawingml::LinePropertiesPtr pBand1HLeftBorder
329  = std::make_shared<oox::drawingml::LineProperties>();
330  oox::drawingml::LinePropertiesPtr pBand1HRightBorder
331  = std::make_shared<oox::drawingml::LineProperties>();
332  oox::drawingml::LinePropertiesPtr pBand1HTopBorder
333  = std::make_shared<oox::drawingml::LineProperties>();
334  oox::drawingml::LinePropertiesPtr pBand1HBottomBorder
335  = std::make_shared<oox::drawingml::LineProperties>();
336  oox::drawingml::LinePropertiesPtr pBand1HInsideHBorder
337  = std::make_shared<oox::drawingml::LineProperties>();
338  oox::drawingml::LinePropertiesPtr pBand1HInsideVBorder
339  = std::make_shared<oox::drawingml::LineProperties>();
340 
341  oox::drawingml::LinePropertiesPtr pBand1VLeftBorder
342  = std::make_shared<oox::drawingml::LineProperties>();
343  oox::drawingml::LinePropertiesPtr pBand1VRightBorder
344  = std::make_shared<oox::drawingml::LineProperties>();
345  oox::drawingml::LinePropertiesPtr pBand1VTopBorder
346  = std::make_shared<oox::drawingml::LineProperties>();
347  oox::drawingml::LinePropertiesPtr pBand1VBottomBorder
348  = std::make_shared<oox::drawingml::LineProperties>();
349  oox::drawingml::LinePropertiesPtr pBand1VInsideHBorder
350  = std::make_shared<oox::drawingml::LineProperties>();
351  oox::drawingml::LinePropertiesPtr pBand1VInsideVBorder
352  = std::make_shared<oox::drawingml::LineProperties>();
353 
354  oox::drawingml::LinePropertiesPtr pBand2HLeftBorder
355  = std::make_shared<oox::drawingml::LineProperties>();
356  oox::drawingml::LinePropertiesPtr pBand2HRightBorder
357  = std::make_shared<oox::drawingml::LineProperties>();
358  oox::drawingml::LinePropertiesPtr pBand2HTopBorder
359  = std::make_shared<oox::drawingml::LineProperties>();
360  oox::drawingml::LinePropertiesPtr pBand2HBottomBorder
361  = std::make_shared<oox::drawingml::LineProperties>();
362  oox::drawingml::LinePropertiesPtr pBand2HInsideHBorder
363  = std::make_shared<oox::drawingml::LineProperties>();
364  oox::drawingml::LinePropertiesPtr pBand2HInsideVBorder
365  = std::make_shared<oox::drawingml::LineProperties>();
366 
367  oox::drawingml::LinePropertiesPtr pBand2VLeftBorder
368  = std::make_shared<oox::drawingml::LineProperties>();
369  oox::drawingml::LinePropertiesPtr pBand2VRightBorder
370  = std::make_shared<oox::drawingml::LineProperties>();
371  oox::drawingml::LinePropertiesPtr pBand2VTopBorder
372  = std::make_shared<oox::drawingml::LineProperties>();
373  oox::drawingml::LinePropertiesPtr pBand2VBottomBorder
374  = std::make_shared<oox::drawingml::LineProperties>();
375  oox::drawingml::LinePropertiesPtr pBand2VInsideHBorder
376  = std::make_shared<oox::drawingml::LineProperties>();
377  oox::drawingml::LinePropertiesPtr pBand2VInsideVBorder
378  = std::make_shared<oox::drawingml::LineProperties>();
379 
380  // End table border line properties definitions for table parts
381 
382  // Start to set fill types.
383 
384  pTblBgFillProperties->moFillType.set(XML_solidFill);
385  pWholeTblFillProperties->moFillType.set(XML_solidFill);
386  pFirstRowFillProperties->moFillType.set(XML_solidFill);
387  pFirstColFillProperties->moFillType.set(XML_solidFill);
388  pLastRowFillProperties->moFillType.set(XML_solidFill);
389  pLastColFillProperties->moFillType.set(XML_solidFill);
390  pBand1HFillProperties->moFillType.set(XML_solidFill);
391  pBand1VFillProperties->moFillType.set(XML_solidFill);
392  pBand2HFillProperties->moFillType.set(XML_solidFill);
393  pBand2VFillProperties->moFillType.set(XML_solidFill);
394 
395  // End to set fill types.
396 
397  // Define common properties.
398 
399  pWholeTblLeftBorder->moLineWidth = 12700;
400  pWholeTblRightBorder->moLineWidth = 12700;
401  pWholeTblTopBorder->moLineWidth = 12700;
402  pWholeTblBottomBorder->moLineWidth = 12700;
403  pWholeTblInsideHBorder->moLineWidth = 12700;
404  pWholeTblInsideVBorder->moLineWidth = 12700;
405 
406  pWholeTblLeftBorder->moPresetDash = XML_solid;
407  pWholeTblRightBorder->moPresetDash = XML_solid;
408  pWholeTblTopBorder->moPresetDash = XML_solid;
409  pWholeTblBottomBorder->moPresetDash = XML_solid;
410  pWholeTblInsideHBorder->moPresetDash = XML_solid;
411  pWholeTblInsideVBorder->moPresetDash = XML_solid;
412 
413  // Start to handle all style groups.
414 
415  OUString style_name = mStyleIdMap[styleId].first;
416  OUString accent_name = mStyleIdMap[styleId].second;
417 
418  if (style_name == "Themed-Style-1")
419  {
420  if (!accent_name.isEmpty())
421  {
422  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
423  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
424  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
425  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
426  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
427  setBorderLineType(pWholeTblInsideVBorder, XML_solidFill);
428  setBorderLineType(pFirstRowLeftBorder, XML_solidFill);
429  setBorderLineType(pFirstRowRightBorder, XML_solidFill);
430  setBorderLineType(pFirstRowTopBorder, XML_solidFill);
431  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
432  setBorderLineType(pLastRowLeftBorder, XML_solidFill);
433  setBorderLineType(pLastRowRightBorder, XML_solidFill);
434  setBorderLineType(pLastRowTopBorder, XML_solidFill);
435  setBorderLineType(pLastRowBottomBorder, XML_solidFill);
436  setBorderLineType(pFirstColLeftBorder, XML_solidFill);
437  setBorderLineType(pFirstColRightBorder, XML_solidFill);
438  setBorderLineType(pFirstColTopBorder, XML_solidFill);
439  setBorderLineType(pFirstColBottomBorder, XML_solidFill);
440  setBorderLineType(pFirstColInsideHBorder, XML_solidFill);
441  setBorderLineType(pLastColLeftBorder, XML_solidFill);
442  setBorderLineType(pLastColRightBorder, XML_solidFill);
443  setBorderLineType(pLastColTopBorder, XML_solidFill);
444  setBorderLineType(pLastColBottomBorder, XML_solidFill);
445  setBorderLineType(pLastColInsideHBorder, XML_solidFill);
446 
447  sal_Int32 accent_val = tokens[mStyleIdMap[styleId].second];
448 
449  wholeTblTextColor.setSchemeClr(XML_dk1);
450  firstRowTextColor.setSchemeClr(XML_lt1);
451 
452  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
453  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
454  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
455  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
456  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
457  pWholeTblInsideVBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
458 
459  pFirstRowLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
460  pFirstRowRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
461  pFirstRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
462  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
463  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
464 
465  pLastRowLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
466  pLastRowRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
467  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
468  pLastRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
469 
470  pFirstColLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
471  pFirstColRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
472  pFirstColTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
473  pFirstColBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
474  pFirstColInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
475 
476  pLastColLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
477  pLastColRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
478  pLastColTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
479  pLastColBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
480  pLastColInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
481 
482  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
483  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
484  }
485  else
486  {
487  wholeTblTextColor.setSchemeClr(XML_tx1);
488  }
489 
490  pBand1HFillProperties->maFillColor.addTransformation(XML_alpha, 40000);
491  pBand1VFillProperties->maFillColor.addTransformation(XML_alpha, 40000);
492  }
493  else if (style_name == "Themed-Style-2")
494  {
495  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
496  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
497  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
498  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
499 
500  sal_Int32 accent_val;
501 
502  if (!accent_name.isEmpty())
503  {
504  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
505  setBorderLineType(pLastRowTopBorder, XML_solidFill);
506  setBorderLineType(pFirstColRightBorder, XML_solidFill);
507  setBorderLineType(pLastColLeftBorder, XML_solidFill);
508 
509  wholeTblTextColor.setSchemeClr(XML_lt1);
510  firstRowTextColor.setSchemeClr(XML_lt1);
511 
512  accent_val = tokens[mStyleIdMap[styleId].second];
513 
514  pTblBgFillProperties->maFillColor.setSchemeClr(accent_val);
515  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
516  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
517  pFirstColRightBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
518  pLastColLeftBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
519  pBand1HFillProperties->maFillColor.setSchemeClr(XML_lt1);
520  pBand1VFillProperties->maFillColor.setSchemeClr(XML_lt1);
521  }
522  else
523  {
524  setBorderLineType(pWholeTblInsideVBorder, XML_solidFill);
525  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
526 
527  accent_val = XML_tx1;
528 
529  pWholeTblInsideVBorder->maLineFill.maFillColor.setSchemeClr(XML_tx1);
530  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(XML_tx1);
531  }
532 
533  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
534  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
535  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
536  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
537 
538  pBand1HFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
539  pBand1VFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
540  pWholeTblLeftBorder->maLineFill.maFillColor.addTransformation(XML_tint, 50000);
541  pWholeTblRightBorder->maLineFill.maFillColor.addTransformation(XML_tint, 50000);
542  pWholeTblTopBorder->maLineFill.maFillColor.addTransformation(XML_tint, 50000);
543  pWholeTblBottomBorder->maLineFill.maFillColor.addTransformation(XML_tint, 50000);
544  }
545  else if (style_name == "Light-Style-1")
546  {
547  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
548  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
549  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
550  setBorderLineType(pLastRowTopBorder, XML_solidFill);
551 
552  wholeTblTextColor.setSchemeClr(XML_tx1);
553 
554  sal_Int32 accent_val;
555 
556  if (!accent_name.isEmpty())
557  accent_val = tokens[mStyleIdMap[styleId].second];
558  else
559  accent_val = XML_tx1;
560 
561  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
562  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
563  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
564  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
565 
566  firstRowTextColor.setSchemeClr(accent_val);
567 
568  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
569  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
570 
571  pBand1HFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
572  pBand1VFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
573  }
574  else if (style_name == "Light-Style-2")
575  {
576  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
577  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
578  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
579  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
580  setBorderLineType(pLastRowTopBorder, XML_solidFill);
581  setBorderLineType(pBand1HTopBorder, XML_solidFill);
582  setBorderLineType(pBand1HBottomBorder, XML_solidFill);
583  setBorderLineType(pBand1VLeftBorder, XML_solidFill);
584  setBorderLineType(pBand1VRightBorder, XML_solidFill);
585  setBorderLineType(pBand2VLeftBorder, XML_solidFill);
586  setBorderLineType(pBand2VRightBorder, XML_solidFill);
587 
588  wholeTblTextColor.setSchemeClr(XML_tx1);
589  firstRowTextColor.setSchemeClr(XML_bg1);
590 
591  sal_Int32 accent_val;
592 
593  if (!accent_name.isEmpty())
594  accent_val = tokens[mStyleIdMap[styleId].second];
595  else
596  accent_val = XML_tx1;
597 
598  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
599  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
600  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
601  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
602 
603  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
604  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
605 
606  pBand1HTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
607  pBand1HBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
608 
609  pBand1VLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
610  pBand1VRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
611 
612  pBand2VLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
613  pBand2VRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
614  }
615  else if (style_name == "Light-Style-3")
616  {
617  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
618  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
619  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
620  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
621  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
622  setBorderLineType(pWholeTblInsideVBorder, XML_solidFill);
623  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
624  setBorderLineType(pLastRowTopBorder, XML_solidFill);
625 
626  wholeTblTextColor.setSchemeClr(XML_tx1);
627 
628  sal_Int32 accent_val;
629 
630  if (!accent_name.isEmpty())
631  accent_val = tokens[mStyleIdMap[styleId].second];
632  else
633  accent_val = XML_tx1;
634 
635  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
636  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
637  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
638  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
639  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
640  pWholeTblInsideVBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
641 
642  firstRowTextColor.setSchemeClr(accent_val);
643  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
644  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
645  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
646  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
647 
648  pBand1HFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
649  pBand1VFillProperties->maFillColor.addTransformation(XML_alpha, 20000);
650  }
651  else if (style_name == "Medium-Style-1")
652  {
653  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
654  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
655  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
656  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
657  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
658  setBorderLineType(pLastRowTopBorder, XML_solidFill);
659 
660  wholeTblTextColor.setSchemeClr(XML_dk1);
661  firstRowTextColor.setSchemeClr(XML_lt1);
662  pWholeTblFillProperties->maFillColor.setSchemeClr(XML_lt1);
663  pLastRowFillProperties->maFillColor.setSchemeClr(XML_lt1);
664 
665  sal_Int32 accent_val;
666 
667  if (!accent_name.isEmpty())
668  accent_val = tokens[mStyleIdMap[styleId].second];
669  else
670  accent_val = XML_dk1;
671 
672  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
673  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
674  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
675  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
676  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
677 
678  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
679  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
680  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
681 
682  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
683 
684  pBand1HFillProperties->maFillColor.addTransformation(XML_tint, 20000);
685  pBand1VFillProperties->maFillColor.addTransformation(XML_tint, 20000);
686  }
687  else if (style_name == "Medium-Style-2")
688  {
689  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
690  setBorderLineType(pLastRowTopBorder, XML_solidFill);
691  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
692  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
693  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
694  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
695  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
696  setBorderLineType(pWholeTblInsideVBorder, XML_solidFill);
697 
698  wholeTblTextColor.setSchemeClr(XML_dk1);
699  firstRowTextColor.setSchemeClr(XML_lt1);
700  lastRowTextColor.setSchemeClr(XML_lt1);
701  firstColTextColor.setSchemeClr(XML_lt1);
702  lastColTextColor.setSchemeClr(XML_lt1);
703  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
704  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
705 
706  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
707  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
708  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
709  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
710  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
711  pWholeTblInsideVBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
712 
713  sal_Int32 accent_val;
714 
715  if (!accent_name.isEmpty())
716  accent_val = tokens[mStyleIdMap[styleId].second];
717  else
718  accent_val = XML_dk1;
719 
720  pWholeTblFillProperties->maFillColor.setSchemeClr(accent_val);
721  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
722  pLastRowFillProperties->maFillColor.setSchemeClr(accent_val);
723  pFirstColFillProperties->maFillColor.setSchemeClr(accent_val);
724  pLastColFillProperties->maFillColor.setSchemeClr(accent_val);
725  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
726  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
727 
728  pWholeTblFillProperties->maFillColor.addTransformation(XML_tint, 20000);
729  pBand1HFillProperties->maFillColor.addTransformation(XML_tint, 40000);
730  pBand1VFillProperties->maFillColor.addTransformation(XML_tint, 40000);
731  }
732  else if (style_name == "Medium-Style-3")
733  {
734  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
735  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
736  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
737  setBorderLineType(pLastRowTopBorder, XML_solidFill);
738 
739  wholeTblTextColor.setSchemeClr(XML_dk1);
740  firstColTextColor.setSchemeClr(XML_lt1);
741  lastColTextColor.setSchemeClr(XML_lt1);
742  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
743  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
744  pWholeTblFillProperties->maFillColor.setSchemeClr(XML_lt1);
745  pLastRowFillProperties->maFillColor.setSchemeClr(XML_lt1);
746  pBand1HFillProperties->maFillColor.setSchemeClr(XML_dk1);
747  pBand1VFillProperties->maFillColor.setSchemeClr(XML_dk1);
748 
749  firstRowTextColor.setSchemeClr(XML_lt1);
750  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
751  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
752 
753  sal_Int32 accent_val;
754 
755  if (!accent_name.isEmpty())
756  accent_val = tokens[mStyleIdMap[styleId].second];
757  else
758  accent_val = XML_dk1;
759 
760  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
761  pFirstColFillProperties->maFillColor.setSchemeClr(accent_val);
762  pLastColFillProperties->maFillColor.setSchemeClr(accent_val);
763 
764  pBand1HFillProperties->maFillColor.addTransformation(XML_tint, 20000);
765  pBand1VFillProperties->maFillColor.addTransformation(XML_tint, 20000);
766  }
767  else if (style_name == "Medium-Style-4")
768  {
769  setBorderLineType(pWholeTblLeftBorder, XML_solidFill);
770  setBorderLineType(pWholeTblRightBorder, XML_solidFill);
771  setBorderLineType(pWholeTblTopBorder, XML_solidFill);
772  setBorderLineType(pWholeTblBottomBorder, XML_solidFill);
773  setBorderLineType(pWholeTblInsideHBorder, XML_solidFill);
774  setBorderLineType(pWholeTblInsideVBorder, XML_solidFill);
775 
776  wholeTblTextColor.setSchemeClr(XML_dk1);
777  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
778  pLastRowFillProperties->maFillColor.setSchemeClr(XML_dk1);
779 
780  sal_Int32 accent_val;
781 
782  if (!accent_name.isEmpty())
783  accent_val = tokens[mStyleIdMap[styleId].second];
784  else
785  accent_val = XML_dk1;
786 
787  pWholeTblLeftBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
788  pWholeTblRightBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
789  pWholeTblTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
790  pWholeTblBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
791  pWholeTblInsideHBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
792  pWholeTblInsideVBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
793  pWholeTblFillProperties->maFillColor.setSchemeClr(accent_val);
794 
795  firstRowTextColor.setSchemeClr(accent_val);
796  pFirstRowFillProperties->maFillColor.setSchemeClr(accent_val);
797  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
798  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
799 
800  pFirstRowFillProperties->maFillColor.addTransformation(XML_tint, 20000);
801  pLastRowFillProperties->maFillColor.addTransformation(XML_tint, 20000);
802  pWholeTblFillProperties->maFillColor.addTransformation(XML_tint, 20000);
803  pBand1HFillProperties->maFillColor.addTransformation(XML_tint, 40000);
804  pBand1VFillProperties->maFillColor.addTransformation(XML_tint, 40000);
805  }
806  else if (style_name == "Dark-Style-1")
807  {
808  setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
809  setBorderLineType(pFirstColRightBorder, XML_solidFill);
810  setBorderLineType(pLastColLeftBorder, XML_solidFill);
811  setBorderLineType(pLastRowTopBorder, XML_solidFill);
812 
813  sal_Int32 transform_val;
814  wholeTblTextColor.setSchemeClr(XML_dk1);
815  firstRowTextColor.setSchemeClr(XML_lt1);
816  pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
817  pFirstColRightBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
818  pLastColLeftBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
819  pFirstRowFillProperties->maFillColor.setSchemeClr(XML_dk1);
820  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
821 
822  sal_Int32 accent_val;
823 
824  if (!accent_name.isEmpty())
825  {
826  accent_val = tokens[mStyleIdMap[styleId].second];
827  transform_val = XML_shade;
828  }
829  else
830  {
831  accent_val = XML_dk1;
832  transform_val = XML_tint;
833  }
834 
835  pWholeTblFillProperties->maFillColor.setSchemeClr(accent_val);
836  pLastRowFillProperties->maFillColor.setSchemeClr(accent_val);
837  pFirstColFillProperties->maFillColor.setSchemeClr(accent_val);
838  pLastColFillProperties->maFillColor.setSchemeClr(accent_val);
839  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
840  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
841 
842  pWholeTblFillProperties->maFillColor.addTransformation(transform_val, 20000);
843  pBand1HFillProperties->maFillColor.addTransformation(transform_val, 40000);
844  pBand1VFillProperties->maFillColor.addTransformation(transform_val, 40000);
845  pLastColFillProperties->maFillColor.addTransformation(transform_val, 60000);
846  pFirstColFillProperties->maFillColor.addTransformation(transform_val, 60000);
847  }
848  else if (style_name == "Dark-Style-2")
849  {
850  setBorderLineType(pLastRowTopBorder, XML_solidFill);
851 
852  wholeTblTextColor.setSchemeClr(XML_dk1);
853  firstRowTextColor.setSchemeClr(XML_lt1);
854 
855  pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(XML_dk1);
856 
857  if (accent_name.isEmpty())
858  pFirstRowFillProperties->maFillColor.setSchemeClr(XML_dk1);
859  else if (accent_name == "Accent1")
860  pFirstRowFillProperties->maFillColor.setSchemeClr(XML_accent2);
861  else if (accent_name == "Accent3")
862  pFirstRowFillProperties->maFillColor.setSchemeClr(XML_accent4);
863  else if (accent_name == "Accent5")
864  pFirstRowFillProperties->maFillColor.setSchemeClr(XML_accent6);
865 
866  sal_Int32 accent_val;
867 
868  if (!accent_name.isEmpty())
869  accent_val = tokens[mStyleIdMap[styleId].second];
870  else
871  accent_val = XML_dk1;
872 
873  pWholeTblFillProperties->maFillColor.setSchemeClr(accent_val);
874  pLastRowFillProperties->maFillColor.setSchemeClr(accent_val);
875  pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
876  pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
877 
878  pWholeTblFillProperties->maFillColor.addTransformation(XML_tint, 20000);
879  pBand1HFillProperties->maFillColor.addTransformation(XML_tint, 40000);
880  pBand1VFillProperties->maFillColor.addTransformation(XML_tint, 40000);
881  pLastRowFillProperties->maFillColor.addTransformation(XML_tint, 20000);
882  }
883 
884  // End to handle all style groups.
885 
886  // Create a TableStyle from handled properties.
887 
888  pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
889  pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
890  pTableStyle->getFirstCol().getTextColor() = firstColTextColor;
891  pTableStyle->getLastRow().getTextColor() = lastRowTextColor;
892  pTableStyle->getLastCol().getTextColor() = lastColTextColor;
893  pTableStyle->getBand1H().getTextColor() = band1HTextColor;
894  pTableStyle->getBand1V().getTextColor() = band1VTextColor;
895  pTableStyle->getBand2H().getTextColor() = band2HTextColor;
896  pTableStyle->getBand2V().getTextColor() = band2VTextColor;
897 
898  pTableStyle->getBackgroundFillProperties() = pTblBgFillProperties;
899  pTableStyle->getWholeTbl().getFillProperties() = pWholeTblFillProperties;
900  pTableStyle->getFirstRow().getFillProperties() = pFirstRowFillProperties;
901  pTableStyle->getFirstCol().getFillProperties() = pFirstColFillProperties;
902  pTableStyle->getLastRow().getFillProperties() = pLastRowFillProperties;
903  pTableStyle->getLastCol().getFillProperties() = pLastColFillProperties;
904  pTableStyle->getBand1H().getFillProperties() = pBand1HFillProperties;
905  pTableStyle->getBand1V().getFillProperties() = pBand1VFillProperties;
906  pTableStyle->getBand2H().getFillProperties() = pBand2HFillProperties;
907  pTableStyle->getBand2V().getFillProperties() = pBand2VFillProperties;
908 
909  insertBorderLine(pTableStyle->getWholeTbl(), XML_left, pWholeTblLeftBorder);
910  insertBorderLine(pTableStyle->getWholeTbl(), XML_right, pWholeTblRightBorder);
911  insertBorderLine(pTableStyle->getWholeTbl(), XML_top, pWholeTblTopBorder);
912  insertBorderLine(pTableStyle->getWholeTbl(), XML_bottom, pWholeTblBottomBorder);
913  insertBorderLine(pTableStyle->getWholeTbl(), XML_insideV, pWholeTblInsideVBorder);
914  insertBorderLine(pTableStyle->getWholeTbl(), XML_insideH, pWholeTblInsideHBorder);
915 
916  insertBorderLine(pTableStyle->getFirstRow(), XML_left, pFirstRowLeftBorder);
917  insertBorderLine(pTableStyle->getFirstRow(), XML_right, pFirstRowRightBorder);
918  insertBorderLine(pTableStyle->getFirstRow(), XML_top, pFirstRowTopBorder);
919  insertBorderLine(pTableStyle->getFirstRow(), XML_bottom, pFirstRowBottomBorder);
920  insertBorderLine(pTableStyle->getFirstRow(), XML_insideV, pFirstRowInsideVBorder);
921  insertBorderLine(pTableStyle->getFirstRow(), XML_insideH, pFirstRowInsideHBorder);
922 
923  insertBorderLine(pTableStyle->getFirstCol(), XML_left, pFirstColLeftBorder);
924  insertBorderLine(pTableStyle->getFirstCol(), XML_right, pFirstColRightBorder);
925  insertBorderLine(pTableStyle->getFirstCol(), XML_top, pFirstColTopBorder);
926  insertBorderLine(pTableStyle->getFirstCol(), XML_bottom, pFirstColBottomBorder);
927  insertBorderLine(pTableStyle->getFirstCol(), XML_insideV, pFirstColInsideVBorder);
928  insertBorderLine(pTableStyle->getFirstCol(), XML_insideH, pFirstColInsideHBorder);
929 
930  insertBorderLine(pTableStyle->getLastRow(), XML_left, pLastRowLeftBorder);
931  insertBorderLine(pTableStyle->getLastRow(), XML_right, pLastRowRightBorder);
932  insertBorderLine(pTableStyle->getLastRow(), XML_top, pLastRowTopBorder);
933  insertBorderLine(pTableStyle->getLastRow(), XML_bottom, pLastRowBottomBorder);
934  insertBorderLine(pTableStyle->getLastRow(), XML_insideV, pLastRowInsideVBorder);
935  insertBorderLine(pTableStyle->getLastRow(), XML_insideH, pLastRowInsideHBorder);
936 
937  insertBorderLine(pTableStyle->getLastCol(), XML_left, pLastColLeftBorder);
938  insertBorderLine(pTableStyle->getLastCol(), XML_right, pLastColRightBorder);
939  insertBorderLine(pTableStyle->getLastCol(), XML_top, pLastColTopBorder);
940  insertBorderLine(pTableStyle->getLastCol(), XML_bottom, pLastColBottomBorder);
941  insertBorderLine(pTableStyle->getLastCol(), XML_insideV, pLastColInsideVBorder);
942  insertBorderLine(pTableStyle->getLastCol(), XML_insideH, pLastColInsideHBorder);
943 
944  insertBorderLine(pTableStyle->getBand1H(), XML_left, pBand1HLeftBorder);
945  insertBorderLine(pTableStyle->getBand1H(), XML_right, pBand1HRightBorder);
946  insertBorderLine(pTableStyle->getBand1H(), XML_top, pBand1HTopBorder);
947  insertBorderLine(pTableStyle->getBand1H(), XML_bottom, pBand1HBottomBorder);
948  insertBorderLine(pTableStyle->getBand1H(), XML_insideV, pBand1HInsideVBorder);
949  insertBorderLine(pTableStyle->getBand1H(), XML_insideH, pBand1HInsideHBorder);
950 
951  insertBorderLine(pTableStyle->getBand1V(), XML_left, pBand1VLeftBorder);
952  insertBorderLine(pTableStyle->getBand1V(), XML_right, pBand1VRightBorder);
953  insertBorderLine(pTableStyle->getBand1V(), XML_top, pBand1VTopBorder);
954  insertBorderLine(pTableStyle->getBand1V(), XML_bottom, pBand1VBottomBorder);
955  insertBorderLine(pTableStyle->getBand1V(), XML_insideV, pBand1VInsideVBorder);
956  insertBorderLine(pTableStyle->getBand1V(), XML_insideH, pBand1VInsideHBorder);
957 
958  insertBorderLine(pTableStyle->getBand2H(), XML_left, pBand2HLeftBorder);
959  insertBorderLine(pTableStyle->getBand2H(), XML_right, pBand2HRightBorder);
960  insertBorderLine(pTableStyle->getBand2H(), XML_top, pBand2HTopBorder);
961  insertBorderLine(pTableStyle->getBand2H(), XML_bottom, pBand2HBottomBorder);
962  insertBorderLine(pTableStyle->getBand2H(), XML_insideV, pBand2HInsideVBorder);
963  insertBorderLine(pTableStyle->getBand2H(), XML_insideH, pBand2HInsideHBorder);
964 
965  insertBorderLine(pTableStyle->getBand2V(), XML_left, pBand2VLeftBorder);
966  insertBorderLine(pTableStyle->getBand2V(), XML_right, pBand2VRightBorder);
967  insertBorderLine(pTableStyle->getBand2V(), XML_top, pBand2VTopBorder);
968  insertBorderLine(pTableStyle->getBand2V(), XML_bottom, pBand2VBottomBorder);
969  insertBorderLine(pTableStyle->getBand2V(), XML_insideV, pBand2VInsideVBorder);
970  insertBorderLine(pTableStyle->getBand2V(), XML_insideH, pBand2VInsideHBorder);
971 
972  return pTableStyle;
973 }
974 
975 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void createStyleIdMap()
std::shared_ptr< FillProperties > FillPropertiesPtr
void setSchemeClr(sal_Int32 nToken)
Sets a scheme color from the a:schemeClr element.
Definition: color.cxx:305
std::map< OUString, std::pair< OUString, OUString > > mStyleIdMap
void setBorderLineType(const oox::drawingml::LinePropertiesPtr &pLineProp, sal_Int32 nToken)
static std::map< OUString, sal_Int32 > tokens
std::map< sal_Int32,::oox::drawingml::LinePropertiesPtr > & getLineBorders()
std::shared_ptr< LineProperties > LinePropertiesPtr
std::unique_ptr< TableStyle > CreateTableStyle(const OUString &styleId)
void insertBorderLine(TableStylePart &aTableStylePart, sal_Int32 nToken, oox::drawingml::LinePropertiesPtr pLineProp)