1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
|
/* This file is part of the KDE project
Copyright (C) 2006 Raphael Langerhorst <[email protected]>
(C) 2002-2004 Ariya Hidayat <[email protected]>
(C) 1999-2003 Laurent Montel <[email protected]>
(C) 2002-2003 Norbert Andres <[email protected]>
(C) 2002-2003 Philipp Mueller <[email protected]>
(C) 2002-2003 John Dailey <[email protected]>
(C) 1999-2003 David Faure <[email protected]>
(C) 1999-2001 Simon Hausmann <[email protected]>
(C) 1998-2000 Torben Weis <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KSPREAD_VIEW
#define KSPREAD_VIEW
#include <tqpoint.h>
#include <tqptrlist.h>
#include <tqstringlist.h>
#include <tqvaluelist.h>
#include <kprinter.h>
#include <kdeprint/kprintdialogpage.h>
#include <KoPoint.h>
#include <KoView.h>
class TQScrollBar;
class KoDocumentEntry;
class KoTabBar;
class SheetSelectWidget;
namespace KSpread
{
class Cell;
class Damage;
class Sheet;
class Canvas;
class Child;
class Doc;
class EditWidget;
class HBorder;
class LocationEditWidget;
class Region;
class Selection;
class VBorder;
class View;
class ComboboxLocationEditWidget;
class EmbeddedKOfficeObject;
class EmbeddedObject;
/**
* \class KPSheetSelectPage
* \brief Print dialog page for selecting sheets to print.
* @author [email protected]
* @see SheetSelectWidget
*
* This dialog is shown in the print dialog and allows the user
* to select the sheets that should be printed and in which order
* they should be printed.
*/
class KPSheetSelectPage : public KPrintDialogPage
{
Q_OBJECT
TQ_OBJECT
public:
KPSheetSelectPage( TQWidget *tqparent = 0 );
// ~KPSheetSelectPage();
// //reimplement virtual functions
/**
* @see printOptionPrefix()
*/
void getOptions( TQMap<TQString,TQString>& opts, bool incldef = false );
/**
* @see printOptionPrefix()
*/
void setOptions( const TQMap<TQString,TQString>& opts );
/**
* @return false if no sheet is selected for printing.
*/
bool isValid( TQString& msg );
/**
* @return list of sheets that will be printed, in correct order.
*/
TQStringList selectedSheets();
/**
* Removes all sheets from the list of selected sheets.
*/
void clearSelection();
/**
* The print order of the sheets is stored in the option map,
* using a prefix plus the index of the sheet, like the following:
* \li sheetprintorder0
* \li sheetprintorder1
* \li sheetprintorder2
* Please note that this is just the key to the value, not the value
* itself. The value of the option is the sheetname itself.
* @param index the index of the print order, starting at 0
* @return the string that is used in the printoption for given index
*/
static TQString printOptionForIndex(unsigned int index);
/**
* @param prt the printer from which the options should be read.
* @return list of sheets to print in correct order configured for given printer.
*/
static TQStringList selectedSheets(KPrinter &prt);
public slots:
/**
* Inserts given sheet to the list of available sheets.
*/
void prependAvailableSheet(const TQString& sheetname);
/**
* Inserts given sheet to the list of sheets for printing at the top.
*/
void prependSelectedSheet(const TQString& sheetname);
protected slots:
// The following slots just implement the code for the buttons
void selectAll();
void select();
void remove();
void removeAll();
void moveTop();
void moveUp();
void moveDown();
void moveBottom();
private:
/**
* The widget used, includes two lists of sheet names and
* buttons to move sheets between and within the lists.
*/
SheetSelectWidget* gui;
};
/** @class View
*
* @brief The View class displays a KSpread document.
*
*
* View is used to display a spreadsheet document and provide
* the interface for the user to perform editing and data analysis.
*
* A view consists of several parts:
* \li canvas to display cells in a sheet
* \li line editor to display and edit cell contents
* \li location editor to show marker and/or selection
* \li column header to show columns
* \li row header to show rows
* \li horizontal and vertical scrollbars for navigation
* \li tab bar to select active worksheet
*
*/
class KSPREAD_EXPORT View : public KoView
{
friend class Canvas;
Q_OBJECT
TQ_OBJECT
public:
/** Creates a new view */
View( TQWidget *_parent, const char *_name,
Doc *doc );
/** Destroys the view */
~View();
Doc* doc() const;
/** Returns the canvas of the view */
Canvas* canvasWidget() const;
/** Returns the column header */
HBorder* hBorderWidget() const;
/** Returns the row header */
VBorder* vBorderWidget() const;
/** Returns the horizontal scrollbar */
TQScrollBar* horzScrollBar() const;
/** Returns the vertical scrollbar */
TQScrollBar* vertScrollBar() const;
/** Returns the editor widget */
KSpread::EditWidget* editWidget() const;
/** Returns the location widget */
ComboboxLocationEditWidget* posWidget() const;
/** Returns the tab bar */
KoTabBar* tabBar() const;
void setZoom( int zoom, bool updateViews ); // change the zoom value
void addSheet( Sheet *_t );
//void removesheet( Sheet *_t );
void removeAllSheets();
void setActiveSheet( Sheet *_t,bool updatesheet=true );
const Sheet* activeSheet() const;
Sheet* activeSheet();
void openPopupMenu( const TQPoint &_global );
void popupRowMenu(const TQPoint & _point ) ;
void popupColumnMenu( const TQPoint & _point);
// void showFormulaToolBar( bool show );
/**
* Used by @ref EditWidget. Sets the text of the active cell(s).
*/
void setText( const TQString& _text, bool array = false );
void enableUndo( bool _b );
void enableRedo( bool _b );
void enableInsertColumn( bool _b );
void enableInsertRow( bool _b );
/**
*
* @param _tqgeometry is the zoomed tqgeometry of the new child.
* @param _entry is the entry to insert.
*
* @todo check validity of @p _entry docs.
*/
void insertChart( const TQRect& _tqgeometry, KoDocumentEntry& _entry );
/**
*
* @param _tqgeometry is the tqgeometry of the new child.
* @param _entry is the entry to insert.
*
* @todo check validity of @p _entry docs.
*/
void insertChild( const TQRect& _tqgeometry, KoDocumentEntry& _entry );
// void insertPicture( const TQRect& _tqgeometry, KURL& _file );
virtual void print( KPrinter &printer );
virtual void setupPrinter( KPrinter &printer );
/**
* Fills the @ref EditWidget with the current cells
* content. This function is usually called after the
* cursor moved.
*/
void updateEditWidget();
/**
* Same as updateEditEidget() but no update of menus and toolbars
*/
void updateEditWidgetOnPress();
/**
* Called before saving, to finish the current edition (if any)
*/
void deleteEditor( bool saveChanges = true );
void closeEditor();
virtual DCOPObject* dcopObject();
virtual TQWidget *canvas() const;
virtual int canvasXOffset() const;
virtual int canvasYOffset() const;
/**
* @reimp
*/
KoDocument *hitTest( const TQPoint &pos );
void initConfig();
void initCalcMenu();
void changeNbOfRecentFiles(int _nb);
void updateBorderButton();
void removeSheet( Sheet *_t );
void insertSheet( Sheet* sheet );
TQColor borderColor() const;
Selection* selectionInfo() const;
Selection* choice() const;
void updateShowSheetMenu();
/**
* Mark all selected cells / regions of cells as 'dirty' (ie. requiring a tqrepaint)
* They will be repainted on the next call to paintUpdates()
*/
void markSelectionAsDirty();
/**
* Repaint any cell with the paintDirty flag that is visible in this view
*/
void paintUpdates();
/**
* Resets the internal handle pointer, called from InsertHandler destructor
*/
void resetInsertHandle();
bool isInsertingObject();
bool showSheet(const TQString& sheetName);
/**
* @return marker for @p sheet
*/
TQPoint markerFromSheet( Sheet* sheet ) const;
/**
* @return scroll offset for @p sheet
*/
KoPoint offsetFromSheet( Sheet* sheet ) const;
/**
* Save current sheet selection.
* Call when we change sheet, or before save in OpenDocument format.
*/
void saveCurrentSheetSelection();
void deleteSelectedObjects();
/**
* Returns the default color for highlighting cells and column / row headers
*/
static TQColor highlightColor();
public slots:
/**
* refresh view when you hide/show vertical scrollbar
*/
void refreshView();
void initialPosition();
/**
* Actions
*/
void createTemplate();
void transformPart();
void copySelection();
void cutSelection();
void deleteSelection();
void clearTextSelection();
void clearCommentSelection();
void clearValiditySelection();
void clearConditionalSelection();
void fillRight();
void fillLeft();
void fillUp();
void fillDown();
void recalcWorkBook();
void recalcWorkSheet();
void paste();
void specialPaste();
void editCell();
void setAreaName();
void showAreaName();
void adjust();
void defaultSelection();
void paperLayoutDlg();
void styleDialog();
void definePrintRange();
void resetPrintRange();
void insertObject();
void insertFromDatabase();
void insertFromTextfile();
void insertFromClipboard();
void insertSpecialChar();
void togglePageBorders( bool );
void toggleProtectSheet( bool );
void toggleProtectDoc( bool );
void viewZoom( const TQString & );
void find();
void findNext();
void findPrevious();
void replace();
void conditional();
void validity();
void insertSeries();
void sort();
void insertHyperlink();
void removeHyperlink();
void goalSeek();
void multipleOperations();
void subtotals();
void textToColumns();
void consolidate();
void insertSheet();
void removeSheet();
void hideSheet();
void showSheet();
void helpUsing();
void insertChart();
void insertPicture();
void moneyFormat(bool b);
void alignLeft( bool b );
void alignRight( bool b );
void alignCenter( bool b );
void alignTop( bool b );
void alignMiddle( bool b );
void alignBottom( bool b );
void wrapText( bool b );
void precisionMinus();
void precisionPlus();
void createStyleFromCell();
void styleSelected( const TQString & );
void setSelectionPrecision(int delta);
void percent(bool b);
void fontSelected( const TQString &_font );
void fontSizeSelected( int size );
void bold( bool b );
void italic( bool b );
void underline( bool b );
void strikeOut( bool b );
void deleteColumn();
void insertColumn();
void deleteRow();
void insertRow();
void hideRow();
void showRow();
void showSelRows();
void hideColumn();
void showColumn();
void showSelColumns();
void insertMathExpr();
void formulaSelection( const TQString &_math );
void changeTextColor();
void changeBackgroundColor();
void sortInc();
void sortDec();
void layoutDlg();
void extraProperties();
void borderBottom();
void borderRight();
void borderLeft();
void borderTop();
void borderOutline();
void borderAll();
void borderRemove();
void changeBorderColor();
void sheetFormat();
void autoSum();
void resizeRow();
void resizeColumn();
void increaseFontSize();
void decreaseFontSize();
void setSelectionFontSize(int size);
void setSelectionTextColor(const TQColor &txtColor);
void setSelectionBackgroundColor(const TQColor &bgColor);
void setSelectionBorderColor(const TQColor &bdColor);
void setSelectionLeftBorderColor(const TQColor &color);
void setSelectionRightBorderColor(const TQColor &color);
void setSelectionTopBorderColor(const TQColor &color);
void setSelectionBottomBorderColor(const TQColor &color);
void setSelectionAllBorderColor(const TQColor &color);
void setSelectionOutlineBorderColor(const TQColor &color);
void upper();
void lower();
void equalizeColumn();
void equalizeRow();
void preference();
void firstLetterUpper();
void verticalText(bool );
void addModifyComment();
void setSelectionComment(TQString comment);
void removeComment();
void changeAngle();
void setSelectionAngle(int angle);
/**
* Merges selected cells into one cell. This will not work if only one
* cell is selected. An entire row or column can't be merged as well.
*
* \sa dissociateCell
*/
void mergeCell();
void mergeCellHorizontal();
void mergeCellVertical();
/**
* Breaks merged cell. Obviously this can be done only on merged cells.
*
* \sa mergeCell
*/
void dissociateCell();
void gotoCell();
void increaseIndent();
void decreaseIndent();
void copyAsText();
void moveSheet( unsigned sheet, unsigned target );
/**
* Shows the sheet properties dialog.
*/
void sheetProperties();
/**
* Switch the active sheet to the name. This slot is connected to the tab bar
* and activated when the user selects a new sheet in the tab bar.
*/
void changeSheet( const TQString& _name );
/**
* Switch the active sheet to the next visible sheet. Does nothing if the current
* active sheet is the last visible sheet in the workbook.
*/
void nextSheet();
/**
* Switch the active sheet to the previous visible sheet. Does nothing if the current
* active sheet is the first visible sheet in the workbook.
*/
void previousSheet();
/**
* Switch the active sheet to the first visible sheet in the workbook. Does nothing
* if the current active sheet is already the first one.
*/
void firstSheet();
/**
* Switch the active sheet to the last visible sheet in the workbook. Does nothing
* if the current active sheet is already the last one.
*/
void lastSheet();
void sortList();
void statusBarClicked(int _id);
void menuCalc(bool);
/**
* Shows the status bar if b is true, otherwise the status bar will be hidden.
*/
void showStatusBar( bool b );
/**
* Shows the tab bar if b is true, otherwise the tab bar will be hidden.
*/
void showTabBar( bool b );
/**
* Shows the formula bar if b is true, otherwise the formula bar will be hidden.
*/
void showFormulaBar( bool b );
/**
* Shows context menu when tabbar is double-clicked.
*/
void popupTabBarMenu( const TQPoint& );
void handleDamages( const TQValueList<Damage*>& damages );
void runInternalTests();
void runInspector();
void initialiseMarkerFromSheet( Sheet *_sheet, const TQPoint &point );
/**
* write in statusBar result of calc (Min, or Max, average, sum, count)
*/
void calcStatusBarOp();
protected slots:
/**
* Popup menu
*/
void slotActivateTool( int _id );
void slotInsert();
void slotInsertCellCopy();
void slotRemove();
void slotRename();
/**
* Invoked if the popup menu for an embedded document should be opened.
*/
void popupChildMenu( KoChild*, const TQPoint& global_pos );
/**
* Invoked when the "Delete Embedded Document" option from an embedded document's
* popup menu is selected.
*/
void slotPopupDeleteChild();
/**
* Border popup menu
*/
void slotPopupAdjustColumn();
void slotPopupAdjustRow();
/**
* list from list choose
*/
void slotItemSelected( int );
void slotListChoosePopupMenu( );
/**
* Called by find/replace (findNext) when it found a match
*/
void slotHighlight( const TQString &text, int matchingIndex, int matchedLength );
/**
* Called when replacing text in a cell
*/
void slotReplace( const TQString &newText, int, int, int );
void slotSpecialChar( TQChar c, const TQString & _font );
void slotSpecialCharDlgClosed();
void propertiesOk();
void objectSelectedChanged();
protected slots:
void slotChildSelected( KoDocumentChild* ch );
void slotChildUnselected( KoDocumentChild* );
public slots:
// Document signals
void slotRefreshView();
void slotUpdateView( Sheet *_sheet );
void slotUpdateView( Sheet *_sheet, const Region& );
void slotUpdateView( EmbeddedObject* obj );
void slotUpdateHBorder( Sheet *_sheet );
void slotUpdateVBorder( Sheet *_sheet );
void slotChangeSelection(const Region&);
void slotChangeChoice(const Region&);
void slotScrollChoice(const Region&);
void slotAddSheet( Sheet *_sheet );
void slotUpdateChildGeometry( EmbeddedKOfficeObject *_child );
void slotSheetRenamed( Sheet* sheet, const TQString& old_name );
void slotSheetHidden( Sheet*_sheet );
void slotSheetShown( Sheet*_sheet );
void slotSheetRemoved( Sheet*_sheet );
void refreshLocale();
void extraSpelling();
void spellCheckerReady();
void spellCheckerMisspelling( const TQString &, const TQStringList &, unsigned int);
void spellCheckerCorrected( const TQString &, const TQString &, unsigned int);
void spellCheckerDone( const TQString & );
void spellCheckerFinished( );
void spellCheckerIgnoreAll( const TQString & word);
void spellCheckerReplaceAll( const TQString &, const TQString &);
void startKSpell();
/**
* Updates the view and the action. This is typically connected
* to KoCommandHistory::commandExecuted() signal.
*/
void commandExecuted();
virtual int leftBorder() const;
virtual int rightBorder() const;
virtual int topBorder() const;
virtual int bottomBorder() const;
protected:
virtual void keyPressEvent ( TQKeyEvent * _ev );
virtual void resizeEvent( TQResizeEvent *_ev );
virtual TQWMatrix matrix() const;
/**
* Returns the position of the top-left point of the currently selected cell in document coordinates.
* This is used when inserting some types of objects or pasting images into the document (so that the newly
* pasted object's top-left point will be aligned with the top-left point of the currently selected cell)
*
*/
KoPoint markerDocumentPosition();
/**
* Activates the formula editor for the current cell.
* This function is usually called if the user presses
* a button in the formula toolbar.
*/
void activateFormulaEditor();
virtual void updateReadWrite( bool readwrite );
virtual void guiActivateEvent( KParts::GUIActivateEvent *ev );
void initFindReplace();
Cell* findNextCell();
private:
class Private;
Private* d;
// don't allow copy or assignment
View( const View& );
View& operator=( const View& );
void initView();
bool spellSwitchToOtherSheet();
void spellCleanup();
/**
* @return @c true if document is being loaded. It is useful to supress scrolling
* while the "View loading" process.
*/
bool isLoading() const;
Cell* nextFindValidCell( int col, int row );
friend class Private;
};
} // namespace KSpread
#endif // KSPREAD_VIEW
|