17
24
Boston, MA 02111-1307, USA.
20
#ifndef __kspread_gui_h__
21
#define __kspread_gui_h__
32
#include <qstringlist.h>
33
#include <qvaluelist.h>
28
class KSpreadEditWidget;
39
class KoDocumentEntry;
29
42
class KSpreadCanvas;
35
class KSpreadPaperLayout;
36
class KSpreadChildPicture;
37
class KSpreadChildFrame;
40
46
class KSpreadEditWidget;
42
47
class KSpreadHBorder;
46
48
class KSpreadLocationEditWidget;
47
class KoDocumentEntry;
48
class KoCharSelectDia;
49
class KStatusBarLabel;
50
class TKSelectColorAction;
54
class KFontSizeAction;
56
class KoPartSelectAction;
58
class KSpreadMacroUndoAction;
59
class KSpreadInsertHandler;
69
#include <qguardedptr.h>
70
#include <qstringlist.h>
73
#include <koDocument.h>
74
#include <koToolBox.h>
75
#include <kdatatool.h>
76
#include <kglobalsettings.h>
78
#include "kspread_selection.h"
49
class KSpreadSelection;
53
class KSpreadComboboxLocationEditWidget;
63
* The KSpreadView class displays a KSpread document.
66
* KSpreadView is used to display a spreadsheet document and provide
67
* the interface for the user to perform editing and data analysis.
69
* A view consists of several parts:
70
* \li canvas to display cells in a sheet
71
* \li line editor to display and edit cell contents
72
* \li location editor to show marker and/or selection
73
* \li column header to show columns
74
* \li row header to show rows
75
* \li horizontal and vertical scrollbars for navigation
76
* \li tab bar to select active worksheet
81
class KSpreadView : public KoView
79
class KSPREAD_EXPORT KSpreadView : public KoView
83
81
friend class KSpreadCanvas;
87
KSpreadView( QWidget *_parent, const char *_name, KSpreadDoc *_doc );
86
/** Creates a new view */
87
KSpreadView( QWidget *_parent, const char *_name,
90
/** Destroys the view */
90
KSpreadCanvas* canvasWidget() const { return m_pCanvas; }
91
KSpreadHBorder* hBorderWidget()const { return m_pHBorderWidget; }
92
KSpreadVBorder* vBorderWidget()const { return m_pVBorderWidget; }
93
QScrollBar* horzScrollBar()const { return m_pHorzScrollBar; }
94
QScrollBar* vertScrollBar()const { return m_pVertScrollBar; }
95
KSpreadEditWidget* editWidget()const { return m_pEditWidget; }
96
KSpreadLocationEditWidget* posWidget()const { return m_pPosWidget; }
98
KSpreadDoc* doc()const { return m_pDoc; }
99
void changeZoomMenu( int zoom );
95
/** Returns the canvas of the view */
96
KSpreadCanvas* canvasWidget() const;
98
/** Returns the column header */
99
KSpreadHBorder* hBorderWidget() const;
101
/** Returns the row header */
102
KSpreadVBorder* vBorderWidget() const;
104
/** Returns the horizontal scrollbar */
105
QScrollBar* horzScrollBar() const;
107
/** Returns the vertical scrollbar */
108
QScrollBar* vertScrollBar() const;
110
/** Returns the editor widget */
111
KSpreadEditWidget* editWidget() const;
113
/** Returns the location widget */
114
KSpreadComboboxLocationEditWidget* posWidget() const;
116
/** Returns the tab bar */
117
KoTabBar* tabBar() const;
100
119
void setZoom( int zoom, bool updateViews ); // change the zoom value
102
void addTable( KSpreadSheet *_t );
103
//void removeTable( KSpreadSheet *_t );
104
void removeAllTables();
105
void setActiveTable( KSpreadSheet *_t,bool updateTable=true );
121
void addSheet( KSpreadSheet *_t );
122
//void removesheet( KSpreadSheet *_t );
123
void removeAllSheets();
124
void setActiveSheet( KSpreadSheet *_t,bool updatesheet=true );
107
const KSpreadSheet* activeTable() const { return m_pTable; }
108
KSpreadSheet* activeTable() { return m_pTable; }
109
KSpreadTabBar* tabBar()const { return m_pTabBar;}
126
const KSpreadSheet* activeSheet() const;
127
KSpreadSheet* activeSheet();
111
129
void openPopupMenu( const QPoint &_global );
112
130
void popupRowMenu(const QPoint & _point ) ;
358
376
void changeAngle();
359
377
void setSelectionAngle(int angle);
380
* Merges selected cells into one cell. This will not work if only one
381
* cell is selected. An entire row or column can't be merged as well.
361
385
void mergeCell();
388
* Breaks merged cell. Obviously this can be done only on merged cells.
362
392
void dissociateCell();
364
395
void increaseIndent();
365
396
void decreaseIndent();
366
397
void copyAsText();
368
* @ref #tabBar is connected to this slot.
369
* When the user selects a new table using the @ref #tabBar this slot
372
void changeTable( const QString& _name );
374
void previousTable();
399
void moveSheet( unsigned sheet, unsigned target );
402
* Shows the sheet properties dialog.
404
void sheetProperties();
407
* Switch the active sheet to the name. This slot is connected to the tab bar
408
* and activated when the user selects a new sheet in the tab bar.
410
void changeSheet( const QString& _name );
413
* Switch the active sheet to the next visible sheet. Does nothing if the current
414
* active sheet is the last visible sheet in the workbook.
419
* Switch the active sheet to the previous visible sheet. Does nothing if the current
420
* active sheet is the first visible sheet in the workbook.
422
void previousSheet();
425
* Switch the active sheet to the first visible sheet in the workbook. Does nothing
426
* if the current active sheet is already the first one.
431
* Switch the active sheet to the last visible sheet in the workbook. Does nothing
432
* if the current active sheet is already the last one.
380
438
void statusBarClicked(int _id);
381
439
void menuCalc(bool);
442
* Shows the status bar if b is true, otherwise the status bar will be hidden.
444
void showStatusBar( bool b );
447
* Shows the tab bar if b is true, otherwise the tab bar will be hidden.
449
void showTabBar( bool b );
452
* Shows the formula bar if b is true, otherwise the formula bar will be hidden.
454
void showFormulaBar( bool b );
457
* If b is true, a red triangle is displayed on the corner of cells
458
* which have comments.
460
void showCommentIndicator( bool b );
463
* Shows context menu when tabbar is double-clicked.
465
void popupTabBarMenu( const QPoint& );
467
void handleDamages( const QValueList<KSpread::Damage*>& damages );
469
void runInternalTests();
501
579
KSpreadCell* findNextCell();
505
QButton* newIconButton( const char *_file, bool _kbutton = false, QWidget *_parent = 0L );
506
void updateButton(KSpreadCell *cell, int column, int row);
507
QScrollBar *m_pHorzScrollBar;
508
QScrollBar *m_pVertScrollBar;
509
KSpreadCanvas *m_pCanvas;
510
KSpreadVBorder *m_pVBorderWidget;
511
KSpreadHBorder *m_pHBorderWidget;
512
KSpreadEditWidget *m_pEditWidget;
514
QFrame *m_pToolWidget;
515
QButton *m_pTabBarFirst;
516
QButton *m_pTabBarLeft;
517
QButton *m_pTabBarRight;
518
QButton *m_pTabBarLast;
519
QButton *m_pOkButton;
520
QButton *m_pCancelButton;
521
KSpreadTabBar *m_pTabBar;
522
KSpreadLocationEditWidget *m_pPosWidget;
523
KoCharSelectDia * m_specialCharDlg;
524
KToggleAction* m_bold;
525
KToggleAction* m_italic;
526
KToggleAction* m_underline;
527
KToggleAction* m_strikeOut;
528
KToggleAction* m_percent;
529
KSelectAction* m_selectStyle;
530
KAction* m_createStyle;
532
KAction* m_precminus;
533
KToggleAction* m_money;
534
KToggleAction* m_alignLeft;
535
KToggleAction* m_alignCenter;
536
KToggleAction* m_alignRight;
537
KToggleAction* m_alignTop;
538
KToggleAction* m_alignMiddle;
539
KToggleAction* m_alignBottom;
540
KAction* m_insertSeries;
541
KAction* m_insertLink;
542
KAction* m_insertFunction;
543
KAction* m_insertSpecialChar;
544
KAction* m_transform;
546
KAction* m_findAction;
547
KAction* m_replaceAction;
550
KAction* m_specialPaste;
552
KAction* m_clearText;
553
KAction* m_clearComment;
554
KAction* m_clearValidity;
555
KAction* m_clearConditional;
556
KAction* m_fillRight;
560
KAction* m_recalc_workbook;
561
KAction* m_recalc_worksheet;
566
KAction* m_paperLayout;
567
KAction* m_styleDialog;
568
KAction* m_definePrintRange;
569
KAction* m_resetPrintRange;
570
KAction* m_insertFromDatabase;
571
KAction* m_insertFromTextfile;
572
KAction* m_insertFromClipboard;
573
KAction* m_insertTable;
574
KAction* m_menuInsertTable;
575
KAction* m_removeTable;
576
KAction* m_renameTable;
577
KAction* m_nextTable;
578
KAction* m_prevTable;
579
KAction* m_firstTable;
580
KAction* m_lastTable;
581
KAction* m_editGlobalScripts;
582
KAction* m_editLocalScripts;
583
KAction* m_reloadScripts;
584
KAction* m_conditional;
588
KAction* m_subTotals;
589
KAction* m_multipleOperations;
590
KAction* m_textToColumns;
591
KAction* m_consolidate;
593
KAction* m_insertCellCopy;
594
KToggleAction* m_multiRow;
595
KFontAction* m_selectFont;
596
KFontSizeAction* m_selectFontSize;
597
KAction* m_deleteColumn;
598
KAction* m_hideColumn;
599
KAction* m_showColumn;
600
KAction* m_showSelColumns;
601
KAction* m_insertColumn;
602
KAction* m_deleteRow;
603
KAction* m_insertRow;
606
KAction* m_showSelRows;
607
KSelectAction* m_formulaSelection;
608
KSelectAction* m_viewZoom;
611
TKSelectColorAction* m_textColor;
612
TKSelectColorAction* m_bgColor;
613
KAction* m_cellLayout;
614
KAction* m_hideTable;
615
KAction* m_showTable;
616
KAction* m_borderLeft;
617
KAction* m_borderRight;
618
KAction* m_borderTop;
619
KAction* m_borderBottom;
620
KAction* m_borderAll;
621
KAction* m_borderOutline;
622
KAction* m_borderRemove;
623
TKSelectColorAction* m_borderColor;
624
KAction* m_tableFormat;
626
KToggleAction* m_showPageBorders;
627
KActionMenu* m_scripts;
631
KAction* m_resizeRow;
632
KAction* m_resizeColumn;
633
KAction* m_fontSizeUp;
634
KAction* m_fontSizeDown;
637
KAction* m_equalizeRow;
638
KAction* m_equalizeColumn;
639
KAction* m_preference;
640
KAction* m_firstLetterUpper;
641
KToggleAction* m_verticalText;
642
KAction* m_addModifyComment;
643
KAction* m_removeComment;
644
KAction* m_insertCell;
645
KAction* m_removeCell;
646
KAction* m_changeAngle;
647
KAction* m_mergeCell;
648
KAction* m_dissociateCell;
650
KAction* m_increaseIndent;
651
KAction* m_decreaseIndent;
653
KAction* m_spellChecking;
655
KAction* m_createTemplate;
657
KAction* m_insertChartFrame;
659
KToggleAction* m_protectSheet;
660
KToggleAction* m_protectDoc;
662
KToggleAction* m_recordChanges;
663
KToggleAction* m_protectChanges;
664
KAction* m_filterChanges;
665
KAction* m_acceptRejectChanges;
666
KAction* m_commentChanges;
667
KAction* m_mergeDocument;
669
KToggleAction* m_menuCalcMin;
670
KToggleAction* m_menuCalcMax;
671
KToggleAction* m_menuCalcAverage;
672
KToggleAction* m_menuCalcCount;
673
KToggleAction* m_menuCalcSum;
674
KToggleAction* m_menuCalcNone;
676
KoPartSelectAction *m_insertPart;
680
KSpreadSpell * kspell;
681
KSpreadSheet * firstSpellTable;
682
KSpreadSheet * currentSpellTable;
683
KSpreadCell * currentCell;
684
KSpreadMacroUndoAction *macroCmdSpellCheck;
685
unsigned int spellCurrCellX;
686
unsigned int spellCurrCellY;
687
unsigned int spellStartCellX;
688
unsigned int spellStartCellY;
689
unsigned int spellEndCellX;
690
unsigned int spellEndCellY;
691
bool spellCheckSelection;
692
QStringList replaceAll;
695
bool spellSwitchToOtherTable();
585
// don't allow copy or assignment
586
KSpreadView( const KSpreadView& );
587
KSpreadView& operator=( const KSpreadView& );
591
bool spellSwitchToOtherSheet();
696
592
void spellCleanup();
699
* Pointer to the last popup menu.
700
* Since only one popup menu can be opened at once, its pointer is stored here.
701
* Delete the old one before you store a pointer to anotheron here.
704
QPopupMenu *m_pPopupMenu;
705
int m_popupMenuFirstToolId;
707
QPopupMenu *m_pPopupRow;
708
QPopupMenu *m_pPopupColumn;
711
* Used for embedded children.
713
QPopupMenu* m_popupChild;
716
* used for list of choose
718
QPopupMenu* m_popupListChoose;
721
* Holds a pointer of the child for which the popup menu has been opened.
723
KSpreadChild* m_popupChildObject;
726
* This DCOP object represents the view.
732
* Tells whether the user modfied the current cell.
733
* Some key events are passed to the @ref EditWindow. When this flag is set and you
734
* want to leave the cell with the marker then you must first save the new text
735
* in the cell before moving the marker.
737
bool m_bEditDirtyFlag;
740
* The active KSpreadSheet. This table has the input focus. It may be 0L, too.
742
KSpreadSheet* m_pTable;
747
* Flags that indicate whether we should display additional
748
* GUI stuff like rulers and scrollbars.
755
* If @ref #updateEditWidget is called it changes some KToggleActions.
756
* That causes them to emit a signal. If this lock is TRUE, then these
757
* signals are ignored.
766
QPtrList<ToolEntry> m_lstTools;
768
static KSpreadScripts *m_pGlobalScriptsDialog;
769
//used to allow to refresh menubar
770
//otherwise kspread crash when I try to refresh menubar
771
//when I start kspread
775
* Holds a guarded pointer to the transformation toolbox.
777
QGuardedPtr<KoTransformToolBox> m_transformToolBox;
780
* Find and Replace context. We remember the options and the strings used
784
QStringList m_findStrings;
785
QStringList m_replaceStrings;
787
* Current "find" operation
791
int m_findLeftColumn;
792
int m_findRightColumn;
796
KStatusBarLabel* m_sbCalcLabel;
798
KSpreadSelection* m_selectionInfo;
799
QMap<KSpreadSheet*, QPoint> savedAnchors;
800
QMap<KSpreadSheet*, QPoint> savedMarkers;
802
KSpreadInsertHandler* m_pInsertHandle;
804
/* helper functions */
805
void initializeCalcActions();
806
void initializeInsertActions();
807
void initializeEditActions();
808
void initializeAreaOperationActions();
809
void initializeGlobalOperationActions();
810
void initializeCellOperationActions();
811
void initializeCellPropertyActions();
812
void initializeTextFormatActions();
813
void initializeTextLayoutActions();
814
void initializeTextPropertyActions();
815
void initializeTableActions();
816
void initializeSpellChecking();
817
void initializeRowColumnActions();
818
void initializeBorderActions();
819
void adjustMapActions( bool mode );
820
void adjustActions( bool mode );
821
void adjustActions( KSpreadSheet const * const table,
822
KSpreadCell const * const cell );
823
bool checkChangeRecordPassword();
824
void endOperation( QRect const & rect );
594
void endOperation( QRect const & rect );
597
#endif // KSPREAD_VIEW