summaryrefslogtreecommitdiffstats
path: root/kword/KWView.h
blob: 08142ac91109ba166de02a795cd7da93976bf58f (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
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
   Copyright (C) 2005 Thomas Zander <zander@kde.org>

   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 kwview_h
#define kwview_h

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

#include <kprinter.h>

#include <KoBorder.h>
#include "defs.h"
#include "KWTextParag.h"

#include <KoPageLayoutDia.h>
#include <KoView.h>
#include <KoPoint.h>
#include <tdeshortcut.h>
#include <KoZoomMode.h>

#include <tqbrush.h>
#include <tqhbox.h>

class KWPage;
class KWViewMode;
class KWDocStruct;
class KWCanvas;
class KWDocument;
class KWGUI;
class KWFrame;
class KWFrameView;
class KWFrameViewManager;
class KWTextFrameSetEdit;
class KMacroCommand;
class KWFrameSet;
class KWFindReplace;
class KWFrameStyle;
class KWTableStyle;
class KWTableFrameSet;

class KoPicture;
class KoSearchContext;
class KoTextFormatInterface;
class KoRuler;
class TTDESelectColorAction;
class KoPartSelectAction;
class KoCharSelectDia;
class KoTextFormat;
class KoFontDia;
class KoParagDia;
class KoTextIterator;

class DCOPObject;
class KStatusBarLabel;
class KoSpell;
class KURL;
class TDEAction;
class TDEActionMenu;
class TDESelectAction;
class TDEToggleAction;
class TDEFontSizeAction;
class TDEFontAction;
class TQResizeEvent;
class TQSplitter;

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


/******************************************************************/
/* Class: KWView                                                  */
/******************************************************************/

class KWView : public KoView
{
    TQ_OBJECT
  

public:
    KWView( const TQString& viewMode, TQWidget *parent, const char *name, KWDocument *doc );
    virtual ~KWView();

    virtual DCOPObject* dcopObject();

    // Those methods update the UI (from the given formatting info)
    // They do NOT do anything to the text
    void showFormat( const KoTextFormat &currentFormat );
    void showAlign( int align );
    void showCounter( KoParagCounter &c );
    void showSpacing( int spacing );
    /**
     * Updates the checked state of the border buttons based on the parameters.
     * @param left represents the left border being currently visible
     * @param right represents the right border being currently visible
     * @param top represents the top border being currently visible
     * @param bottom represents the bottom border being currently visible
     */
    void updateBorderButtons( const KoBorder& left, const KoBorder& right,
                          const KoBorder& top, const KoBorder& bottom );

    void showStyle( const TQString & styleName );
    void showRulerIndent( double leftMargin, double firstLine, double rightMargin, bool rtl );
    void showZoom( int zoom ); // show a zoom value in the combo
    void showZoom( const TQString& zoom ); // show a zoom value in the combo
    void setZoom( int zoom, bool updateViews ); // change the zoom value

    bool viewFrameBorders() const { return m_viewFrameBorders; }
    void setViewFrameBorders(bool b);

    /**
     * Returns the KWord global KSpell2 Broker object.
     */
    KSpell2::Broker *broker() const;

    void setNoteType(NoteType nt, bool change=true);

    KWDocument *kWordDocument()const { return m_doc; }
    KWGUI *getGUI()const { return m_gui; }
    KWViewMode* viewMode() const;

    void updateStyleList();
    void updateFrameStyleList();
    void updateTableStyleList();

    void initGui();

    /// returns the current page number this view is looking at
    int currentPage() const;

    /**
     * Overloaded from View
     */
    bool doubleClickActivation() const;
    /**
     * Overloaded from View
     */
    TQWidget* canvas() const;
    /**
     * Overloaded from View
     */
    int canvasXOffset() const;
    /**
     * Overloaded from View
     */
    int canvasYOffset() const;
    /**
     * Overloaded vrom View
     */
    void canvasAddChild( KoViewChild *child );

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

    virtual TQPoint applyViewTransformations( const TQPoint& ) const;
    virtual TQPoint reverseViewTransformations( const TQPoint& ) const;

    void changeNbOfRecentFiles(int nb);

    void changeZoomMenu( int zoom=-1);

    void refreshMenuExpression();

    void updateGridButton();

    void deleteFrame(bool warning=true);

    TQPopupMenu * popupMenu( const TQString& name );

    TQPtrList<TDEAction> &dataToolActionList() { return m_actionList; }
    TQPtrList<TDEAction> &variableActionList() { return m_variableActionList; }
    TQPtrList<TDEAction> &tableActions() { return m_tableActionList; }

    enum { // bitfield
        ProvidesImage = 1,
        ProvidesPlainText = 2,
        ProvidesOasis = 4,
        ProvidesFormula = 8
    };
    static int checkClipboard( TQMimeSource *data );

    bool insertInlinePicture();

    void displayFrameInlineInfo();

    void initGUIButton();

    void updateHeaderFooterButton();
    void updateFooter();
    void updateHeader();
    void switchModeView();
    void changeFootNoteMenuItem( bool b);
    void insertFile(const KURL& url);
    void testAndCloseAllFrameSetProtectedContent();
    void updateBgSpellCheckingState();
    void updateRulerInProtectContentMode();
    void deselectAllFrames();
    void autoSpellCheck(bool b);
    void insertDirectCursor(bool b);
    void updateDirectCursorButton();

    void deleteFrameSet( KWFrameSet *);

    TQPtrList<TDEAction> listOfResultOfCheckWord( const TQString &word );

    int  tableSelectCell(const TQString &tableName, uint row, uint col);
    void tableInsertRow(uint row, KWTableFrameSet *table = 0);
    void tableInsertCol(uint col, KWTableFrameSet *table = 0);
    int tableDeleteRow(const TQValueList<uint>& rows, KWTableFrameSet *table = 0);
    int tableDeleteCol(const TQValueList<uint>& cols, KWTableFrameSet *table = 0);

    void pasteData( TQMimeSource* data, bool drop );

    KWFrameViewManager* frameViewManager() const;

public slots:
    void fileStatistics();
    void editCut();
    void editCopy();
    void editPaste();
    void editSelectAll();
    void editSelectAllFrames();
    void editSelectCurrentFrame();
    void editFind();
    void editFindNext();
    void editFindPrevious();
    void editReplace();
    void editDeleteFrame();
    void editCustomVariable();
    void editCustomVars();
    void editMailMergeDataBase();
    void createLinkedFrame();

    void viewTextMode();
    void viewPageMode();
    void viewPreviewMode();
    void slotViewFormattingChars();
    void slotViewFrameBorders();
    void viewHeader();
    void viewFooter();
    void viewZoom( const TQString &s );
    void updateZoom();

    void insertTable();
    void insertPicture();
    void insertSpecialChar();
    void insertFrameBreak();
    void insertVariable();
    void insertFootNote();
    void insertContents();
    void insertLink();
    void insertComment();
    void removeComment();
    void copyTextOfComment();

    void insertPage();
    void deletePage();

    void formatFont();
    void formatParagraph();
    void formatPage();
    void formatFrameSet();

    void slotSpellCheck();
    void extraAutoFormat();
    void extraFrameStylist();
    void extraStylist();
    void extraCreateTemplate();

    void toolsCreateText();
    void insertFormula( TQMimeSource* source=0 );
    void toolsPart();

    void tableProperties();
    void tableInsertRow();
    void tableInsertCol();
    void tableResizeCol();
    void tableDeleteRow();
    void tableDeleteCol();
    void tableJoinCells();
    void tableSplitCells();
    void tableSplitCells(int col, int row);
    void tableProtectCells(bool);
    void tableUngroupTable();
    void tableDelete();
    void tableStylist();
    void convertTableToText();
    void sortText();
    void addPersonalExpression();

    void slotStyleSelected();
    void slotFrameStyleSelected();
    void slotTableStyleSelected();
    void textStyleSelected( int );
    void frameStyleSelected( int );
    void tableStyleSelected( int );
    void textSizeSelected( int );
    void increaseFontSize();
    void decreaseFontSize();
    void textFontSelected( const TQString & );
    void textBold();
    void textItalic();
    void textUnderline();
    void textStrikeOut();
    void textColor();
    void textAlignLeft();
    void textAlignCenter();
    void textAlignRight();
    void textAlignBlock();
    void textSpacingSingle();
    void textSpacingOneAndHalf();
    void textSpacingDouble();
    void textSuperScript();
    void textSubScript();
    void textIncreaseIndent();
    void textDecreaseIndent();
    void textDefaultFormat();
    void slotCounterStyleSelected();

    // Text and Frame borders.
    void borderOutline();
    void borderLeft();
    void borderRight();
    void borderTop();
    void borderBottom();
    void backgroundColor();

    void showFormulaToolbar( bool show );

    void configure();
    void configureCompletion();

    void newPageLayout( const KoPageLayout &layout );
    void newLeftIndent( double leftIndent);
    void newFirstIndent( double firstIndent);
    void newRightIndent( double rightIndent);

    void clipboardDataChanged();
    void tabListChanged( const KoTabulatorList & tabList );

    void updatePageInfo();
    void updateFrameStatusBarItem();
    void setTemporaryStatusBarText(const TQString &text);

    void slotSpecialChar(TQChar , const TQString &);
    void slotFrameSetEditChanged();
    void showMouseMode( int /*KWCanvas::MouseMode*/ mouseMode );
    void frameSelectedChanged();
    void docStructChanged(int type);
    void documentModified( bool );
    void changeOverwriteMode( bool );
    void slotHRulerDoubleClicked();
    void slotHRulerDoubleClicked( double );
    void slotUnitChanged(KoUnit::Unit);

    void numPagesChanged();

    void insertExpression();

    void updateTocActionText(bool hasToc);

    void changeCaseOfText();

    void editPersonalExpr();

    void slotUpdateRuler();
    void slotEmbedImage( const TQString &filename );

    void insertCustomVariable();
    void insertNewCustomVariable();
    void slotSpecialCharDlgClosed();

    void refreshCustomMenu();

    void changePicture();

    void configureHeaderFooter();

    void inlineFrame();

    /** Move the selected frame above maximum 1 frame that is in front of it. */
    void raiseFrame() { adjustZOrderOfSelectedFrames(RaiseFrame); };
    /** Move the selected frame behind maximum 1 frame that is behind it */
    void lowerFrame() { adjustZOrderOfSelectedFrames(LowerFrame); };
    /** Move the selected frame(s) to be in the front most position. */
    void bringToFront() { adjustZOrderOfSelectedFrames(BringToFront); };
    /** Move the selected frame(s) to be behind all other frames */
    void sendToBack() { adjustZOrderOfSelectedFrames(SendToBack); };

    void openLink();
    void changeLink();
    void copyLink();
    void removeLink();
    void addToBookmark();
    void editComment();
    void showDocStructure();
    void showRuler();
    void viewGrid();
    void viewSnapToGrid();

    void slotSoftHyphen();
    void slotLineBreak();
    void slotNonbreakingSpace();
    void slotNonbreakingHyphen();

    void slotIncreaseNumberingLevel();
    void slotDecreaseNumberingLevel();

    void refreshAllVariable();

    void slotAllowAutoFormat();

    void slotCompletion();

    void applyAutoFormat();
    void createStyleFromSelection();

    void configureFootEndNote();
    void editFootEndNote();
    void changeFootNoteType();
    void savePicture();

    void autoSpellCheck();
    void goToFootEndNote();

    // Document Structure Area popup menu.
    void docStructEdit();
    void docStructSpeak();
    void docStructSelect();
    void docStructDelete();
    void docStructProperties();
    void openDocStructurePopupMenu( const TQPoint &p, KWFrameSet *frameset, KWTextParag *parag);

    void insertFile();

    void addBookmark();
    void selectBookmark();
    void importStyle();

    void createFrameStyle();

    void insertDirectCursor();

    void convertToTextBox();

    void slotAddIgnoreAllWord();

    void embeddedStoreInternal();

    void goToDocumentStructure();
    void goToDocument();

    void addWordToDictionary();

    void insertPicture( const KoPicture& picture, const bool makeInline, const bool keepRatio, int suggestedWidth, int suggestedHeight );

    // end of public methods
protected slots:
    virtual void slotChildActivated( bool a ); ///< from KoView
    void slotSetInitialPosition();

    void spellCheckerMisspelling( const TQString &, int );
    void spellCheckerCorrected( const TQString &, int, const TQString & );
    void spellCheckerDone( const TQString & );
    void spellCheckerCancel();

    void spellAddAutoCorrect (const TQString & originalword, const TQString & newword);
    void slotApplyFont();
    void slotApplyParag();
    void slotPageLayoutChanged( const KoPageLayout& layout );
    void slotChangeCaseState(bool b);
    void slotChangeCutState(bool b);
    void slotCorrectWord();

    /// This slot is called when the document has finished loading.
    void slotDocumentLoadingCompleted();

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

    void loadexpressionActions( TDEActionMenu * parentMenu);

    void createExpressionActions( TDEActionMenu * parentMenu,const TQString& filename,int &i , bool insertSepar, const TQMap<TQString, TDEShortcut>& personalShortCut );

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

    KWTextFrameSetEdit *currentTextEdit() const;
    /** The current text-edit if there is one, otherwise the selected text objects
     * This is what the "bold", "italic" etc. buttons apply to. */
    TQPtrList<KoTextFormatInterface> applicableTextInterfaces() const;

    void setupActions();

    virtual void resizeEvent( TQResizeEvent *e );
    virtual void guiActivateEvent( KParts::GUIActivateEvent *ev );

    virtual void updateReadWrite( bool readwrite );
    /**
     * Make sure the actions related to tables have the right texts and enabled options.
     * @param selectFrames a list of selected frames
     * @see KWFrameViewManager::selectedFrames()
     */
    void updateTableActions( TQValueList<KWFrameView*> selectFrames);


    void startKSpell();
    void clearSpellChecker(bool cancelSpellCheck = false );

    TQValueList<TQString> getInlineFramesets( const TQDomNode &framesetElem );

    // Helper stuff for the frame adjustment;
    enum MoveFrameType  { RaiseFrame, LowerFrame, BringToFront, SendToBack };
    void adjustZOrderOfSelectedFrames(MoveFrameType moveType);
    void increaseAllZOrdersAbove(int refZOrder, int pageNum, const TQPtrList<KWFrame>& frameSelection);
    void decreaseAllZOrdersUnder(int refZOrder, int pageNum, const TQPtrList<KWFrame>& frameSelection);
    int raiseFrame(const TQPtrList<KWFrame>& frameSelection, const KWFrame *frame);
    int lowerFrame(const TQPtrList<KWFrame>& frameSelection, const KWFrame *frame);
    int bringToFront(const TQPtrList<KWFrame>& frameSelection, const KWFrame *frame);
    int sendToBack(const TQPtrList<KWFrame>& frameSelection, const KWFrame *frame);
    void textStyleSelected( KoParagStyle *sty );
    void frameStyleSelected( KWFrameStyle *sty );
    void tableStyleSelected( KWTableStyle *sty );
    void changeFootEndNoteState();
    void refreshDeletePageAction();

    void spellCheckerRemoveHighlight();

    void setSpacing( KoParagLayout::SpacingType spacing, const TQString &commandName );

private:  // methods
    void deleteSelectedFrames();
    void borderChanged(KoBorder::BorderType type);
    void updateZoomControls();

private: // variables
    KWDocument *m_doc;

    TDEAction *m_actionFileStatistics;
    TDEAction *m_actionEditCut;
    TDEAction *m_actionEditCopy;
    TDEAction *m_actionEditPaste;
    TDEAction *m_actionEditSelectAll;
    TDEAction *m_actionEditSelectCurrentFrame;
    TDEAction *m_actionEditDelFrame;
    TDEAction *m_actionCreateLinkedFrame;
    TDEAction *m_actionRaiseFrame;
    TDEAction *m_actionLowerFrame;
    TDEAction *m_actionSendBackward;
    TDEAction *m_actionBringToFront;

    TDEAction *m_actionEditCustomVars;
    TDEAction *m_actionEditCustomVarsEdit;
    TDEAction *m_actionEditFind;
    TDEAction *m_actionEditFindNext;
    TDEAction *m_actionEditFindPrevious;
    TDEAction *m_actionEditReplace;
    TDEAction *m_actionApplyAutoFormat;

    TDEToggleAction *m_actionViewTextMode;
    TDEToggleAction *m_actionViewPageMode;
    TDEToggleAction *m_actionViewPreviewMode;

    TDEToggleAction *m_actionViewFormattingChars;
    TDEToggleAction *m_actionViewFrameBorders;
    TDEToggleAction *m_actionViewHeader;
    TDEToggleAction *m_actionViewFooter;
    TDEToggleAction *m_actionViewFootNotes;
    TDEToggleAction *m_actionViewEndNotes;
    TDEToggleAction *m_actionShowDocStruct;
    TDEToggleAction *m_actionShowRuler;
    TDEToggleAction *m_actionViewShowGrid;
    TDEToggleAction *m_actionViewSnapToGrid;
    TDEToggleAction *m_actionAllowAutoFormat;

    TDEToggleAction *m_actionAllowBgSpellCheck;

    TDESelectAction *m_actionViewZoom;

    TDEAction *m_actionInsertFrameBreak;
    TDEAction *m_actionInsertFootEndNote;
    TDEAction *m_actionInsertContents;
    TDEAction *m_actionInsertLink;
    TDEAction *m_actionInsertComment;
    TDEAction *m_actionEditComment;
    TDEAction *m_actionRemoveComment;
    TDEAction *m_actionCopyTextOfComment;
    //TDEAction *actionInsertPage;
    TDEAction *m_actionDeletePage;

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

    TDEActionMenu *m_actionInsertCustom;

    VariableDefMap m_variableDefMap;
    TDEAction *m_actionInsertFormula;
    TDEAction *m_actionInsertTable;
    TDEAction *m_actionAutoFormat;

    TDEToggleAction *m_actionToolsCreateText;
    TDEToggleAction *m_actionToolsCreatePix;
    KoPartSelectAction *m_actionToolsCreatePart;

    TDEAction *m_actionFormatFont;
    TDEAction *m_actionFormatDefault;
    TDEAction *m_actionFormatFrameStylist;
    TDEAction *m_actionFormatStylist;
    TDEAction *m_actionFormatPage;

    TDEAction *m_actionFontSizeIncrease;
    TDEAction *m_actionFontSizeDecrease;

    TDEFontSizeAction *m_actionFormatFontSize;
    TDEFontAction *m_actionFormatFontFamily;
    TDESelectAction *m_actionFormatStyle;
    TDEActionMenu *m_actionFormatStyleMenu;
    TDEToggleAction *m_actionFormatBold;
    TDEToggleAction *m_actionFormatItalic;
    TDEToggleAction *m_actionFormatUnderline;
    TDEToggleAction *m_actionFormatStrikeOut;
    TTDESelectColorAction *m_actionFormatColor;
    TDEToggleAction *m_actionFormatAlignLeft;
    TDEToggleAction *m_actionFormatAlignCenter;
    TDEToggleAction *m_actionFormatAlignRight;
    TDEToggleAction *m_actionFormatAlignBlock;
    TDEToggleAction *m_actionFormatSpacingSingle;
    TDEToggleAction *m_actionFormatSpacingOneAndHalf;
    TDEToggleAction *m_actionFormatSpacingDouble;
    TDEAction *m_actionFormatParag;
    TDEAction *m_actionFormatFrameSet;
    TDEAction *m_actionFormatIncreaseIndent;
    TDEAction *m_actionFormatDecreaseIndent;
    TDEActionMenu *m_actionFormatBullet;
    TDEActionMenu *m_actionFormatNumber;
    TDEToggleAction *m_actionFormatSuper;
    TDEToggleAction *m_actionFormatSub;
    TDEAction* m_actionInsertSpecialChar;

    // Text and Frame borders.
    TDESelectAction *m_actionFrameStyle;
    TDEActionMenu *m_actionFrameStyleMenu;
    TDESelectAction *m_actionTableStyle;
    TDEActionMenu *m_actionTableStyleMenu;
    TDEToggleAction *m_actionBorderLeft;
    TDEToggleAction *m_actionBorderRight;
    TDEToggleAction *m_actionBorderTop;
    TDEToggleAction *m_actionBorderBottom;
    TDEToggleAction *m_actionBorderOutline;
    TTDESelectColorAction *m_actionBorderColor;
    TDESelectAction *m_actionBorderWidth;
    TDESelectAction *m_actionBorderStyle;
    TTDESelectColorAction *m_actionBackgroundColor;

    TDEAction *m_actionTableDelRow;
    TDEAction *m_actionTableDelCol;
    TDEAction *m_actionTableInsertRow;
    TDEAction *m_actionTableInsertCol;
    TDEAction *m_actionTableResizeCol;
    TDEAction *m_actionTableJoinCells;
    TDEAction *m_actionTableSplitCells;
    TDEAction *m_actionConvertTableToText;
    TDEAction *m_actionSortText;
    TDEAction *m_actionAddPersonalExpression;
    TDEToggleAction *m_actionTableProtectCells;

    TDEAction *m_actionTableUngroup;
    TDEAction *m_actionTableDelete;

    TDEAction *m_actionTableStylist;
    TDEAction *m_actionTablePropertiesMenu;
    TDEAction *m_actionTableProperties;

    TDEAction *m_actionExtraCreateTemplate;

    TDEAction *m_actionChangeCase;

    TDEAction *m_actionEditPersonnalExpr;

    TDEAction *m_actionConfigure;

    TDEAction *m_actionConfigureCompletion;

    TDEAction *m_actionSavePicture;

    TDEAction *m_actionConfigureHeaderFooter;
    TDEToggleAction *m_actionInlineFrame;

    TDEAction *m_actionOpenLink;
    TDEAction *m_actionChangeLink;
    TDEAction *m_actionCopyLink;
    TDEAction *m_actionAddLinkToBookmak;
    TDEAction *m_actionRemoveLink;

    TDEAction *m_actionRefreshAllVariable;
    TDEAction *m_actionCreateStyleFromSelection;

    TDEAction *m_actionConfigureFootEndNote;

    TDEAction *m_actionEditFootEndNote;

    TDEAction *m_actionChangeFootNoteType;

    TDEAction *m_actionGoToFootEndNote;

    // Document Structure Area popup menu.
    TDEAction *m_actionDocStructEdit;
    TDEAction *m_actionDocStructSpeak;
    TDEAction *m_actionDocStructSelect;
    TDEAction *m_actionDocStructDelete;
    TDEAction *m_actionDocStructProperties;

    TDEAction *m_actionInsertFile;

    TDEAction *m_actionAddBookmark;
    TDEAction *m_actionSelectBookmark;

    TDEAction *m_actionImportStyle;

    TDEAction *m_actionCreateFrameStyle;

    TDEAction *m_actionConvertToTextBox;

    TDEAction *m_actionSpellIgnoreAll;
    TDEAction *m_actionSpellCheck;

    TDEToggleAction *m_actionEmbeddedStoreInternal;

    TDEAction *m_actionAddWordToPersonalDictionary;

    TDEToggleAction *m_actionInsertDirectCursor;

    TDEAction *m_actionGoToDocumentStructure;
    TDEAction *m_actionGoToDocument;


    KoCharSelectDia *m_specialCharDlg;
    KoFontDia *m_fontDlg;
    KoParagDia *m_paragDlg;

    KWGUI *m_gui;

    DCOPObject *m_dcop;

    KoSearchContext *m_searchEntry, *m_replaceEntry;
    KWFindReplace *m_findReplace;

    TQPtrList<TDEAction> m_actionList; // for the kodatatools
    TQPtrList<TDEAction> m_variableActionList;
    TQPtrList<TDEAction> m_tableActionList;

    KWPage *m_currentPage; ///< current page number

    // Statusbar items
    KStatusBarLabel* m_sbPageLabel; ///< 'Current page number and page count' label
    KStatusBarLabel* m_sbModifiedLabel;
    KStatusBarLabel* m_sbFramesLabel; ///< Info about selected frames
    KStatusBarLabel* m_sbOverwriteLabel;
    KStatusBarLabel* m_sbUnitLabel;
    KStatusBarLabel* m_sbZoomLabel;

    // Zoom values for each viewmode ( todo a viewmode enum and a qmap or so )
    struct KWZoomValueStore {
        int m_zoom;
        KoZoomMode::Mode m_zoomMode;
    };
    KWZoomValueStore m_zoomViewModeNormal;
    KWZoomValueStore m_zoomViewModePreview;

    bool m_viewFrameBorders /*, m_viewTableGrid*/;

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


    KWFrameSet *m_fsInline;

    // Split cell in table
    struct {
        unsigned int columns, rows;
    } m_tableSplit;
};

/******************************************************************/
/* Class: KWViewWidget                                            */
/******************************************************************/
class KWViewWidget : public TQWidget
{
    TQ_OBJECT
  

public:
    KWViewWidget( TQWidget *parent, KWView *view );

protected:
    void resizeEvent( TQResizeEvent *e );

    // A pointer to the view.
    KWView          *m_view;
};

/******************************************************************/
/* Class: KWGUI                                                   */
/******************************************************************/

class KWGUI : public TQHBox
{
    TQ_OBJECT
  

public:
    KWGUI( const TQString& viewMode, TQWidget *parent, KWView *view );

    void showGUI();

    KWView *getView()const { return m_view; }
    KWCanvas *canvasWidget()const { return m_canvas; }
    KoRuler *getVertRuler()const { return m_vertRuler; }
    KoRuler *getHorzRuler()const { return m_horRuler; }
    KoTabChooser *getTabChooser()const { return m_tabChooser; }
    KWDocStruct *getDocStruct()const { return m_docStruct; }

public slots:
    void reorganize();

protected slots:
    void unitChanged( KoUnit::Unit );

protected:
    void resizeEvent( TQResizeEvent *e );

    // A pointer to the view.
    KWView          *m_view;

    // The left side
    KWDocStruct     *m_docStruct;

    // The right side
    TQWidget         *m_right;	// The layout widget.

    KoTabChooser    *m_tabChooser;
    KoRuler         *m_vertRuler;
    KoRuler         *m_horRuler;
    KWCanvas        *m_canvas;

    TQSplitter       *m_panner;

};

#endif