29#include "KSpreadCellIface.h"
31#include "kspread_doc.h"
32#include "kspread_sheet.h"
33#include "kspread_value.h"
34#include "valueconverter.h"
39 : m_point( 0, 0 ), m_sheet( 0 )
43void CellIface::setCell( Sheet* sheet,
const TQPoint& point )
49bool CellIface::isDefault()
const
51 if( !m_sheet )
return false;
52 Cell* cell = m_sheet->cellAt( m_point );
56bool CellIface::isEmpty()
const
58 if (!m_sheet)
return true;
59 Cell *cell=m_sheet->cellAt(m_point);
63TQString CellIface::text()
const
65 if( !m_sheet )
return TQString();
66 Cell* cell = m_sheet->cellAt( m_point );
67 return m_sheet->doc()->converter()->asString (cell->
value()).asString();
70void CellIface::setText(
const TQString& text )
72 if( !m_sheet )
return;
73 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
77TQString CellIface::visibleContentAsString()
const
79 if( !m_sheet )
return TQString();
80 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
81 if (cell->
isEmpty())
return TQString();
92TQString CellIface::comment()
const
94 if( !m_sheet )
return TQString();
95 Cell* cell = m_sheet->cellAt( m_point );
96 return cell->
format()->comment(m_point.x(), m_point.y());
99void CellIface::setComment(
const TQString& comment )
101 if( !m_sheet )
return;
102 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
103 cell->
format()->setComment( comment);
104 m_sheet->setRegionPaintDirty(cell->
cellRect());
107void CellIface::setValue(
int value )
109 if( !m_sheet )
return;
110 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
114void CellIface::setValue(
double value )
116 if( !m_sheet )
return;
117 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
121double CellIface::value()
const
123 if( !m_sheet )
return 0.0;
124 Cell* cell = m_sheet->cellAt( m_point );
125 return m_sheet->doc()->converter()->asFloat (cell->
value()).asFloat();
128void CellIface::setBgColor(
const TQString& _c)
130 if( !m_sheet )
return;
131 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
133 cell->
format()->setBgColor(c);
134 m_sheet->setRegionPaintDirty(cell->
cellRect());
137void CellIface::setBgColor(
int r,
int g,
int b)
139 if( !m_sheet )
return;
140 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
142 cell->
format()->setBgColor(c);
143 m_sheet->setRegionPaintDirty(cell->
cellRect());
146TQString CellIface::bgColor()
const
148 if( !m_sheet )
return TQString();
149 Cell* cell = m_sheet->cellAt( m_point );
150 return cell->
bgColor( m_point.x(), m_point.y() ).name();
153TQString CellIface::textColor()
const
155 if( !m_sheet )
return TQString();
156 Cell* cell = m_sheet->cellAt( m_point );
157 return cell->
format()->textColor( m_point.x(), m_point.y() ).name();
160void CellIface::setTextColor(
int r,
int g,
int b)
162 if( !m_sheet )
return;
163 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
165 cell->
format()->setTextColor(c);
166 m_sheet->setRegionPaintDirty(cell->
cellRect());
169void CellIface::setTextColor(
const TQString& _c)
171 if( !m_sheet )
return;
172 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
174 cell->
format()->setTextColor(c);
175 m_sheet->setRegionPaintDirty(cell->
cellRect());
178void CellIface::setAngle(
int angle)
180 if( !m_sheet )
return;
181 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
182 cell->
format()->setAngle(angle);
183 m_sheet->setRegionPaintDirty(cell->
cellRect());
186int CellIface::angle()
const
188 if( !m_sheet )
return 0;
189 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
190 return cell->
format()->getAngle(m_point.x(), m_point.y());
193void CellIface::setVerticalText(
bool _vertical)
195 if( !m_sheet )
return;
196 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
197 cell->
format()->setVerticalText(_vertical);
198 m_sheet->setRegionPaintDirty(cell->
cellRect());
201bool CellIface::verticalText()
const
203 if( !m_sheet )
return false;
204 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
205 return cell->
format()->verticalText( m_point.x(), m_point.y() );
209void CellIface::setMultiRow(
bool _multi)
211 if( !m_sheet )
return;
212 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
213 cell->
format()->setMultiRow( _multi );
214 m_sheet->setRegionPaintDirty(cell->
cellRect());
217bool CellIface::multiRow()
const
219 if( !m_sheet )
return false;
220 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
221 return cell->
format()->multiRow( m_point.x(), m_point.y() );
224void CellIface::setAlign(
const TQString& _Align )
226 if( !m_sheet )
return;
227 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
231 else if(_Align==
"Right")
233 else if(_Align==
"Center")
234 Align=Format::Center;
236 Align=Format::Undefined;
237 cell->
format()->setAlign( Align);
238 m_sheet->setRegionPaintDirty(cell->
cellRect());
241TQString CellIface::align()
const
243 if( !m_sheet )
return TQString();
244 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
245 TQString alignString;
246 switch( cell->
format()->align( m_point.x(), m_point.y() ) )
254 case Format::Center :
255 alignString=
"Center";
257 case Format::Undefined :
258 alignString=
"Undefined";
264void CellIface::setAlignY(
const TQString& _AlignY )
266 if( !m_sheet )
return;
267 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
268 Format::AlignY AlignY;
271 else if(_AlignY==
"Middle")
272 AlignY=Format::Middle;
273 else if(_AlignY==
"Bottom")
274 AlignY=Format::Bottom;
276 AlignY=Format::Middle;
277 cell->
format()->setAlignY( AlignY);
278 m_sheet->setRegionPaintDirty(cell->
cellRect());
281TQString CellIface::alignY()
const
283 if( !m_sheet )
return TQString();
284 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
285 TQString alignString;
286 switch( cell->
format()->alignY( m_point.x(), m_point.y() ) )
291 case Format::Middle :
292 alignString=
"Middle";
294 case Format::Bottom :
295 alignString=
"Bottom";
297 case Format::UndefinedY :
298 alignString=
"UndefinedY";
304void CellIface::setPostfix(
const TQString &_postfix)
306 if( !m_sheet )
return;
307 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
308 cell->
format()->setPostfix( _postfix );
309 m_sheet->setRegionPaintDirty(cell->
cellRect());
312TQString CellIface::prefix()
const
314 if( !m_sheet )
return TQString();
315 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
316 return cell->
format()->prefix( m_point.x(), m_point.y() );
319void CellIface::setPrefix(
const TQString &_prefix)
321 if( !m_sheet )
return;
322 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
323 cell->
format()->setPrefix( _prefix );
324 m_sheet->setRegionPaintDirty(cell->
cellRect());
327TQString CellIface::postfix()
const
329 if( !m_sheet )
return TQString();
330 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
331 return cell->
format()->postfix( m_point.x(), m_point.y() );
334void CellIface::setFormatType(
const TQString &_formatType)
336 if( !m_sheet )
return;
338 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
340 cell->
format()->setPrecision(2);
341 if (_formatType==
"Generic")
342 format = Generic_format;
343 else if(_formatType==
"Number")
344 format=Number_format;
345 else if (_formatType==
"Text")
347 else if(_formatType==
"Money")
349 else if(_formatType==
"Percentage")
350 format=Percentage_format;
351 else if(_formatType==
"Scientific")
352 format=Scientific_format;
353 else if(_formatType==
"ShortDate")
354 format=ShortDate_format;
355 else if(_formatType==
"TextDate")
356 format=TextDate_format;
357 else if(_formatType==
"Time")
359 else if(_formatType==
"SecondeTime")
360 format=SecondeTime_format;
361 else if(_formatType==
"fraction_half")
362 format=fraction_half;
363 else if(_formatType==
"fraction_quarter")
364 format=fraction_quarter;
365 else if(_formatType==
"fraction_eighth")
366 format=fraction_eighth;
367 else if(_formatType==
"fraction_sixteenth")
368 format=fraction_sixteenth;
369 else if(_formatType==
"fraction_tenth")
370 format=fraction_tenth;
371 else if(_formatType==
"fraction_hundredth")
372 format=fraction_hundredth;
373 else if(_formatType==
"fraction_one_digit")
374 format=fraction_one_digit;
375 else if(_formatType==
"fraction_two_digits")
376 format=fraction_two_digits;
377 else if(_formatType==
"fraction_three_digits")
378 format=fraction_three_digits;
380 format=Generic_format;
381 cell->
format()->setFormatType( format);
382 m_sheet->setRegionPaintDirty(cell->
cellRect());
385TQString CellIface::getFormatType()
const
387 if( !m_sheet )
return TQString();
389 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
390 TQString stringFormat;
391 switch( cell->
format()->getFormatType(m_point.x(), m_point.y()))
397 stringFormat=
"Number";
400 stringFormat=
"Money";
402 case Percentage_format:
403 stringFormat=
"Percentage";
405 case Scientific_format:
406 stringFormat=
"Scientific";
408 case ShortDate_format:
409 stringFormat=
"ShortDate";
411 case TextDate_format:
412 stringFormat=
"TextDate";
440 stringFormat=
"date format";
445 case SecondeTime_format:
446 stringFormat=
"SecondeTime";
456 stringFormat=
"time format";
459 stringFormat=
"fraction_half";
461 case fraction_quarter:
462 stringFormat=
"fraction_quarter";
464 case fraction_eighth:
465 stringFormat=
"fraction_eighth";
467 case fraction_sixteenth:
468 stringFormat=
"fraction_sixteenth";
471 stringFormat=
"fraction_tenth";
473 case fraction_hundredth:
474 stringFormat=
"fraction_hundredth";
476 case fraction_one_digit:
477 stringFormat=
"fraction_one_digit";
479 case fraction_two_digits:
480 stringFormat=
"fraction_two_digits";
482 case fraction_three_digits:
483 stringFormat=
"fraction_three_digits";
491void CellIface::setPrecision(
int _p)
493 if( !m_sheet )
return;
494 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
495 cell->
format()->setPrecision( _p );
496 m_sheet->setRegionPaintDirty(cell->
cellRect());
499int CellIface::precision()
const
501 if( !m_sheet )
return 0;
502 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
503 return cell->
format()->precision( m_point.x(), m_point.y() );
506void CellIface::setTextFontBold(
bool _b)
508 if( !m_sheet )
return;
509 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
510 cell->
format()->setTextFontBold( _b );
511 m_sheet->setRegionPaintDirty(cell->
cellRect());
514bool CellIface::textFontBold()
const
516 if( !m_sheet )
return false;
517 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
518 return cell->
format()->textFontBold( m_point.x(), m_point.y() );
521void CellIface::setTextFontItalic(
bool _b)
523 if( !m_sheet )
return;
524 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
525 cell->
format()->setTextFontItalic( _b );
526 m_sheet->setRegionPaintDirty(cell->
cellRect());
529bool CellIface::textFontItalic()
const
531 if( !m_sheet )
return false;
532 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
533 return cell->
format()->textFontItalic( m_point.x(), m_point.y() );
537void CellIface::setTextFontUnderline(
bool _b)
539 if( !m_sheet )
return;
540 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
541 cell->
format()->setTextFontUnderline( _b );
542 m_sheet->setRegionPaintDirty(cell->
cellRect());
545bool CellIface::textFontUnderline()
const
547 if( !m_sheet )
return false;
548 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
549 return cell->
format()->textFontUnderline( m_point.x(), m_point.y() );
552void CellIface::setTextFontStrike(
bool _b)
554 if( !m_sheet )
return;
555 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
556 cell->
format()->setTextFontStrike( _b );
557 m_sheet->setRegionPaintDirty(cell->
cellRect());
560bool CellIface::textFontStrike()
const
562 if( !m_sheet )
return false;
563 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
564 return cell->
format()->textFontStrike( m_point.x(), m_point.y() );
567void CellIface::setTextFontSize(
int _size )
569 if( !m_sheet )
return;
570 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
571 cell->
format()->setTextFontSize( _size );
572 m_sheet->setRegionPaintDirty(cell->
cellRect());
575int CellIface::textFontSize()
const
577 if( !m_sheet )
return 10;
578 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
579 return cell->
format()->textFontSize( m_point.x(), m_point.y() );
582void CellIface::setTextFontFamily(
const TQString& _font )
584 if( !m_sheet )
return;
585 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
586 cell->
format()->setTextFontFamily( _font );
587 m_sheet->setRegionPaintDirty(cell->
cellRect());
590TQString CellIface::textFontFamily()
const
592 if( !m_sheet )
return TQString();
593 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
594 return cell->
format()->textFontFamily( m_point.x(), m_point.y() );
598void CellIface::setLeftBorderStyle(
const TQString& _style )
600 if( !m_sheet )
return;
601 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
602 if(_style==
"DotLine")
603 cell->
format()->setLeftBorderStyle(TQt::DotLine);
604 else if(_style==
"DashLine")
605 cell->
format()->setLeftBorderStyle(TQt::DashLine);
606 else if(_style==
"DashDotLine")
607 cell->
format()->setLeftBorderStyle(TQt::DashDotLine);
608 else if(_style==
"DashDotDotLine")
609 cell->
format()->setLeftBorderStyle(TQt::DashDotDotLine);
610 else if(_style==
"SolidLine")
611 cell->
format()->setLeftBorderStyle(TQt::SolidLine);
613 cell->
format()->setLeftBorderStyle(TQt::SolidLine);
614 m_sheet->setRegionPaintDirty(cell->
cellRect());
618void CellIface::setLeftBorderColor(
const TQString& _c)
620 if( !m_sheet )
return;
622 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
623 cell->
format()->setLeftBorderColor(c );
624 m_sheet->setRegionPaintDirty(cell->
cellRect());
628void CellIface::setLeftBorderColor(
int r,
int g,
int b)
630 if( !m_sheet )
return;
631 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
633 cell->
format()->setLeftBorderColor(c );
634 m_sheet->setRegionPaintDirty(cell->
cellRect());
637void CellIface::setLeftBorderWidth(
int _size )
639 if( !m_sheet )
return;
640 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
641 cell->
format()->setLeftBorderWidth( _size );
642 m_sheet->setRegionPaintDirty(cell->
cellRect());
646int CellIface::leftBorderWidth()
const
648 if( !m_sheet )
return 0;
649 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
650 return cell->
format()->leftBorderWidth(m_point.x(), m_point.y());
653TQString CellIface::leftBorderColor()
const
655 if( !m_sheet )
return TQString();
656 Cell* cell = m_sheet->cellAt( m_point );
657 return cell->
format()->leftBorderColor( m_point.x(), m_point.y() ).name();
660TQString CellIface::leftBorderStyle()
const
662 if( !m_sheet )
return TQString();
663 Cell* cell = m_sheet->cellAt( m_point );
664 TQt::PenStyle penStyle=cell->
format()->leftBorderStyle( m_point.x(), m_point.y() );
666 if( penStyle==TQt::DotLine)
668 else if( penStyle==TQt::DashLine)
670 else if( penStyle==TQt::DashDotLine)
672 else if( penStyle==TQt::DashDotDotLine)
673 tmp=
"DashDotDotLine";
674 else if( penStyle==TQt::SolidLine)
682void CellIface::setRightBorderStyle(
const TQString& _style )
684 if( !m_sheet )
return;
685 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
686 if(_style==
"DotLine")
687 cell->
format()->setRightBorderStyle(TQt::DotLine);
688 else if(_style==
"DashLine")
689 cell->
format()->setRightBorderStyle(TQt::DashLine);
690 else if(_style==
"DashDotLine")
691 cell->
format()->setRightBorderStyle(TQt::DashDotLine);
692 else if(_style==
"DashDotDotLine")
693 cell->
format()->setRightBorderStyle(TQt::DashDotDotLine);
694 else if(_style==
"SolidLine")
695 cell->
format()->setRightBorderStyle(TQt::SolidLine);
697 cell->
format()->setRightBorderStyle(TQt::SolidLine);
698 m_sheet->setRegionPaintDirty(cell->
cellRect());
702void CellIface::setRightBorderColor(
const TQString& _c)
704 if( !m_sheet )
return;
706 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
707 cell->
format()->setRightBorderColor(c );
708 m_sheet->setRegionPaintDirty(cell->
cellRect());
711void CellIface::setRightBorderColor(
int r,
int g,
int b)
713 if( !m_sheet )
return;
714 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
716 cell->
format()->setRightBorderColor(c );
717 m_sheet->setRegionPaintDirty(cell->
cellRect());
720void CellIface::setRightBorderWidth(
int _size )
722 if( !m_sheet )
return;
723 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
724 cell->
format()->setRightBorderWidth( _size );
725 m_sheet->setRegionPaintDirty(cell->
cellRect());
729int CellIface::rightBorderWidth()
const
731 if( !m_sheet )
return 0;
732 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
733 return cell->
format()->rightBorderWidth(m_point.x(), m_point.y());
736TQString CellIface::rightBorderColor()
const
738 if( !m_sheet )
return TQString();
739 Cell* cell = m_sheet->cellAt( m_point );
740 return cell->
format()->rightBorderColor( m_point.x(), m_point.y() ).name();
743TQString CellIface::rightBorderStyle()
const
745 if( !m_sheet )
return TQString();
746 Cell* cell = m_sheet->cellAt( m_point );
747 TQt::PenStyle penStyle=cell->
format()->rightBorderStyle( m_point.x(), m_point.y() );
749 if( penStyle==TQt::DotLine)
751 else if( penStyle==TQt::DashLine)
753 else if( penStyle==TQt::DashDotLine)
755 else if( penStyle==TQt::DashDotDotLine)
756 tmp=
"DashDotDotLine";
757 else if( penStyle==TQt::SolidLine)
765void CellIface::setTopBorderStyle(
const TQString& _style )
767 if( !m_sheet )
return;
768 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
769 if(_style==
"DotLine")
770 cell->
format()->setTopBorderStyle(TQt::DotLine);
771 else if(_style==
"DashLine")
772 cell->
format()->setTopBorderStyle(TQt::DashLine);
773 else if(_style==
"DashDotLine")
774 cell->
format()->setTopBorderStyle(TQt::DashDotLine);
775 else if(_style==
"DashDotDotLine")
776 cell->
format()->setTopBorderStyle(TQt::DashDotDotLine);
777 else if(_style==
"SolidLine")
778 cell->
format()->setTopBorderStyle(TQt::SolidLine);
780 cell->
format()->setTopBorderStyle(TQt::SolidLine);
781 m_sheet->setRegionPaintDirty(cell->
cellRect());
785void CellIface::setTopBorderColor(
const TQString& _c)
787 if( !m_sheet )
return;
789 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
790 cell->
format()->setTopBorderColor(c );
791 m_sheet->setRegionPaintDirty(cell->
cellRect());
794void CellIface::setTopBorderColor(
int r,
int g,
int b)
796 if( !m_sheet )
return;
797 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
799 cell->
format()->setTopBorderColor(c );
800 m_sheet->setRegionPaintDirty(cell->
cellRect());
803void CellIface::setTopBorderWidth(
int _size )
805 if( !m_sheet )
return;
806 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
807 cell->
format()->setTopBorderWidth( _size );
808 m_sheet->setRegionPaintDirty(cell->
cellRect());
811int CellIface::topBorderWidth()
const
813 if( !m_sheet )
return 0;
814 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
815 return cell->
format()->topBorderWidth(m_point.x(), m_point.y());
818TQString CellIface::topBorderColor()
const
820 if( !m_sheet )
return TQString();
821 Cell* cell = m_sheet->cellAt( m_point );
822 return cell->
format()->topBorderColor( m_point.x(), m_point.y() ).name();
825TQString CellIface::topBorderStyle()
const
827 if( !m_sheet )
return TQString();
828 Cell* cell = m_sheet->cellAt( m_point );
829 TQt::PenStyle penStyle=cell->
format()->topBorderStyle( m_point.x(), m_point.y() );
831 if( penStyle==TQt::DotLine)
833 else if( penStyle==TQt::DashLine)
835 else if( penStyle==TQt::DashDotLine)
837 else if( penStyle==TQt::DashDotDotLine)
838 tmp=
"DashDotDotLine";
839 else if( penStyle==TQt::SolidLine)
847void CellIface::setBottomBorderStyle(
const TQString& _style )
849 if( !m_sheet )
return;
850 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
851 if(_style==
"DotLine")
852 cell->
format()->setBottomBorderStyle(TQt::DotLine);
853 else if(_style==
"DashLine")
854 cell->
format()->setBottomBorderStyle(TQt::DashLine);
855 else if(_style==
"DashDotLine")
856 cell->
format()->setBottomBorderStyle(TQt::DashDotLine);
857 else if(_style==
"DashDotDotLine")
858 cell->
format()->setBottomBorderStyle(TQt::DashDotDotLine);
859 else if(_style==
"SolidLine")
860 cell->
format()->setBottomBorderStyle(TQt::SolidLine);
862 cell->
format()->setBottomBorderStyle(TQt::SolidLine);
863 m_sheet->setRegionPaintDirty(cell->
cellRect());
867void CellIface::setBottomBorderColor(
const TQString& _c)
869 if( !m_sheet )
return;
871 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
872 cell->
format()->setBottomBorderColor(c );
873 m_sheet->setRegionPaintDirty(cell->
cellRect());
876void CellIface::setBottomBorderColor(
int r,
int g,
int b)
878 if( !m_sheet )
return;
879 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
881 cell->
format()->setBottomBorderColor(c );
882 m_sheet->setRegionPaintDirty(cell->
cellRect());
885void CellIface::setBottomBorderWidth(
int _size )
887 if( !m_sheet )
return;
888 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
889 cell->
format()->setBottomBorderWidth( _size );
890 m_sheet->setRegionPaintDirty(cell->
cellRect());
893int CellIface::bottomBorderWidth()
const
895 if( !m_sheet )
return 0;
896 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
897 return cell->
format()->bottomBorderWidth(m_point.x(), m_point.y());
900TQString CellIface::bottomBorderColor()
const
902 if( !m_sheet )
return TQString();
903 Cell* cell = m_sheet->cellAt( m_point );
904 return cell->
format()->bottomBorderColor( m_point.x(), m_point.y() ).name();
907TQString CellIface::bottomBorderStyle()
const
909 if( !m_sheet )
return TQString();
910 Cell* cell = m_sheet->cellAt( m_point );
911 TQt::PenStyle penStyle=cell->
format()->bottomBorderStyle( m_point.x(), m_point.y() );
913 if( penStyle==TQt::DotLine)
915 else if( penStyle==TQt::DashLine)
917 else if( penStyle==TQt::DashDotLine)
919 else if( penStyle==TQt::DashDotDotLine)
920 tmp=
"DashDotDotLine";
921 else if( penStyle==TQt::SolidLine)
929void CellIface::setFallDiagonalStyle(
const TQString& _style )
931 if( !m_sheet )
return;
932 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
933 if(_style==
"DotLine")
934 cell->
format()->setFallDiagonalStyle(TQt::DotLine);
935 else if(_style==
"DashLine")
936 cell->
format()->setFallDiagonalStyle(TQt::DashLine);
937 else if(_style==
"DashDotLine")
938 cell->
format()->setFallDiagonalStyle(TQt::DashDotLine);
939 else if(_style==
"DashDotDotLine")
940 cell->
format()->setFallDiagonalStyle(TQt::DashDotDotLine);
941 else if(_style==
"SolidLine")
942 cell->
format()->setFallDiagonalStyle(TQt::SolidLine);
944 cell->
format()->setFallDiagonalStyle(TQt::SolidLine);
945 m_sheet->setRegionPaintDirty(cell->
cellRect());
949void CellIface::setFallDiagonalColor(
const TQString& _c)
951 if( !m_sheet )
return;
953 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
954 cell->
format()->setFallDiagonalColor(c );
955 m_sheet->setRegionPaintDirty(cell->
cellRect());
958void CellIface::setFallDiagonalColor(
int r,
int g,
int b)
960 if( !m_sheet )
return;
961 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
963 cell->
format()->setFallDiagonalColor(c );
964 m_sheet->setRegionPaintDirty(cell->
cellRect());
967void CellIface::setFallDiagonalWidth(
int _size )
969 if( !m_sheet )
return;
970 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
971 cell->
format()->setFallDiagonalWidth( _size );
972 m_sheet->setRegionPaintDirty(cell->
cellRect());
975int CellIface::fallDiagonalWidth()
const
977 if( !m_sheet )
return 0;
978 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
979 return cell->
format()->fallDiagonalWidth(m_point.x(), m_point.y());
982TQString CellIface::fallDiagonalColor()
const
984 if( !m_sheet )
return TQString();
985 Cell* cell = m_sheet->cellAt( m_point );
986 return cell->
format()->fallDiagonalColor( m_point.x(), m_point.y() ).name();
989TQString CellIface::fallDiagonalStyle()
const
991 if( !m_sheet )
return TQString();
992 Cell* cell = m_sheet->cellAt( m_point );
993 TQt::PenStyle penStyle=cell->
format()->fallDiagonalStyle( m_point.x(), m_point.y() );
995 if( penStyle==TQt::DotLine)
997 else if( penStyle==TQt::DashLine)
999 else if( penStyle==TQt::DashDotLine)
1001 else if( penStyle==TQt::DashDotDotLine)
1002 tmp=
"DashDotDotLine";
1003 else if( penStyle==TQt::SolidLine)
1012void CellIface::setGoUpDiagonalStyle(
const TQString& _style )
1014 if( !m_sheet )
return;
1015 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1016 if(_style==
"DotLine")
1017 cell->
format()->setGoUpDiagonalStyle(TQt::DotLine);
1018 else if(_style==
"DashLine")
1019 cell->
format()->setGoUpDiagonalStyle(TQt::DashLine);
1020 else if(_style==
"DashDotLine")
1021 cell->
format()->setGoUpDiagonalStyle(TQt::DashDotLine);
1022 else if(_style==
"DashDotDotLine")
1023 cell->
format()->setGoUpDiagonalStyle(TQt::DashDotDotLine);
1024 else if(_style==
"SolidLine")
1025 cell->
format()->setGoUpDiagonalStyle(TQt::SolidLine);
1027 cell->
format()->setGoUpDiagonalStyle(TQt::SolidLine);
1028 m_sheet->setRegionPaintDirty(cell->
cellRect());
1032void CellIface::setGoUpDiagonalColor(
const TQString& _c)
1034 if( !m_sheet )
return;
1036 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1037 cell->
format()->setGoUpDiagonalColor(c );
1038 m_sheet->setRegionPaintDirty(cell->
cellRect());
1041void CellIface::setGoUpDiagonalColor(
int r,
int g,
int b)
1043 if( !m_sheet )
return;
1044 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1046 cell->
format()->setGoUpDiagonalColor(c );
1047 m_sheet->setRegionPaintDirty(cell->
cellRect());
1050void CellIface::setGoUpDiagonalWidth(
int _size )
1052 if( !m_sheet )
return;
1053 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1054 cell->
format()->setGoUpDiagonalWidth( _size );
1055 m_sheet->setRegionPaintDirty(cell->
cellRect());
1058int CellIface::goUpDiagonalWidth()
const
1060 if( !m_sheet )
return 0;
1061 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1062 return cell->
format()->goUpDiagonalWidth(m_point.x(), m_point.y());
1065TQString CellIface::goUpDiagonalColor()
const
1067 if( !m_sheet )
return TQString();
1068 Cell* cell = m_sheet->cellAt( m_point );
1069 return cell->
format()->goUpDiagonalColor( m_point.x(), m_point.y() ).name();
1072TQString CellIface::goUpDiagonalStyle()
const
1074 if( !m_sheet )
return TQString();
1075 Cell* cell = m_sheet->cellAt( m_point );
1076 TQt::PenStyle penStyle=cell->
format()->goUpDiagonalStyle( m_point.x(), m_point.y() );
1078 if( penStyle==TQt::DotLine)
1080 else if( penStyle==TQt::DashLine)
1082 else if( penStyle==TQt::DashDotLine)
1084 else if( penStyle==TQt::DashDotDotLine)
1085 tmp=
"DashDotDotLine";
1086 else if( penStyle==TQt::SolidLine)
1093void CellIface::setIndent(
double indent)
1095 if( !m_sheet )
return;
1096 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1098 cell->
format()->setIndent( indent );
1100 cell->
format()->setIndent( 0.0 );
1101 m_sheet->setRegionPaintDirty(cell->
cellRect());
1104double CellIface::getIndent()
const
1106 if( !m_sheet )
return 0.0;
1107 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1108 return cell->
format()->getIndent( m_point.x(), m_point.y() );
1111void CellIface::setDontPrintText (
bool _print)
1113 if( !m_sheet )
return;
1114 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1115 cell->
format()->setDontPrintText ( _print);
1118bool CellIface::getDontprintText()
const
1120 if( !m_sheet )
return false;
1121 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1122 return cell->
format()->getDontprintText(m_point.x(), m_point.y());
1125bool CellIface::hasValidation()
const
1127 if( !m_sheet )
return false;
1128 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1129 if ( cell->getValidity( 0 ) )
1135TQString CellIface::validationTitle()
const
1137 if( !m_sheet )
return "";
1138 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1139 if ( cell->getValidity( 0 ) )
1141 return cell->getValidity( 0 )->title;
1147TQString CellIface::validationMessage()
const
1149 if( !m_sheet )
return "";
1150 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1151 if ( cell->getValidity( 0 ) )
1153 return cell->getValidity( 0 )->message;
1159TQStringList CellIface::listValidation()
const
1161 if( !m_sheet )
return TQStringList();
1162 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1163 if ( cell->getValidity( 0 ) )
1165 return cell->getValidity( 0 )->listValidity;
1168 return TQStringList();
1172TQString CellIface::validationTitleInfo()
const
1174 if( !m_sheet )
return "";
1175 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1176 if ( cell->getValidity( 0 ) )
1178 return cell->getValidity( 0 )->titleInfo;
1184TQString CellIface::validationMessageInfo()
const
1186 if( !m_sheet )
return "";
1187 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1188 if ( cell->getValidity( 0 ) )
1190 return cell->getValidity( 0 )->messageInfo;
1197bool CellIface::displayValidationInformation()
const
1199 if( !m_sheet )
return false;
1200 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1201 if ( cell->getValidity( 0 ) )
1203 return cell->getValidity( 0 )->displayValidationInformation;
1209bool CellIface::displayValidationMessage()
const
1211 if( !m_sheet )
return false;
1212 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1213 if ( cell->getValidity( 0 ) )
1215 return cell->getValidity( 0 )->displayMessage;
1221bool CellIface::validationAllowEmptyCell()
const
1223 if( !m_sheet )
return false;
1224 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1225 if ( cell->getValidity( 0 ) )
1227 return cell->getValidity( 0 )->allowEmptyCell;
1233void CellIface::removeValidity()
1235 if( !m_sheet )
return;
1236 Cell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
1237 cell->removeValidity();
const Value value() const
Returns the value that this cell holds.
void setValue(const Value &value)
Sets the value for this cell.
bool isEmpty() const
Returns true if this cell has no content, i.e no text and no formula.
void setCellText(const TQString &_text, bool asString=false)
The high-level method for setting text, when the user inputs it.
Format * format() const
Returns the format object of this cell.
bool isDefault() const
Returns true if this is a default cell (with row and column equal to zero).
const TQColor & bgColor(int col, int row) const
double asFloat() const
Returns the floating-point value of this value.
TQString asString() const
Returns the string value of this value.