kspread
Cell.hGo to the documentation of this file.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
00030
00031
00032
00033
00034 #ifndef KSPREAD_CELL
00035 #define KSPREAD_CELL
00036
00037 #include <QDate>
00038 #include <QSharedDataPointer>
00039
00040 #include "Condition.h"
00041 #include "Global.h"
00042 #include "Format.h"
00043
00044 #include "database/Database.h"
00045
00046 class QDomElement;
00047 class QDomDocument;
00048 class QFont;
00049 class QRect;
00050 class QPoint;
00051
00052 class KLocale;
00053 class KoXmlWriter;
00054 class KoGenStyles;
00055 class KoGenStyle;
00056 class KoOdfLoadingContext;
00057
00058 namespace KSpread
00059 {
00060 class Doc;
00061 class Formula;
00062 class OdfLoadingContext;
00063 class OdfSavingContext;
00064 class Sheet;
00065 class Validity;
00066 class Value;
00067
00074 class KSPREAD_EXPORT Cell
00075 {
00076 public:
00083 Cell();
00084
00089 Cell( const Sheet* sheet, int column, int row );
00090
00095 Cell( const Sheet* sheet, const QPoint& pos );
00096
00100 Cell( const Cell& other );
00101
00105 ~Cell();
00106
00110 Sheet* sheet() const;
00111
00115 KLocale* locale() const;
00116
00121 bool isDefault() const;
00122
00126 bool isEmpty() const;
00127
00131 bool isNull() const;
00132
00136 bool isFormula() const;
00137
00141 int column() const;
00142
00146 int row() const;
00147
00152 QString name() const;
00153
00158 QString fullName() const;
00159
00163 QString columnName() const;
00164
00169 static QString name( int col, int row );
00170
00175 static QString fullName( const Sheet *s, int col, int row );
00176
00181 static QString columnName( uint column );
00182
00186 QString displayText() const;
00187
00191 QString comment() const;
00192
00193 void setComment( const QString& comment );
00194
00198 Conditions conditions() const;
00199
00200 void setConditions( const Conditions& conditions );
00201
00205 Database database() const;
00206
00211 Formula formula() const;
00212
00216 void setFormula( const Formula& formula );
00217
00222 QString link() const;
00223
00230 void setLink( const QString& link );
00231
00235 Style style() const;
00236
00241 Style effectiveStyle() const;
00242
00243 void setStyle( const Style& style );
00244
00248 Validity validity() const;
00249
00250 void setValidity( Validity validity );
00251
00256 const Value value() const;
00257
00267 void setValue( const Value& value );
00268
00273 QString userInput() const;
00274
00282 void setUserInput( const QString& text );
00283
00293 void parseUserInput( const QString& text );
00294
00298 bool load( const KoXmlElement& cell,
00299 int _xshift, int _yshift,
00300 Paste::Mode pm = Paste::Normal,
00301 Paste::Operation op = Paste::OverWrite,
00302 bool paste = false );
00303
00314 QDomElement save(QDomDocument& doc, int xOffset = 0, int yOffset = 0, bool era = false);
00315
00320 QTime toTime(const KoXmlElement &element);
00321
00326 QDate toDate(const KoXmlElement &element);
00327
00334 bool loadOdf(const KoXmlElement& element, OdfLoadingContext& tableContext);
00335
00339 bool saveOdf( KoXmlWriter& xmlwriter, KoGenStyles& mainStyles,
00340 int row, int column, int &repeated,
00341 OdfSavingContext& savingContext);
00342
00348 void copyFormat( const Cell& cell );
00349
00355 void copyContent( const Cell& cell );
00356
00363 void copyAll( const Cell& cell);
00364
00368 double width() const;
00369
00373 double height() const;
00374
00378 QPoint cellPosition() const;
00379
00387 bool needsPrinting() const;
00388
00389
00390
00391
00393
00394
00395
00396
00403 bool isPartOfMerged() const;
00404
00408 Cell masterCell() const;
00409
00421 void mergeCells( int _col, int _row, int _x, int _y );
00422
00426 bool doesMergeCells() const;
00427
00432 int mergedXCells() const;
00433
00438 int mergedYCells() const;
00439
00440
00441
00442
00444
00445
00446
00447
00448 bool isLocked() const;
00449 QRect lockedCells() const;
00450
00451
00452
00453
00455
00456
00457
00458
00467 QString encodeFormula(bool fixedReferences = false) const;
00468
00474 QString decodeFormula(const QString& text) const;
00475
00485 QString pasteOperation( const QString &new_text, const QString &old_text, Paste::Operation op );
00486
00487
00488
00489
00491
00492
00493
00494
00499 bool makeFormula();
00500
00501
00502
00503
00505
00506
00507
00508
00510 int effectiveAlignX() const;
00512 bool isDate() const;
00514 bool isTime() const;
00516 bool isText() const;
00517
00518
00519
00520
00522
00523
00524
00525
00529 Cell& operator=( const Cell& other );
00530
00536 bool operator<( const Cell& other ) const;
00537
00543 bool operator==( const Cell& other ) const;
00544
00548 bool operator!() const;
00549
00550
00551
00552
00554
00555
00556
00557
00561 bool compareData( const Cell& other ) const;
00562
00563 protected:
00569 void loadOdfCellText( const KoXmlElement& parent );
00570
00574 void loadOdfObjects( const KoXmlElement& e, KoOdfLoadingContext& odfContext );
00575
00579 void saveOdfAnnotation( KoXmlWriter &xmlwriter );
00580
00581 private:
00582 class Private;
00583 QSharedDataPointer<Private> d;
00584
00588 bool loadCellData(const KoXmlElement &text, Paste::Operation op);
00589
00593 bool saveCellResult( QDomDocument& doc, QDomElement& result, QString str );
00594
00598 void saveOdfValue (KoXmlWriter &xmlWriter);
00599
00604 QString saveOdfCellStyle( KoGenStyle ¤tCellStyle, KoGenStyles &mainStyles );
00605 };
00606
00607 inline uint qHash( const Cell& cell )
00608 {
00609 return ( static_cast<uint>( cell.column() ) << 16 ) + static_cast<uint>( cell.row() );
00610 }
00611
00612 }
00613
00614 Q_DECLARE_TYPEINFO( KSpread::Cell, Q_MOVABLE_TYPE );
00615
00616
00617
00618
00619
00620
00621 inline kdbgstream operator<<(kdbgstream str, const KSpread::Cell& cell)
00622 {
00623 return str << qPrintable(KSpread::Cell::columnName(cell.column()) + QString::number(cell.row()));
00624 }
00625
00626 #endif // KSPREAD_CELL
|