00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KSPREAD_SHEET
00023 #define KSPREAD_SHEET
00024
00025 class KSpreadSheet;
00026 class KSpreadSheetPrint;
00027
00028 class ColumnFormat;
00029 class RowFormat;
00030 class KSpreadCell;
00031 class KSpreadStyle;
00032 class KSpreadView;
00033 class KSpreadPoint;
00034 class KSpreadMap;
00035 class KSpreadCanvas;
00036 class KSpreadDoc;
00037 class KSpreadSelection;
00038 class KSpreadUndoInsertRemoveAction;
00039 class KoDocumentEntry;
00040 class KoStyleStack;
00041 class KoGenStyles;
00042 class KSpreadGenValidationStyles;
00043 class QWidget;
00044 class QPainter;
00045 class QDomElement;
00046
00047 namespace KSpread {
00048 class DependencyManager;
00049 }
00050
00051 class DCOPObject;
00052 class KPrinter;
00053 class KoOasisSettings;
00054
00055 #include <koDocument.h>
00056 #include <koDocumentChild.h>
00057 #include <koOasisSettings.h>
00058
00059 #include <qpen.h>
00060 #include <qptrlist.h>
00061 #include <qintdict.h>
00062 #include <qmemarray.h>
00063 #include <qrect.h>
00064 #include <qwidget.h>
00065 #include <qdragobject.h>
00066 #include <koOasisStyles.h>
00067 #include <koxmlwriter.h>
00068
00069 #include "kspread_autofill.h"
00070 #include "kspread_format.h"
00071 #include "kspread_cell.h"
00072 #include "kspread_global.h"
00073
00074
00075
00076
00077
00078
00079
00083 class CellBinding : public QObject
00084 {
00085 Q_OBJECT
00086 public:
00087 CellBinding( KSpreadSheet *_sheet, const QRect& _area );
00088 virtual ~CellBinding();
00089
00090 bool contains( int _x, int _y );
00097 virtual void cellChanged( KSpreadCell *_obj );
00098
00099 virtual void setIgnoreChanges( bool _ignore ) { m_bIgnoreChanges = _ignore; }
00100
00101 virtual QRect& dataArea() { return m_rctDataArea; }
00102 virtual void setDataArea( const QRect _rect ) { m_rctDataArea = _rect; }
00103
00104 KSpreadSheet* sheet()const { return m_pSheet; }
00105
00106 signals:
00107 void changed( KSpreadCell *_obj );
00108
00109 protected:
00110 QRect m_rctDataArea;
00111 KSpreadSheet *m_pSheet;
00112 bool m_bIgnoreChanges;
00113 };
00114
00115
00116
00117
00118
00119
00120
00124 class KSpreadChild : public KoDocumentChild
00125 {
00126 public:
00127 KSpreadChild( KSpreadDoc *parent, KSpreadSheet *_sheet, KoDocument* doc, const QRect& geometry );
00128 KSpreadChild( KSpreadDoc *parent, KSpreadSheet *_sheet );
00129 ~KSpreadChild();
00130
00131 KSpreadDoc* parent()const { return (KSpreadDoc*)parent(); }
00132 KSpreadSheet* sheet()const { return m_pSheet; }
00133
00134 protected:
00135 KSpreadSheet *m_pSheet;
00136 };
00137
00138
00139
00140
00141
00142
00143
00144 class ChartChild;
00145 namespace KoChart { class Part; }
00146
00147 class ChartBinding : public CellBinding
00148 {
00149 Q_OBJECT
00150 public:
00151
00152 ChartBinding( KSpreadSheet *_sheet, const QRect& _area, ChartChild *_child );
00153 virtual ~ChartBinding();
00154
00155 virtual void cellChanged( KSpreadCell *_obj );
00156
00157 private:
00158 ChartChild* m_child;
00159 };
00160
00161 class ChartChild : public KSpreadChild
00162 {
00163 Q_OBJECT
00164 public:
00165 ChartChild( KSpreadDoc *_spread, KSpreadSheet *_sheet, KoDocument* doc, const QRect& _rect );
00166 ChartChild( KSpreadDoc *_spread, KSpreadSheet *_sheet );
00167 ~ChartChild();
00168
00169 void setDataArea( const QRect& _data );
00170 void update();
00171
00175 bool load( const QDomElement& element );
00179 QDomElement save( QDomDocument& doc );
00180
00184 bool loadDocument( KoStore* _store );
00185
00186 KoChart::Part* chart();
00187
00188 private:
00189 ChartBinding *m_pBinding;
00190 };
00191
00192
00193
00194
00195
00196
00197
00202 class KSpreadTextDrag : public QTextDrag
00203 {
00204 Q_OBJECT
00205
00206 public:
00207 KSpreadTextDrag( QWidget * dragSource = 0L, const char * name = 0L );
00208 virtual ~KSpreadTextDrag();
00209
00210 void setPlain( QString const & _plain ) { setText( _plain ); }
00211 void setKSpread( QByteArray const & _kspread ) { m_kspread = _kspread; }
00212
00213 virtual QByteArray encodedData( const char * mime ) const;
00214 virtual const char* format( int i ) const;
00215
00216 static bool canDecode( QMimeSource * e );
00217
00218 static const char * selectionMimeType();
00219
00220 protected:
00221 QByteArray m_kspread;
00222 };
00223
00224
00225
00226
00227
00228
00229
00230
00231 class SheetPrivate;
00232
00233
00236 class KSPREAD_EXPORT KSpreadSheet : public QObject
00237 {
00238 friend class KSpreadCell;
00239
00240 Q_OBJECT
00241
00242
00243 Q_PROPERTY( QString sheetName READ sheetName )
00244 Q_PROPERTY( bool autoCalc READ getAutoCalc WRITE setAutoCalc )
00245 Q_PROPERTY( bool showGrid READ getShowGrid WRITE setShowGrid )
00246
00247 public:
00248 enum Direction { Right, Left, Up, Down };
00249 enum SortingOrder{ Increase, Decrease };
00250 enum ChangeRef { ColumnInsert, ColumnRemove, RowInsert, RowRemove };
00251 enum TestType { Text, Validity, Comment, ConditionalCellAttribute };
00252
00253 enum LayoutDirection { LeftToRight, RightToLeft };
00254
00255 KSpreadSheet ( KSpreadMap* map, const QString &sheetName,
00256 const char *_name=0L );
00257 ~KSpreadSheet();
00258
00259 virtual bool isEmpty( unsigned long int x, unsigned long int y ) const;
00260
00264 QString sheetName() const;
00265
00269 QString tableName() const { return sheetName(); }
00270
00290 bool setSheetName( const QString& name, bool init = FALSE, bool makeUndo=true );
00291
00292 KSpreadMap* workbook();
00293 KSpreadDoc* doc();
00294
00298 virtual QDomElement saveXML( QDomDocument& );
00302 virtual bool loadXML( const QDomElement& );
00303
00304 virtual bool loadOasis( const QDomElement& sheet, const KoOasisStyles& oasisStyles );
00305
00306 virtual bool saveOasis( KoXmlWriter & xmlWriter, KoGenStyles &mainStyles, KSpreadGenValidationStyles &valStyle );
00307 void saveOasisHeaderFooter( KoXmlWriter &xmlWriter ) const;
00308
00309 void loadOasisSettings( const KoOasisSettings::NamedMap &settings );
00310 void saveOasisSettings( KoXmlWriter &settingsWriter, const QPoint& marker ) const;
00311 void saveOasisPrintStyleLayout( KoGenStyle &style ) const;
00312
00316 virtual bool saveChildren( KoStore* _store, const QString &_path );
00320 virtual bool loadChildren( KoStore* _store );
00321
00322 bool isLoading();
00323
00327 LayoutDirection layoutDirection() const;
00328
00333 void setLayoutDirection( LayoutDirection dir );
00334
00338 bool isRightToLeft() const;
00339
00340 void password( QCString & passwd ) const ;
00341 bool isProtected() const;
00342 void setProtected( QCString const & passwd );
00343 bool checkPassword( QCString const & passwd ) const;
00344
00345 void setDefaultHeight( double height );
00346 void setDefaultWidth( double width );
00347
00348 const ColumnFormat* columnFormat( int _column ) const;
00349 ColumnFormat* columnFormat( int _column );
00355 ColumnFormat* nonDefaultColumnFormat( int _column, bool force_creation = TRUE );
00356
00357 const RowFormat* rowFormat( int _row ) const;
00358 RowFormat* rowFormat( int _row );
00364 RowFormat* nonDefaultRowFormat( int _row, bool force_creation = TRUE );
00365
00370 KSpreadCell* firstCell() const;
00371
00372 RowFormat* firstRow() const;
00373
00374 ColumnFormat* firstCol() const;
00375
00376 KSpreadCell* cellAt( int _column, int _row ) const;
00383 KSpreadCell* cellAt( int _column, int _row, bool _scrollbar_update = false );
00387 KSpreadCell* cellAt( const QPoint& _point, bool _scrollbar_update = false )
00388 { return cellAt( _point.x(), _point.y(), _scrollbar_update ); }
00398 KSpreadCell* visibleCellAt( int _column, int _row, bool _scrollbar_update = false );
00409 KSpreadCell* nonDefaultCell( int _column, int _row, bool _scrollbar_update = false, KSpreadStyle * _style = 0 );
00410 KSpreadCell* nonDefaultCell( QPoint const & cellRef, bool scroll = false )
00411 { return nonDefaultCell( cellRef.x(), cellRef.y(), scroll ); }
00412
00413 KSpreadCell* defaultCell() const;
00414
00415 KSpreadFormat* defaultFormat();
00416 const KSpreadFormat* defaultFormat() const;
00417
00419 KSpreadValue value (int col, int row) const;
00421 KSpreadValue valueRange (int col1, int row1, int col2, int row2) const;
00422
00423 QRect visibleRect( KSpreadCanvas const * const _canvas ) const;
00424 int topRow( double _ypos, double &_top, const KSpreadCanvas *_canvas = 0L ) const;
00425 int bottomRow( double _ypos, const KSpreadCanvas *_canvas = 0L ) const;
00426 int leftColumn( double _xpos, double &_left, const KSpreadCanvas *_canvas = 0L ) const;
00427 int rightColumn( double _xpos, const KSpreadCanvas *_canvas = 0L ) const;
00428
00436 int columnPos( int _col, const KSpreadCanvas *_canvas = 0L ) const;
00446 double dblColumnPos( int _col, const KSpreadCanvas *_canvas = 0L ) const;
00454 int rowPos( int _row, const KSpreadCanvas *_canvas = 0L ) const;
00464 double dblRowPos( int _row, const KSpreadCanvas *_canvas = 0L ) const;
00465
00469 double sizeMaxX() const ;
00473 double sizeMaxY() const;
00474
00479 void adjustSizeMaxX ( double _x );
00480
00485 void adjustSizeMaxY ( double _y );
00486
00490 void setLayoutDirtyFlag();
00497 void setCalcDirtyFlag();
00498
00502
00503
00504
00510 void recalc();
00511
00514 void valueChanged (KSpreadCell *cell);
00515
00520 void setText( int row, int column, const QString& text,
00521 bool asString = false );
00522
00523
00524
00525 void setSelectionFont( KSpreadSelection* selectionInfo,
00526 const char *_font = 0L, int _size = -1,
00527 signed char _bold = -1, signed char _italic = -1,
00528 signed char _underline = -1,
00529 signed char _strike = -1 );
00530
00531 void setSelectionMoneyFormat( KSpreadSelection* selectionInfo, bool b );
00532 void setSelectionAlign( KSpreadSelection* selectionInfo,
00533 KSpreadFormat::Align _align );
00534 void setSelectionAlignY( KSpreadSelection* selectionInfo,
00535 KSpreadFormat::AlignY _alignY );
00536 void setSelectionPrecision( KSpreadSelection* selectionInfo, int _delta );
00537 void setSelectionPercent( KSpreadSelection* selectionInfo, bool b );
00538 void setSelectionMultiRow( KSpreadSelection* selectionInfo, bool enable );
00539 void setSelectionStyle( KSpreadSelection* selectionInfo, KSpreadStyle * style );
00540
00544 void setSelectionSize( KSpreadSelection* selectionInfo, int _size );
00545
00550 void setSelectionUpperLower( KSpreadSelection* selectionInfo, int _type );
00551
00552 void setSelectionfirstLetterUpper( KSpreadSelection* selectionInfo);
00553
00554 void setSelectionVerticalText( KSpreadSelection* selectionInfo, bool _b);
00555
00556 void setSelectionComment( KSpreadSelection* selectionInfo,
00557 const QString &_comment);
00558 void setSelectionRemoveComment(KSpreadSelection* selectionInfo);
00559
00560 void setSelectionAngle(KSpreadSelection* selectionInfo, int _value );
00561
00562 void setSelectionTextColor( KSpreadSelection* selectionInfo,
00563 const QColor &tbColor );
00564 void setSelectionbgColor( KSpreadSelection* selectionInfo,
00565 const QColor &bg_Color );
00566 void setSelectionBorderColor( KSpreadSelection* selectionInfo,
00567 const QColor &bd_Color );
00568
00575 void deleteSelection( KSpreadSelection* selectionInfo, bool undo = true );
00576
00582 void copySelection( KSpreadSelection* selectionInfo );
00588 void cutSelection( KSpreadSelection* selectionInfo );
00594 void clearTextSelection( KSpreadSelection* selectionInfo );
00595
00596 void clearValiditySelection(KSpreadSelection* selectionInfo );
00597
00598 void clearConditionalSelection(KSpreadSelection* selectionInfo );
00599
00600 void fillSelection( KSpreadSelection * selectionInfo, int direction );
00601
00602 void setWordSpelling(KSpreadSelection* selectionInfo,const QString _listWord );
00603
00604 QString getWordSpelling(KSpreadSelection* selectionInfo );
00605
00610 void paste( const QRect & pasteArea, bool makeUndo = true, PasteMode = Normal,
00611 Operation = OverWrite, bool insert = false, int insertTo = 0,
00612 bool pasteFC = false );
00613 void paste( const QByteArray & data, const QRect & pasteArea,
00614 bool makeUndo = false, PasteMode= Normal, Operation = OverWrite,
00615 bool insert = false, int insertTo = 0, bool pasteFC = false );
00616 void defaultSelection( KSpreadSelection* selectionInfo );
00617
00621 void pasteTextPlain( QString &_text, QRect pasteArea);
00622
00623 void sortByRow( const QRect &area, int ref_row, SortingOrder );
00624 void sortByRow( const QRect &area, int key1, int key2, int key3,
00625 SortingOrder order1, SortingOrder order2, SortingOrder order3,
00626 QStringList const * firstKey, bool copyFormat, bool headerRow,
00627 KSpreadPoint const & outputPoint, bool respectCase );
00628 void sortByColumn( const QRect &area, int ref_column, SortingOrder );
00629 void sortByColumn( const QRect &area, int key1, int key2, int key3,
00630 SortingOrder order1, SortingOrder order2, SortingOrder order3,
00631 QStringList const * firstKey, bool copyFormat, bool headerRow,
00632 KSpreadPoint const & outputPoint, bool respectCase );
00633 void swapCells( int x1, int y1, int x2, int y2, bool cpFormat );
00634
00640 void copyCells( int x1, int y1, int x2, int y2, bool cpFormat );
00641 void setSeries( const QPoint &_marker, double start, double end, double step, Series mode, Series type );
00642
00652 bool shiftRow( const QRect &_rect, bool makeUndo=true );
00653 bool shiftColumn( const QRect& rect, bool makeUndo=true );
00654
00655 void unshiftColumn( const QRect& rect, bool makeUndo=true );
00656 void unshiftRow( const QRect& rect, bool makeUndo=true );
00657
00663 bool insertColumn( int col, int nbCol=0, bool makeUndo=true );
00668 bool insertRow( int row, int nbRow=0, bool makeUndo=true );
00669
00673 void removeColumn( int col, int nbCol=0, bool makeUndo=true );
00677 void removeRow( int row, int nbRow=0, bool makeUndo=true );
00678
00682 void hideRow( int row, int nbRow=0, QValueList<int>list=QValueList<int>() );
00683 void emitHideRow();
00684 void showRow( int row, int NbRow=0, QValueList<int>list=QValueList<int>() );
00685
00689 void hideColumn( int col, int NbCol=0, QValueList<int>list=QValueList<int>() );
00690 void emitHideColumn();
00691 void showColumn( int col, int NbCol=0, QValueList<int>list=QValueList<int>() );
00692
00693 int adjustColumn( KSpreadSelection* selectionInfo, int _col = -1 );
00694 int adjustRow( KSpreadSelection* selectionInfo, int _row = -1 );
00695
00699 void borderLeft( KSpreadSelection* selectionInfo, const QColor &_color );
00700 void borderTop( KSpreadSelection* selectionInfo, const QColor &_color );
00701 void borderOutline( KSpreadSelection* selectionInfo, const QColor &_color );
00702 void borderAll( KSpreadSelection* selectionInfo, const QColor &_color );
00703 void borderRemove( KSpreadSelection* selectionInfo );
00704 void borderBottom( KSpreadSelection* selectionInfo, const QColor &_color );
00705 void borderRight( KSpreadSelection* selectionInfo, const QColor &_color );
00706
00707 void setConditional( KSpreadSelection* selectionInfo,
00708 QValueList<KSpreadConditional> const & newConditions );
00709
00710 void setValidity( KSpreadSelection* selectionInfo,KSpreadValidity tmp );
00711
00715 bool getShowGrid() const;
00716
00720 void setShowGrid( bool _showGrid );
00721
00725 bool getShowFormula() const;
00726
00727 void setShowFormula(bool _showFormula);
00728
00732 bool getShowFormulaIndicator() const;
00733
00734 void setShowFormulaIndicator(bool _showFormulaIndicator);
00735
00736 bool getLcMode() const;
00737
00738 void setLcMode(bool _lcMode);
00739
00740 bool getAutoCalc() const;
00741
00742 void setAutoCalc(bool _AutoCalc);
00743
00744 bool getShowColumnNumber() const;
00745
00746 void setShowColumnNumber(bool _showColumnNumber);
00747
00748 bool getHideZero() const;
00749
00750 void setHideZero(bool _hideZero);
00751
00752 bool getFirstLetterUpper() const;
00753
00754 void setFirstLetterUpper(bool _firstUpper);
00755
00756 void mergeCells( const QRect &area );
00757 void dissociateCell( const QPoint &cellRef );
00758 void changeMergedCell( int m_iCol, int m_iRow, int m_iExtraX, int m_iExtraY);
00759
00760 void increaseIndent( KSpreadSelection* selectionInfo );
00761 void decreaseIndent( KSpreadSelection* selectionInfo );
00762
00763 bool areaIsEmpty(const QRect &area, TestType _type = Text) ;
00764
00765 void refreshPreference() ;
00766
00767 void hideSheet(bool _hide);
00768
00769 void removeSheet();
00770
00771 QRect selectionCellMerged(const QRect &_sel);
00786 void changeNameCellRef( const QPoint & pos, bool fullRowOrColumn,
00787 ChangeRef ref, QString tabname, int NbCol = 1,
00788 KSpreadUndoInsertRemoveAction * undo = 0 );
00789
00790
00791 void refreshRemoveAreaName(const QString &_areaName);
00792 void refreshChangeAreaName(const QString &_areaName);
00793
00794
00805 void refreshChart(const QPoint & pos, bool fullRowOrColumn, ChangeRef ref);
00809 void refreshMergedCell();
00810
00814 bool isHidden()const;
00818 void setHidden( bool hidden );
00819
00826 QPainter& painter();
00832 QWidget* widget()const;
00833
00840 bool isShowPageBorders() const;
00841
00848 void setShowPageBorders( bool _b );
00849
00850 void addCellBinding( CellBinding *_bind );
00851 void removeCellBinding( CellBinding *_bind );
00852 CellBinding* firstCellBinding();
00853 CellBinding* nextCellBinding();
00854
00860 bool getCellRectangle( const QRect &_range, QPtrList<KSpreadCell> &_list );
00861
00865 KSpreadSheet *findSheet( const QString & _name );
00866
00872 void insertCell( KSpreadCell *_cell );
00878 void insertColumnFormat( ColumnFormat *_l );
00884 void insertRowFormat( RowFormat *_l );
00885
00892 QDomDocument saveCellRect( const QRect &, bool copy = false, bool era = false );
00893
00901 bool loadSelection( const QDomDocument& doc, const QRect &pasteArea,
00902 int _xshift, int _yshift, bool makeUndo,
00903 PasteMode = Normal, Operation = OverWrite,
00904 bool insert = false, int insertTo = 0, bool paste = false );
00905
00906 void loadSelectionUndo( const QDomDocument & doc, const QRect &loadArea,
00907 int _xshift, int _yshift,bool insert,int insertTo);
00908
00916 bool testAreaPasteInsert()const;
00917
00928 void deleteCells( const QRect& rect );
00929
00930
00935 bool testListChoose(KSpreadSelection* selectionInfo);
00936
00940 QString copyAsText(KSpreadSelection* selection);
00941
00950 void autofill( QRect &src, QRect &dest );
00951
00958 void deleteChild( KSpreadChild *_child );
00962 void insertChild( const QRect& _geometry, KoDocumentEntry& );
00966 void insertChart( const QRect& _geometry, KoDocumentEntry&, const QRect& _data );
00967 void changeChildGeometry( KSpreadChild *_child, const QRect& _geometry );
00968
00969 const QColorGroup& colorGroup() { return widget()->colorGroup(); }
00970
00971 int id() const;
00972
00978 int maxColumn() const ;
00979
00986 void checkRangeHBorder ( int _column );
00987
00993 int maxRow() const ;
00994
01001 void checkRangeVBorder ( int _row );
01002
01003
01004 void enableScrollBarUpdates( bool _enable );
01005
01006 virtual DCOPObject* dcopObject();
01007
01008 static KSpreadSheet* find( int _id );
01009
01010 #ifndef NDEBUG
01011 void printDebug();
01012 #endif
01013
01019 void updateCell( KSpreadCell* _cell, int _col, int _row );
01020
01026 void updateCellArea(const QRect &cellArea);
01027
01031 void update();
01032
01036 void updateView();
01037
01041 void updateView( QRect const & rect );
01042
01046 void refreshView(const QRect& rect);
01047
01048 void emit_updateRow( RowFormat *_format, int _row );
01049 void emit_updateColumn( ColumnFormat *_format, int _column );
01050
01057 const QPen& emptyPen() const ;
01058 const QBrush& emptyBrush() const;
01059 const QColor& emptyColor() const;
01060
01061 void updateLocale();
01062
01063
01069 void setRegionPaintDirty(QRect const & region);
01070
01074 void clearPaintDirtyData();
01075
01079 bool cellIsPaintDirty(QPoint const & cell);
01080
01090 KSpreadCell* getFirstCellColumn(int col) const;
01091
01101 KSpreadCell* getLastCellColumn(int col) const;
01102
01112 KSpreadCell* getFirstCellRow(int row) const;
01113
01123 KSpreadCell* getLastCellRow(int row) const;
01124
01134 KSpreadCell* getNextCellUp(int col, int row) const;
01135
01145 KSpreadCell* getNextCellDown(int col, int row) const;
01146
01157 KSpreadCell* getNextCellLeft(int col, int row) const;
01158
01169 KSpreadCell* getNextCellRight(int col, int row) const;
01170
01171 KSpreadSheetPrint * print() const;
01172
01174 KSpread::DependencyManager *dependencies ();
01175
01176 signals:
01177 void sig_refreshView();
01178 void sig_updateView( KSpreadSheet *_sheet );
01179 void sig_updateView( KSpreadSheet *_sheet, const QRect& );
01180 void sig_updateHBorder( KSpreadSheet *_sheet );
01181 void sig_updateVBorder( KSpreadSheet *_sheet );
01182 void sig_updateChildGeometry( KSpreadChild *_child );
01183 void sig_removeChild( KSpreadChild *_child );
01184 void sig_maxColumn( int _max_column );
01185 void sig_maxRow( int _max_row );
01189 void sig_nameChanged( KSpreadSheet* sheet, const QString& old_name );
01194 void sig_polygonInvalidated( const QPointArray& );
01195
01196 void sig_SheetHidden( KSpreadSheet* sheet);
01197 void sig_SheetShown( KSpreadSheet* sheet);
01198 void sig_SheetRemoved( KSpreadSheet* sheet);
01199 void sig_SheetActivated( KSpreadSheet* );
01200 void sig_RefreshView( KSpreadSheet* );
01201
01202 protected:
01208 void changeCellTabName( QString const & old_name,QString const & new_name );
01209
01210 bool loadRowFormat( const QDomElement& row, int &rowIndex, const KoOasisStyles& oasisStyles, bool isLast );
01211 bool loadColumnFormat(const QDomElement& row, const KoOasisStyles& oasisStyles, int & indexCol );
01212 bool loadSheetStyleFormat( QDomElement *style );
01213 void loadOasisMasterLayoutPage( KoStyleStack &styleStack );
01214
01215 QString saveOasisSheetStyleName( KoGenStyles &mainStyles );
01216 void saveOasisColRowCell( KoXmlWriter& xmlWriter, KoGenStyles &mainStyles, int maxCols, int maxRows, KSpreadGenValidationStyles &valStyle );
01217 void saveOasisCells( KoXmlWriter& xmlWriter, KoGenStyles &mainStyles, int row, int maxCols, KSpreadGenValidationStyles &valStyle );
01218 void convertPart( const QString & part, KoXmlWriter & writer ) const;
01219 void addText( const QString & text, KoXmlWriter & writer ) const;
01220
01221 void maxRowCols( int & maxCols, int & maxRows );
01222
01223 QString getPart( const QDomNode & part );
01224 void replaceMacro( QString & text, const QString & old, const QString & newS );
01225
01226 void insertChild( KSpreadChild *_child );
01227
01231 void fillSequence( QPtrList<KSpreadCell>& _srcList, QPtrList<KSpreadCell>& _destList, QPtrList<AutoFillSequence>& _seqList, bool down = true );
01232
01233 static int s_id;
01234 static QIntDict<KSpreadSheet>* s_mapSheets;
01235
01236 public:
01237
01238
01239 struct CellWorker {
01240 const bool create_if_default;
01241 const bool emit_signal;
01242 const bool type_B;
01243
01244 CellWorker( bool cid=true, bool es=true, bool tb=true ) : create_if_default( cid ), emit_signal( es ), type_B( tb ) { }
01245 virtual ~CellWorker() { }
01246
01247 virtual class KSpreadUndoAction* createUndoAction( KSpreadDoc* doc, KSpreadSheet* sheet, QRect& r ) =0;
01248
01249
01250 virtual bool testCondition( RowFormat* ) { return false; }
01251 virtual void doWork( RowFormat* ) { }
01252 virtual void doWork( ColumnFormat* ) { }
01253 virtual void prepareCell( KSpreadCell* ) { }
01254
01255
01256 virtual bool testCondition( KSpreadCell* cell ) =0;
01257 virtual void doWork( KSpreadCell* cell, bool cellRegion, int x, int y ) =0;
01258 };
01259
01260
01261 struct CellWorkerTypeA : public CellWorker {
01262 CellWorkerTypeA( ) : CellWorker( true, true, false ) { }
01263 virtual QString getUndoTitle( ) =0;
01264 class KSpreadUndoAction* createUndoAction( KSpreadDoc* doc, KSpreadSheet* sheet, QRect& r );
01265 };
01266 static QString translateOpenCalcPoint( const QString & str );
01267 protected:
01268 typedef enum { CompleteRows, CompleteColumns, CellRegion } SelectionType;
01269 SelectionType workOnCells( KSpreadSelection* selectionInfo,
01270 CellWorker& worker );
01271
01272 private:
01273 bool FillSequenceWithInterval (QPtrList<KSpreadCell>& _srcList,
01274 QPtrList<KSpreadCell>& _destList,
01275 QPtrList<AutoFillSequence>& _seqList,
01276 bool down);
01277
01278 void FillSequenceWithCopy (QPtrList<KSpreadCell>& _srcList,
01279 QPtrList<KSpreadCell>& _destList,
01280 bool down);
01281
01282 void convertObscuringBorders();
01283 void checkCellContent(KSpreadCell * cell1, KSpreadCell * cell2, int & ret);
01284 int adjustColumnHelper( KSpreadCell * c, int _col, int _row );
01285 void checkContentDirection( QString const & name );
01286
01287 SheetPrivate* d;
01288
01289
01290 KSpreadSheet( const KSpreadSheet& );
01291 KSpreadSheet& operator=( const KSpreadSheet& );
01292 };
01293
01294
01295 typedef KSpreadSheet KSpreadSheet;
01296
01297 #endif // KSPREAD_SHEET