kword

KWDocument.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2002-2006 David Faure <faure@kde.org>
4 Copyright (C) 2005 Thomas Zander <zander@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef kwdoc_h
23#define kwdoc_h
24
25#ifdef HAVE_CONFIG_H
26#include <config.h>
27#endif
28
29class TQDragObject;
30class KoSavingContext;
31class KoGenStyles;
32class KWDocument;
33class KPrinter;
34class KWTextImage;
35class KWTextFrameSet;
36class KWPictureFrameSet;
37class KWMailMergeDataBase;
38class KWFrameSet;
39class KWTableFrameSet;
40class KWPartFrameSet;
41class KoStyleCollection;
42class KoParagStyle;
43class KWFrameStyle;
44class KWTableStyle;
45class KWTableTemplate;
46#define KoParagStyle KoParagStyle
47class KWFrame;
48class KWViewMode;
49class KMacroCommand;
50class KoDocumentEntry;
51class TQPainter;
52class KoAutoFormat;
53class KCommand;
54class KoCommandHistory;
55class KoVariable;
56class KoVariableFormatCollection;
57class KWVariableCollection;
58class KoTextObject;
59class KWBgSpellCheck;
60class KoStyleCollection;
63class KWTableTemplateCollection;
65class DCOPObject;
66class KWLoadingInfo;
67class KoPicture;
68class KoTextBookmark;
69class KoTextBookmarkList;
70class KoPictureCollection;
71class KWDocumentChild;
72class KWPageManager;
73class KWPage;
74
75class TQFont;
76class TQStringList;
77class TQRect;
78
79namespace KFormula {
80 class Document;
81 class DocumentWrapper;
82}
83
84class KoTextParag;
85class KoOasisSettings;
86
87#include "KWAnchorPos.h" // legacy loading stuff
88#include "KWView.h"
89
90#include <KoDocument.h>
91#include <KoTextZoomHandler.h>
92#include <KoPictureKey.h>
93#include <KoStyleCollection.h> // for KoStyleChangeDefMap
94
95#include <tqmap.h>
96#include <tqptrlist.h>
97#include <tqfont.h>
98#include <tqvaluevector.h>
99
100/******************************************************************/
101/* Class: KWDocument */
102/******************************************************************/
103
104class KWDocument : public KoDocument, public KoTextZoomHandler
105{
106 TQ_OBJECT
107
108 TQ_PROPERTY( double ptColumnWidth READ ptColumnWidth )
109 TQ_PROPERTY( double ptColumnSpacing READ ptColumnSpacing )
110 TQ_PROPERTY( double gridX READ gridX WRITE setGridX )
111 TQ_PROPERTY( double gridY READ gridY WRITE setGridY )
112 TQ_PROPERTY( bool snapToGrid READ snapToGrid WRITE setSnapToGrid )
113 TQ_PROPERTY( double indentValue READ indentValue WRITE setIndentValue )
114 TQ_PROPERTY( int nbPagePerRow READ nbPagePerRow WRITE setNbPagePerRow )
115 TQ_PROPERTY( double defaultColumnSpacing READ defaultColumnSpacing WRITE setDefaultColumnSpacing )
116 TQ_PROPERTY( int maxRecentFiles READ maxRecentFiles )
117 TQ_PROPERTY( TQString globalLanguage READ globalLanguage WRITE setGlobalLanguage )
118 TQ_PROPERTY( bool globalHyphenation READ globalHyphenation WRITE setGlobalHyphenation )
119 TQ_PROPERTY( bool insertDirectCursor READ insertDirectCursor WRITE setInsertDirectCursor )
120 TQ_PROPERTY( TQStringList personalExpressionPath READ personalExpressionPath WRITE setPersonalExpressionPath )
121 TQ_PROPERTY( bool viewFormattingBreak READ viewFormattingBreak WRITE setViewFormattingBreak )
122 TQ_PROPERTY( bool viewFormattingTabs READ viewFormattingTabs WRITE setViewFormattingTabs )
123 TQ_PROPERTY( bool viewFormattingSpace READ viewFormattingSpace WRITE setViewFormattingSpace )
124 TQ_PROPERTY( bool viewFormattingEndParag READ viewFormattingEndParag WRITE setViewFormattingEndParag )
125 TQ_PROPERTY( bool cursorInProtectedArea READ cursorInProtectedArea WRITE setCursorInProtectedArea )
126 TQ_PROPERTY( bool pgUpDownMovesCaret READ pgUpDownMovesCaret WRITE setPgUpDownMovesCaret )
127 TQ_PROPERTY( bool allowAutoFormat READ allowAutoFormat WRITE setAllowAutoFormat )
128 TQ_PROPERTY( int undoRedoLimit READ undoRedoLimit WRITE setUndoRedoLimit )
129
130public:
131 friend class KWOasisLoader;
132 friend class KWStartupWidget;
133
134 KWDocument( TQWidget *parentWidget = 0, const char *widname = 0, TQObject* parent = 0, const char* name = 0, bool singleViewMode = false );
135 ~KWDocument();
136
137 enum ProcessingType {WP = 0, DTP = 1};
138
139 static const int CURRENT_SYNTAX_VERSION;
140
141public:
142 virtual bool initDoc(InitDocFlags flags, TQWidget* parentWidget=0);
143
144 virtual bool loadOasis( const TQDomDocument& doc, KoOasisStyles& oasisStyles, const TQDomDocument& settings, KoStore* store );
145
155 enum { STYLE_FRAME_AUTO = 20, STYLE_FRAME_USER,
156 STYLE_TABLE_CELL_AUTO, STYLE_TABLE_CELL_USER,
157 STYLE_TABLE, STYLE_TABLE_COLUMN, STYLE_TABLE_ROW };
158
159 virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter );
160
161 virtual int supportedSpecialFormats() const;
162
163 enum SaveFlag { SaveAll, SaveSelected }; // kpresenter will also have SavePage
164
168 TQDragObject* dragSelected( const TQValueList<KWFrameView*> &selectedFrames);
172 TQDragObject* dragSelected( TQWidget *parent, KWTextFrameSet* fs );
173
174 virtual bool loadXML( TQIODevice *, const TQDomDocument & dom );
175 virtual bool loadChildren( KoStore *store );
176 virtual TQDomDocument saveXML();
177 void processPictureRequests();
178 void processAnchorRequests();
179 bool processFootNoteRequests();
180
181 int syntaxVersion( ) const { return m_syntaxVersion; }
182
184 void progressItemLoaded();
185
189 virtual void paintContent( TQPainter& painter, const TQRect& rect, bool transparent = false, double zoomX = 1.0, double zoomY = 1.0 );
190
191 virtual TQPixmap generatePreview( const TQSize &size );
192
197 void createEmptyRegion( const TQRect & crect, TQRegion & emptyRegion, KWViewMode * viewMode );
202 void eraseEmptySpace( TQPainter * painter, const TQRegion & emptySpaceRegion, const TQBrush & brush );
203
204 virtual void setEmpty();
205
206 virtual void addView( KoView *view );
207 virtual void removeView( KoView *view );
208
209 virtual void addShell( KoMainWindow *shell );
210
211 KWPartFrameSet* insertObject( const KoRect& rect, KoDocumentEntry& e, TQWidget* parentWidget );
212
215 KWDocumentChild* createChildDoc( const KoRect& rect, KoDocument* childDoc );
216
217 void setPageLayout( const KoPageLayout& layout, const KoColumns& cl, const KoKWHeaderFooter& hf, bool updateViews = true );
218
219 void getPageLayout( KoPageLayout& layout, KoColumns& cl, KoKWHeaderFooter& hf );
220
221 KWTextFrameSet * textFrameSet ( unsigned int num ) const;
223 KWFrameSet *frameSet( unsigned int num )
224 { return m_lstFrameSet.at( num ); }
225
227 KWFrameSet * frameSetByName( const TQString & name );
228
230 unsigned int frameSetCount() const
231 { return m_lstFrameSet.count(); }
232
234 TQString generateFramesetName( const TQString & templateName );
235
237 TQPtrListIterator<KWFrameSet> framesetsIterator() const { return TQPtrListIterator<KWFrameSet>(m_lstFrameSet); }
238
239 TQValueList<KoTextObject *> visibleTextObjects(KWViewMode *viewmode) const;
240
242 void addFrameSet( KWFrameSet *f, bool finalize = true );
244 void removeFrameSet( KWFrameSet *f );
245
248 void deleteTable( KWTableFrameSet *groupManager );
249 void deleteFrame( KWFrame * frame );
250
252 unsigned int paperHeight(int pageNum) const;
254 unsigned int paperWidth(int pageNum) const;
256 unsigned int pageTop( int pgNum ) const;
257 double ptColumnWidth() const;
258 double ptColumnSpacing() const { return m_pageColumns.ptColumnSpacing; }
259 double ptFootnoteBodySpacing() const { return m_pageHeaderFooter.ptFootNoteBodySpacing; }
260
261 unsigned int numColumns() const { return m_pageColumns.columns; }
262
263 void repaintAllViews( bool erase = false );
267 void repaintAllViewsExcept( KWView *view, bool erase = false );
268
269
273 void delayedRepaintAllViews();
274
278 void delayedRecalcFrames( int fromPage );
279
283 TQPixmap* doubleBufferPixmap( const TQSize& );
289 void maybeDeleteDoubleBufferPixmap();
290
295 void frameChanged( KWFrame * frame );
296 void framesChanged( const TQPtrList<KWFrame> & frames, KWView * view = 0L );
297
298 TQString uniqueFramesetName( const TQString& oldName );
304 void pasteFrames( TQDomElement topElem, KMacroCommand * macroCmd, bool copyFootNote = false, bool dontCreateFootNote = false, bool selectFrames = true );
305
306 void insertEmbedded( KoStore *store, TQDomElement topElem, KMacroCommand * macroCmd, double offset );
307 void completePasting();
308 void completeOasisPasting();
309 void saveOasisDocumentStyles( KoStore* store, KoGenStyles& mainStyles, KoSavingContext& savingContext, SaveFlag saveFlag, const TQByteArray& headerFooterContent ) const;
310
311 KoStyleCollection * styleCollection()const { return m_styleColl;}
312 KWFrameStyleCollection * frameStyleCollection()const { return m_frameStyleColl;}
313 KWTableStyleCollection * tableStyleCollection()const { return m_tableStyleColl;}
314 KWTableTemplateCollection * tableTemplateCollection()const { return m_tableTemplateColl;}
315
316 TQFont defaultFont() const { return m_defaultFont; }
317 void setDefaultFont( const TQFont & newFont ) {
318 m_defaultFont = newFont;
319 }
320
325 int pageCount() const;
331 int startPage() const;
336 int lastPage() const;
337
338 KoPictureCollection *pictureCollection() { return m_pictureCollection; }
339 KoVariableFormatCollection *variableFormatCollection()const { return m_varFormatCollection; }
340
341 TQValueList<KWView *> getAllViews() const { return m_lstViews; }
342
351 KWPage* insertPage( int afterPageNum );
356 KWPage* appendPage();
362 void afterInsertPage( int num );
368 TQPtrList<KWFrame> framesToCopyOnNewPage( int afterPageNum ) const;
369
373 void removePage( int num );
374
378 void afterRemovePages();
379
385 bool tryRemovingPages();
386
387 ProcessingType processingType()const { return m_processingType; }
388 int frameSetNum( KWFrameSet* fs ) { return m_lstFrameSet.findRef( fs ); }
389
390 void lowerMainFrames( int pageNum );
391 void lowerMainFrames( int pageNum, int lowestZOrder );
392
394 TQPtrList<KWTextFrameSet> allTextFramesets( bool onlyReadWrite ) const;
396 int numberOfTextFrameSet( KWFrameSet* fs, bool onlyReadWrite );
398 KWFrameSet * textFrameSetFromIndex( unsigned int num, bool onlyReadWrite );
399
402 virtual TQValueList<KoTextDocument *> allTextDocuments() const;
403
404
410 TQPtrList<KWFrame> framesInPage( int pageNum , bool sorted=true) const;
411
412
417 int maxZOrder( int pageNum ) const;
418
419 void updateAllFrames( int flags = 0xff /* see KWFrameSet::UpdateFramesFlags */ );
420
421 // The grid is in _pt_ now
422 double gridX()const { return m_gridX; }
423 double gridY()const { return m_gridY; }
424 void setGridX(double gridx);
425 void setGridY(double gridy) { m_gridY = gridy; }
426
427 void updateGridButton();
428
429 bool showGrid() const { return m_bShowGrid; }
430 void setShowGrid ( bool grid ) { m_bShowGrid = grid; }
431
432 bool snapToGrid() const { return m_bSnapToGrid; }
433 void setSnapToGrid( bool b ) { m_bSnapToGrid = b; }
434
435 // Currently unused. Not sure we want to go that way, now that we have
436 // paragLayoutChanged and formatChanged in applyStyleChange.
437 //int applyStyleChangeMask() { return styleMask; }
438 //void setApplyStyleChangeMask( int f ) { styleMask = f; }
439
440 // paragLayoutChanged is a set of flags for the parag layout - see the enum in KWParagLayout
441 // formatChanged is a set of flags from KoTextFormat
442 // If both are -1, it means the style has been deleted.
443 void applyStyleChange( KoStyleChangeDefMap changed );
444 void updateAllStyleLists();
445 void updateStyleListOrder( const TQStringList &list );
446
447 void updateAllFrameStyleLists();
448 void updateAllTableStyleLists();
449
450 bool isHeaderVisible() const { return m_headerVisible; }
451 bool isFooterVisible() const { return m_footerVisible; }
452 void setHeaderVisible( bool h );
453 void setFooterVisible( bool f );
454 bool hasEndNotes() const;
455
457 void recalcFrames( int fromPage = 0, int toPage = -1, uint flags = 0 );
458
459 KoHFType headerType() const { return m_pageHeaderFooter.header; }
460 KoHFType footerType() const { return m_pageHeaderFooter.footer; }
461 const KoKWHeaderFooter& headerFooterInfo() const { return m_pageHeaderFooter; }
462
463 void setFrameCoords( double x, double y, double w, double h );
464
465 void addCommand( KCommand * cmd );
466
467 KoCommandHistory * commandHistory() const { return m_commandHistory; }
468 KoAutoFormat * autoFormat() const { return m_autoFormat; }
469
474 void addTextImageRequest( KWTextImage *img );
479 void addPictureRequest( KWPictureFrameSet *fs );
484 void addAnchorRequest( const TQString &framesetName, const KWAnchorPosition &anchorPos );
489 void addFootNoteRequest( const TQString &framesetName, KWFootNoteVariable* var );
490
492 KWFrameSet *loadFrameSet( TQDomElement framesetElem, bool loadFrames = true , bool loadFootnote = true);
493 void loadEmbeddedObjects( TQDomElement& word );
494 void saveEmbeddedObjects( TQDomElement& parentElem, const TQPtrList<KoDocumentChild>& childList );
495 void loadEmbedded( const TQDomElement &embedded );
496
497 void recalcVariables( int type );
498
499 KWVariableCollection *variableCollection() const { return m_varColl; }
500
501 KWMailMergeDataBase *mailMergeDataBase() const { return m_slDataBase; }
502 int mailMergeRecord() const;
503 void setMailMergeRecord( int r );
504
505 bool backgroundSpellCheckEnabled() const;
506 void enableBackgroundSpellCheck( bool b );
507
508 bool canRemovePage( int num );
509
517 virtual void setZoomAndResolution( int zoom, int dpiX, int dpiY );
518
519 void newZoomAndResolution( bool updateViews, bool forPrint );
520
526 TQString viewModeType() const { return m_viewModeType; }
527
531 KWViewMode* layoutViewMode() const { return m_layoutViewMode; }
532
536 void switchViewMode( const TQString& newViewMode );
537
538
540 static TQString getAttribute(TQDomElement &element, const char *attributeName, const TQString &defaultValue)
541 {
542 return element.attribute( attributeName, defaultValue );
543 }
544
545 static int getAttribute(TQDomElement &element, const char *attributeName, int defaultValue)
546 {
547 TQString value;
548 if ( ( value = element.attribute( attributeName ) ) != TQString() )
549 return value.toInt();
550 else
551 return defaultValue;
552 }
553
554 static double getAttribute(TQDomElement &element, const char *attributeName, double defaultValue)
555 {
556 TQString value;
557 if ( ( value = element.attribute( attributeName ) ) != TQString() )
558 return value.toDouble();
559 else
560 return defaultValue;
561 }
562
563#ifndef NDEBUG
564 void printStyleDebug();
565 void printDebug();
566#endif
567
569 void layout();
570
571 // This settings has to be here [instead of KWView] because we need to
572 // format paragraphs slightly differently (to add room for the CR char)
573 bool viewFormattingChars() const { return m_viewFormattingChars; }
574 void setViewFormattingChars(bool b) { m_viewFormattingChars=b; }
575
576 bool viewFormattingEndParag() const { return m_viewFormattingEndParag; }
577 void setViewFormattingEndParag(bool b) { m_viewFormattingEndParag=b; }
578
579 bool viewFormattingSpace() const { return m_viewFormattingSpace; }
580 void setViewFormattingSpace(bool b) { m_viewFormattingSpace=b; }
581
582 bool viewFormattingTabs() const { return m_viewFormattingTabs; }
583 void setViewFormattingTabs(bool b) { m_viewFormattingTabs=b; }
584
585 bool viewFormattingBreak() const { return m_viewFormattingBreak; }
586 void setViewFormattingBreak(bool b) { m_viewFormattingBreak=b; }
587
588 // Also view properties, but stored, loaded and saved here (lacking a more global object).
589 bool viewFrameBorders() const { return m_viewFrameBorders; }
590 void setViewFrameBorders( bool b );
591 void setShowRuler(bool ruler){ m_bShowRuler=ruler; }
592 bool showRuler() const { return m_bShowRuler; }
593
594 bool showStatusBar() const { return m_bShowStatusBar;}
595 void setShowStatusBar( bool status ) { m_bShowStatusBar = status;}
596
597 bool showScrollBar() const { return m_bShowScrollBar; }
598 void setShowScrollBar( bool status ) { m_bShowScrollBar = status;}
599
600 bool pgUpDownMovesCaret() const { return m_pgUpDownMovesCaret; }
601 void setPgUpDownMovesCaret( bool b ) { m_pgUpDownMovesCaret = b; }
602
603 bool showdocStruct() const {return m_bShowDocStruct;}
604 void setShowDocStruct(bool b){m_bShowDocStruct=b;}
605
606 bool allowAutoFormat() const { return m_bAllowAutoFormat; }
607 void setAllowAutoFormat(bool b){ m_bAllowAutoFormat=b; }
608
609 bool insertDirectCursor() const { return m_bInsertDirectCursor; }
610 void setInsertDirectCursor(bool b);
611
612
613 // in pt
614 double indentValue()const { return m_indent; }
615 void setIndentValue(double ind) { m_indent=ind; }
616
617 int nbPagePerRow() const{ return m_iNbPagePerRow; }
618 void setNbPagePerRow(int nb) { m_iNbPagePerRow=nb; }
619
620 int maxRecentFiles() const { return m_maxRecentFiles; }
621
622
623 // in pt
624 double defaultColumnSpacing()const{ return m_defaultColumnSpacing ;}
625 void setDefaultColumnSpacing(double val){ m_defaultColumnSpacing=val; }
632 KFormula::Document* formulaDocument( bool init = true );
633
634 void reorganizeGUI();
636 void terminateEditing( KWFrameSet * frameSet )
637 { emit sig_terminateEditing( frameSet ); }
638
639 void clearUndoRedoInfos();
640
641 void refreshDocStructure(FrameSetType);
642 void refreshDocStructure(int);
643
644 int typeItemDocStructure(FrameSetType type);
645
646 void refreshMenuExpression();
647
648 void refreshMenuCustomVariable();
649
650 void updateZoomRuler();
651
653 void setTocPresent(bool hasToc);
655 bool tocPresent(){return m_hasTOC;}
656
657 TQString sectionTitle( int pageNum ) const;
658
659 void updateRulerFrameStartEnd();
660
664 static TQColor resolveTextColor( const TQColor & col, TQPainter * painter );
665 static TQColor defaultTextColor( TQPainter * painter );
666 static TQColor resolveBgColor( const TQColor & col, TQPainter * painter = 0 );
667 static TQBrush resolveBgBrush( const TQBrush & brush, TQPainter * painter = 0 );
668 static TQColor defaultBgColor( TQPainter * painter );
669
670
671 virtual DCOPObject* dcopObject();
672
673 int undoRedoLimit() const;
674 void setUndoRedoLimit(int val);
675
676 void updateContentsSize(){emit newContentsSize();}
677
678 void refreshGUIButton();
679
680 void initConfig();
681 void saveConfig();
682 void startBackgroundSpellCheck();
683 void reactivateBgSpellChecking();
684
685 void updateHeaderButton();
686 void updateFooterButton();
687
688 TQStringList spellCheckIgnoreList() const { return m_spellCheckIgnoreList; }
689 void setSpellCheckIgnoreList( const TQStringList& lst );
690 void addSpellCheckIgnoreWord( const TQString & );
691
692 void updateTextFrameSetEdit();
693 void changeFootNoteConfig();
694 void displayFootNoteFieldCode();
695
696
697 double tabStopValue() const { return m_tabStop; }
698 void setTabStopValue ( double tabStop );
699
700 void changeBgSpellCheckingState( bool b );
701
702 // To position the cursor when opening a document
703 TQString initialFrameSet() const;
704 int initialCursorParag() const;
705 int initialCursorIndex() const;
707 void deleteInitialEditingInfo();
708
709 bool cursorInProtectedArea()const;
710 void setCursorInProtectedArea( bool b );
711
712 SeparatorLinePos footNoteSeparatorLinePosition()const { return m_footNoteSeparatorLinePos;}
713 void setFootNoteSeparatorLinePosition(SeparatorLinePos pos) {m_footNoteSeparatorLinePos = pos;}
714
715 int footNoteSeparatorLineLength() const { return m_iFootNoteSeparatorLineLength;}
716 void setFootNoteSeparatorLineLength( int length){ m_iFootNoteSeparatorLineLength = length;}
717
718 double footNoteSeparatorLineWidth() const { return m_footNoteSeparatorLineWidth;}
719 void setFootNoteSeparatorLineWidth( double width){ m_footNoteSeparatorLineWidth=width;}
720
721 SeparatorLineLineType footNoteSeparatorLineType()const { return m_footNoteSeparatorLineType;}
722 void setFootNoteSeparatorLineType( SeparatorLineLineType type) {m_footNoteSeparatorLineType = type;}
723
724 const KoTextBookmarkList* bookmarkList() const { return m_bookmarkList; }
725 void insertBookmark( const TQString &name, KoTextParag *startparag, KoTextParag *endparag, int start, int end );
726 void deleteBookmark( const TQString &name );
727 void renameBookmark( const TQString &oldname, const TQString &newName );
728
729 const KoTextBookmark * bookmarkByName( const TQString & name ) const;
730 TQStringList listOfBookmarkName(KWViewMode * viewMode) const;
731
732 void paragraphDeleted( KoTextParag *parag, KWFrameSet *frm);
733 void paragraphModified(KoTextParag* parag, int /*KoTextParag::ParagModifyType*/ type, int start, int length);
734
735 void initBookmarkList();
736 void loadImagesFromStore( KoStore *store );
737 void loadPictureMap ( TQDomElement& domElement );
738
739 void testAndCloseAllFrameSetProtectedContent();
740 void updateRulerInProtectContentMode();
741
742 KoPageLayout pageLayout(int pageNumber = 0) const;
743
744 TQStringList personalExpressionPath() const { return m_personalExpressionPath;}
745 void setPersonalExpressionPath( const TQStringList & );
746
747
748 void updateDirectCursorButton();
749
750 TQString globalLanguage()const { return m_globalLanguage; }
751 void setGlobalLanguage( const TQString & lang ){m_globalLanguage = lang;}
752 void addWordToDictionary( const TQString & );
753
754 bool globalHyphenation() const { return m_bGlobalHyphenation; }
755 void setGlobalHyphenation ( bool hyphen );
756
757 KWLoadingInfo* createLoadingInfo();
758 KWLoadingInfo* loadingInfo() const { return m_loadingInfo; }
759 void deleteLoadingInfo();
760
761 KFormula::DocumentWrapper* formulaDocumentWrapper() { return m_formulaDocumentWrapper; }
762
763 KWPageManager *pageManager() const { return m_pageManager; }
764
765 KWBgSpellCheck* backSpeller() const { return m_bgSpellCheck; }
766
768 bool loadOasisPageLayout( const TQString& masterPageName, KoOasisContext& context );
769
770 // end of public methods
771signals:
772
774 void pageLayoutChanged( const KoPageLayout& );
775
777 void newContentsSize();
778
782 void mainTextHeightChanged();
783
785 void numPagesChanged();
786
787 void docStructureChanged(int);
788 void sig_terminateEditing( KWFrameSet * fs );
789
790 void sig_refreshMenuCustomVariable();
791
792 void sigFrameSetAdded(KWFrameSet*);
793 void sigFrameSetRemoved(KWFrameSet*);
794
795public slots:
796 void slotRepaintChanged( KWFrameSet * frameset );
797 void framesChanged( const TQValueList<KWFrame*> &frames);
798
800 void invalidate(const KWFrameSet *skipThisFrameSet=0);
801
802 virtual void initEmpty();
803
804protected slots:
805 void slotRecalcFrames();
806 void slotRepaintAllViews();
807 void slotDocumentRestored();
808 void slotCommandExecuted();
809 void slotDocumentInfoModifed();
810 void slotChapterParagraphFormatted( KoTextParag* parag );
811 void saveDialogShown();
812
813 virtual void openExistingFile( const TQString& file );
814 virtual void openTemplate( const TQString& file );
815
816private slots:
818 void updateFramesChanged();
819
820protected:
821 void nextParagraphNeedingCheck();
823 void fixZOrders();
824 TQString checkSectionTitleInParag( KoTextParag* parag, KWTextFrameSet*, int pageNum ) const;
825 KoView* createViewInstance( TQWidget* parent, const char* name );
826
827 virtual bool completeLoading( KoStore* store );
828 virtual bool completeSaving( KoStore *store );
829
830 void loadFrameSets( const TQDomElement &framesets );
831 void loadStyleTemplates( const TQDomElement &styles );
832 void saveStyle( KoParagStyle *sty, TQDomElement parentElem );
833 void saveFrameStyle( KWFrameStyle *sty, TQDomElement parentElem );
834 void saveTableStyle( KWTableStyle *sty, TQDomElement parentElem );
835
836 void loadFrameStyleTemplates( const TQDomElement &styles );
837 void loadDefaultFrameStyleTemplates();
838 void loadTableStyleTemplates( const TQDomElement &styles );
839 void loadDefaultTableStyleTemplates();
840 void loadDefaultTableTemplates();
841 bool loadMasterPageStyle( const TQString& masterPageName, KoOasisContext& context );
842
843 void saveOasisBody( KoXmlWriter& writer, KoSavingContext& context ) const;
844 void saveOasisCustomFied( KoXmlWriter &writer )const;
845
846 TQValueList<KoPictureKey> savePictureList();
847
849 TQDragObject* dragSelectedPrivate( TQWidget *parent, const TQValueList<KWFrameView*> &selectedFrames, KWTextFrameSet* fs);
864 bool saveOasisHelper( KoStore* store, KoXmlWriter* manifestWriter, SaveFlag saveFlag,
865 const TQValueList<KWFrameView*> &selectedFrames,
866 TQString* plainText = 0, KoPicture* picture = 0, KWTextFrameSet* fs = 0 );
867
868 void saveOasisSettings( KoXmlWriter &settingsWriter ) const;
869 void saveSelectedFrames( KoXmlWriter& bodyWriter,
870 KoSavingContext& savingContext, TQValueList<KoPictureKey>& pictureList,
871 const TQValueList<KWFrameView*> &selectedFrames, TQString* plainText ) const;
872
873 // inherited from KoDocument
874 TQWidget* createCustomDocumentWidget(TQWidget *parent);
875
876private:
877 void clear();
878 void endOfLoading();
879
880 class FramesChangedHandler {
881 public:
882 FramesChangedHandler(KWDocument *parent);
883 void addFrame(KWFrame*);
884 void addFrameSet(KWFrameSet*);
885 void execute();
886 private:
887 KWDocument *m_parent;
888 TQValueList<KWFrameSet*> m_frameSets;
889 bool m_needLayout;
890 };
891
892 // Variables:
893 TQValueList<KWView *> m_lstViews;
894
895 KoColumns m_pageColumns;
896 KoKWHeaderFooter m_pageHeaderFooter;
897
898 KoPictureCollection* m_pictureCollection;
899
900 TQPtrList<KWFrameSet> m_lstFrameSet;
901
902 unsigned int m_itemsLoaded;
903 unsigned int m_nrItemsToLoad;
904
905 ProcessingType m_processingType;
906 double m_gridX, m_gridY;
907
908 DCOPObject *dcop;
909
910 KoCommandHistory * m_commandHistory;
911 KoAutoFormat * m_autoFormat;
912
913 // ===== Legacy loading stuff, remove when switching to OASIS =====
915 TQString m_urlIntern;
916
917 TQMap<KoPictureKey, TQString> m_pictureMap;
918
920 TQPtrList<KWTextImage> m_textImageRequests;
921 TQPtrList<KWPictureFrameSet> m_pictureRequests;
922 TQMap<TQString, KWAnchorPosition> m_anchorRequests;
923 TQMap<TQString, KWFootNoteVariable *> m_footnoteVarRequests;
924 // ===== End of legacy loading stuff =====
925
926 TQMap<TQString,TQString> * m_pasteFramesetsMap;
927
928 KoVariableFormatCollection *m_varFormatCollection;
929 KWMailMergeDataBase *m_slDataBase;
930 int slRecordNum;
931
937 int m_syntaxVersion;
938
939 TQFont m_defaultFont;
940 bool m_headerVisible, m_footerVisible;
941 bool m_viewFrameBorders;
942 bool m_bShowRuler;
943 bool m_bShowDocStruct;
944 bool m_hasTOC;
945 bool m_bShowStatusBar;
946 bool m_pgUpDownMovesCaret;
947 bool m_repaintAllViewsPending;
948 bool m_bAllowAutoFormat;
949 bool m_bShowScrollBar;
950 bool m_cursorInProtectectedArea;
951 bool m_bInsertDirectCursor;
952 bool m_bHasEndNotes;
953
954 bool m_viewFormattingChars;
955 bool m_viewFormattingEndParag;
956 bool m_viewFormattingSpace;
957 bool m_viewFormattingTabs;
958 bool m_viewFormattingBreak;
959
963 KFormula::DocumentWrapper* m_formulaDocumentWrapper;
964
965 double m_indent;
966 double m_defaultColumnSpacing;
967
968 int m_iNbPagePerRow;
969 int m_maxRecentFiles;
970 int m_recalcFramesPending;
971
973 TQString m_viewModeType;
975 KWViewMode* m_layoutViewMode;
976 KWVariableCollection *m_varColl;
977 KWBgSpellCheck *m_bgSpellCheck;
978 KoStyleCollection *m_styleColl;
979 KWFrameStyleCollection *m_frameStyleColl;
980 KWTableStyleCollection *m_tableStyleColl;
981 KWTableTemplateCollection *m_tableTemplateColl;
982
983
984 SeparatorLinePos m_footNoteSeparatorLinePos;
986 int m_iFootNoteSeparatorLineLength;
987
988 double m_footNoteSeparatorLineWidth;
989
990 SeparatorLineLineType m_footNoteSeparatorLineType;
991
994 TQValueVector< TQString > m_sectionTitles;
995
996 double m_tabStop;
997 TQStringList m_spellCheckIgnoreList; // per-document
998 TQStringList m_spellCheckPersonalDict; // per-user
999 TQPixmap* m_bufPixmap;
1000
1001 KWLoadingInfo* m_loadingInfo;
1002
1003 class InitialEditing;
1005 InitialEditing *m_initialEditing;
1006
1007 KoTextBookmarkList* m_bookmarkList;
1008
1009 TQStringList m_personalExpressionPath;
1010 TQString m_globalLanguage;
1011 bool m_bGlobalHyphenation;
1012 bool m_bGeneratingPreview;
1013
1014 bool m_bShowGrid;
1015 bool m_bSnapToGrid;
1016
1017 KWPageManager *m_pageManager;
1018 FramesChangedHandler *m_framesChangedHandler;
1019};
1020
1021#endif
The variable showing the footnote number in superscript, in the text.
Definition KWVariable.h:106
Class: KWFrameSet Base type, a frameset holds content as well as frames to show that content.
Definition KWFrameSet.h:62
Collection of frame styles.
The user-visible style for frames (borders and background).
This class represents a single frame.
Definition KWFrame.h:68
Temporary information used only during loading.
The Page Manager manages all the pages a document contains and separates all the frames the document ...
This class represents a printed page of the document.
Definition KWPage.h:30
A frameset that contains an embedded object (a KWDocumentChild).
This class implements tables by acting as the manager for the frame(set)s which make up the table cel...
Collection of user-defined table styles.
Table style (can created/modified/deleted by the user) A table style is simply a paragraph style and ...
Class: KWTextFrameSet Contains text (KoTextObject) and frames to display that text.
This class is used by "Insert Picture", i.e.
Definition KWTextImage.h:34
Abstract base class for KWCanvas's view modes.
Definition KWViewMode.h:48