diff --git a/sc/inc/defaulttablestyledata.hxx b/sc/inc/defaulttablestyledata.hxx index 06bbe33ba022..2c12fb9a95c6 100644 --- a/sc/inc/defaulttablestyledata.hxx +++ b/sc/inc/defaulttablestyledata.hxx @@ -68,9 +68,18 @@ struct TableStyleElement int nDxfId; }; +enum class TableStyleCategory +{ + Light, + Medium, + Dark +}; + struct TableStyle { const char* pName; + TableStyleCategory eCategory; + int nNumber; size_t nElements; int pTableStyleElementIds[9]; }; diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 89ca3a06793a..6e65a50911ea 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -467,4 +467,9 @@ #define STR_AUTOCALC_OFF NC_("STR_AUTOCALC_OFF", "AutoCalculate: Off\nClick to enable.") +/* Table Styles */ +#define STR_TABLE_STYLE_LIGHT NC_("STR_TABLE_STYLE_LIGHT", "Table Style Light") +#define STR_TABLE_STYLE_MEDIUM NC_("STR_TABLE_STYLE_MEDIUM", "Table Style Medium") +#define STR_TABLE_STYLE_DARK NC_("STR_TABLE_STYLE_DARK", "Table Style Dark") + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/TableStyleGenerator.cxx b/sc/source/core/data/TableStyleGenerator.cxx index 7148a5b8f5f7..a542e2ba35e0 100644 --- a/sc/source/core/data/TableStyleGenerator.cxx +++ b/sc/source/core/data/TableStyleGenerator.cxx @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include @@ -296,6 +298,21 @@ buildDxfPatterns(ScDocument& rDoc, const std::vector& rFillItems, return aDxfPatterns; } +TranslateId getCategoryTranslateId(TableStyleCategory eCategory) +{ + switch (eCategory) + { + case TableStyleCategory::Light: + return STR_TABLE_STYLE_LIGHT; + case TableStyleCategory::Medium: + return STR_TABLE_STYLE_MEDIUM; + case TableStyleCategory::Dark: + return STR_TABLE_STYLE_DARK; + } + SAL_WARN("sc", "getCategoryTranslateId: unknown TableStyleCategory"); + return {}; +} + void assembleTableStyles(ScTableStyles& rTableStyles, const std::vector>& rDxfPatterns) { @@ -303,8 +320,10 @@ void assembleTableStyles(ScTableStyles& rTableStyles, for (size_t i = 0; i < nTableStyles; ++i) { const ::TableStyle& rStyleInfo = aTableStyles[i]; + OUString aUIName = ScResId(getCategoryTranslateId(rStyleInfo.eCategory)) + " " + + OUString::number(rStyleInfo.nNumber); auto pStyle = std::make_unique(OUString::createFromAscii(rStyleInfo.pName), - std::optional()); + std::optional(aUIName)); pStyle->SetOOXMLDefault(true); for (size_t j = 0; j < rStyleInfo.nElements; ++j) diff --git a/sc/source/core/data/defaulttablestyles.inc b/sc/source/core/data/defaulttablestyles.inc index cbac3e12b50f..2cf41369fbef 100644 --- a/sc/source/core/data/defaulttablestyles.inc +++ b/sc/source/core/data/defaulttablestyles.inc @@ -27,7 +27,7 @@ constexpr Dxf aDxfs[] = { { -1, 2, -1 }, { -1, 3, -1 }, { -1, 4, -1 }, { -1, 5, constexpr TableStyleElement aTableStyleElements[] = { { ScTableStyleElement::FirstColumnStripe, 0 }, { ScTableStyleElement::SecondColumnStripe, 0 }, { ScTableStyleElement::FirstColumnStripe, 1 }, { ScTableStyleElement::SecondColumnStripe, 1 }, { ScTableStyleElement::FirstColumnStripe, 2 }, { ScTableStyleElement::SecondColumnStripe, 2 }, { ScTableStyleElement::FirstColumnStripe, 3 }, { ScTableStyleElement::SecondColumnStripe, 3 }, { ScTableStyleElement::FirstColumnStripe, 4 }, { ScTableStyleElement::SecondColumnStripe, 4 }, { ScTableStyleElement::FirstColumnStripe, 5 }, { ScTableStyleElement::SecondColumnStripe, 5 }, { ScTableStyleElement::FirstColumnStripe, 6 }, { ScTableStyleElement::SecondColumnStripe, 6 }, { ScTableStyleElement::FirstRowStripe, 7 }, { ScTableStyleElement::SecondRowStripe, 7 }, { ScTableStyleElement::FirstRowStripe, 8 }, { ScTableStyleElement::SecondRowStripe, 8 }, { ScTableStyleElement::FirstRowStripe, 9 }, { ScTableStyleElement::SecondRowStripe, 9 }, { ScTableStyleElement::FirstRowStripe, 10 }, { ScTableStyleElement::SecondRowStripe, 10 }, { ScTableStyleElement::FirstRowStripe, 11 }, { ScTableStyleElement::SecondRowStripe, 11 }, { ScTableStyleElement::FirstRowStripe, 12 }, { ScTableStyleElement::SecondRowStripe, 12 }, { ScTableStyleElement::FirstRowStripe, 13 }, { ScTableStyleElement::SecondRowStripe, 13 }, { ScTableStyleElement::TotalRow, 14 }, { ScTableStyleElement::FirstColumnStripe, 15 }, { ScTableStyleElement::FirstRowStripe, 15 }, { ScTableStyleElement::WholeTable, 16 }, { ScTableStyleElement::FirstColumnStripe, 16 }, { ScTableStyleElement::FirstRowStripe, 16 }, { ScTableStyleElement::FirstColumnStripe, 17 }, { ScTableStyleElement::FirstRowStripe, 17 }, { ScTableStyleElement::FirstColumnStripe, 18 }, { ScTableStyleElement::FirstRowStripe, 18 }, { ScTableStyleElement::FirstColumnStripe, 19 }, { ScTableStyleElement::FirstRowStripe, 19 }, { ScTableStyleElement::WholeTable, 20 }, { ScTableStyleElement::FirstColumnStripe, 20 }, { ScTableStyleElement::FirstRowStripe, 20 }, { ScTableStyleElement::FirstColumnStripe, 21 }, { ScTableStyleElement::FirstRowStripe, 21 }, { ScTableStyleElement::FirstColumnStripe, 22 }, { ScTableStyleElement::FirstRowStripe, 22 }, { ScTableStyleElement::FirstColumnStripe, 23 }, { ScTableStyleElement::FirstRowStripe, 23 }, { ScTableStyleElement::FirstColumnStripe, 24 }, { ScTableStyleElement::FirstRowStripe, 24 }, { ScTableStyleElement::FirstColumnStripe, 25 }, { ScTableStyleElement::FirstRowStripe, 25 }, { ScTableStyleElement::WholeTable, 26 }, { ScTableStyleElement::FirstColumnStripe, 26 }, { ScTableStyleElement::FirstRowStripe, 26 }, { ScTableStyleElement::FirstColumnStripe, 27 }, { ScTableStyleElement::FirstRowStripe, 27 }, { ScTableStyleElement::FirstColumnStripe, 28 }, { ScTableStyleElement::FirstRowStripe, 28 }, { ScTableStyleElement::FirstColumnStripe, 29 }, { ScTableStyleElement::FirstRowStripe, 29 }, { ScTableStyleElement::FirstColumnStripe, 30 }, { ScTableStyleElement::FirstRowStripe, 30 }, { ScTableStyleElement::FirstColumnStripe, 31 }, { ScTableStyleElement::FirstRowStripe, 31 }, { ScTableStyleElement::WholeTable, 32 }, { ScTableStyleElement::FirstColumnStripe, 32 }, { ScTableStyleElement::FirstRowStripe, 32 }, { ScTableStyleElement::FirstColumnStripe, 33 }, { ScTableStyleElement::FirstRowStripe, 33 }, { ScTableStyleElement::FirstColumnStripe, 34 }, { ScTableStyleElement::FirstRowStripe, 34 }, { ScTableStyleElement::FirstColumnStripe, 35 }, { ScTableStyleElement::FirstRowStripe, 35 }, { ScTableStyleElement::HeaderRow, 36 }, { ScTableStyleElement::WholeTable, 37 }, { ScTableStyleElement::WholeTable, 38 }, { ScTableStyleElement::WholeTable, 39 }, { ScTableStyleElement::HeaderRow, 39 }, { ScTableStyleElement::WholeTable, 40 }, { ScTableStyleElement::WholeTable, 41 }, { ScTableStyleElement::HeaderRow, 41 }, { ScTableStyleElement::WholeTable, 42 }, { ScTableStyleElement::WholeTable, 43 }, { ScTableStyleElement::HeaderRow, 43 }, { ScTableStyleElement::WholeTable, 44 }, { ScTableStyleElement::WholeTable, 45 }, { ScTableStyleElement::WholeTable, 46 }, { ScTableStyleElement::WholeTable, 47 }, { ScTableStyleElement::WholeTable, 48 }, { ScTableStyleElement::WholeTable, 49 }, { ScTableStyleElement::WholeTable, 50 }, { ScTableStyleElement::WholeTable, 51 }, { ScTableStyleElement::WholeTable, 52 }, { ScTableStyleElement::WholeTable, 53 }, { ScTableStyleElement::WholeTable, 54 }, { ScTableStyleElement::WholeTable, 55 }, { ScTableStyleElement::WholeTable, 56 }, { ScTableStyleElement::WholeTable, 57 }, { ScTableStyleElement::WholeTable, 58 }, { ScTableStyleElement::WholeTable, 59 }, { ScTableStyleElement::WholeTable, 60 }, { ScTableStyleElement::WholeTable, 61 }, { ScTableStyleElement::WholeTable, 62 }, { ScTableStyleElement::WholeTable, 63 }, { ScTableStyleElement::WholeTable, 64 }, { ScTableStyleElement::WholeTable, 65 }, { ScTableStyleElement::WholeTable, 66 }, { ScTableStyleElement::WholeTable, 67 }, { ScTableStyleElement::WholeTable, 68 }, { ScTableStyleElement::WholeTable, 69 }, { ScTableStyleElement::WholeTable, 70 }, { ScTableStyleElement::WholeTable, 71 }, { ScTableStyleElement::WholeTable, 72 }, { ScTableStyleElement::WholeTable, 73 }, { ScTableStyleElement::WholeTable, 74 }, { ScTableStyleElement::WholeTable, 75 }, { ScTableStyleElement::WholeTable, 76 }, { ScTableStyleElement::WholeTable, 77 }, { ScTableStyleElement::WholeTable, 78 }, { ScTableStyleElement::WholeTable, 79 }, { ScTableStyleElement::WholeTable, 80 }, { ScTableStyleElement::WholeTable, 81 }, { ScTableStyleElement::WholeTable, 82 }, { ScTableStyleElement::WholeTable, 83 }, { ScTableStyleElement::WholeTable, 84 }, { ScTableStyleElement::WholeTable, 85 }, { ScTableStyleElement::WholeTable, 86 }, { ScTableStyleElement::WholeTable, 87 }, { ScTableStyleElement::LastColumn, 88 }, { ScTableStyleElement::FirstColumn, 88 }, { ScTableStyleElement::HeaderRow, 88 }, { ScTableStyleElement::HeaderRow, 89 }, { ScTableStyleElement::HeaderRow, 90 }, { ScTableStyleElement::HeaderRow, 91 }, { ScTableStyleElement::TotalRow, 92 }, { ScTableStyleElement::TotalRow, 93 }, { ScTableStyleElement::FirstColumn, 94 }, { ScTableStyleElement::LastColumn, 95 }, { ScTableStyleElement::TotalRow, 96 }, { ScTableStyleElement::FirstColumn, 97 }, { ScTableStyleElement::LastColumn, 98 }, { ScTableStyleElement::LastColumn, 99 }, { ScTableStyleElement::FirstColumn, 99 }, { ScTableStyleElement::HeaderRow, 99 }, { ScTableStyleElement::HeaderRow, 100 }, { ScTableStyleElement::HeaderRow, 101 }, { ScTableStyleElement::TotalRow, 102 }, { ScTableStyleElement::TotalRow, 103 }, { ScTableStyleElement::FirstColumn, 104 }, { ScTableStyleElement::LastColumn, 105 }, { ScTableStyleElement::LastColumn, 106 }, { ScTableStyleElement::FirstColumn, 106 }, { ScTableStyleElement::HeaderRow, 106 }, { ScTableStyleElement::HeaderRow, 107 }, { ScTableStyleElement::HeaderRow, 108 }, { ScTableStyleElement::TotalRow, 109 }, { ScTableStyleElement::TotalRow, 110 }, { ScTableStyleElement::FirstColumn, 111 }, { ScTableStyleElement::LastColumn, 112 }, { ScTableStyleElement::LastColumn, 113 }, { ScTableStyleElement::FirstColumn, 113 }, { ScTableStyleElement::HeaderRow, 113 }, { ScTableStyleElement::HeaderRow, 114 }, { ScTableStyleElement::HeaderRow, 115 }, { ScTableStyleElement::TotalRow, 116 }, { ScTableStyleElement::TotalRow, 117 }, { ScTableStyleElement::FirstColumn, 118 }, { ScTableStyleElement::LastColumn, 119 }, { ScTableStyleElement::LastColumn, 120 }, { ScTableStyleElement::FirstColumn, 120 }, { ScTableStyleElement::HeaderRow, 120 }, { ScTableStyleElement::HeaderRow, 121 }, { ScTableStyleElement::HeaderRow, 122 }, { ScTableStyleElement::TotalRow, 123 }, { ScTableStyleElement::TotalRow, 124 }, { ScTableStyleElement::FirstColumn, 125 }, { ScTableStyleElement::LastColumn, 126 }, { ScTableStyleElement::LastColumn, 127 }, { ScTableStyleElement::FirstColumn, 127 }, { ScTableStyleElement::HeaderRow, 127 }, { ScTableStyleElement::HeaderRow, 128 }, { ScTableStyleElement::HeaderRow, 129 }, { ScTableStyleElement::TotalRow, 130 }, { ScTableStyleElement::TotalRow, 131 }, { ScTableStyleElement::FirstColumn, 132 }, { ScTableStyleElement::LastColumn, 133 }, { ScTableStyleElement::LastColumn, 134 }, { ScTableStyleElement::FirstColumn, 134 }, { ScTableStyleElement::HeaderRow, 134 }, { ScTableStyleElement::HeaderRow, 135 }, { ScTableStyleElement::HeaderRow, 136 }, { ScTableStyleElement::TotalRow, 137 }, { ScTableStyleElement::LastColumn, 138 }, { ScTableStyleElement::FirstColumn, 138 }, { ScTableStyleElement::HeaderRow, 138 }, { ScTableStyleElement::HeaderRow, 139 }, { ScTableStyleElement::HeaderRow, 140 }, { ScTableStyleElement::HeaderRow, 141 }, { ScTableStyleElement::HeaderRow, 142 }, { ScTableStyleElement::HeaderRow, 143 }, { ScTableStyleElement::HeaderRow, 144 }, { ScTableStyleElement::HeaderRow, 145 }, { ScTableStyleElement::HeaderRow, 146 }, { ScTableStyleElement::TotalRow, 147 }, { ScTableStyleElement::TotalRow, 148 }, { ScTableStyleElement::TotalRow, 149 }, { ScTableStyleElement::TotalRow, 150 }, { ScTableStyleElement::TotalRow, 151 }, { ScTableStyleElement::TotalRow, 152 }, { ScTableStyleElement::TotalRow, 153 }, { ScTableStyleElement::TotalRow, 154 }, { ScTableStyleElement::TotalRow, 155 }, { ScTableStyleElement::TotalRow, 156 }, { ScTableStyleElement::TotalRow, 157 }, { ScTableStyleElement::TotalRow, 158 }, { ScTableStyleElement::TotalRow, 159 }, { ScTableStyleElement::TotalRow, 160 }, { ScTableStyleElement::TotalRow, 161 }, { ScTableStyleElement::LastColumn, 162 }, { ScTableStyleElement::FirstColumn, 162 }, { ScTableStyleElement::HeaderRow, 163 }, { ScTableStyleElement::TotalRow, 164 }, { ScTableStyleElement::LastColumn, 165 }, { ScTableStyleElement::FirstColumn, 165 }, { ScTableStyleElement::HeaderRow, 166 }, { ScTableStyleElement::TotalRow, 167 }, { ScTableStyleElement::LastColumn, 168 }, { ScTableStyleElement::FirstColumn, 168 }, { ScTableStyleElement::HeaderRow, 169 }, { ScTableStyleElement::TotalRow, 170 }, { ScTableStyleElement::LastColumn, 171 }, { ScTableStyleElement::FirstColumn, 171 }, { ScTableStyleElement::HeaderRow, 172 }, { ScTableStyleElement::TotalRow, 173 }, { ScTableStyleElement::LastColumn, 174 }, { ScTableStyleElement::FirstColumn, 174 }, { ScTableStyleElement::HeaderRow, 175 }, { ScTableStyleElement::TotalRow, 176 }, { ScTableStyleElement::LastColumn, 177 }, { ScTableStyleElement::FirstColumn, 177 }, { ScTableStyleElement::HeaderRow, 178 }, { ScTableStyleElement::TotalRow, 179 } }; -constexpr TableStyle aTableStyles[] = { { "TableStyleDark1", 7, { 76, 133, 137, 138, 139, 35, 34 } }, { "TableStyleDark10", 7, { 53, 82, 213, 195, 194, 52, 51 } }, { "TableStyleDark11", 7, { 66, 85, 213, 195, 194, 65, 64 } }, { "TableStyleDark2", 7, { 77, 133, 140, 141, 142, 37, 36 } }, { "TableStyleDark3", 7, { 78, 133, 149, 150, 151, 44, 43 } }, { "TableStyleDark4", 7, { 80, 133, 158, 159, 160, 50, 49 } }, { "TableStyleDark5", 7, { 81, 133, 167, 168, 169, 57, 56 } }, { "TableStyleDark6", 7, { 83, 133, 176, 177, 178, 63, 62 } }, { "TableStyleDark7", 7, { 84, 133, 185, 186, 187, 70, 69 } }, { "TableStyleDark8", 7, { 31, 75, 213, 195, 194, 30, 29 } }, { "TableStyleDark9", 7, { 40, 79, 213, 195, 194, 39, 38 } }, { "TableStyleLight1", 7, { 86, 197, 205, 195, 194, 33, 32 } }, { "TableStyleLight10", 9, { 93, 154, 215, 195, 194, 18, 19, 4, 5 } }, { "TableStyleLight11", 9, { 96, 163, 216, 195, 194, 20, 21, 6, 7 } }, { "TableStyleLight12", 9, { 99, 172, 217, 195, 194, 22, 23, 8, 9 } }, { "TableStyleLight13", 9, { 102, 181, 218, 195, 194, 24, 25, 10, 11 } }, { "TableStyleLight14", 9, { 105, 190, 219, 195, 194, 26, 27, 12, 13 } }, { "TableStyleLight15", 7, { 89, 198, 213, 195, 194, 33, 32 } }, { "TableStyleLight16", 7, { 91, 199, 214, 195, 194, 42, 41 } }, { "TableStyleLight17", 7, { 94, 200, 215, 195, 194, 48, 47 } }, { "TableStyleLight18", 7, { 97, 201, 216, 195, 194, 55, 54 } }, { "TableStyleLight19", 7, { 100, 202, 217, 195, 194, 61, 60 } }, { "TableStyleLight2", 7, { 124, 222, 223, 221, 220, 42, 41 } }, { "TableStyleLight20", 7, { 103, 203, 218, 195, 194, 68, 67 } }, { "TableStyleLight21", 7, { 106, 204, 219, 195, 194, 74, 73 } }, { "TableStyleLight3", 7, { 125, 226, 227, 225, 224, 48, 47 } }, { "TableStyleLight4", 7, { 126, 230, 231, 229, 228, 55, 54 } }, { "TableStyleLight5", 7, { 127, 234, 235, 233, 232, 61, 60 } }, { "TableStyleLight6", 7, { 128, 238, 239, 237, 236, 68, 67 } }, { "TableStyleLight7", 7, { 129, 242, 243, 241, 240, 74, 73 } }, { "TableStyleLight8", 9, { 87, 132, 213, 195, 194, 14, 15, 0, 1 } }, { "TableStyleLight9", 9, { 90, 145, 214, 195, 194, 16, 17, 2, 3 } }, { "TableStyleMedium1", 7, { 88, 132, 213, 195, 194, 33, 32 } }, { "TableStyleMedium10", 7, { 114, 156, 157, 153, 152, 46, 45 } }, { "TableStyleMedium11", 7, { 116, 165, 166, 162, 161, 52, 51 } }, { "TableStyleMedium12", 7, { 118, 174, 175, 171, 170, 59, 58 } }, { "TableStyleMedium13", 7, { 120, 183, 184, 180, 179, 65, 64 } }, { "TableStyleMedium14", 7, { 122, 192, 193, 189, 188, 72, 71 } }, { "TableStyleMedium15", 7, { 109, 134, 28, 131, 130, 33, 32 } }, { "TableStyleMedium16", 7, { 108, 146, 28, 144, 143, 33, 32 } }, { "TableStyleMedium17", 7, { 108, 155, 28, 153, 152, 33, 32 } }, { "TableStyleMedium18", 7, { 108, 164, 28, 162, 161, 33, 32 } }, { "TableStyleMedium19", 7, { 108, 173, 28, 171, 170, 33, 32 } }, { "TableStyleMedium2", 7, { 92, 145, 214, 195, 194, 42, 41 } }, { "TableStyleMedium20", 7, { 108, 182, 28, 180, 179, 33, 32 } }, { "TableStyleMedium21", 7, { 108, 191, 28, 189, 188, 33, 32 } }, { "TableStyleMedium22", 7, { 111, 196, 206, 195, 194, 30, 29 } }, { "TableStyleMedium23", 7, { 113, 196, 207, 195, 194, 39, 38 } }, { "TableStyleMedium24", 7, { 115, 196, 208, 195, 194, 46, 45 } }, { "TableStyleMedium25", 7, { 117, 196, 209, 195, 194, 52, 51 } }, { "TableStyleMedium26", 7, { 119, 196, 210, 195, 194, 59, 58 } }, { "TableStyleMedium27", 7, { 121, 196, 211, 195, 194, 65, 64 } }, { "TableStyleMedium28", 7, { 123, 196, 212, 195, 194, 72, 71 } }, { "TableStyleMedium3", 7, { 95, 154, 215, 195, 194, 48, 47 } }, { "TableStyleMedium4", 7, { 98, 163, 216, 195, 194, 55, 54 } }, { "TableStyleMedium5", 7, { 101, 172, 217, 195, 194, 61, 60 } }, { "TableStyleMedium6", 7, { 104, 181, 218, 195, 194, 68, 67 } }, { "TableStyleMedium7", 7, { 107, 190, 219, 195, 194, 74, 73 } }, { "TableStyleMedium8", 7, { 110, 135, 136, 131, 130, 30, 29 } }, { "TableStyleMedium9", 7, { 112, 147, 148, 144, 143, 39, 38 } } }; +constexpr TableStyle aTableStyles[] = { { "TableStyleDark1", TableStyleCategory::Dark, 1, 7, { 76, 133, 137, 138, 139, 35, 34 } }, { "TableStyleDark10", TableStyleCategory::Dark, 10, 7, { 53, 82, 213, 195, 194, 52, 51 } }, { "TableStyleDark11", TableStyleCategory::Dark, 11, 7, { 66, 85, 213, 195, 194, 65, 64 } }, { "TableStyleDark2", TableStyleCategory::Dark, 2, 7, { 77, 133, 140, 141, 142, 37, 36 } }, { "TableStyleDark3", TableStyleCategory::Dark, 3, 7, { 78, 133, 149, 150, 151, 44, 43 } }, { "TableStyleDark4", TableStyleCategory::Dark, 4, 7, { 80, 133, 158, 159, 160, 50, 49 } }, { "TableStyleDark5", TableStyleCategory::Dark, 5, 7, { 81, 133, 167, 168, 169, 57, 56 } }, { "TableStyleDark6", TableStyleCategory::Dark, 6, 7, { 83, 133, 176, 177, 178, 63, 62 } }, { "TableStyleDark7", TableStyleCategory::Dark, 7, 7, { 84, 133, 185, 186, 187, 70, 69 } }, { "TableStyleDark8", TableStyleCategory::Dark, 8, 7, { 31, 75, 213, 195, 194, 30, 29 } }, { "TableStyleDark9", TableStyleCategory::Dark, 9, 7, { 40, 79, 213, 195, 194, 39, 38 } }, { "TableStyleLight1", TableStyleCategory::Light, 1, 7, { 86, 197, 205, 195, 194, 33, 32 } }, { "TableStyleLight10", TableStyleCategory::Light, 10, 9, { 93, 154, 215, 195, 194, 18, 19, 4, 5 } }, { "TableStyleLight11", TableStyleCategory::Light, 11, 9, { 96, 163, 216, 195, 194, 20, 21, 6, 7 } }, { "TableStyleLight12", TableStyleCategory::Light, 12, 9, { 99, 172, 217, 195, 194, 22, 23, 8, 9 } }, { "TableStyleLight13", TableStyleCategory::Light, 13, 9, { 102, 181, 218, 195, 194, 24, 25, 10, 11 } }, { "TableStyleLight14", TableStyleCategory::Light, 14, 9, { 105, 190, 219, 195, 194, 26, 27, 12, 13 } }, { "TableStyleLight15", TableStyleCategory::Light, 15, 7, { 89, 198, 213, 195, 194, 33, 32 } }, { "TableStyleLight16", TableStyleCategory::Light, 16, 7, { 91, 199, 214, 195, 194, 42, 41 } }, { "TableStyleLight17", TableStyleCategory::Light, 17, 7, { 94, 200, 215, 195, 194, 48, 47 } }, { "TableStyleLight18", TableStyleCategory::Light, 18, 7, { 97, 201, 216, 195, 194, 55, 54 } }, { "TableStyleLight19", TableStyleCategory::Light, 19, 7, { 100, 202, 217, 195, 194, 61, 60 } }, { "TableStyleLight2", TableStyleCategory::Light, 2, 7, { 124, 222, 223, 221, 220, 42, 41 } }, { "TableStyleLight20", TableStyleCategory::Light, 20, 7, { 103, 203, 218, 195, 194, 68, 67 } }, { "TableStyleLight21", TableStyleCategory::Light, 21, 7, { 106, 204, 219, 195, 194, 74, 73 } }, { "TableStyleLight3", TableStyleCategory::Light, 3, 7, { 125, 226, 227, 225, 224, 48, 47 } }, { "TableStyleLight4", TableStyleCategory::Light, 4, 7, { 126, 230, 231, 229, 228, 55, 54 } }, { "TableStyleLight5", TableStyleCategory::Light, 5, 7, { 127, 234, 235, 233, 232, 61, 60 } }, { "TableStyleLight6", TableStyleCategory::Light, 6, 7, { 128, 238, 239, 237, 236, 68, 67 } }, { "TableStyleLight7", TableStyleCategory::Light, 7, 7, { 129, 242, 243, 241, 240, 74, 73 } }, { "TableStyleLight8", TableStyleCategory::Light, 8, 9, { 87, 132, 213, 195, 194, 14, 15, 0, 1 } }, { "TableStyleLight9", TableStyleCategory::Light, 9, 9, { 90, 145, 214, 195, 194, 16, 17, 2, 3 } }, { "TableStyleMedium1", TableStyleCategory::Medium, 1, 7, { 88, 132, 213, 195, 194, 33, 32 } }, { "TableStyleMedium10", TableStyleCategory::Medium, 10, 7, { 114, 156, 157, 153, 152, 46, 45 } }, { "TableStyleMedium11", TableStyleCategory::Medium, 11, 7, { 116, 165, 166, 162, 161, 52, 51 } }, { "TableStyleMedium12", TableStyleCategory::Medium, 12, 7, { 118, 174, 175, 171, 170, 59, 58 } }, { "TableStyleMedium13", TableStyleCategory::Medium, 13, 7, { 120, 183, 184, 180, 179, 65, 64 } }, { "TableStyleMedium14", TableStyleCategory::Medium, 14, 7, { 122, 192, 193, 189, 188, 72, 71 } }, { "TableStyleMedium15", TableStyleCategory::Medium, 15, 7, { 109, 134, 28, 131, 130, 33, 32 } }, { "TableStyleMedium16", TableStyleCategory::Medium, 16, 7, { 108, 146, 28, 144, 143, 33, 32 } }, { "TableStyleMedium17", TableStyleCategory::Medium, 17, 7, { 108, 155, 28, 153, 152, 33, 32 } }, { "TableStyleMedium18", TableStyleCategory::Medium, 18, 7, { 108, 164, 28, 162, 161, 33, 32 } }, { "TableStyleMedium19", TableStyleCategory::Medium, 19, 7, { 108, 173, 28, 171, 170, 33, 32 } }, { "TableStyleMedium2", TableStyleCategory::Medium, 2, 7, { 92, 145, 214, 195, 194, 42, 41 } }, { "TableStyleMedium20", TableStyleCategory::Medium, 20, 7, { 108, 182, 28, 180, 179, 33, 32 } }, { "TableStyleMedium21", TableStyleCategory::Medium, 21, 7, { 108, 191, 28, 189, 188, 33, 32 } }, { "TableStyleMedium22", TableStyleCategory::Medium, 22, 7, { 111, 196, 206, 195, 194, 30, 29 } }, { "TableStyleMedium23", TableStyleCategory::Medium, 23, 7, { 113, 196, 207, 195, 194, 39, 38 } }, { "TableStyleMedium24", TableStyleCategory::Medium, 24, 7, { 115, 196, 208, 195, 194, 46, 45 } }, { "TableStyleMedium25", TableStyleCategory::Medium, 25, 7, { 117, 196, 209, 195, 194, 52, 51 } }, { "TableStyleMedium26", TableStyleCategory::Medium, 26, 7, { 119, 196, 210, 195, 194, 59, 58 } }, { "TableStyleMedium27", TableStyleCategory::Medium, 27, 7, { 121, 196, 211, 195, 194, 65, 64 } }, { "TableStyleMedium28", TableStyleCategory::Medium, 28, 7, { 123, 196, 212, 195, 194, 72, 71 } }, { "TableStyleMedium3", TableStyleCategory::Medium, 3, 7, { 95, 154, 215, 195, 194, 48, 47 } }, { "TableStyleMedium4", TableStyleCategory::Medium, 4, 7, { 98, 163, 216, 195, 194, 55, 54 } }, { "TableStyleMedium5", TableStyleCategory::Medium, 5, 7, { 101, 172, 217, 195, 194, 61, 60 } }, { "TableStyleMedium6", TableStyleCategory::Medium, 6, 7, { 104, 181, 218, 195, 194, 68, 67 } }, { "TableStyleMedium7", TableStyleCategory::Medium, 7, 7, { 107, 190, 219, 195, 194, 74, 73 } }, { "TableStyleMedium8", TableStyleCategory::Medium, 8, 7, { 110, 135, 136, 131, 130, 30, 29 } }, { "TableStyleMedium9", TableStyleCategory::Medium, 9, 7, { 112, 147, 148, 144, 143, 39, 38 } } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/workben/generate_ooxml_tablestyle_info.py b/sc/workben/generate_ooxml_tablestyle_info.py index 828f76e0fd37..6385c0daa3a5 100644 --- a/sc/workben/generate_ooxml_tablestyle_info.py +++ b/sc/workben/generate_ooxml_tablestyle_info.py @@ -1,3 +1,5 @@ +import re + import click import xml.etree.ElementTree as ET from dataclasses import dataclass @@ -303,6 +305,9 @@ def parse_table_style(style) -> TableStyle: elif table_style_name == "TableStyleDark4 ": # Trim unintended trailing space table_style_name = "TableStyleDark4" + elif table_style_name == "TableStyleLight14 ": + # Trim unintended trailing space + table_style_name = "TableStyleLight14" return TableStyle(table_style_name, [parse_table_style_element(element, style_defs) for element in list(tableStyle)]) @@ -559,14 +564,19 @@ def dump_table_styles(table_styles: list[TableStyle], output_path: str): for table_style in sorted(table_styles): table_style_element_ids = ", ".join([f"{table_style_element_map[element]}" for element in table_style.elements]) table_style_element_str = f"{{ {table_style_element_ids} }}" - output.append(f"{{ \"{table_style.name}\", {len(table_style.elements)}, {table_style_element_str} }}") + # Extract category and number from the style name (e.g. "TableStyleLight1" -> Light, 1) + m = re.match(r"^TableStyle(Light|Medium|Dark)(\d+)\s*$", table_style.name) + assert m, f"Unexpected table style name: {table_style.name}" + category = f"TableStyleCategory::{m.group(1)}" + number = m.group(2) + output.append(f"{{ \"{table_style.name}\", {category}, {number}, {len(table_style.elements)}, {table_style_element_str} }}") output_str = ", ".join(output) table_style_str = f"constexpr TableStyle aTableStyles[] = {{ {output_str} }};\n" content.append(table_style_str) content.append(footer) - with open(output_path, "w") as f: + with open(output_path, "w", newline="\n") as f: f.write("\n".join(content))