LibreOffice Module lotuswordpro (master) 1
xfutil.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 *
31 *
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
38 *
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
56/*************************************************************************
57 * @file
58 * Util functions for xml filter.
59 ************************************************************************/
60#include <xfilter/xfutil.hxx>
61
62OUString GetTableColName(sal_Int32 col)
63{
64 int remain = 0;
65 char ch;
66 std::string strOut;
67
68 if( col <= 26 )
69 {
70 ch = 'A' + col -1;
71 strOut += ch;
72 return OUString::createFromAscii(strOut);
73 }
74
75 while( col>26 )
76 {
77 remain = col%26;
78 col = col/26;
79 ch = 'A' + remain -1;
80 strOut += ch;
81 }
82
83 ch = 'A' + remain -1;
84 strOut += ch;
85 return OUString::createFromAscii(strOut);
86}
87
88//tool functions:
90{
91 switch(type)
92 {
94 return "none";
96 return "single";
98 return "double";
100 return "dotted";
102 return "dash";
104 return "long-dash";
106 return "dot-dash";
108 return "dot-dot-dash";
110 return "wave";
112 return "bold";
114 return "bold-dotted";
116 return "bold-dash";
118 return "bold-long-dash";
120 return "bold-dot-dash";
122 return "bold-dot-dot-dash";
124 return "bold-wave";
126 return "double-wave";
128 return "small-wave";
129 }
130 return OUString();
131}
132
134{
135 switch(type)
136 {
138 return "single-line";
140 return "double-line";
142 return "thick-line";
144 return "slash";
145 case enumXFCrossoutX:
146 return "X";
147 default:
148 break;
149 }
150 return OUString();
151}
152
154{
155 switch(type) {
157 return "uppercase";
159 return "lowercase";
161 return "capitalize";
163 return "small-caps";
164 default:
165 break;
166 }
167 return OUString();
168}
169
171{
172 switch(dir)
173 {
174 case enumXFTextDirLR:
175 return "lr";
177 return "lr-tb";
179 return "page";
180 case enumXFTextDirRL:
181 return "rl";
183 return "rl-tb";
184 case enumXFTextDirTB:
185 return "tb";
187 return "tb-lr";
189 return "tb-rl";
190 default:
191 break;
192 }
193 return OUString();
194}
195
197{
198 switch(pos)
199 {
201 return "left";
203 return "right";
205 return "center";
207 return "from-left";
208 default:
209 break;
210 }
211 return OUString();
212}
213
215{
216 switch(rel)
217 {
219 return "page";
221 return "page-content";
223 return "page-end-margin";
225 return "page-start-margin";
227 return "paragraph";
229 return "paragraph-content";
231 return "paragraph-end-margin";
233 return "paragraph-start-margin";
235 return "char";
237 return "frame";
239 return "frame-content";
241 return "frame-end-margin";
243 return "frame-start-margin";
244 default:
245 break;
246 }
247 return OUString();
248}
249
251{
252 switch(pos)
253 {
255 return "top";
257 return "middle";
259 return "bottom";
261 return "from-top";
263 return "below";
264 }
265 return OUString();
266}
267
269{
270 switch(rel)
271 {
273 return "baseline";
275 return "char";
277 return "frame";
279 return "frame-content";
281 return "line";
283 return "page";
285 return "page-content";
287 return "paragraph";
289 return "paragraph-content";
291 return "text";
292 }
293 return OUString();
294}
295
297{
298 if( align == enumXFAlignStart )
299 return "start";
300 else if( align == enumXFAlignCenter )
301 return "center";
302 else if( align == enumXFAlignEnd )
303 return "end";
304 else if( align == enumXFAlignJustify )
305 return "justify";
306 else if( align == enumXFAlignBottom )
307 return "bottom";
308 else if( align == enumXFAlignTop )
309 return "top";
310 else if( align == enumXFAlignMiddle )
311 return "middle";
312 else if( align == enumXFALignMargins )
313 return "margins";
314
315 return OUString();
316}
317
319{
320 OUString sRet;
321 switch(usage)
322 {
324 sRet = "all";
325 break;
327 sRet = "left";
328 break;
330 sRet = "right";
331 break;
333 sRet = "mirrored";
334 break;
335 default:
336 sRet = "mirrored";
337 break;
338 }
339 return sRet;
340}
341
343{
344 OUString sRet;
345 switch(type)
346 {
348 sRet = "boolean";
349 break;
351 sRet = "currency";
352 break;
354 sRet = "date";
355 break;
357 sRet = "float";
358 break;
360 sRet = "percentage";
361 break;
363 sRet = "string";
364 break;
366 sRet = "time";
367 break;
368 default:
369 sRet = "mirrored";
370 break;
371 }
372 return sRet;
373}
374
376{
377 switch(mode)
378 {
380 return "standard";
382 return "greyscale";
384 return "watermark";
385 case enumXFColorMono:
386 return "mono";
387 }
388 return OUString();
389}
390
391/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RttiCompleteObjectLocator col
ConversionMode mode
ResultType type
size_t pos
enumXFValueType
Definition: xfdefs.hxx:405
@ enumXFValueTypePercentage
Definition: xfdefs.hxx:411
@ enumXFValueTypeBoolean
Definition: xfdefs.hxx:407
@ enumXFValueTypeFloat
Definition: xfdefs.hxx:410
@ enumXFValueTypeCurrency
Definition: xfdefs.hxx:408
@ enumXFValueTypeTime
Definition: xfdefs.hxx:413
@ enumXFValueTypeDate
Definition: xfdefs.hxx:409
@ enumXFValueTypeString
Definition: xfdefs.hxx:412
enumXFFrameYPos
Definition: xfdefs.hxx:329
@ enumXFFrameYPosFromTop
Definition: xfdefs.hxx:333
@ enumXFFrameYPosMiddle
Definition: xfdefs.hxx:331
@ enumXFFrameYPosTop
Definition: xfdefs.hxx:330
@ enumXFFrameYPosBottom
Definition: xfdefs.hxx:332
@ enumXFFrameYPosBelow
Definition: xfdefs.hxx:334
enumXFPageUsage
Definition: xfdefs.hxx:396
@ enumXFPageUsageMirror
Definition: xfdefs.hxx:401
@ enumXFPageUsageLeft
Definition: xfdefs.hxx:399
@ enumXFPageUsageAll
Definition: xfdefs.hxx:398
@ enumXFPageUsageRight
Definition: xfdefs.hxx:400
enumXFAlignType
Definition: xfdefs.hxx:172
@ enumXFAlignJustify
Definition: xfdefs.hxx:177
@ enumXFAlignBottom
Definition: xfdefs.hxx:180
@ enumXFAlignStart
Definition: xfdefs.hxx:174
@ enumXFAlignMiddle
Definition: xfdefs.hxx:179
@ enumXFAlignEnd
Definition: xfdefs.hxx:176
@ enumXFAlignTop
Definition: xfdefs.hxx:178
@ enumXFALignMargins
Definition: xfdefs.hxx:181
@ enumXFAlignCenter
Definition: xfdefs.hxx:175
enumXFFrameYRel
Definition: xfdefs.hxx:315
@ enumXFFrameYRelLine
Definition: xfdefs.hxx:320
@ enumXFFrameYRelPage
Definition: xfdefs.hxx:321
@ enumXFFrameYRelChar
Definition: xfdefs.hxx:317
@ enumXFFrameYRelText
Definition: xfdefs.hxx:325
@ enumXFFrameYRelPageContent
Definition: xfdefs.hxx:322
@ enumXFFrameYRelFrameContent
Definition: xfdefs.hxx:319
@ enumXFFrameYRelFrame
Definition: xfdefs.hxx:318
@ enumXFFrameYRelParaContent
Definition: xfdefs.hxx:324
@ enumXFFrameYRelPara
Definition: xfdefs.hxx:323
@ enumXFFrameYRelBaseLine
Definition: xfdefs.hxx:316
enumXFColorMode
Definition: xfdefs.hxx:388
@ enumXFColorWatermark
Definition: xfdefs.hxx:392
@ enumXFColorGreyscale
Definition: xfdefs.hxx:390
@ enumXFColorStandard
Definition: xfdefs.hxx:389
@ enumXFColorMono
Definition: xfdefs.hxx:391
enumXFCrossout
Definition: xfdefs.hxx:144
@ enumXFCrossoutDouble
Definition: xfdefs.hxx:147
@ enumXFCrossoutSignel
Definition: xfdefs.hxx:146
@ enumXFCrossoutX
Definition: xfdefs.hxx:150
@ enumXFCrossoutSlash
Definition: xfdefs.hxx:149
@ enumXFCrossoutThick
Definition: xfdefs.hxx:148
enumXFUnderline
Definition: xfdefs.hxx:115
@ enumXFUnderlineSingle
Definition: xfdefs.hxx:117
@ enumXFUnderlineBoldDash
Definition: xfdefs.hxx:127
@ enumXFUnderlineWave
Definition: xfdefs.hxx:124
@ enumXFUnderlineLongDash
Definition: xfdefs.hxx:121
@ enumXFUnderlineBold
Definition: xfdefs.hxx:125
@ enumXFUnderlineDotDash
Definition: xfdefs.hxx:122
@ enumXFUnderlineNone
Definition: xfdefs.hxx:116
@ enumXFUnderlineDotDotDash
Definition: xfdefs.hxx:123
@ enumXFUnderlineDotted
Definition: xfdefs.hxx:119
@ enumXFUnderlineBoldWave
Definition: xfdefs.hxx:131
@ enumXFUnderlineBoldLongDash
Definition: xfdefs.hxx:128
@ enumXFUnderlineSmallWave
Definition: xfdefs.hxx:133
@ enumXFUnderlineBoldDotted
Definition: xfdefs.hxx:126
@ enumXFUnderlineDash
Definition: xfdefs.hxx:120
@ enumXFUnderlineDouble
Definition: xfdefs.hxx:118
@ enumXFUnderlineBoldDotDotDash
Definition: xfdefs.hxx:130
@ enumXFUnderlineDoubleWave
Definition: xfdefs.hxx:132
@ enumXFUnderlineBoldDotDash
Definition: xfdefs.hxx:129
enumXFFrameXPos
Definition: xfdefs.hxx:307
@ enumXFFrameXPosCenter
Definition: xfdefs.hxx:310
@ enumXFFrameXPosFromLeft
Definition: xfdefs.hxx:311
@ enumXFFrameXPosLeft
Definition: xfdefs.hxx:308
@ enumXFFrameXPosRight
Definition: xfdefs.hxx:309
enumXFTextDir
Definition: xfdefs.hxx:277
@ enumXFTextDirRL
Definition: xfdefs.hxx:282
@ enumXFTextDirLR
Definition: xfdefs.hxx:279
@ enumXFTextDirTB_RL
Definition: xfdefs.hxx:286
@ enumXFTextDirRL_TB
Definition: xfdefs.hxx:283
@ enumXFTextDirTB_LR
Definition: xfdefs.hxx:285
@ enumXFTextDirPage
Definition: xfdefs.hxx:281
@ enumXFTextDirTB
Definition: xfdefs.hxx:284
@ enumXFTextDirLR_TB
Definition: xfdefs.hxx:280
enumXFTransform
Definition: xfdefs.hxx:154
@ enumXFTransformSmallCaps
Definition: xfdefs.hxx:159
@ enumXFTransformLower
Definition: xfdefs.hxx:157
@ enumXFTransformUpper
Definition: xfdefs.hxx:156
@ enumXFTransformCapitalize
Definition: xfdefs.hxx:158
enumXFFrameXRel
Definition: xfdefs.hxx:290
@ enumXFFrameXRelPage
Definition: xfdefs.hxx:291
@ enumXFFrameXRelFrameEndMargin
Definition: xfdefs.hxx:302
@ enumXFFrameXRelFrameContent
Definition: xfdefs.hxx:301
@ enumXFFrameXRelFrameStartMargin
Definition: xfdefs.hxx:303
@ enumXFFrameXRelParaEndMargin
Definition: xfdefs.hxx:297
@ enumXFFrameXRelPageContent
Definition: xfdefs.hxx:292
@ enumXFFrameXRelChar
Definition: xfdefs.hxx:299
@ enumXFFrameXRelParaStartMargin
Definition: xfdefs.hxx:298
@ enumXFFrameXRelPara
Definition: xfdefs.hxx:295
@ enumXFFrameXRelParaContent
Definition: xfdefs.hxx:296
@ enumXFFrameXRelPageStartMargin
Definition: xfdefs.hxx:294
@ enumXFFrameXRelFrame
Definition: xfdefs.hxx:300
@ enumXFFrameXRelPageEndMargin
Definition: xfdefs.hxx:293
OUString GetUnderlineName(enumXFUnderline type)
Definition: xfutil.cxx:89
OUString GetFrameXRel(enumXFFrameXRel rel)
Definition: xfutil.cxx:214
OUString GetFrameYRel(enumXFFrameYRel rel)
Definition: xfutil.cxx:268
OUString GetFrameXPos(enumXFFrameXPos pos)
Definition: xfutil.cxx:196
OUString GetTableColName(sal_Int32 col)
Definition: xfutil.cxx:62
OUString GetColorMode(enumXFColorMode mode)
Definition: xfutil.cxx:375
OUString GetTextDirName(enumXFTextDir dir)
Definition: xfutil.cxx:170
OUString GetAlignName(enumXFAlignType align)
Definition: xfutil.cxx:296
OUString GetTransformName(enumXFTransform type)
Definition: xfutil.cxx:153
OUString GetValueType(enumXFValueType type)
Definition: xfutil.cxx:342
OUString GetCrossoutName(enumXFCrossout type)
Definition: xfutil.cxx:133
OUString GetPageUsageName(enumXFPageUsage usage)
Definition: xfutil.cxx:318
OUString GetFrameYPos(enumXFFrameYPos pos)
Definition: xfutil.cxx:250