kspread

KSpreadLayoutIface.cpp
1/* This file is part of the KDE project
2
3 Copyright 2002 Laurent Montel <montel@kde.org>
4 Copyright 2002 Philipp Mueller <philipp.mueller@gmx.de>
5 Copyright 2002 John Dailey <dailey@vt.edu>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21*/
22
23#include "KSpreadLayoutIface.h"
24#include <tqbrush.h>
25#include "kspread_format.h"
26
27using namespace KSpread;
28
29LayoutIface::LayoutIface(Format *_layout)
30{
31 layout=_layout;
32}
33
34void LayoutIface::setBgColor(const TQString& _c)
35{
36 TQColor c(_c);
37 layout->setBgColor(c);
38}
39
40void LayoutIface::setBgColor(int r,int g,int b)
41{
42 TQColor c(r,g,b);
43 layout->setBgColor(c);
44}
45
46
47void LayoutIface::setTextColor(int r,int g,int b)
48{
49 TQColor c(r,g,b);
50 layout->setTextColor(c);
51}
52
53void LayoutIface::setTextColor(const TQString& _c)
54{
55 TQColor c(_c);
56 layout->setTextColor(c);
57}
58
59void LayoutIface::setAngle(int angle)
60{
61 layout->setAngle(angle);
62}
63
64void LayoutIface::setVerticalText(bool _vertical)
65{
66 layout->setVerticalText(_vertical);
67}
68
69void LayoutIface::setMultiRow(bool _multi)
70{
71 layout->setMultiRow( _multi );
72}
73
74void LayoutIface::setAlign( const TQString& _Align )
75{
76 Format::Align Align;
77 if(_Align=="Left")
78 Align=Format::Left;
79 else if(_Align=="Right")
80 Align=Format::Right;
81 else if(_Align=="Center")
82 Align=Format::Center;
83 else
84 Align=Format::Undefined;
85 layout->setAlign( Align);
86}
87
88void LayoutIface::setAlignY( const TQString& _AlignY )
89{
90 Format::AlignY AlignY;
91 if(_AlignY=="Top")
92 AlignY=Format::Top;
93 else if(_AlignY=="Middle")
94 AlignY=Format::Middle;
95 else if(_AlignY=="Bottom")
96 AlignY=Format::Bottom;
97 else
98 AlignY=Format::Middle;
99 layout->setAlignY( AlignY);
100}
101
102void LayoutIface::setPostfix(const TQString &_postfix)
103{
104 layout->setPostfix( _postfix );
105}
106
107void LayoutIface::setPrefix(const TQString &_prefix)
108{
109 layout->setPrefix( _prefix );
110}
111
112void LayoutIface::setFormatType(const TQString &_formatType)
113{
114 FormatType format;
115 layout->setPrecision(2);
116 if (_formatType=="Generic")
117 format = Generic_format;
118 else if(_formatType=="Number")
119 format=Number_format;
120 else if(_formatType=="Money")
121 format=Money_format;
122 else if(_formatType=="Percentage")
123 format=Percentage_format;
124 else if(_formatType=="Scientific")
125 format=Scientific_format;
126 else if(_formatType=="ShortDate")
127 format=ShortDate_format;
128 else if(_formatType=="TextDate")
129 format=TextDate_format;
130 else if(_formatType=="Time")
131 format=Time_format;
132 else if(_formatType=="SecondeTime")
133 format=SecondeTime_format;
134 else if(_formatType=="fraction_half")
135 format=fraction_half;
136 else if(_formatType=="fraction_quarter")
137 format=fraction_quarter;
138 else if(_formatType=="fraction_eighth")
139 format=fraction_eighth;
140 else if(_formatType=="fraction_sixteenth")
141 format=fraction_sixteenth;
142 else if(_formatType=="fraction_tenth")
143 format=fraction_tenth;
144 else if(_formatType=="fraction_hundredth")
145 format=fraction_hundredth;
146 else if(_formatType=="fraction_one_digit")
147 format=fraction_one_digit;
148 else if(_formatType=="fraction_two_digits")
149 format=fraction_two_digits;
150 else if(_formatType=="fraction_three_digits")
151 format=fraction_three_digits;
152 else
153 format=Generic_format;
154 layout->setFormatType( format);
155}
156
157
158void LayoutIface::setPrecision(int _p)
159{
160 layout->setPrecision( _p );
161}
162
163void LayoutIface::setTextFontBold(bool _b)
164{
165 layout->setTextFontBold( _b );
166}
167
168void LayoutIface::setTextFontItalic(bool _b)
169{
170 layout->setTextFontItalic( _b );
171}
172
173void LayoutIface::setTextFontUnderline(bool _b)
174{
175 layout->setTextFontUnderline( _b );
176}
177
178void LayoutIface::setTextFontStrike(bool _b)
179{
180 layout->setTextFontStrike( _b );
181}
182
183void LayoutIface::setTextFontSize( int _size )
184{
185 layout->setTextFontSize( _size );
186}
187
188void LayoutIface::setTextFontFamily( const TQString& _font )
189{
190 layout->setTextFontFamily( _font );
191}
192
193
194//border left
195void LayoutIface::setLeftBorderStyle( const TQString& _style )
196{
197 if(_style=="DotLine")
198 layout->setLeftBorderStyle(TQt::DotLine);
199 else if(_style=="DashLine")
200 layout->setLeftBorderStyle(TQt::DashLine);
201 else if(_style=="DashDotLine")
202 layout->setLeftBorderStyle(TQt::DashDotLine);
203 else if(_style=="DashDotDotLine")
204 layout->setLeftBorderStyle(TQt::DashDotDotLine);
205 else if(_style=="SolidLine")
206 layout->setLeftBorderStyle(TQt::SolidLine);
207 else
208 layout->setLeftBorderStyle(TQt::SolidLine);
209}
210
211void LayoutIface::setLeftBorderColor(const TQString& _c)
212{
213 TQColor c(_c);
214 layout->setLeftBorderColor(c );
215}
216
217void LayoutIface::setLeftBorderColor(int r,int g,int b)
218{
219 TQColor c(r,g,b);
220 layout->setLeftBorderColor(c );
221}
222
223void LayoutIface::setLeftBorderWidth( int _size )
224{
225 layout->setLeftBorderWidth( _size );
226}
227
228
229//border right
230void LayoutIface::setRightBorderStyle( const TQString& _style )
231{
232 if(_style=="DotLine")
233 layout->setRightBorderStyle(TQt::DotLine);
234 else if(_style=="DashLine")
235 layout->setRightBorderStyle(TQt::DashLine);
236 else if(_style=="DashDotLine")
237 layout->setRightBorderStyle(TQt::DashDotLine);
238 else if(_style=="DashDotDotLine")
239 layout->setRightBorderStyle(TQt::DashDotDotLine);
240 else if(_style=="SolidLine")
241 layout->setRightBorderStyle(TQt::SolidLine);
242 else
243 layout->setRightBorderStyle(TQt::SolidLine);
244}
245
246void LayoutIface::setRightBorderColor(const TQString& _c)
247{
248 TQColor c(_c);
249 layout->setRightBorderColor(c );
250}
251
252void LayoutIface::setRightBorderColor(int r,int g,int b)
253{
254 TQColor c(r,g,b);
255 layout->setRightBorderColor(c );
256}
257
258void LayoutIface::setRightBorderWidth( int _size )
259{
260 layout->setRightBorderWidth( _size );
261}
262
263
264//border top
265void LayoutIface::setTopBorderStyle( const TQString& _style )
266{
267 if(_style=="DotLine")
268 layout->setTopBorderStyle(TQt::DotLine);
269 else if(_style=="DashLine")
270 layout->setTopBorderStyle(TQt::DashLine);
271 else if(_style=="DashDotLine")
272 layout->setTopBorderStyle(TQt::DashDotLine);
273 else if(_style=="DashDotDotLine")
274 layout->setTopBorderStyle(TQt::DashDotDotLine);
275 else if(_style=="SolidLine")
276 layout->setTopBorderStyle(TQt::SolidLine);
277 else
278 layout->setTopBorderStyle(TQt::SolidLine);
279}
280
281void LayoutIface::setTopBorderColor(const TQString& _c)
282{
283 TQColor c(_c);
284 layout->setTopBorderColor(c );
285}
286
287void LayoutIface::setTopBorderColor(int r,int g,int b)
288{
289 TQColor c(r,g,b);
290 layout->setTopBorderColor(c );
291}
292
293void LayoutIface::setTopBorderWidth( int _size )
294{
295 layout->setTopBorderWidth( _size );
296}
297
298
299//border bottom
300void LayoutIface::setBottomBorderStyle( const TQString& _style )
301{
302 if(_style=="DotLine")
303 layout->setBottomBorderStyle(TQt::DotLine);
304 else if(_style=="DashLine")
305 layout->setBottomBorderStyle(TQt::DashLine);
306 else if(_style=="DashDotLine")
307 layout->setBottomBorderStyle(TQt::DashDotLine);
308 else if(_style=="DashDotDotLine")
309 layout->setBottomBorderStyle(TQt::DashDotDotLine);
310 else if(_style=="SolidLine")
311 layout->setBottomBorderStyle(TQt::SolidLine);
312 else
313 layout->setBottomBorderStyle(TQt::SolidLine);
314}
315
316void LayoutIface::setBottomBorderColor(const TQString& _c)
317{
318 TQColor c(_c);
319 layout->setBottomBorderColor(c );
320}
321void LayoutIface::setBottomBorderColor(int r,int g,int b)
322{
323 TQColor c(r,g,b);
324 layout->setBottomBorderColor(c );
325}
326
327void LayoutIface::setBottomBorderWidth( int _size )
328{
329 layout->setBottomBorderWidth( _size );
330}
331
332
333//fall back diagonal
334void LayoutIface::setFallDiagonalStyle( const TQString& _style )
335{
336 if(_style=="DotLine")
337 layout->setFallDiagonalStyle(TQt::DotLine);
338 else if(_style=="DashLine")
339 layout->setFallDiagonalStyle(TQt::DashLine);
340 else if(_style=="DashDotLine")
341 layout->setFallDiagonalStyle(TQt::DashDotLine);
342 else if(_style=="DashDotDotLine")
343 layout->setFallDiagonalStyle(TQt::DashDotDotLine);
344 else if(_style=="SolidLine")
345 layout->setFallDiagonalStyle(TQt::SolidLine);
346 else
347 layout->setFallDiagonalStyle(TQt::SolidLine);
348}
349
350void LayoutIface::setFallDiagonalColor(const TQString& _c)
351{
352 TQColor c(_c);
353 layout->setFallDiagonalColor(c );
354}
355void LayoutIface::setFallDiagonalColor(int r,int g,int b)
356{
357 TQColor c(r,g,b);
358 layout->setFallDiagonalColor(c );
359}
360
361void LayoutIface::setFallDiagonalWidth( int _size )
362{
363 layout->setFallDiagonalWidth( _size );
364}
365
366
367
368//GoUpDiagonal
369void LayoutIface::setGoUpDiagonalStyle( const TQString& _style )
370{
371 if(_style=="DotLine")
372 layout->setGoUpDiagonalStyle(TQt::DotLine);
373 else if(_style=="DashLine")
374 layout->setGoUpDiagonalStyle(TQt::DashLine);
375 else if(_style=="DashDotLine")
376 layout->setGoUpDiagonalStyle(TQt::DashDotLine);
377 else if(_style=="DashDotDotLine")
378 layout->setGoUpDiagonalStyle(TQt::DashDotDotLine);
379 else if(_style=="SolidLine")
380 layout->setGoUpDiagonalStyle(TQt::SolidLine);
381 else
382 layout->setGoUpDiagonalStyle(TQt::SolidLine);
383}
384
385void LayoutIface::setGoUpDiagonalColor(const TQString& _c)
386{
387 TQColor c(_c);
388 layout->setGoUpDiagonalColor(c );
389}
390void LayoutIface::setGoUpDiagonalColor(int r,int g,int b)
391{
392 TQColor c(r,g,b);
393 layout->setGoUpDiagonalColor(c );
394}
395
396void LayoutIface::setGoUpDiagonalWidth( int _size )
397{
398 layout->setGoUpDiagonalWidth( _size );
399}
400
401
402void LayoutIface::setIndent( double indent )
403{
404 if( indent >= 0.0 )
405 layout->setIndent( indent );
406 else
407 layout->setIndent( 0.0 );
408}
409
410
411void LayoutIface::setDontPrintText ( bool _print)
412{
413 layout->setDontPrintText ( _print);
414}
415
The KSpread namespace.
Definition commands.h:39