Line data Source code
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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #include <TDefTableHandler.hxx>
20 : #include <PropertyMap.hxx>
21 : #include <ConversionHelper.hxx>
22 : #include <ooxml/resourceids.hxx>
23 : #include <filter/msfilter/util.hxx>
24 : #include <com/sun/star/table/BorderLine2.hpp>
25 : #include <com/sun/star/text/TableColumnSeparator.hpp>
26 : #include <com/sun/star/text/VertOrientation.hpp>
27 :
28 : namespace writerfilter {
29 : namespace dmapper {
30 :
31 : using namespace ::com::sun::star;
32 :
33 :
34 :
35 6462 : TDefTableHandler::TDefTableHandler() :
36 : LoggedProperties("TDefTableHandler"),
37 : m_nLineWidth(0),
38 : m_nLineType(0),
39 : m_nLineColor(0),
40 6462 : m_nLineDistance(0)
41 : {
42 6462 : }
43 :
44 :
45 12924 : TDefTableHandler::~TDefTableHandler()
46 : {
47 12924 : }
48 :
49 31809 : OUString TDefTableHandler::getBorderTypeString(sal_Int32 nType)
50 : {
51 31809 : switch (nType)
52 : {
53 3472 : case NS_ooxml::LN_Value_ST_Border_nil: return OUString("nil");
54 4673 : case NS_ooxml::LN_Value_ST_Border_none: return OUString("none");
55 22892 : case NS_ooxml::LN_Value_ST_Border_single: return OUString("single");
56 0 : case NS_ooxml::LN_Value_ST_Border_thick: return OUString("thick");
57 182 : case NS_ooxml::LN_Value_ST_Border_double: return OUString("double");
58 4 : case NS_ooxml::LN_Value_ST_Border_dotted: return OUString("dotted");
59 24 : case NS_ooxml::LN_Value_ST_Border_dashed: return OUString("dashed");
60 0 : case NS_ooxml::LN_Value_ST_Border_dotDash: return OUString("dotDash");
61 0 : case NS_ooxml::LN_Value_ST_Border_dotDotDash: return OUString("dotDotDash");
62 0 : case NS_ooxml::LN_Value_ST_Border_triple: return OUString("triple");
63 17 : case NS_ooxml::LN_Value_ST_Border_thinThickSmallGap: return OUString("thinThickSmallGap");
64 34 : case NS_ooxml::LN_Value_ST_Border_thickThinSmallGap: return OUString("thickThinSmallGap");
65 0 : case NS_ooxml::LN_Value_ST_Border_thinThickThinSmallGap: return OUString("thinThickThinSmallGap");
66 4 : case NS_ooxml::LN_Value_ST_Border_thinThickMediumGap: return OUString("thinThickMediumGap");
67 19 : case NS_ooxml::LN_Value_ST_Border_thickThinMediumGap: return OUString("thickThinMediumGap");
68 0 : case NS_ooxml::LN_Value_ST_Border_thinThickThinMediumGap: return OUString("thinThickThinMediumGap");
69 12 : case NS_ooxml::LN_Value_ST_Border_thinThickLargeGap: return OUString("thinThickLargeGap");
70 69 : case NS_ooxml::LN_Value_ST_Border_thickThinLargeGap: return OUString("thickThinLargeGap");
71 0 : case NS_ooxml::LN_Value_ST_Border_thinThickThinLargeGap: return OUString("thinThickThinLargeGap");
72 0 : case NS_ooxml::LN_Value_ST_Border_wave: return OUString("wave");
73 0 : case NS_ooxml::LN_Value_ST_Border_doubleWave: return OUString("doubleWave");
74 66 : case NS_ooxml::LN_Value_ST_Border_dashSmallGap: return OUString("dashSmallGap");
75 0 : case NS_ooxml::LN_Value_ST_Border_dashDotStroked: return OUString("dashDotStroked");
76 16 : case NS_ooxml::LN_Value_ST_Border_threeDEmboss: return OUString("threeDEmboss");
77 16 : case NS_ooxml::LN_Value_ST_Border_threeDEngrave: return OUString("threeDEngrave");
78 182 : case NS_ooxml::LN_Value_ST_Border_outset: return OUString("outset");
79 79 : case NS_ooxml::LN_Value_ST_Border_inset: return OUString("inset");
80 0 : case NS_ooxml::LN_Value_ST_Border_apples: return OUString("apples");
81 0 : case NS_ooxml::LN_Value_ST_Border_archedScallops: return OUString("archedScallops");
82 0 : case NS_ooxml::LN_Value_ST_Border_babyPacifier: return OUString("babyPacifier");
83 0 : case NS_ooxml::LN_Value_ST_Border_babyRattle: return OUString("babyRattle");
84 0 : case NS_ooxml::LN_Value_ST_Border_balloons3Colors: return OUString("balloons3Colors");
85 0 : case NS_ooxml::LN_Value_ST_Border_balloonsHotAir: return OUString("balloonsHotAir");
86 0 : case NS_ooxml::LN_Value_ST_Border_basicBlackDashes: return OUString("basicBlackDashes");
87 0 : case NS_ooxml::LN_Value_ST_Border_basicBlackDots: return OUString("basicBlackDots");
88 0 : case NS_ooxml::LN_Value_ST_Border_basicBlackSquares: return OUString("basicBlackSquares");
89 0 : case NS_ooxml::LN_Value_ST_Border_basicThinLines: return OUString("basicThinLines");
90 0 : case NS_ooxml::LN_Value_ST_Border_basicWhiteDashes: return OUString("basicWhiteDashes");
91 0 : case NS_ooxml::LN_Value_ST_Border_basicWhiteDots: return OUString("basicWhiteDots");
92 0 : case NS_ooxml::LN_Value_ST_Border_basicWhiteSquares: return OUString("basicWhiteSquares");
93 0 : case NS_ooxml::LN_Value_ST_Border_basicWideInline: return OUString("basicWideInline");
94 0 : case NS_ooxml::LN_Value_ST_Border_basicWideMidline: return OUString("basicWideMidline");
95 0 : case NS_ooxml::LN_Value_ST_Border_basicWideOutline: return OUString("basicWideOutline");
96 0 : case NS_ooxml::LN_Value_ST_Border_bats: return OUString("bats");
97 0 : case NS_ooxml::LN_Value_ST_Border_birds: return OUString("birds");
98 0 : case NS_ooxml::LN_Value_ST_Border_birdsFlight: return OUString("birdsFlight");
99 0 : case NS_ooxml::LN_Value_ST_Border_cabins: return OUString("cabins");
100 0 : case NS_ooxml::LN_Value_ST_Border_cakeSlice: return OUString("cakeSlice");
101 0 : case NS_ooxml::LN_Value_ST_Border_candyCorn: return OUString("candyCorn");
102 0 : case NS_ooxml::LN_Value_ST_Border_celticKnotwork: return OUString("celticKnotwork");
103 0 : case NS_ooxml::LN_Value_ST_Border_certificateBanner: return OUString("certificateBanner");
104 0 : case NS_ooxml::LN_Value_ST_Border_chainLink: return OUString("chainLink");
105 0 : case NS_ooxml::LN_Value_ST_Border_champagneBottle: return OUString("champagneBottle");
106 0 : case NS_ooxml::LN_Value_ST_Border_checkedBarBlack: return OUString("checkedBarBlack");
107 0 : case NS_ooxml::LN_Value_ST_Border_checkedBarColor: return OUString("checkedBarColor");
108 0 : case NS_ooxml::LN_Value_ST_Border_checkered: return OUString("checkered");
109 0 : case NS_ooxml::LN_Value_ST_Border_christmasTree: return OUString("christmasTree");
110 0 : case NS_ooxml::LN_Value_ST_Border_circlesLines: return OUString("circlesLines");
111 0 : case NS_ooxml::LN_Value_ST_Border_circlesRectangles: return OUString("circlesRectangles");
112 0 : case NS_ooxml::LN_Value_ST_Border_classicalWave: return OUString("classicalWave");
113 0 : case NS_ooxml::LN_Value_ST_Border_clocks: return OUString("clocks");
114 0 : case NS_ooxml::LN_Value_ST_Border_compass: return OUString("compass");
115 0 : case NS_ooxml::LN_Value_ST_Border_confetti: return OUString("confetti");
116 0 : case NS_ooxml::LN_Value_ST_Border_confettiGrays: return OUString("confettiGrays");
117 0 : case NS_ooxml::LN_Value_ST_Border_confettiOutline: return OUString("confettiOutline");
118 0 : case NS_ooxml::LN_Value_ST_Border_confettiStreamers: return OUString("confettiStreamers");
119 0 : case NS_ooxml::LN_Value_ST_Border_confettiWhite: return OUString("confettiWhite");
120 0 : case NS_ooxml::LN_Value_ST_Border_cornerTriangles: return OUString("cornerTriangles");
121 0 : case NS_ooxml::LN_Value_ST_Border_couponCutoutDashes: return OUString("couponCutoutDashes");
122 0 : case NS_ooxml::LN_Value_ST_Border_couponCutoutDots: return OUString("couponCutoutDots");
123 0 : case NS_ooxml::LN_Value_ST_Border_crazyMaze: return OUString("crazyMaze");
124 0 : case NS_ooxml::LN_Value_ST_Border_creaturesButterfly: return OUString("creaturesButterfly");
125 0 : case NS_ooxml::LN_Value_ST_Border_creaturesFish: return OUString("creaturesFish");
126 0 : case NS_ooxml::LN_Value_ST_Border_creaturesInsects: return OUString("creaturesInsects");
127 0 : case NS_ooxml::LN_Value_ST_Border_creaturesLadyBug: return OUString("creaturesLadyBug");
128 0 : case NS_ooxml::LN_Value_ST_Border_crossStitch: return OUString("crossStitch");
129 0 : case NS_ooxml::LN_Value_ST_Border_cup: return OUString("cup");
130 0 : case NS_ooxml::LN_Value_ST_Border_decoArch: return OUString("decoArch");
131 0 : case NS_ooxml::LN_Value_ST_Border_decoArchColor: return OUString("decoArchColor");
132 0 : case NS_ooxml::LN_Value_ST_Border_decoBlocks: return OUString("decoBlocks");
133 0 : case NS_ooxml::LN_Value_ST_Border_diamondsGray: return OUString("diamondsGray");
134 0 : case NS_ooxml::LN_Value_ST_Border_doubleD: return OUString("doubleD");
135 0 : case NS_ooxml::LN_Value_ST_Border_doubleDiamonds: return OUString("doubleDiamonds");
136 0 : case NS_ooxml::LN_Value_ST_Border_earth1: return OUString("earth1");
137 0 : case NS_ooxml::LN_Value_ST_Border_earth2: return OUString("earth2");
138 0 : case NS_ooxml::LN_Value_ST_Border_eclipsingSquares1: return OUString("eclipsingSquares1");
139 0 : case NS_ooxml::LN_Value_ST_Border_eclipsingSquares2: return OUString("eclipsingSquares2");
140 0 : case NS_ooxml::LN_Value_ST_Border_eggsBlack: return OUString("eggsBlack");
141 0 : case NS_ooxml::LN_Value_ST_Border_fans: return OUString("fans");
142 0 : case NS_ooxml::LN_Value_ST_Border_film: return OUString("film");
143 0 : case NS_ooxml::LN_Value_ST_Border_firecrackers: return OUString("firecrackers");
144 0 : case NS_ooxml::LN_Value_ST_Border_flowersBlockPrint: return OUString("flowersBlockPrint");
145 0 : case NS_ooxml::LN_Value_ST_Border_flowersDaisies: return OUString("flowersDaisies");
146 0 : case NS_ooxml::LN_Value_ST_Border_flowersModern1: return OUString("flowersModern1");
147 0 : case NS_ooxml::LN_Value_ST_Border_flowersModern2: return OUString("flowersModern2");
148 0 : case NS_ooxml::LN_Value_ST_Border_flowersPansy: return OUString("flowersPansy");
149 0 : case NS_ooxml::LN_Value_ST_Border_flowersRedRose: return OUString("flowersRedRose");
150 0 : case NS_ooxml::LN_Value_ST_Border_flowersRoses: return OUString("flowersRoses");
151 0 : case NS_ooxml::LN_Value_ST_Border_flowersTeacup: return OUString("flowersTeacup");
152 0 : case NS_ooxml::LN_Value_ST_Border_flowersTiny: return OUString("flowersTiny");
153 0 : case NS_ooxml::LN_Value_ST_Border_gems: return OUString("gems");
154 0 : case NS_ooxml::LN_Value_ST_Border_gingerbreadMan: return OUString("gingerbreadMan");
155 0 : case NS_ooxml::LN_Value_ST_Border_gradient: return OUString("gradient");
156 0 : case NS_ooxml::LN_Value_ST_Border_handmade1: return OUString("handmade1");
157 0 : case NS_ooxml::LN_Value_ST_Border_handmade2: return OUString("handmade2");
158 0 : case NS_ooxml::LN_Value_ST_Border_heartBalloon: return OUString("heartBalloon");
159 0 : case NS_ooxml::LN_Value_ST_Border_heartGray: return OUString("heartGray");
160 0 : case NS_ooxml::LN_Value_ST_Border_hearts: return OUString("hearts");
161 0 : case NS_ooxml::LN_Value_ST_Border_heebieJeebies: return OUString("heebieJeebies");
162 0 : case NS_ooxml::LN_Value_ST_Border_holly: return OUString("holly");
163 0 : case NS_ooxml::LN_Value_ST_Border_houseFunky: return OUString("houseFunky");
164 0 : case NS_ooxml::LN_Value_ST_Border_hypnotic: return OUString("hypnotic");
165 0 : case NS_ooxml::LN_Value_ST_Border_iceCreamCones: return OUString("iceCreamCones");
166 0 : case NS_ooxml::LN_Value_ST_Border_lightBulb: return OUString("lightBulb");
167 0 : case NS_ooxml::LN_Value_ST_Border_lightning1: return OUString("lightning1");
168 0 : case NS_ooxml::LN_Value_ST_Border_lightning2: return OUString("lightning2");
169 0 : case NS_ooxml::LN_Value_ST_Border_mapPins: return OUString("mapPins");
170 0 : case NS_ooxml::LN_Value_ST_Border_mapleLeaf: return OUString("mapleLeaf");
171 0 : case NS_ooxml::LN_Value_ST_Border_mapleMuffins: return OUString("mapleMuffins");
172 0 : case NS_ooxml::LN_Value_ST_Border_marquee: return OUString("marquee");
173 0 : case NS_ooxml::LN_Value_ST_Border_marqueeToothed: return OUString("marqueeToothed");
174 0 : case NS_ooxml::LN_Value_ST_Border_moons: return OUString("moons");
175 0 : case NS_ooxml::LN_Value_ST_Border_mosaic: return OUString("mosaic");
176 0 : case NS_ooxml::LN_Value_ST_Border_musicNotes: return OUString("musicNotes");
177 0 : case NS_ooxml::LN_Value_ST_Border_northwest: return OUString("northwest");
178 0 : case NS_ooxml::LN_Value_ST_Border_ovals: return OUString("ovals");
179 0 : case NS_ooxml::LN_Value_ST_Border_packages: return OUString("packages");
180 0 : case NS_ooxml::LN_Value_ST_Border_palmsBlack: return OUString("palmsBlack");
181 0 : case NS_ooxml::LN_Value_ST_Border_palmsColor: return OUString("palmsColor");
182 0 : case NS_ooxml::LN_Value_ST_Border_paperClips: return OUString("paperClips");
183 0 : case NS_ooxml::LN_Value_ST_Border_papyrus: return OUString("papyrus");
184 0 : case NS_ooxml::LN_Value_ST_Border_partyFavor: return OUString("partyFavor");
185 0 : case NS_ooxml::LN_Value_ST_Border_partyGlass: return OUString("partyGlass");
186 0 : case NS_ooxml::LN_Value_ST_Border_pencils: return OUString("pencils");
187 0 : case NS_ooxml::LN_Value_ST_Border_people: return OUString("people");
188 0 : case NS_ooxml::LN_Value_ST_Border_peopleWaving: return OUString("peopleWaving");
189 0 : case NS_ooxml::LN_Value_ST_Border_peopleHats: return OUString("peopleHats");
190 0 : case NS_ooxml::LN_Value_ST_Border_poinsettias: return OUString("poinsettias");
191 0 : case NS_ooxml::LN_Value_ST_Border_postageStamp: return OUString("postageStamp");
192 0 : case NS_ooxml::LN_Value_ST_Border_pumpkin1: return OUString("pumpkin1");
193 0 : case NS_ooxml::LN_Value_ST_Border_pushPinNote2: return OUString("pushPinNote2");
194 0 : case NS_ooxml::LN_Value_ST_Border_pushPinNote1: return OUString("pushPinNote1");
195 0 : case NS_ooxml::LN_Value_ST_Border_pyramids: return OUString("pyramids");
196 0 : case NS_ooxml::LN_Value_ST_Border_pyramidsAbove: return OUString("pyramidsAbove");
197 0 : case NS_ooxml::LN_Value_ST_Border_quadrants: return OUString("quadrants");
198 0 : case NS_ooxml::LN_Value_ST_Border_rings: return OUString("rings");
199 0 : case NS_ooxml::LN_Value_ST_Border_safari: return OUString("safari");
200 0 : case NS_ooxml::LN_Value_ST_Border_sawtooth: return OUString("sawtooth");
201 0 : case NS_ooxml::LN_Value_ST_Border_sawtoothGray: return OUString("sawtoothGray");
202 0 : case NS_ooxml::LN_Value_ST_Border_scaredCat: return OUString("scaredCat");
203 0 : case NS_ooxml::LN_Value_ST_Border_seattle: return OUString("seattle");
204 0 : case NS_ooxml::LN_Value_ST_Border_shadowedSquares: return OUString("shadowedSquares");
205 0 : case NS_ooxml::LN_Value_ST_Border_sharksTeeth: return OUString("sharksTeeth");
206 0 : case NS_ooxml::LN_Value_ST_Border_shorebirdTracks: return OUString("shorebirdTracks");
207 0 : case NS_ooxml::LN_Value_ST_Border_skyrocket: return OUString("skyrocket");
208 0 : case NS_ooxml::LN_Value_ST_Border_snowflakeFancy: return OUString("snowflakeFancy");
209 0 : case NS_ooxml::LN_Value_ST_Border_snowflakes: return OUString("snowflakes");
210 0 : case NS_ooxml::LN_Value_ST_Border_sombrero: return OUString("sombrero");
211 0 : case NS_ooxml::LN_Value_ST_Border_southwest: return OUString("southwest");
212 0 : case NS_ooxml::LN_Value_ST_Border_stars: return OUString("stars");
213 0 : case NS_ooxml::LN_Value_ST_Border_starsTop: return OUString("starsTop");
214 0 : case NS_ooxml::LN_Value_ST_Border_stars3d: return OUString("stars3d");
215 0 : case NS_ooxml::LN_Value_ST_Border_starsBlack: return OUString("starsBlack");
216 0 : case NS_ooxml::LN_Value_ST_Border_starsShadowed: return OUString("starsShadowed");
217 0 : case NS_ooxml::LN_Value_ST_Border_sun: return OUString("sun");
218 0 : case NS_ooxml::LN_Value_ST_Border_swirligig: return OUString("swirligig");
219 0 : case NS_ooxml::LN_Value_ST_Border_tornPaper: return OUString("tornPaper");
220 0 : case NS_ooxml::LN_Value_ST_Border_tornPaperBlack: return OUString("tornPaperBlack");
221 0 : case NS_ooxml::LN_Value_ST_Border_trees: return OUString("trees");
222 0 : case NS_ooxml::LN_Value_ST_Border_triangleParty: return OUString("triangleParty");
223 0 : case NS_ooxml::LN_Value_ST_Border_triangles: return OUString("triangles");
224 0 : case NS_ooxml::LN_Value_ST_Border_tribal1: return OUString("tribal1");
225 0 : case NS_ooxml::LN_Value_ST_Border_tribal2: return OUString("tribal2");
226 0 : case NS_ooxml::LN_Value_ST_Border_tribal3: return OUString("tribal3");
227 0 : case NS_ooxml::LN_Value_ST_Border_tribal4: return OUString("tribal4");
228 0 : case NS_ooxml::LN_Value_ST_Border_tribal5: return OUString("tribal5");
229 0 : case NS_ooxml::LN_Value_ST_Border_tribal6: return OUString("tribal6");
230 0 : case NS_ooxml::LN_Value_ST_Border_twistedLines1: return OUString("twistedLines1");
231 0 : case NS_ooxml::LN_Value_ST_Border_twistedLines2: return OUString("twistedLines2");
232 0 : case NS_ooxml::LN_Value_ST_Border_vine: return OUString("vine");
233 0 : case NS_ooxml::LN_Value_ST_Border_waveline: return OUString("waveline");
234 0 : case NS_ooxml::LN_Value_ST_Border_weavingAngles: return OUString("weavingAngles");
235 0 : case NS_ooxml::LN_Value_ST_Border_weavingBraid: return OUString("weavingBraid");
236 0 : case NS_ooxml::LN_Value_ST_Border_weavingRibbon: return OUString("weavingRibbon");
237 0 : case NS_ooxml::LN_Value_ST_Border_weavingStrips: return OUString("weavingStrips");
238 0 : case NS_ooxml::LN_Value_ST_Border_whiteFlowers: return OUString("whiteFlowers");
239 0 : case NS_ooxml::LN_Value_ST_Border_woodwork: return OUString("woodwork");
240 0 : case NS_ooxml::LN_Value_ST_Border_xIllusions: return OUString("xIllusions");
241 0 : case NS_ooxml::LN_Value_ST_Border_zanyTriangles: return OUString("zanyTriangles");
242 0 : case NS_ooxml::LN_Value_ST_Border_zigZag: return OUString("zigZag");
243 0 : case NS_ooxml::LN_Value_ST_Border_zigZagStitch: return OUString("zigZagStitch");
244 48 : default: break;
245 : }
246 48 : return OUString();
247 : }
248 :
249 4489 : OUString TDefTableHandler::getThemeColorTypeString(sal_Int32 nType)
250 : {
251 4489 : switch (nType)
252 : {
253 2 : case NS_ooxml::LN_Value_St_ThemeColor_dark1: return OUString("dark1");
254 0 : case NS_ooxml::LN_Value_St_ThemeColor_light1: return OUString("light1");
255 0 : case NS_ooxml::LN_Value_St_ThemeColor_dark2: return OUString("dark2");
256 0 : case NS_ooxml::LN_Value_St_ThemeColor_light2: return OUString("light2");
257 1310 : case NS_ooxml::LN_Value_St_ThemeColor_accent1: return OUString("accent1");
258 353 : case NS_ooxml::LN_Value_St_ThemeColor_accent2: return OUString("accent2");
259 219 : case NS_ooxml::LN_Value_St_ThemeColor_accent3: return OUString("accent3");
260 132 : case NS_ooxml::LN_Value_St_ThemeColor_accent4: return OUString("accent4");
261 65 : case NS_ooxml::LN_Value_St_ThemeColor_accent5: return OUString("accent5");
262 249 : case NS_ooxml::LN_Value_St_ThemeColor_accent6: return OUString("accent6");
263 121 : case NS_ooxml::LN_Value_St_ThemeColor_hyperlink: return OUString("hyperlink");
264 37 : case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink: return OUString("followedHyperlink");
265 0 : case NS_ooxml::LN_Value_St_ThemeColor_none: return OUString("none");
266 838 : case NS_ooxml::LN_Value_St_ThemeColor_background1: return OUString("background1");
267 877 : case NS_ooxml::LN_Value_St_ThemeColor_text1: return OUString("text1");
268 3 : case NS_ooxml::LN_Value_St_ThemeColor_background2: return OUString("background2");
269 283 : case NS_ooxml::LN_Value_St_ThemeColor_text2: return OUString("text2");
270 0 : default: break;
271 : }
272 0 : return OUString();
273 : }
274 :
275 67598 : void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
276 : {
277 67598 : sal_Int32 nIntValue = rVal.getInt();
278 : (void)nIntValue;
279 : (void)rName;
280 67598 : switch( rName )
281 : {
282 : case NS_ooxml::LN_CT_Border_sz:
283 : // width of a single line in 1/8 pt, max of 32 pt -> twip * 5 / 2.
284 15900 : m_nLineWidth = nIntValue * 5 / 2;
285 15900 : appendGrabBag("sz", OUString::number(nIntValue));
286 15900 : break;
287 : case NS_ooxml::LN_CT_Border_val:
288 19895 : m_nLineType = nIntValue;
289 19895 : appendGrabBag("val", TDefTableHandler::getBorderTypeString(nIntValue));
290 19895 : break;
291 : case NS_ooxml::LN_CT_Border_color:
292 15697 : appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true)));
293 15697 : m_nLineColor = nIntValue;
294 15697 : break;
295 : case NS_ooxml::LN_CT_Border_space:
296 15489 : appendGrabBag("space", OUString::number(nIntValue));
297 15489 : m_nLineDistance = nIntValue;
298 15489 : break;
299 : case NS_ooxml::LN_CT_Border_shadow:
300 : //if 1 then line has shadow - unsupported
301 : case NS_ooxml::LN_CT_Border_frame:
302 : // ignored
303 0 : break;
304 : case NS_ooxml::LN_CT_Border_themeColor:
305 545 : appendGrabBag("themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
306 545 : break;
307 : case NS_ooxml::LN_CT_Border_themeTint:
308 : case NS_ooxml::LN_CT_Border_themeShade:
309 : // ignored
310 72 : break;
311 : default:
312 : OSL_FAIL("unknown attribute");
313 : }
314 67598 : }
315 :
316 :
317 20082 : void TDefTableHandler::localResolve(Id rName, writerfilter::Reference<Properties>::Pointer_t pProperties)
318 : {
319 20082 : if( pProperties.get())
320 : {
321 20082 : m_nLineWidth = m_nLineType = m_nLineColor = m_nLineDistance = 0;
322 20082 : std::vector<beans::PropertyValue> aSavedGrabBag;
323 20082 : if (!m_aInteropGrabBagName.isEmpty())
324 : {
325 6442 : aSavedGrabBag = m_aInteropGrabBag;
326 6442 : m_aInteropGrabBag.clear();
327 : }
328 20082 : pProperties->resolve( *this );
329 20082 : table::BorderLine2 aBorderLine;
330 20082 : ConversionHelper::MakeBorderLine(m_nLineWidth, m_nLineType, m_nLineColor, aBorderLine, /*bIsOOXML=*/true);
331 20082 : const bool rtl = false; // TODO
332 20082 : switch( rName )
333 : {
334 : case NS_ooxml::LN_CT_TcBorders_top:
335 3601 : m_aTopBorderLines.push_back(aBorderLine);
336 3601 : if (!m_aInteropGrabBagName.isEmpty())
337 622 : aSavedGrabBag.push_back(getInteropGrabBag("top"));
338 3601 : break;
339 : case NS_ooxml::LN_CT_TcBorders_start:
340 : if( rtl )
341 : m_aRightBorderLines.push_back(aBorderLine);
342 : else
343 699 : m_aLeftBorderLines.push_back(aBorderLine);
344 699 : if (!m_aInteropGrabBagName.isEmpty())
345 0 : aSavedGrabBag.push_back(getInteropGrabBag("start"));
346 699 : break;
347 : case NS_ooxml::LN_CT_TcBorders_left:
348 2454 : m_aLeftBorderLines.push_back(aBorderLine);
349 2454 : if (!m_aInteropGrabBagName.isEmpty())
350 473 : aSavedGrabBag.push_back(getInteropGrabBag("left"));
351 2454 : break;
352 : case NS_ooxml::LN_CT_TcBorders_bottom:
353 3906 : m_aBottomBorderLines.push_back(aBorderLine);
354 3906 : if (!m_aInteropGrabBagName.isEmpty())
355 671 : aSavedGrabBag.push_back(getInteropGrabBag("bottom"));
356 3906 : break;
357 : case NS_ooxml::LN_CT_TcBorders_end:
358 : if( rtl )
359 : m_aLeftBorderLines.push_back(aBorderLine);
360 : else
361 724 : m_aRightBorderLines.push_back(aBorderLine);
362 724 : if (!m_aInteropGrabBagName.isEmpty())
363 0 : aSavedGrabBag.push_back(getInteropGrabBag("end"));
364 724 : break;
365 : case NS_ooxml::LN_CT_TcBorders_right:
366 2495 : m_aRightBorderLines.push_back(aBorderLine);
367 2495 : if (!m_aInteropGrabBagName.isEmpty())
368 528 : aSavedGrabBag.push_back(getInteropGrabBag("right"));
369 2495 : break;
370 : case NS_ooxml::LN_CT_TcBorders_insideH:
371 1457 : m_aInsideHBorderLines.push_back(aBorderLine);
372 1457 : if (!m_aInteropGrabBagName.isEmpty())
373 289 : aSavedGrabBag.push_back(getInteropGrabBag("insideH"));
374 1457 : break;
375 : case NS_ooxml::LN_CT_TcBorders_insideV:
376 1182 : m_aInsideVBorderLines.push_back(aBorderLine);
377 1182 : if (!m_aInteropGrabBagName.isEmpty())
378 295 : aSavedGrabBag.push_back(getInteropGrabBag("insideV"));
379 1182 : break;
380 : case NS_ooxml::LN_CT_TcBorders_tl2br:
381 1782 : if (!m_aInteropGrabBagName.isEmpty())
382 1782 : aSavedGrabBag.push_back(getInteropGrabBag("tl2br"));
383 1782 : break;
384 : case NS_ooxml::LN_CT_TcBorders_tr2bl:
385 1782 : if (!m_aInteropGrabBagName.isEmpty())
386 1782 : aSavedGrabBag.push_back(getInteropGrabBag("tr2bl"));
387 1782 : break;
388 : default:;
389 : }
390 20082 : if (!m_aInteropGrabBagName.isEmpty())
391 6442 : m_aInteropGrabBag = aSavedGrabBag;
392 : }
393 20082 : }
394 :
395 :
396 20082 : void TDefTableHandler::lcl_sprm(Sprm & rSprm)
397 : {
398 20082 : switch( rSprm.getId() )
399 : {
400 : case NS_ooxml::LN_CT_TcBorders_top:
401 : case NS_ooxml::LN_CT_TcBorders_left:
402 : case NS_ooxml::LN_CT_TcBorders_start:
403 : case NS_ooxml::LN_CT_TcBorders_bottom:
404 : case NS_ooxml::LN_CT_TcBorders_right:
405 : case NS_ooxml::LN_CT_TcBorders_end:
406 : case NS_ooxml::LN_CT_TcBorders_insideH:
407 : case NS_ooxml::LN_CT_TcBorders_insideV:
408 : case NS_ooxml::LN_CT_TcBorders_tl2br:
409 : case NS_ooxml::LN_CT_TcBorders_tr2bl:
410 : {
411 20082 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
412 20082 : localResolve( rSprm.getId(), pProperties );
413 : }
414 20082 : break;
415 : default:;
416 : }
417 20082 : }
418 :
419 6462 : void TDefTableHandler::fillCellProperties(
420 : size_t nCell, ::std::shared_ptr< TablePropertyMap > pCellProperties ) const
421 : {
422 6462 : if( m_aCellBorderPositions.size() > nCell )
423 : {
424 0 : sal_Int16 nVertOrient = text::VertOrientation::NONE;
425 0 : switch( m_aCellVertAlign[nCell] ) //0 - top 1 - center 2 - bottom
426 : {
427 0 : case 1: nVertOrient = text::VertOrientation::CENTER; break;
428 0 : case 2: nVertOrient = text::VertOrientation::BOTTOM; break;
429 : default:;
430 : }
431 0 : pCellProperties->Insert( PROP_VERT_ORIENT, uno::makeAny( nVertOrient ) );
432 : }
433 6462 : if( m_aTopBorderLines.size() > nCell )
434 3601 : pCellProperties->Insert( PROP_TOP_BORDER, uno::makeAny( m_aTopBorderLines[nCell] ) );
435 6462 : if( m_aLeftBorderLines.size() > nCell )
436 3153 : pCellProperties->Insert( PROP_LEFT_BORDER, uno::makeAny( m_aLeftBorderLines[nCell] ) );
437 6462 : if( m_aBottomBorderLines.size() > nCell )
438 3906 : pCellProperties->Insert( PROP_BOTTOM_BORDER, uno::makeAny( m_aBottomBorderLines[nCell] ) );
439 6462 : if( m_aRightBorderLines.size() > nCell )
440 3219 : pCellProperties->Insert( PROP_RIGHT_BORDER, uno::makeAny( m_aRightBorderLines[nCell] ) );
441 6462 : if( m_aInsideHBorderLines.size() > nCell )
442 1457 : pCellProperties->Insert( META_PROP_HORIZONTAL_BORDER, uno::makeAny( m_aInsideHBorderLines[nCell] ) );
443 6462 : if( m_aInsideVBorderLines.size() > nCell )
444 1182 : pCellProperties->Insert( META_PROP_VERTICAL_BORDER, uno::makeAny( m_aInsideVBorderLines[nCell] ) );
445 6462 : }
446 :
447 :
448 2167 : void TDefTableHandler::enableInteropGrabBag(const OUString& aName)
449 : {
450 2167 : m_aInteropGrabBagName = aName;
451 2167 : }
452 :
453 8609 : beans::PropertyValue TDefTableHandler::getInteropGrabBag(const OUString& aName)
454 : {
455 8609 : beans::PropertyValue aRet;
456 8609 : if (aName.isEmpty())
457 2167 : aRet.Name = m_aInteropGrabBagName;
458 : else
459 6442 : aRet.Name = aName;
460 :
461 17218 : uno::Sequence<beans::PropertyValue> aSeq(m_aInteropGrabBag.size());
462 8609 : beans::PropertyValue* pSeq = aSeq.getArray();
463 38134 : for (std::vector<beans::PropertyValue>::iterator i = m_aInteropGrabBag.begin(); i != m_aInteropGrabBag.end(); ++i)
464 29525 : *pSeq++ = *i;
465 8609 : m_aInteropGrabBag.clear();
466 :
467 8609 : aRet.Value = uno::makeAny(aSeq);
468 17218 : return aRet;
469 : }
470 :
471 67526 : void TDefTableHandler::appendGrabBag(const OUString& aKey, const OUString& aValue)
472 : {
473 67526 : beans::PropertyValue aProperty;
474 67526 : aProperty.Name = aKey;
475 67526 : aProperty.Value = uno::makeAny(aValue);
476 67526 : m_aInteropGrabBag.push_back(aProperty);
477 67526 : }
478 :
479 : } //namespace dmapper
480 : } //namespace writerfilter
481 :
482 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|