00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "KSpreadCellIface.h"
00030
00031 #include "kspread_sheet.h"
00032
00033 KSpreadCellIface::KSpreadCellIface()
00034 : m_point( 0, 0 ), m_sheet( 0 )
00035 {
00036 }
00037
00038 void KSpreadCellIface::setCell( KSpreadSheet* sheet, const QPoint& point )
00039 {
00040 m_sheet = sheet;
00041 m_point = point;
00042 }
00043
00044 bool KSpreadCellIface::isDefault() const
00045 {
00046 if( !m_sheet ) return false;
00047 KSpreadCell* cell = m_sheet->cellAt( m_point );
00048 return cell->isDefault();
00049 }
00050
00051 bool KSpreadCellIface::isEmpty() const
00052 {
00053 if (!m_sheet) return true;
00054 KSpreadCell *cell=m_sheet->cellAt(m_point);
00055 return cell->isEmpty();
00056 }
00057
00058 QString KSpreadCellIface::text() const
00059 {
00060 if( !m_sheet ) return QString::null;
00061 KSpreadCell* cell = m_sheet->cellAt( m_point );
00062 return cell->value().asString();
00063 }
00064
00065 void KSpreadCellIface::setText( const QString& text )
00066 {
00067 if( !m_sheet ) return;
00068 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00069 cell->setCellText( text );
00070 }
00071
00072 QString KSpreadCellIface::visibleContentAsString() const
00073 {
00074 if( !m_sheet ) return QString::null;
00075 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00076 if (cell->isEmpty()) return QString::null;
00077 QString ret;
00078 ret=cell->value().asString();
00079
00080 if (ret.isEmpty())
00081 {
00082 ret=QString::number(cell->value().asFloat());
00083 }
00084 return ret;
00085 }
00086
00087 QString KSpreadCellIface::comment() const
00088 {
00089 if( !m_sheet ) return QString::null;
00090 KSpreadCell* cell = m_sheet->cellAt( m_point );
00091 return cell->comment(m_point.x(), m_point.y());
00092 }
00093
00094 void KSpreadCellIface::setComment( const QString& comment )
00095 {
00096 if( !m_sheet ) return;
00097 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00098 cell->setComment( comment);
00099 m_sheet->setRegionPaintDirty(cell->cellRect());
00100 }
00101
00102 void KSpreadCellIface::setValue( int value )
00103 {
00104 if( !m_sheet ) return;
00105 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00106 cell->setValue( (double)value );
00107 }
00108
00109 void KSpreadCellIface::setValue( double value )
00110 {
00111 if( !m_sheet ) return;
00112 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00113 cell->setValue( value );
00114 }
00115
00116 double KSpreadCellIface::value() const
00117 {
00118 if( !m_sheet ) return 0.0;
00119 KSpreadCell* cell = m_sheet->cellAt( m_point );
00120 return cell->value().asFloat();
00121 }
00122
00123 void KSpreadCellIface::setBgColor(const QString& _c)
00124 {
00125 if( !m_sheet ) return;
00126 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00127 QColor c(_c);
00128 cell->setBgColor(c);
00129 m_sheet->setRegionPaintDirty(cell->cellRect());
00130 }
00131
00132 void KSpreadCellIface::setBgColor(int r,int g,int b)
00133 {
00134 if( !m_sheet ) return;
00135 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00136 QColor c(r,g,b);
00137 cell->setBgColor(c);
00138 m_sheet->setRegionPaintDirty(cell->cellRect());
00139 }
00140
00141 QString KSpreadCellIface::bgColor() const
00142 {
00143 if( !m_sheet ) return QString::null;
00144 KSpreadCell* cell = m_sheet->cellAt( m_point );
00145 return cell->bgColor( m_point.x(), m_point.y() ).name();
00146 }
00147
00148 QString KSpreadCellIface::textColor() const
00149 {
00150 if( !m_sheet ) return QString::null;
00151 KSpreadCell* cell = m_sheet->cellAt( m_point );
00152 return cell->textColor( m_point.x(), m_point.y() ).name();
00153 }
00154
00155 void KSpreadCellIface::setTextColor(int r,int g,int b)
00156 {
00157 if( !m_sheet ) return;
00158 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00159 QColor c(r,g,b);
00160 cell->setTextColor(c);
00161 m_sheet->setRegionPaintDirty(cell->cellRect());
00162 }
00163
00164 void KSpreadCellIface::setTextColor(const QString& _c)
00165 {
00166 if( !m_sheet ) return;
00167 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00168 QColor c(_c);
00169 cell->setTextColor(c);
00170 m_sheet->setRegionPaintDirty(cell->cellRect());
00171 }
00172
00173 void KSpreadCellIface::setAngle(int angle)
00174 {
00175 if( !m_sheet ) return;
00176 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00177 cell->setAngle(angle);
00178 m_sheet->setRegionPaintDirty(cell->cellRect());
00179 }
00180
00181 int KSpreadCellIface::angle() const
00182 {
00183 if( !m_sheet ) return 0;
00184 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00185 return cell->getAngle(m_point.x(), m_point.y());
00186 }
00187
00188 void KSpreadCellIface::setVerticalText(bool _vertical)
00189 {
00190 if( !m_sheet ) return;
00191 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00192 cell->setVerticalText(_vertical);
00193 m_sheet->setRegionPaintDirty(cell->cellRect());
00194 }
00195
00196 bool KSpreadCellIface::verticalText() const
00197 {
00198 if( !m_sheet ) return false;
00199 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00200 return cell->verticalText( m_point.x(), m_point.y() );
00201 }
00202
00203
00204 void KSpreadCellIface::setMultiRow(bool _multi)
00205 {
00206 if( !m_sheet ) return;
00207 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00208 cell->setMultiRow( _multi );
00209 m_sheet->setRegionPaintDirty(cell->cellRect());
00210 }
00211
00212 bool KSpreadCellIface::multiRow() const
00213 {
00214 if( !m_sheet ) return false;
00215 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00216 return cell->multiRow( m_point.x(), m_point.y() );
00217 }
00218
00219 void KSpreadCellIface::setAlign( const QString& _Align )
00220 {
00221 if( !m_sheet ) return;
00222 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00223 KSpreadCell::Align Align;
00224 if(_Align=="Left")
00225 Align=KSpreadCell::Left;
00226 else if(_Align=="Right")
00227 Align=KSpreadCell::Right;
00228 else if(_Align=="Center")
00229 Align=KSpreadCell::Center;
00230 else
00231 Align=KSpreadCell::Undefined;
00232 cell->setAlign( Align);
00233 m_sheet->setRegionPaintDirty(cell->cellRect());
00234 }
00235
00236 QString KSpreadCellIface::align() const
00237 {
00238 if( !m_sheet ) return QString::null;
00239 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00240 QString alignString;
00241 switch( cell->align( m_point.x(), m_point.y() ) )
00242 {
00243 case KSpreadCell::Left :
00244 alignString="Left";
00245 break;
00246 case KSpreadCell::Right :
00247 alignString="Right";
00248 break;
00249 case KSpreadCell::Center :
00250 alignString="Center";
00251 break;
00252 case KSpreadCell::Undefined :
00253 alignString="Undefined";
00254 break;
00255 }
00256 return alignString;
00257 }
00258
00259 void KSpreadCellIface::setAlignY( const QString& _AlignY )
00260 {
00261 if( !m_sheet ) return;
00262 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00263 KSpreadCell::AlignY AlignY;
00264 if(_AlignY=="Top")
00265 AlignY=KSpreadCell::Top;
00266 else if(_AlignY=="Middle")
00267 AlignY=KSpreadCell::Middle;
00268 else if(_AlignY=="Bottom")
00269 AlignY=KSpreadCell::Bottom;
00270 else
00271 AlignY=KSpreadCell::Middle;
00272 cell->setAlignY( AlignY);
00273 m_sheet->setRegionPaintDirty(cell->cellRect());
00274 }
00275
00276 QString KSpreadCellIface::alignY() const
00277 {
00278 if( !m_sheet ) return QString::null;
00279 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00280 QString alignString;
00281 switch( cell->alignY( m_point.x(), m_point.y() ) )
00282 {
00283 case KSpreadCell::Top :
00284 alignString="Top";
00285 break;
00286 case KSpreadCell::Middle :
00287 alignString="Middle";
00288 break;
00289 case KSpreadCell::Bottom :
00290 alignString="Bottom";
00291 break;
00292 case KSpreadCell::UndefinedY :
00293 alignString="UndefinedY";
00294 break;
00295 }
00296 return alignString;
00297 }
00298
00299 void KSpreadCellIface::setPostfix(const QString &_postfix)
00300 {
00301 if( !m_sheet ) return;
00302 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00303 cell->setPostfix( _postfix );
00304 m_sheet->setRegionPaintDirty(cell->cellRect());
00305 }
00306
00307 QString KSpreadCellIface::prefix() const
00308 {
00309 if( !m_sheet ) return QString::null;
00310 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00311 return cell->prefix( m_point.x(), m_point.y() );
00312 }
00313
00314 void KSpreadCellIface::setPrefix(const QString &_prefix)
00315 {
00316 if( !m_sheet ) return;
00317 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00318 cell->setPrefix( _prefix );
00319 m_sheet->setRegionPaintDirty(cell->cellRect());
00320 }
00321
00322 QString KSpreadCellIface::postfix() const
00323 {
00324 if( !m_sheet ) return QString::null;
00325 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00326 return cell->postfix( m_point.x(), m_point.y() );
00327 }
00328
00329 void KSpreadCellIface::setFormatType(const QString &_formatType)
00330 {
00331 if( !m_sheet ) return;
00332
00333 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00334 FormatType format;
00335 cell->setPrecision(2);
00336 if (_formatType=="Generic")
00337 format = Generic_format;
00338 else if(_formatType=="Number")
00339 format=Number_format;
00340 else if (_formatType=="Text")
00341 format=Text_format;
00342 else if(_formatType=="Money")
00343 format=Money_format;
00344 else if(_formatType=="Percentage")
00345 format=Percentage_format;
00346 else if(_formatType=="Scientific")
00347 format=Scientific_format;
00348 else if(_formatType=="ShortDate")
00349 format=ShortDate_format;
00350 else if(_formatType=="TextDate")
00351 format=TextDate_format;
00352 else if(_formatType=="Time")
00353 format=Time_format;
00354 else if(_formatType=="SecondeTime")
00355 format=SecondeTime_format;
00356 else if(_formatType=="fraction_half")
00357 format=fraction_half;
00358 else if(_formatType=="fraction_quarter")
00359 format=fraction_quarter;
00360 else if(_formatType=="fraction_eighth")
00361 format=fraction_eighth;
00362 else if(_formatType=="fraction_sixteenth")
00363 format=fraction_sixteenth;
00364 else if(_formatType=="fraction_tenth")
00365 format=fraction_tenth;
00366 else if(_formatType=="fraction_hundredth")
00367 format=fraction_hundredth;
00368 else if(_formatType=="fraction_one_digit")
00369 format=fraction_one_digit;
00370 else if(_formatType=="fraction_two_digits")
00371 format=fraction_two_digits;
00372 else if(_formatType=="fraction_three_digits")
00373 format=fraction_three_digits;
00374 else
00375 format=Generic_format;
00376 cell->setFormatType( format);
00377 m_sheet->setRegionPaintDirty(cell->cellRect());
00378 }
00379
00380 QString KSpreadCellIface::getFormatType() const
00381 {
00382 if( !m_sheet ) return QString::null;
00383
00384 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00385 QString stringFormat;
00386 switch( cell->getFormatType(m_point.x(), m_point.y()))
00387 {
00388 case Text_format:
00389 stringFormat="Text";
00390 break;
00391 case Number_format:
00392 stringFormat="Number";
00393 break;
00394 case Money_format:
00395 stringFormat="Money";
00396 break;
00397 case Percentage_format:
00398 stringFormat="Percentage";
00399 break;
00400 case Scientific_format:
00401 stringFormat="Scientific";
00402 break;
00403 case ShortDate_format:
00404 stringFormat="ShortDate";
00405 break;
00406 case TextDate_format:
00407 stringFormat="TextDate";
00408 break;
00409 case date_format1:
00410 case date_format2:
00411 case date_format3:
00412 case date_format4:
00413 case date_format5:
00414 case date_format6:
00415 case date_format7:
00416 case date_format8:
00417 case date_format9:
00418 case date_format10:
00419 case date_format11:
00420 case date_format12:
00421 case date_format13:
00422 case date_format14:
00423 case date_format15:
00424 case date_format16:
00425 case date_format17:
00426 case date_format18:
00427 case date_format19:
00428 case date_format20:
00429 case date_format21:
00430 case date_format22:
00431 case date_format23:
00432 case date_format24:
00433 case date_format25:
00434 case date_format26:
00435 stringFormat="date format";
00436 break;
00437 case Time_format:
00438 stringFormat="Time";
00439 break;
00440 case SecondeTime_format:
00441 stringFormat="SecondeTime";
00442 break;
00443 case Time_format1:
00444 case Time_format2:
00445 case Time_format3:
00446 case Time_format4:
00447 case Time_format5:
00448 case Time_format6:
00449 case Time_format7:
00450 case Time_format8:
00451 stringFormat="time format";
00452 break;
00453 case fraction_half:
00454 stringFormat="fraction_half";
00455 break;
00456 case fraction_quarter:
00457 stringFormat="fraction_quarter";
00458 break;
00459 case fraction_eighth:
00460 stringFormat="fraction_eighth";
00461 break;
00462 case fraction_sixteenth:
00463 stringFormat="fraction_sixteenth";
00464 break;
00465 case fraction_tenth:
00466 stringFormat="fraction_tenth";
00467 break;
00468 case fraction_hundredth:
00469 stringFormat="fraction_hundredth";
00470 break;
00471 case fraction_one_digit:
00472 stringFormat="fraction_one_digit";
00473 break;
00474 case fraction_two_digits:
00475 stringFormat="fraction_two_digits";
00476 break;
00477 case fraction_three_digits:
00478 stringFormat="fraction_three_digits";
00479 break;
00480 }
00481 return stringFormat;
00482 }
00483
00484 void KSpreadCellIface::setPrecision(int _p)
00485 {
00486 if( !m_sheet ) return;
00487 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00488 cell->setPrecision( _p );
00489 m_sheet->setRegionPaintDirty(cell->cellRect());
00490 }
00491
00492 int KSpreadCellIface::precision() const
00493 {
00494 if( !m_sheet ) return 0;
00495 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00496 return cell->precision( m_point.x(), m_point.y() );
00497 }
00498
00499 void KSpreadCellIface::setTextFontBold(bool _b)
00500 {
00501 if( !m_sheet ) return;
00502 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00503 cell->setTextFontBold( _b );
00504 m_sheet->setRegionPaintDirty(cell->cellRect());
00505 }
00506
00507 bool KSpreadCellIface::textFontBold() const
00508 {
00509 if( !m_sheet ) return false;
00510 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00511 return cell->textFontBold( m_point.x(), m_point.y() );
00512 }
00513
00514 void KSpreadCellIface::setTextFontItalic(bool _b)
00515 {
00516 if( !m_sheet ) return;
00517 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00518 cell->setTextFontItalic( _b );
00519 m_sheet->setRegionPaintDirty(cell->cellRect());
00520 }
00521
00522 bool KSpreadCellIface::textFontItalic() const
00523 {
00524 if( !m_sheet ) return false;
00525 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00526 return cell->textFontItalic( m_point.x(), m_point.y() );
00527 }
00528
00529
00530 void KSpreadCellIface::setTextFontUnderline(bool _b)
00531 {
00532 if( !m_sheet ) return;
00533 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00534 cell->setTextFontUnderline( _b );
00535 m_sheet->setRegionPaintDirty(cell->cellRect());
00536 }
00537
00538 bool KSpreadCellIface::textFontUnderline() const
00539 {
00540 if( !m_sheet ) return false;
00541 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00542 return cell->textFontUnderline( m_point.x(), m_point.y() );
00543 }
00544
00545 void KSpreadCellIface::setTextFontStrike(bool _b)
00546 {
00547 if( !m_sheet ) return;
00548 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00549 cell->setTextFontStrike( _b );
00550 m_sheet->setRegionPaintDirty(cell->cellRect());
00551 }
00552
00553 bool KSpreadCellIface::textFontStrike() const
00554 {
00555 if( !m_sheet ) return false;
00556 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00557 return cell->textFontStrike( m_point.x(), m_point.y() );
00558 }
00559
00560 void KSpreadCellIface::setTextFontSize( int _size )
00561 {
00562 if( !m_sheet ) return;
00563 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00564 cell->setTextFontSize( _size );
00565 m_sheet->setRegionPaintDirty(cell->cellRect());
00566 }
00567
00568 int KSpreadCellIface::textFontSize() const
00569 {
00570 if( !m_sheet ) return 10;
00571 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00572 return cell->textFontSize( m_point.x(), m_point.y() );
00573 }
00574
00575 void KSpreadCellIface::setTextFontFamily( const QString& _font )
00576 {
00577 if( !m_sheet ) return;
00578 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00579 cell->setTextFontFamily( _font );
00580 m_sheet->setRegionPaintDirty(cell->cellRect());
00581 }
00582
00583 QString KSpreadCellIface::textFontFamily() const
00584 {
00585 if( !m_sheet ) return QString::null;
00586 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00587 return cell->textFontFamily( m_point.x(), m_point.y() );
00588 }
00589
00590
00591 void KSpreadCellIface::setLeftBorderStyle( const QString& _style )
00592 {
00593 if( !m_sheet ) return;
00594 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00595 if(_style=="DotLine")
00596 cell->setLeftBorderStyle(Qt::DotLine);
00597 else if(_style=="DashLine")
00598 cell->setLeftBorderStyle(Qt::DashLine);
00599 else if(_style=="DashDotLine")
00600 cell->setLeftBorderStyle(Qt::DashDotLine);
00601 else if(_style=="DashDotDotLine")
00602 cell->setLeftBorderStyle(Qt::DashDotDotLine);
00603 else if(_style=="SolidLine")
00604 cell->setLeftBorderStyle(Qt::SolidLine);
00605 else
00606 cell->setLeftBorderStyle(Qt::SolidLine);
00607 m_sheet->setRegionPaintDirty(cell->cellRect());
00608
00609 }
00610
00611 void KSpreadCellIface::setLeftBorderColor(const QString& _c)
00612 {
00613 if( !m_sheet ) return;
00614 QColor c(_c);
00615 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00616 cell->setLeftBorderColor(c );
00617 m_sheet->setRegionPaintDirty(cell->cellRect());
00618
00619 }
00620
00621 void KSpreadCellIface::setLeftBorderColor(int r,int g,int b)
00622 {
00623 if( !m_sheet ) return;
00624 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00625 QColor c(r,g,b);
00626 cell->setLeftBorderColor(c );
00627 m_sheet->setRegionPaintDirty(cell->cellRect());
00628 }
00629
00630 void KSpreadCellIface::setLeftBorderWidth( int _size )
00631 {
00632 if( !m_sheet ) return;
00633 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00634 cell->setLeftBorderWidth( _size );
00635 m_sheet->setRegionPaintDirty(cell->cellRect());
00636 }
00637
00638
00639 int KSpreadCellIface::leftBorderWidth() const
00640 {
00641 if( !m_sheet ) return 0;
00642 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00643 return cell->leftBorderWidth(m_point.x(), m_point.y());
00644 }
00645
00646 QString KSpreadCellIface::leftBorderColor() const
00647 {
00648 if( !m_sheet ) return QString::null;
00649 KSpreadCell* cell = m_sheet->cellAt( m_point );
00650 return cell->leftBorderColor( m_point.x(), m_point.y() ).name();
00651 }
00652
00653 QString KSpreadCellIface::leftBorderStyle() const
00654 {
00655 if( !m_sheet ) return QString::null;
00656 KSpreadCell* cell = m_sheet->cellAt( m_point );
00657 Qt::PenStyle penStyle=cell->leftBorderStyle( m_point.x(), m_point.y() );
00658 QString tmp;
00659 if( penStyle==Qt::DotLine)
00660 tmp="DotLine";
00661 else if( penStyle==Qt::DashLine)
00662 tmp="DashLine";
00663 else if( penStyle==Qt::DashDotLine)
00664 tmp="DashDotLine";
00665 else if( penStyle==Qt::DashDotDotLine)
00666 tmp="DashDotDotLine";
00667 else if( penStyle==Qt::SolidLine)
00668 tmp="SolidLine";
00669 else
00670 tmp="SolidLine";
00671 return tmp;
00672 }
00673
00674
00675 void KSpreadCellIface::setRightBorderStyle( const QString& _style )
00676 {
00677 if( !m_sheet ) return;
00678 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00679 if(_style=="DotLine")
00680 cell->setRightBorderStyle(Qt::DotLine);
00681 else if(_style=="DashLine")
00682 cell->setRightBorderStyle(Qt::DashLine);
00683 else if(_style=="DashDotLine")
00684 cell->setRightBorderStyle(Qt::DashDotLine);
00685 else if(_style=="DashDotDotLine")
00686 cell->setRightBorderStyle(Qt::DashDotDotLine);
00687 else if(_style=="SolidLine")
00688 cell->setRightBorderStyle(Qt::SolidLine);
00689 else
00690 cell->setRightBorderStyle(Qt::SolidLine);
00691 m_sheet->setRegionPaintDirty(cell->cellRect());
00692
00693 }
00694
00695 void KSpreadCellIface::setRightBorderColor(const QString& _c)
00696 {
00697 if( !m_sheet ) return;
00698 QColor c(_c);
00699 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00700 cell->setRightBorderColor(c );
00701 m_sheet->setRegionPaintDirty(cell->cellRect());
00702
00703 }
00704 void KSpreadCellIface::setRightBorderColor(int r,int g,int b)
00705 {
00706 if( !m_sheet ) return;
00707 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00708 QColor c(r,g,b);
00709 cell->setRightBorderColor(c );
00710 m_sheet->setRegionPaintDirty(cell->cellRect());
00711 }
00712
00713 void KSpreadCellIface::setRightBorderWidth( int _size )
00714 {
00715 if( !m_sheet ) return;
00716 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00717 cell->setRightBorderWidth( _size );
00718 m_sheet->setRegionPaintDirty(cell->cellRect());
00719
00720 }
00721
00722 int KSpreadCellIface::rightBorderWidth() const
00723 {
00724 if( !m_sheet ) return 0;
00725 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00726 return cell->rightBorderWidth(m_point.x(), m_point.y());
00727 }
00728
00729 QString KSpreadCellIface::rightBorderColor() const
00730 {
00731 if( !m_sheet ) return QString::null;
00732 KSpreadCell* cell = m_sheet->cellAt( m_point );
00733 return cell->rightBorderColor( m_point.x(), m_point.y() ).name();
00734 }
00735
00736 QString KSpreadCellIface::rightBorderStyle() const
00737 {
00738 if( !m_sheet ) return QString::null;
00739 KSpreadCell* cell = m_sheet->cellAt( m_point );
00740 Qt::PenStyle penStyle=cell->rightBorderStyle( m_point.x(), m_point.y() );
00741 QString tmp;
00742 if( penStyle==Qt::DotLine)
00743 tmp="DotLine";
00744 else if( penStyle==Qt::DashLine)
00745 tmp="DashLine";
00746 else if( penStyle==Qt::DashDotLine)
00747 tmp="DashDotLine";
00748 else if( penStyle==Qt::DashDotDotLine)
00749 tmp="DashDotDotLine";
00750 else if( penStyle==Qt::SolidLine)
00751 tmp="SolidLine";
00752 else
00753 tmp="SolidLine";
00754 return tmp;
00755 }
00756
00757
00758 void KSpreadCellIface::setTopBorderStyle( const QString& _style )
00759 {
00760 if( !m_sheet ) return;
00761 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00762 if(_style=="DotLine")
00763 cell->setTopBorderStyle(Qt::DotLine);
00764 else if(_style=="DashLine")
00765 cell->setTopBorderStyle(Qt::DashLine);
00766 else if(_style=="DashDotLine")
00767 cell->setTopBorderStyle(Qt::DashDotLine);
00768 else if(_style=="DashDotDotLine")
00769 cell->setTopBorderStyle(Qt::DashDotDotLine);
00770 else if(_style=="SolidLine")
00771 cell->setTopBorderStyle(Qt::SolidLine);
00772 else
00773 cell->setTopBorderStyle(Qt::SolidLine);
00774 m_sheet->setRegionPaintDirty(cell->cellRect());
00775
00776 }
00777
00778 void KSpreadCellIface::setTopBorderColor(const QString& _c)
00779 {
00780 if( !m_sheet ) return;
00781 QColor c(_c);
00782 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00783 cell->setTopBorderColor(c );
00784 m_sheet->setRegionPaintDirty(cell->cellRect());
00785
00786 }
00787 void KSpreadCellIface::setTopBorderColor(int r,int g,int b)
00788 {
00789 if( !m_sheet ) return;
00790 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00791 QColor c(r,g,b);
00792 cell->setTopBorderColor(c );
00793 m_sheet->setRegionPaintDirty(cell->cellRect());
00794 }
00795
00796 void KSpreadCellIface::setTopBorderWidth( int _size )
00797 {
00798 if( !m_sheet ) return;
00799 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00800 cell->setTopBorderWidth( _size );
00801 m_sheet->setRegionPaintDirty(cell->cellRect());
00802 }
00803
00804 int KSpreadCellIface::topBorderWidth() const
00805 {
00806 if( !m_sheet ) return 0;
00807 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00808 return cell->topBorderWidth(m_point.x(), m_point.y());
00809 }
00810
00811 QString KSpreadCellIface::topBorderColor() const
00812 {
00813 if( !m_sheet ) return QString::null;
00814 KSpreadCell* cell = m_sheet->cellAt( m_point );
00815 return cell->topBorderColor( m_point.x(), m_point.y() ).name();
00816 }
00817
00818 QString KSpreadCellIface::topBorderStyle() const
00819 {
00820 if( !m_sheet ) return QString::null;
00821 KSpreadCell* cell = m_sheet->cellAt( m_point );
00822 Qt::PenStyle penStyle=cell->topBorderStyle( m_point.x(), m_point.y() );
00823 QString tmp;
00824 if( penStyle==Qt::DotLine)
00825 tmp="DotLine";
00826 else if( penStyle==Qt::DashLine)
00827 tmp="DashLine";
00828 else if( penStyle==Qt::DashDotLine)
00829 tmp="DashDotLine";
00830 else if( penStyle==Qt::DashDotDotLine)
00831 tmp="DashDotDotLine";
00832 else if( penStyle==Qt::SolidLine)
00833 tmp="SolidLine";
00834 else
00835 tmp="SolidLine";
00836 return tmp;
00837 }
00838
00839
00840 void KSpreadCellIface::setBottomBorderStyle( const QString& _style )
00841 {
00842 if( !m_sheet ) return;
00843 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00844 if(_style=="DotLine")
00845 cell->setBottomBorderStyle(Qt::DotLine);
00846 else if(_style=="DashLine")
00847 cell->setBottomBorderStyle(Qt::DashLine);
00848 else if(_style=="DashDotLine")
00849 cell->setBottomBorderStyle(Qt::DashDotLine);
00850 else if(_style=="DashDotDotLine")
00851 cell->setBottomBorderStyle(Qt::DashDotDotLine);
00852 else if(_style=="SolidLine")
00853 cell->setBottomBorderStyle(Qt::SolidLine);
00854 else
00855 cell->setBottomBorderStyle(Qt::SolidLine);
00856 m_sheet->setRegionPaintDirty(cell->cellRect());
00857
00858 }
00859
00860 void KSpreadCellIface::setBottomBorderColor(const QString& _c)
00861 {
00862 if( !m_sheet ) return;
00863 QColor c(_c);
00864 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00865 cell->setBottomBorderColor(c );
00866 m_sheet->setRegionPaintDirty(cell->cellRect());
00867
00868 }
00869 void KSpreadCellIface::setBottomBorderColor(int r,int g,int b)
00870 {
00871 if( !m_sheet ) return;
00872 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00873 QColor c(r,g,b);
00874 cell->setBottomBorderColor(c );
00875 m_sheet->setRegionPaintDirty(cell->cellRect());
00876 }
00877
00878 void KSpreadCellIface::setBottomBorderWidth( int _size )
00879 {
00880 if( !m_sheet ) return;
00881 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00882 cell->setBottomBorderWidth( _size );
00883 m_sheet->setRegionPaintDirty(cell->cellRect());
00884 }
00885
00886 int KSpreadCellIface::bottomBorderWidth() const
00887 {
00888 if( !m_sheet ) return 0;
00889 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00890 return cell->bottomBorderWidth(m_point.x(), m_point.y());
00891 }
00892
00893 QString KSpreadCellIface::bottomBorderColor() const
00894 {
00895 if( !m_sheet ) return QString::null;
00896 KSpreadCell* cell = m_sheet->cellAt( m_point );
00897 return cell->bottomBorderColor( m_point.x(), m_point.y() ).name();
00898 }
00899
00900 QString KSpreadCellIface::bottomBorderStyle() const
00901 {
00902 if( !m_sheet ) return QString::null;
00903 KSpreadCell* cell = m_sheet->cellAt( m_point );
00904 Qt::PenStyle penStyle=cell->bottomBorderStyle( m_point.x(), m_point.y() );
00905 QString tmp;
00906 if( penStyle==Qt::DotLine)
00907 tmp="DotLine";
00908 else if( penStyle==Qt::DashLine)
00909 tmp="DashLine";
00910 else if( penStyle==Qt::DashDotLine)
00911 tmp="DashDotLine";
00912 else if( penStyle==Qt::DashDotDotLine)
00913 tmp="DashDotDotLine";
00914 else if( penStyle==Qt::SolidLine)
00915 tmp="SolidLine";
00916 else
00917 tmp="SolidLine";
00918 return tmp;
00919 }
00920
00921
00922 void KSpreadCellIface::setFallDiagonalStyle( const QString& _style )
00923 {
00924 if( !m_sheet ) return;
00925 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00926 if(_style=="DotLine")
00927 cell->setFallDiagonalStyle(Qt::DotLine);
00928 else if(_style=="DashLine")
00929 cell->setFallDiagonalStyle(Qt::DashLine);
00930 else if(_style=="DashDotLine")
00931 cell->setFallDiagonalStyle(Qt::DashDotLine);
00932 else if(_style=="DashDotDotLine")
00933 cell->setFallDiagonalStyle(Qt::DashDotDotLine);
00934 else if(_style=="SolidLine")
00935 cell->setFallDiagonalStyle(Qt::SolidLine);
00936 else
00937 cell->setFallDiagonalStyle(Qt::SolidLine);
00938 m_sheet->setRegionPaintDirty(cell->cellRect());
00939
00940 }
00941
00942 void KSpreadCellIface::setFallDiagonalColor(const QString& _c)
00943 {
00944 if( !m_sheet ) return;
00945 QColor c(_c);
00946 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00947 cell->setFallDiagonalColor(c );
00948 m_sheet->setRegionPaintDirty(cell->cellRect());
00949
00950 }
00951 void KSpreadCellIface::setFallDiagonalColor(int r,int g,int b)
00952 {
00953 if( !m_sheet ) return;
00954 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00955 QColor c(r,g,b);
00956 cell->setFallDiagonalColor(c );
00957 m_sheet->setRegionPaintDirty(cell->cellRect());
00958 }
00959
00960 void KSpreadCellIface::setFallDiagonalWidth( int _size )
00961 {
00962 if( !m_sheet ) return;
00963 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00964 cell->setFallDiagonalWidth( _size );
00965 m_sheet->setRegionPaintDirty(cell->cellRect());
00966 }
00967
00968 int KSpreadCellIface::fallDiagonalWidth() const
00969 {
00970 if( !m_sheet ) return 0;
00971 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
00972 return cell->fallDiagonalWidth(m_point.x(), m_point.y());
00973 }
00974
00975 QString KSpreadCellIface::fallDiagonalColor() const
00976 {
00977 if( !m_sheet ) return QString::null;
00978 KSpreadCell* cell = m_sheet->cellAt( m_point );
00979 return cell->fallDiagonalColor( m_point.x(), m_point.y() ).name();
00980 }
00981
00982 QString KSpreadCellIface::fallDiagonalStyle() const
00983 {
00984 if( !m_sheet ) return QString::null;
00985 KSpreadCell* cell = m_sheet->cellAt( m_point );
00986 Qt::PenStyle penStyle=cell->fallDiagonalStyle( m_point.x(), m_point.y() );
00987 QString tmp;
00988 if( penStyle==Qt::DotLine)
00989 tmp="DotLine";
00990 else if( penStyle==Qt::DashLine)
00991 tmp="DashLine";
00992 else if( penStyle==Qt::DashDotLine)
00993 tmp="DashDotLine";
00994 else if( penStyle==Qt::DashDotDotLine)
00995 tmp="DashDotDotLine";
00996 else if( penStyle==Qt::SolidLine)
00997 tmp="SolidLine";
00998 else
00999 tmp="SolidLine";
01000 return tmp;
01001 }
01002
01003
01004
01005 void KSpreadCellIface::setGoUpDiagonalStyle( const QString& _style )
01006 {
01007 if( !m_sheet ) return;
01008 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01009 if(_style=="DotLine")
01010 cell->setGoUpDiagonalStyle(Qt::DotLine);
01011 else if(_style=="DashLine")
01012 cell->setGoUpDiagonalStyle(Qt::DashLine);
01013 else if(_style=="DashDotLine")
01014 cell->setGoUpDiagonalStyle(Qt::DashDotLine);
01015 else if(_style=="DashDotDotLine")
01016 cell->setGoUpDiagonalStyle(Qt::DashDotDotLine);
01017 else if(_style=="SolidLine")
01018 cell->setGoUpDiagonalStyle(Qt::SolidLine);
01019 else
01020 cell->setGoUpDiagonalStyle(Qt::SolidLine);
01021 m_sheet->setRegionPaintDirty(cell->cellRect());
01022
01023 }
01024
01025 void KSpreadCellIface::setGoUpDiagonalColor(const QString& _c)
01026 {
01027 if( !m_sheet ) return;
01028 QColor c(_c);
01029 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01030 cell->setGoUpDiagonalColor(c );
01031 m_sheet->setRegionPaintDirty(cell->cellRect());
01032
01033 }
01034 void KSpreadCellIface::setGoUpDiagonalColor(int r,int g,int b)
01035 {
01036 if( !m_sheet ) return;
01037 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01038 QColor c(r,g,b);
01039 cell->setGoUpDiagonalColor(c );
01040 m_sheet->setRegionPaintDirty(cell->cellRect());
01041 }
01042
01043 void KSpreadCellIface::setGoUpDiagonalWidth( int _size )
01044 {
01045 if( !m_sheet ) return;
01046 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01047 cell->setGoUpDiagonalWidth( _size );
01048 m_sheet->setRegionPaintDirty(cell->cellRect());
01049 }
01050
01051 int KSpreadCellIface::goUpDiagonalWidth() const
01052 {
01053 if( !m_sheet ) return 0;
01054 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01055 return cell->goUpDiagonalWidth(m_point.x(), m_point.y());
01056 }
01057
01058 QString KSpreadCellIface::goUpDiagonalColor() const
01059 {
01060 if( !m_sheet ) return QString::null;
01061 KSpreadCell* cell = m_sheet->cellAt( m_point );
01062 return cell->goUpDiagonalColor( m_point.x(), m_point.y() ).name();
01063 }
01064
01065 QString KSpreadCellIface::goUpDiagonalStyle() const
01066 {
01067 if( !m_sheet ) return QString::null;
01068 KSpreadCell* cell = m_sheet->cellAt( m_point );
01069 Qt::PenStyle penStyle=cell->goUpDiagonalStyle( m_point.x(), m_point.y() );
01070 QString tmp;
01071 if( penStyle==Qt::DotLine)
01072 tmp="DotLine";
01073 else if( penStyle==Qt::DashLine)
01074 tmp="DashLine";
01075 else if( penStyle==Qt::DashDotLine)
01076 tmp="DashDotLine";
01077 else if( penStyle==Qt::DashDotDotLine)
01078 tmp="DashDotDotLine";
01079 else if( penStyle==Qt::SolidLine)
01080 tmp="SolidLine";
01081 else
01082 tmp="SolidLine";
01083 return tmp;
01084 }
01085
01086 void KSpreadCellIface::setIndent(double indent)
01087 {
01088 if( !m_sheet ) return;
01089 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01090 if( indent >= 0.0 )
01091 cell->setIndent( indent );
01092 else
01093 cell->setIndent( 0.0 );
01094 m_sheet->setRegionPaintDirty(cell->cellRect());
01095 }
01096
01097 double KSpreadCellIface::getIndent() const
01098 {
01099 if( !m_sheet ) return 0.0;
01100 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01101 return cell->getIndent( m_point.x(), m_point.y() );
01102 }
01103
01104 void KSpreadCellIface::setDontPrintText ( bool _print)
01105 {
01106 if( !m_sheet ) return;
01107 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01108 cell->setDontPrintText ( _print);
01109 }
01110
01111 bool KSpreadCellIface::getDontprintText() const
01112 {
01113 if( !m_sheet ) return false;
01114 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01115 return cell->getDontprintText(m_point.x(), m_point.y());
01116 }
01117
01118 bool KSpreadCellIface::hasValidation() const
01119 {
01120 if( !m_sheet ) return false;
01121 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01122 if ( cell->getValidity( 0 ) )
01123 return true;
01124 else
01125 return false;
01126 }
01127
01128 QString KSpreadCellIface::validationTitle() const
01129 {
01130 if( !m_sheet ) return "";
01131 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01132 if ( cell->getValidity( 0 ) )
01133 {
01134 return cell->getValidity( 0 )->title;
01135 }
01136 else
01137 return "";
01138 }
01139
01140 QString KSpreadCellIface::validationMessage() const
01141 {
01142 if( !m_sheet ) return "";
01143 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01144 if ( cell->getValidity( 0 ) )
01145 {
01146 return cell->getValidity( 0 )->message;
01147 }
01148 else
01149 return "";
01150 }
01151
01152 QStringList KSpreadCellIface::listValidation() const
01153 {
01154 if( !m_sheet ) return QStringList();
01155 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01156 if ( cell->getValidity( 0 ) )
01157 {
01158 return cell->getValidity( 0 )->listValidity;
01159 }
01160 else
01161 return QStringList();
01162 }
01163
01164
01165 QString KSpreadCellIface::validationTitleInfo() const
01166 {
01167 if( !m_sheet ) return "";
01168 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01169 if ( cell->getValidity( 0 ) )
01170 {
01171 return cell->getValidity( 0 )->titleInfo;
01172 }
01173 else
01174 return "";
01175 }
01176
01177 QString KSpreadCellIface::validationMessageInfo() const
01178 {
01179 if( !m_sheet ) return "";
01180 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01181 if ( cell->getValidity( 0 ) )
01182 {
01183 return cell->getValidity( 0 )->messageInfo;
01184 }
01185 else
01186 return "";
01187 }
01188
01189
01190 bool KSpreadCellIface::displayValidationInformation() const
01191 {
01192 if( !m_sheet ) return false;
01193 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01194 if ( cell->getValidity( 0 ) )
01195 {
01196 return cell->getValidity( 0 )->displayValidationInformation;
01197 }
01198 else
01199 return false;
01200 }
01201
01202 bool KSpreadCellIface::displayValidationMessage() const
01203 {
01204 if( !m_sheet ) return false;
01205 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01206 if ( cell->getValidity( 0 ) )
01207 {
01208 return cell->getValidity( 0 )->displayMessage;
01209 }
01210 else
01211 return false;
01212 }
01213
01214 bool KSpreadCellIface::validationAllowEmptyCell() const
01215 {
01216 if( !m_sheet ) return false;
01217 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01218 if ( cell->getValidity( 0 ) )
01219 {
01220 return cell->getValidity( 0 )->allowEmptyCell;
01221 }
01222 else
01223 return false;
01224 }
01225
01226 void KSpreadCellIface::removeValidity()
01227 {
01228 if( !m_sheet ) return;
01229 KSpreadCell* cell = m_sheet->nonDefaultCell( m_point.x(), m_point.y() );
01230 cell->removeValidity();
01231 }