summaryrefslogtreecommitdiffstats
path: root/kpresenter/KPrView.h
blob: 456e2f13bac120e48fdfa271372e37f838c8b72d (plain)
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
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <[email protected]>
   Copyright (C) 2005-2006 Thorsten Zachmann <[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 kpresenter_view_h
#define kpresenter_view_h

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <tqguardedptr.h>
#include <tqtimer.h>
#include <tqdatetime.h>

#include <KoView.h>
#include "global.h"
#include <KoBrush.h>
#include <KoPen.h>
#include <KoRuler.h>

class TQPopupMenu;
class TQSplitter;
class TQLabel;
class DCOPObject;
class KPrView;
class KPrBackDialog;
class KoRuler;
class TQScrollBar;
class AFChoose;
class KPrPropertyEditor;
class KPrPgConfDia;
class KPrSlideTransitionDia;
class KPrRotationDialogImpl;
class KPrShadowDialogImpl;
class KPrImageEffectDia;
class ConfPieDia;
class ConfRectDia;
class ConfPolygonDia;
class ConfPictureDia;
class KPrPresDurationDia;
class TQToolButton;
class KPrSideBar;
class KPrNoteBar;

class TDEAction;
class TDEActionMenu;
class TDEToggleAction;
class TTDESelectColorAction;
class KoPartSelectAction;
class KoPicture;
class KoParagStyle;
class KoLineStyleAction;
class KoLineWidthAction;
class KoRect;

class KoCharSelectDia;
class KoTextFormat;
class KoTextObject;
class KoTextZoomHandler;

class KCommand;
class KMacroCommand;
class TDEFontSizeAction;
class KColorAction;
class TDESelectAction;
class TDEFontAction;
class KoParagCounter;
class TDEActionMenu;
class KoSearchContext;
class KPrFindReplace;
class KPrCanvas;
class KoFontDia;
class KoParagDia;
class KPrObject;
class KPrPixmapObject;
class KPrDocument;
class KPrPage;
class KPrTextObject;
class KoTextIterator;
class KStatusBarLabel;

class KoSpell;
#include <tdespell2/broker.h>
namespace KSpell2 {
    class Dialog;
}

class PageBase : public TQWidget
{
public:
    PageBase( TQWidget *parent, KPrView *v ) : TQWidget( parent ), view( v ) {}
    void resizeEvent( TQResizeEvent *e );

private:
    KPrView *view;

};


class KPrView : public KoView
{
    friend class PageBase;
    TQ_OBJECT
  

public:
    KPrView( KPrDocument* _doc, TQWidget *_parent = 0, const char *_name = 0 );
    ~KPrView();

    void initGui();
    virtual DCOPObject* dcopObject();

    // for dcop interface
    int getCurrentPresPage() const;
    int getCurrentPresStep() const;
    int getPresStepsOfPage() const;
    int getNumPresPages() const;
    bool gotoPresPage( int pg );

    virtual void setupPrinter( KPrinter &printer );
    virtual void print( KPrinter &printer );

    void showFormat( const KoTextFormat &format );

    void showZoom( int zoom ); // show a zoom value in the combo
    void setZoom( int zoom, bool updateViews ); // change the zoom value
    void changeZoomMenu( int zoom=-1);
    void showStyle( const TQString & styleName );
    void updateStyleList();

    KoTextZoomHandler *zoomHandler() const;

    //used this function when we when to print/create web presentation etc...
    //=>we unzoom it.
    void unZoomDocument(int &dpiX,int &dpiY);
    void zoomDocument(int zoom);

    //refresh footer/header button when we make undo/redo show/hide header/footer
    void updateHeaderFooterButton();
    void updateDisplayObjectMasterPageButton();

    void updateDisplayBackgroundButton();
    virtual int leftBorder() const { return canvas()->mapTo(const_cast<KPrView *>(this), TQPoint(0,0)).x(); };
    virtual int rightBorder() const { return width() - canvas()->mapTo(const_cast<KPrView *>(this), TQPoint(canvas()->width(), 0)).x(); };
    virtual int topBorder() const { return canvas()->mapTo(const_cast<KPrView *>(this), TQPoint(0,0)).y(); };
    virtual int bottomBorder() const { return height() - canvas()->mapTo(const_cast<KPrView *>(this), TQPoint(0, canvas()->height())).y(); };

    void updateGuideLineButton();

    void updateGridButton();
    void savePicture( const TQString& oldName, KoPicture& picture);
    void savePicture( KPrPixmapObject* obj );

    void insertFile(const TQString &path);
    void testAndCloseAllTextObjectProtectedContent();
    void updateRulerInProtectContentMode();
    TQPtrList<TDEAction> listOfResultOfCheckWord( const TQString &word );

    /**
     * Returns the KPresenter global KSpell2 Broker object.
     */
    KSpell2::Broker *broker() const;
    bool editMaster() const { return m_editMaster;}

signals:
    void currentPageChanged( int );
    void presentationFinished();

public slots:
    // edit menu
    void editCut();
    void editCopy();
    void editPaste();
    void editDelete();
    void editSelectAll();
    void editDeSelectAll();
    void editCopyPage();
    void editDuplicatePage();
    void editDelPage();
    void editFind();
    void editReplace();

    // view menu
    void viewShowSideBar();
    void viewShowNoteBar();
    void viewSlideMaster();
    void viewZoom( const TQString &s );

    void viewFooter();
    void viewHeader();
    void insertComment();
    void editComment();

    void viewGuideLines();

    void viewGrid();

    void viewSnapToGrid();

    // insert menu
    void insertPage();
    void insertPicture();
    void insertPicture(const TQString &file);
    void insertSpecialChar();

    // tools menu
    void toolsMouse();
    void toolsRotate();
    void toolsZoom();
    void toolsLine();
    void toolsLinePopup();
    void toolsShapePopup();
    void toolsRectangle();
    void toolsCircleOrEllipse();
    void toolsPie();
    void toolsText();
    void toolsAutoform();
    void toolsDiagramm();
    void toolsTable();
    void toolsFormula();
    void toolsObject();
    void toolsFreehand();
    void toolsPolyline();
    void toolsQuadricBezierCurve();
    void toolsCubicBezierCurve();
    void toolsConvexOrConcavePolygon();
    void toolsClosedLinePopup();
    void toolsClosedFreehand();
    void toolsClosedPolyline();
    void toolsClosedQuadricBezierCurve();
    void toolsClosedCubicBezierCurve();

    // extra menu
    void extraProperties();
    void extraRaise();
    void extraLower();
    void extraRotate();
    void extraSendBackward();
    void extraBringForward();
    void extraArrangePopup();

    void extraShadow();
    void extraBackground();
    void extraLayout();
    void extraConfigure();
    void extraLineBegin();
    void extraLineEnd();
    void extraWebPres();
    void extraMSPres();
    void extraCreateTemplate();
    void extraDefaultTemplate();
    void extraGroup();
    void extraUnGroup();
    void extraPenStyle( int newStyle );
    void extraPenWidth( double newWidth );

    void configureCompletion();

    void extraAlignObjLeft();
    void extraAlignObjCenterH();
    void extraAlignObjRight();
    void extraAlignObjTop();
    void extraAlignObjCenterV();
    void extraAlignObjBottom();

    // screen menu
    void screenConfigPages();
    void screenAssignEffect();
    void screenTransEffect();
    void screenStart();
    void screenStartFromFirst();
    void screenStop();
    void screenPause();
    void screenFirst();
    /**
     * Go to previous step of the presentation.
     * gotoPreviousPage: if is set to true go to beginning of the
     *                   previous page.
     */
    void screenPrev( bool gotoPreviousPage = false );
    /**
     * Go to the next step of the presentation.
     * gotoNextPage: if is set to true go to beginning of the
     *               next page.
     */
    void screenNext( bool gotoNextPage = false );
    void screenLast();
    void screenSkip();

    // text toolbar
    void sizeSelected( int size );
    void fontSelected( const TQString &fontFamily );
    void textBold();
    void textItalic();
    void textUnderline();
    void textStrikeOut();
    void textColor();
    void textAlignLeft();
    void textAlignCenter();
    void textAlignRight();
    void textAlignBlock();
    void mtextFont();

    void slotCounterStyleSelected();

    void textDepthPlus();
    void textDepthMinus();
    void textContentsToHeight();
    void textObjectToContents();
    void textInsertPageNum();
    void textDefaultFormat();

    // color bar
    void penChosen();
    void brushChosen();

    void skipToPage( int _num );
    void nextPage();
    void prevPage();

    /**
     * Update a given item in the sidebar
     */
    void updateSideBarItem( KPrPage * page );
    void addSideBarItem( int pos );
    void moveSideBarItem( int oldPos, int newPos );
    void removeSideBarItem( int pos );

    //statusbar updates
    void updatePageInfo();
    void updateObjectStatusBarItem();
    void pageNumChanged();
    void updateSideBarMenu();

    void objectSelectedChanged();

    void renamePageTitle();

    void picViewOriginalSize();
    void picViewOrig640x480();
    void picViewOrig800x600();
    void picViewOrig1024x768();
    void picViewOrig1280x1024();
    void picViewOrig1600x1200();

    void chPic();
    void imageEffect();

    void textSubScript();
    void textSuperScript();

    void slotSpecialChar(TQChar, const TQString &);
    void slotSpecialCharDlgClosed();

    void insertLink();
    void changeLink();
    void copyLink();
    void removeLink();
    void addToBookmark();
    void slotSoftHyphen();
    void slotNonbreakingSpace();
    void slotNonbreakingHyphen();
    void slotLineBreak();
    void slotIncreaseNumberingLevel();
    void slotDecreaseNumberingLevel();

    void extraAutoFormat();
    void slotSpellCheck();


    void spellCheckerDone( const TQString & );
    void spellCheckerCancel();
    void startKSpell();
    void spellAddAutoCorrect (const TQString & originalword, const TQString & newword);
    void spellCheckerMisspelling( const TQString &, int );
    void spellCheckerCorrected( const TQString &, int, const TQString & );
    void alignChanged( int );

    void formatParagraph();
    void changeNbOfRecentFiles(int _nb);

    void insertVariable();

    void insertCustomVariable();
    void insertNewCustomVariable();
    void refreshCustomMenu();

    void editCustomVars ();
    void openLink();

    void increaseFontSize();
    void decreaseFontSize();

    void tabListChanged( const KoTabulatorList & tabList );

    void newLeftIndent( double _leftIndent);
    void newFirstIndent( double _firstIndent);
    void newRightIndent( double _rightIndent);
    void slotUpdateRuler();

    void slotHRulerDoubleClicked( double ptpos );
    void slotHRulerDoubleClicked();

    void changeCaseOfText();
    void slotStyleSelected();
    void textStyleSelected( int );
    void extraStylist();

    void slotAllowAutoFormat();

    void slotCompletion();

    void removeComment();
    void copyTextOfComment();

    //zoom menu
    void zoomMinus();
    void zoomPageWidth();
    void zoomEntirePage();
    void zoomPlus();
    void zoomSelectedObject();
    void zoomPageHeight();
    void zoomAllObject();

    void flipHorizontal();
    void flipVertical();
    void closeObject();

    void duplicateObj();
    void applyAutoFormat();
    void createStyleFromSelection();

    void alignVerticalTop();
    void alignVerticalBottom();
    void alignVerticalCenter();


    void savePicture();
    void autoSpellCheck();

    void insertFile();
    void editCustomVariable();
    void importStyle();

    void backgroundPicture();
    void updateBgSpellCheckingState();
    void updatePresentationButton(bool);
    void refreshGroupButton();
    void slotAddIgnoreAllWord();
    void addWordToDictionary();
    void customSlideShow();

    void displayObjectFromMasterPage();
    void displayBackground();
    void slotUnitChanged(KoUnit::Unit);
    void documentModified( bool );

public:
    // create GUI
    virtual void createGUI();

    // get current pagenum, 1-based
    unsigned int getCurrPgNum() const;
    /**
     * Recalculate the currPgNum from the activePage of the canvas
     * This is necessary after a page has inserted.
     */
    void recalcCurrentPageNum();

    // return pointer to document
    KPrDocument *kPresenterDoc() const {return m_pKPresenterDoc; }

    // properties
    void changePicture( const TQString & );

    KPrCanvas* getCanvas() const { return m_canvas;}

    void setRulerMouseShow( bool _show );
    void setRulerMousePos( int mx, int my );

    // set scrollbar ranges
    void setRanges();

    KoRuler *getHRuler() const { return h_ruler; }
    KoRuler *getVRuler() const { return v_ruler; }
    KoTabChooser *getTabChooser() const { return tabChooser; }
    TQScrollBar *getHScrollBar() const { return horz; }
    TQScrollBar *getVScrollBar() const { return vert; }

    /**
     * @brief Show the rect where object lies
     *
     * It will move the screen to the top right corner of object
     * when it is not allready totaly visible on the screen.
     *
     * @param object which should be shown
     */
    void showObjectRect( const KPrObject * object );

    PieType getPieType() const { return pieType; }
    int getPieAngle() const { return pieAngle; }
    int getPieLength() const { return pieLength; }
    KoPen getPen() const { return pen; }
    TQBrush getBrush() const { return brush; }
    LineEnd getLineBegin() const { return lineBegin; }
    LineEnd getLineEnd() const{ return lineEnd; }
    TQColor getGColor1() const { return gColor1; }
    TQColor getGColor2() const { return gColor2; }
    BCType getGType() const { return gType; }
    FillType getFillType() const { return fillType; }
    bool getGUnbalanced() const { return gUnbalanced; }
    int getGXFactor() const { return gXFactor; }
    int getGYFactor() const { return gYFactor; }
    TTDESelectColorAction* getActionBrushColor() const { return actionBrushColor; }
    TTDESelectColorAction* getActionPenColor() const { return actionPenColor; }

    void setPieType(PieType _pieType) { pieType = _pieType; }
    void setPieAngle(int _pieAngle) { pieAngle = _pieAngle; }
    void setPieLength(int _pieLength) { pieLength = _pieLength; }
    void setPen(KoPen _pen) { pen = _pen; }
    void setBrush(TQBrush _brush) { brush = _brush; }
    void setLineBegin(LineEnd _lineBegin) { lineBegin = _lineBegin; }
    void setLineEnd(LineEnd _lineEnd){ lineEnd = _lineEnd; }
    void setGColor1(TQColor _gColor1) { gColor1 = _gColor1; }
    void setGColor2(TQColor _gColor2) { gColor2 = _gColor2; }
    void setGType(BCType _gType) { gType = _gType; }
    void setFillType(FillType _fillType) { fillType = _fillType; }
    void setGUnbalanced(bool _gUnbalanced) { gUnbalanced = _gUnbalanced; }
    void setGXFactor(int _gXFactor) { gXFactor = _gXFactor; }
    void setGYFactor(int _gYFactor) { gYFactor = _gYFactor; }

    void setTool( ToolEditMode toolEditMode );

    int getRndX() const { return rndX; }
    int getRndY() const { return rndY; }

    void setRndX(int _rndX) { rndX = _rndX; }
    void setRndY(int _rndY) { rndY = _rndY; }

//     TQFont &currFont() { return tbFont; }
//     TQColor &currColor() { return tbColor; }

    void enableWebPres();
    void enableMSPres();

    /**
     * Overloaded from View
     */
    bool doubleClickActivation() const;
    /**
     * Overloaded from View
     */
    TQWidget* canvas() const;
    /**
     * Overloaded from View
     */
    int canvasXOffset() const;
    /**
     * Overloaded from View
     */
    int canvasYOffset() const;

    /**
     * Rebuild the whole sidebar
     */
    void updateSideBar();

    void refreshPageButton();

    void setCanvasXOffset( int _x );
    void setCanvasYOffset( int _y );

    void openPopupMenuObject( const TQString & name , const TQPoint & _point );
    void openPopupMenuMenuPage( const TQPoint & _point );
    void openPopupMenuSideBar(const TQPoint & _point);

    void openPopupMenuZoom( const TQPoint & _point );

    void penColorChanged( const KoPen & _pen );
    void brushColorChanged( const TQBrush & _brush );

    /**
     * Restart the timer for going to the next page.
     * This is used in automatic presentation mode.
     */
    void restartAutoPresTimer();

    /**
     * Continue the stopped timer for going to the next page.
     * This is used in automatic presentation mode.
     */
    void continueAutoPresTimer();

    /**
     * Stop the timer for going to the next page.
     * This is used in automatic presentation mode.
     */
    void stopAutoPresTimer();

    /**
     * Set the timer for going to next step to sec seconds.
     * This is used in automatic presentation mode.
     */
    void setAutoPresTimer( int sec );

    void showCounter( KoParagCounter &c );

    TQPopupMenu * popupMenu( const TQString& name );

    void showRulerIndent( double _leftMargin, double _firstLine, double _rightMargin, bool rtl );

    void reorganize();

    // For KPrNoteBar
    KPrNoteBar *getNoteBar() const { return notebar; }

    // Used by Page to plug/unplug the datatool actions
    TQPtrList<TDEAction>& actionList() { return m_actionList; }
    // Used by Page to plug/unplug the variable actions
    TQPtrList<TDEAction> &variableActionList() { return m_variableActionList; }

    // for Polygon object
    bool getCheckConcavePolygon() const { return checkConcavePolygon; }
    int getCornersValue() const { return cornersValue; }
    int getSharpnessValue() const { return sharpnessValue; }

    void setCheckConcavePolygon(bool _concavePolygon) { checkConcavePolygon = _concavePolygon; }
    void setCornersValue(int _cornersValue) { cornersValue = _cornersValue; }
    void setSharpnessValue(int _sharpnessValue) { sharpnessValue = _sharpnessValue; }

    // for Picture Object
    PictureMirrorType getPictureMirrorType() const { return mirrorType; }
    int getPictureDepth() const { return depth; }
    bool getPictureSwapRGB() const { return swapRGB; }
    bool getPictureGrayscal() const { return grayscal; }
    int getPictureBright() const { return bright; }

    /**
     * Set the duration of the given page ( zero based ).
     * This reads out m_duration and adds it to the given page.
     * m_duration is restarted.
     */
    void setPageDuration( int _pgNum );

    /**
     * @brief Zoom the rect
     *
     * @param rect The rect which should be zoomed to.
     */
    void setZoomRect( const KoRect & rect );
    void changeVerticalAlignmentStatus(VerticalAlignmentType _type );

    void closeTextObject();
    void deSelectAllObjects();

    void insertDirectCursor(bool b);
    void updateDirectCursorButton();

    void setEditMaster( bool editMaster );

protected slots:
    // dialog slots
    void backOk( KPrBackDialog*, bool );
    void afChooseOk( const TQString & );
    void slotAfchooseCanceled();
    void propertiesOk();
    void pgConfOk();
    void rotateOk();
    void shadowOk();
    void pddClosed();

    // scrolling
    void scrollH( int );
    void scrollV( int );

    // textobject
    void fontChanged( const TQFont & );
    void colorChanged( const TQColor &color );

    void extraLineBeginNormal();
    void extraLineBeginArrow();
    void extraLineBeginRect();
    void extraLineBeginCircle();
    void extraLineBeginLineArrow();
    void extraLineBeginDimensionLine();
    void extraLineBeginDoubleArrow();
    void extraLineBeginDoubleLineArrow();
    void setExtraLineBegin(LineEnd lb);
    void extraLineEndNormal();
    void extraLineEndArrow();
    void extraLineEndRect();
    void extraLineEndCircle();
    void extraLineEndLineArrow();
    void extraLineEndDimensionLine();
    void extraLineEndDoubleArrow();
    void extraLineEndDoubleLineArrow();
    void setExtraLineEnd(LineEnd le);

    void setExtraPenStyle( Qt::PenStyle style );
    void setExtraPenWidth( double width );

    /**
     * Restart the presenation from the first shown slide.
     * This only works in automatic presentation and infinite loop mode.
     */
    void restartPresentation() { m_autoPresRestart = true; }
    /**
     * Finish the automatic presentation mode.
     * This only works in automatic presentation mode.
     */
    void stopAutomaticPresentation() { m_autoPresStop = true; }

    void newPageLayout( const KoPageLayout &_layout );
    void openPageLayoutDia() { extraLayout(); }
    void unitChanged( KoUnit::Unit );

    void doAutomaticScreenPres();

    void getPageMouseWheelEvent( TQWheelEvent *e );
    void updateRuler();

    void refreshAllVariable();
    void slotViewFormattingChars();
    void slotUpdateScrollBarRanges();

    void addGuideLine();

    void refreshRuler( bool state );
    void slotApplyFont();
    void slotApplyParag();
    void slotObjectEditChanged();
    void slotChangeCutState(bool );

    void insertDirectCursor();
    void slotCorrectWord();
    void editFindNext();
    void editFindPrevious();

    void initialLayoutOfSplitter();

    virtual void slotChildActivated(bool a);

    void loadingFinished();

protected:
    virtual void resizeEvent( TQResizeEvent* );
    virtual void dragEnterEvent( TQDragEnterEvent *e );
    virtual void dragMoveEvent( TQDragMoveEvent *e );
    virtual void dragLeaveEvent( TQDragLeaveEvent *e );
    virtual void dropEvent( TQDropEvent *e );

    virtual void keyPressEvent( TQKeyEvent* );

    virtual void guiActivateEvent( KParts::GUIActivateEvent *ev );

// GUI
    void setupActions();
    void setupPopupMenus();
    void setupScrollbars();
    void setupRulers();

    void startScreenPres( int pgNum = -1 );

    virtual void updateReadWrite( bool readwrite );

    void addVariableActions( int type, const TQStringList & texts,
                             TDEActionMenu * parentMenu, const TQString & menuText );

    void showParagraphDialog( int initialPage = -1, double initialTabPos = 0.0 );

    TQValueList<KoTextObject *> spellAddTextObject() const;

    bool switchInOtherPage( const TQString & text );

    void openThePresentationDurationDialog();
    TQString presentationDurationDataFormatChange( int _time );

    int getZoomEntirePage() const;

    KCommand * applyAutoFormatToCurrentPage( const TQPtrList<KoTextObject> & lst);
    void textStyleSelected( KoParagStyle *_sty );

    /*
     * create a command which sets the pen according to the flags
     * for the selected objects on the active and sticky page
     */
    KCommand * getPenCmd( const TQString &name, KoPen pen, LineEnd lb, LineEnd le, int flags );

    void spellCheckerRemoveHighlight();

    void updateNoteBarText();
private:
    void clearSpellChecker(bool cancelSpellCheck = false);

// ********** variables **********

    // document
    KPrDocument *m_pKPresenterDoc;

    // flags
    /**
     * Set to true if the presentation sould be restarted.
     * This only works in automatic presentation and infinite loop mode.
     */
    bool m_autoPresRestart;

    /**
     * Set to true if the presentation sould be stoped.
     * This only works in automatic presentation mode.
     */
    bool m_autoPresStop;
    bool m_screenSaverWasEnabled;
    bool m_dpmsWasEnabled;

    // right button popup menus
    TQPopupMenu *rb_lbegin, *rb_lend;
    TQPopupMenu *m_arrangeObjectsPopup;
    TQPtrList<TDEAction> m_actionList; // for the kodatatools
    TQPtrList<TDEAction> m_variableActionList;

    // scrollbars
    TQScrollBar *vert, *horz;

    // dialogs
    AFChoose *afChoose;
    KPrPropertyEditor *m_propertyEditor;
    KPrPgConfDia *pgConfDia;
    KPrRotationDialogImpl *rotateDia;
    KPrShadowDialogImpl *shadowDia;
    KPrImageEffectDia *imageEffectDia;
    KPrPresDurationDia *presDurationDia;

    // default pen and brush
    KoPen pen;
    TQBrush brush;
    LineEnd lineBegin;
    LineEnd lineEnd;
    TQColor gColor1, gColor2;
    BCType gType;
    FillType fillType;
    PieType pieType;
    bool gUnbalanced;
    int gXFactor, gYFactor;
    int pieLength, pieAngle;
    int rndX, rndY;
    // for Convex/Concave Polygon
    bool checkConcavePolygon;
    int cornersValue;
    int sharpnessValue;
    /// used to save mouse pos
    TQPoint m_mousePos;

    // for Picture Object
    PictureMirrorType mirrorType;
    int depth;
    bool swapRGB;
    bool grayscal;
    int bright;

    // the page
    KPrCanvas *m_canvas;
    KoRuler *h_ruler, *v_ruler;
    KoTabChooser *tabChooser;
    // text toolbar values
    TQFont tbFont;
    int tbAlign;
    TQColor tbColor;

    bool m_bShowGUI;
    bool presStarted;
    /**
     * Indicates if the master page is edited
     */
    bool m_editMaster;
    bool allowWebPres;
    bool allowMSPres;
    int currPg; // 0-based

    TQSize oldSize;

    int screensaver_pid;

    // Statusbar items
    TQLabel * m_sbPageLabel; // 'Current page number and page count' label
    TQLabel * m_sbObjectLabel; // Info about selected object
    TQLabel *m_sbSavingLabel; // use when saving file
    KStatusBarLabel* m_sbModifiedLabel;
    KStatusBarLabel* m_sbUnitLabel;
    KStatusBarLabel* m_sbZoomLabel;

    // actions
    TDEAction *actionEditCut;
    TDEAction *actionEditCustomVars;
    TDEAction *actionEditCopy;
    TDEAction *actionEditPaste;
    TDEAction *actionEditDelete;
    TDEAction *actionEditSelectAll;
    TDEAction *actionEditDeSelectAll;
    TDEAction *actionEditCopyPage;
    TDEAction *actionEditDuplicatePage;
    TDEAction *actionEditDelPage;

    TDEToggleAction *actionViewShowSideBar;
    TDEToggleAction *actionViewShowNoteBar;
    TDEToggleAction *actionViewSlideMaster;

    TDEToggleAction *actionViewShowGuideLine;

    TDEToggleAction *actionViewFormattingChars;
    TDEToggleAction *actionViewShowGrid;
    TDEToggleAction *actionViewSnapToGrid;

    TDEAction *actionInsertPage;
    TDEAction *actionInsertPicture;

    TDEToggleAction *actionToolsMouse;
    TDEToggleAction *actionToolsRotate;
    TDEToggleAction *actionToolsZoom;
    TDEToggleAction *actionToolsLine;
    TDEToggleAction *actionToolsRectangle;
    TDEToggleAction *actionToolsCircleOrEllipse;
    TDEToggleAction *actionToolsPie;
    TDEToggleAction *actionToolsText;
    TDEToggleAction *actionToolsAutoform;
    TDEToggleAction *actionToolsDiagramm;
    TDEToggleAction *actionToolsTable;
    TDEToggleAction *actionToolsFormula;
    TDEToggleAction *actionToolsFreehand;
    TDEToggleAction *actionToolsPolyline;
    TDEToggleAction *actionToolsQuadricBezierCurve;
    TDEToggleAction *actionToolsCubicBezierCurve;
    TDEToggleAction *actionToolsConvexOrConcavePolygon;
    TDEToggleAction *actionToolsClosedFreehand;
    TDEToggleAction *actionToolsClosedPolyline;
    TDEToggleAction *actionToolsClosedQuadricBezierCurve;
    TDEToggleAction *actionToolsClosedCubicBezierCurve;
    KoPartSelectAction *actionToolsObject;
    TDEActionMenu *actionToolsLinePopup;
    TDEActionMenu *actionToolsShapePopup;
    TDEActionMenu *actionToolsClosedLinePopup;

    TDEAction *actionTextFont;
    TDEFontSizeAction *actionTextFontSize;
    TDEFontAction *actionTextFontFamily;
    TDEToggleAction *actionTextAlignLeft;
    TDEToggleAction *actionTextAlignCenter;
    TDEToggleAction *actionTextAlignRight;
    TDEToggleAction *actionTextAlignBlock;

    TDEActionMenu *actionFormatBullet;
    TDEActionMenu *actionFormatNumber;


    TDEAction *actionTextDepthPlus;
    TDEAction *actionTextDepthMinus;
    TDEAction *actionTextExtentCont2Height;
    TDEAction *actionTextExtendObj2Cont;
    TDEToggleAction *actionTextBold;
    TDEToggleAction *actionTextItalic;
    TDEToggleAction *actionTextUnderline;
    TDEToggleAction *actionFormatStrikeOut;
    TDEAction *actionTextInsertPageNum;

    TDEAction *actionExtraProperties;
    TDEAction *actionExtraRaise;
    TDEAction *actionExtraLower;

    TDEAction *actionExtraBringForward;
    TDEAction *actionExtraSendBackward;
    TDEActionMenu *actionExtraArrangePopup;

    TDEAction *actionExtraRotate;
    TDEAction *actionExtraShadow;
    TDEActionMenu *actionExtraAlignObjsPopup;
    TDEAction *actionExtraAlignObjLeft;
    TDEAction *actionExtraAlignObjCenterH;
    TDEAction *actionExtraAlignObjRight;
    TDEAction *actionExtraAlignObjTop;
    TDEAction *actionExtraAlignObjCenterV;
    TDEAction *actionExtraAlignObjBottom;
    TDEAction *actionExtraBackground;
    TDEAction *actionExtraLayout;
    TDEAction *actionExtraConfigure;
    TDEAction *actionExtraWebPres;
    TDEAction *actionExtraMSPres;
    TDEAction *actionExtraCreateTemplate;
    TDEAction *actionExtraLineBegin;
    TDEAction *actionExtraLineEnd;
    TDEAction *actionExtraGroup;
    TDEAction *actionExtraUnGroup;
    KoLineStyleAction *actionExtraPenStyle;
    KoLineWidthAction *actionExtraPenWidth;

    TDEAction *actionScreenConfigPages;
    TDEAction *actionScreenAssignEffect;
    TDEAction *actionScreenTransEffect;
    TDEAction *actionScreenStart;
    TDEAction *actionScreenStartFromFirst;
    TDEAction *actionScreenStop;
    TDEAction *actionScreenPause;
    TDEAction *actionScreenFirst;
    TDEAction *actionScreenPrev;
    TDEAction *actionScreenNext;
    TDEAction *actionScreenLast;
    TDEAction *actionScreenSkip;

    TDEAction *actionEditFind;
    TDEAction *actionEditFindNext;
    TDEAction *actionEditFindPrevious;
    TDEAction *actionEditReplace;

    TDEAction *actionCustomSlideShow;

    TDEAction *actionColorBar;
    TDEAction *actionExtraDefaultTemplate;

    TTDESelectColorAction* actionBrushColor;
    TTDESelectColorAction* actionPenColor;
    TTDESelectColorAction* actionTextColor;


    TDEAction *actionResizeTextObject;
    TDEAction *actionExtendObjectHeight;
    TDEAction *actionObjectProperties;

    TDEAction *actionRenamePage;

    TDEAction *actionPicOriginalSize;
    TDEAction *actionPic640x480;
    TDEAction *actionPic800x600;
    TDEAction *actionPic1024x768;
    TDEAction *actionPic1280x1024;
    TDEAction *actionPic1600x1200;
    TDEAction *actionChangePic;
    TDEAction *actionExtraSpellCheck;
    TDEAction *actionFormatDefault;

    TDEAction *actionImageEffect;

    TDEAction *actionInsertComment;
    TDEAction *actionEditComment;
    TDEAction *actionRemoveComment;
    TDEAction *actionCopyTextOfComment;

    TDEAction *actionImportStyle;

    DCOPObject *dcop;

    TQToolButton *pgNext, *pgPrev;
    KPrSideBar *sidebar;
    KPrNoteBar *notebar;
    TQSplitter *splitter;
    PageBase *pageBase;

    TDEToggleAction *actionFormatSuper;
    TDEToggleAction *actionFormatSub;

    TDEToggleAction *m_actionExtraHeader;
    TDEToggleAction *m_actionExtraFooter;

    TDEAction* actionInsertSpecialChar;
    TDEAction *actionInsertLink;

    TDEAction * actionChangeLink;
    TDEAction *actionCopyLink;
    TDEAction *actionRemoveLink;

    TDEAction *actionAddLinkToBookmak;
    TDEAction *actionFormatParag;
    TDEAction *actionOpenLink;
    TDEAction *actionIncreaseFontSize;
    TDEAction *actionDecreaseFontSize;
    TDEAction *actionChangeCase;
    TDEAction *actionRefreshAllVariable;

    TDESelectAction *actionViewZoom;

    TDESelectAction *actionFormatStyle;

    TDEToggleAction *actionAllowAutoFormat;

    TDEToggleAction *actionDisplayObjectFromMasterPage;

    TDEToggleAction *actionDisplayBackgroundPage;

    TDEAction *actionFormatStylist;

    TDEAction *actionAddGuideLine;

    TDEAction *actionConfigureCompletion;

    TDEAction *actionZoomMinus;
    TDEAction *actionZoomPageWidth;
    TDEAction *actionZoomEntirePage;
    TDEAction *actionZoomPlus;
    TDEAction *actionZoomSelectedObject;
    TDEAction *actionZoomPageHeight;
    TDEAction *actionZoomAllObject;

    TDEAction *actionFlipHorizontal;
    TDEAction *actionFlipVertical;
    TDEAction *actionCloseObject;

    TDEAction *actionDuplicateObj;
    TDEAction *actionApplyAutoFormat;

    TDEAction *actionCreateStyleFromSelection;

    TDEAction *actionSavePicture;

    TDEAction *actionSaveBackgroundPicture;


    TDEAction *actionInsertFile;

    TDEAction *actionSpellIgnoreAll;

    TDEToggleAction *actionAlignVerticalTop;
    TDEToggleAction *actionAlignVerticalBottom;
    TDEToggleAction *actionAlignVerticalCenter;

    TDEToggleAction *actionAllowBgSpellCheck;
    TDEAction *actionEditCustomVarsEdit;
    TDEActionMenu *actionFormatStyleMenu;
    TDEToggleAction *actionInsertDirectCursor;

    TDEAction *actionAddWordToPersonalDictionary;

    /// timer for automatic presentation mode
    TQTimer m_autoPresTimer;
    /// time for messuring the elapsed time of the timer
    TQTime m_autoPresTime;
    /// the elapsed time if the timer gets stopped in milliseconds
    int m_autoPresElapsedTime;
    /// the value of m_autoPresTimer in milliseconds
    int m_autoPresTimerValue;
    /// true if the timer is connected to doAutomaticScreenPres
    bool m_autoPresTimerConnected;

    /// timer for duration of a page
    TQTime m_duration;
    /// list for saving the duration of the pages
    TQValueList<int> m_presentationDurationList;

    KoCharSelectDia *m_specialCharDlg;

    // store the currently selected line-tool
    enum CurrentLineTool {
        LtLine = 1,
        LtFreehand = 2,
        LtPolyline = 4,
        LtQuadricBezier = 8,
        LtCubicBezier = 16
    };

    CurrentLineTool m_currentLineTool;

    // store the currently selected shape-tool
    enum CurrentShapeTool {
        StRectangle = 1,
        StCircle = 2,
        StPie = 4,
        StPolygon = 8
    };

    CurrentShapeTool m_currentShapeTool;

    // store the currently selected closed-line-tool
    enum CurrentClosedLineTool {
        CltFreehand = 1,
        CltPolyline = 2,
        CltQuadricBezier = 4,
        CltCubicBezier = 8
    };

    CurrentClosedLineTool m_currentClosedLineTool;

    // Spell-checking
    struct {
        KoSpell *kospell;
        KMacroCommand * macroCmdSpellCheck;
        TQStringList replaceAll;
        KoTextIterator * textIterator;
        KSpell2::Dialog *dlg;
    } m_spell;

    KSpell2::Broker::Ptr m_broker;



    TDEActionMenu *actionInsertVariable;
    TDEActionMenu *actionInsertCustom;

    struct VariableDef {
        int type;
        int subtype;
    };
    typedef TQMap<TDEAction *, VariableDef> VariableDefMap;
    VariableDefMap m_variableDefMap;

    KoSearchContext *m_searchEntry, *m_replaceEntry;
    KPrFindReplace *m_findReplace;
    KoFontDia *m_fontDlg;
    KoParagDia *m_paragDlg;
    int m_switchPage;
    int m_initSwitchPage;

    int xOffsetSaved, yOffsetSaved; // saved when going fullscreen
    bool m_bDisplayFieldCode; //save state before to go to presentation mode
};

#endif