kword

KWDocument.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003    Copyright (C) 2002-2006 David Faure <faure@kde.org>
00004    Copyright (C) 2005 Thomas Zander <zander@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef kwdoc_h
00023 #define kwdoc_h
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028 
00029 class QDragObject;
00030 class KoSavingContext;
00031 class KoGenStyles;
00032 class KWDocument;
00033 class KPrinter;
00034 class KWTextImage;
00035 class KWTextFrameSet;
00036 class KWPictureFrameSet;
00037 class KWMailMergeDataBase;
00038 class KWFrameSet;
00039 class KWTableFrameSet;
00040 class KWPartFrameSet;
00041 class KoStyleCollection;
00042 class KoParagStyle;
00043 class KWFrameStyle;
00044 class KWTableStyle;
00045 class KWTableTemplate;
00046 #define KoParagStyle KoParagStyle
00047 class KWFrame;
00048 class KWViewMode;
00049 class KMacroCommand;
00050 class KoDocumentEntry;
00051 class QPainter;
00052 class KoAutoFormat;
00053 class KCommand;
00054 class KoCommandHistory;
00055 class KoVariable;
00056 class KoVariableFormatCollection;
00057 class KWVariableCollection;
00058 class KoTextObject;
00059 class KWBgSpellCheck;
00060 class KoStyleCollection;
00061 class KWFrameStyleCollection;
00062 class KWTableStyleCollection;
00063 class KWTableTemplateCollection;
00064 class KWFootNoteVariable;
00065 class DCOPObject;
00066 class KWLoadingInfo;
00067 class KoPicture;
00068 class KoTextBookmark;
00069 class KoTextBookmarkList;
00070 class KoPictureCollection;
00071 class KWDocumentChild;
00072 class KWPageManager;
00073 class KWPage;
00074 
00075 class QFont;
00076 class QStringList;
00077 class QRect;
00078 
00079 namespace KFormula {
00080     class Document;
00081     class DocumentWrapper;
00082 }
00083 
00084 class KoTextParag;
00085 class KoOasisSettings;
00086 
00087 #include "KWAnchorPos.h" // legacy loading stuff
00088 #include "KWView.h"
00089 
00090 #include <KoDocument.h>
00091 #include <KoTextZoomHandler.h>
00092 #include <KoPictureKey.h>
00093 #include <KoStyleCollection.h> // for KoStyleChangeDefMap
00094 
00095 #include <qmap.h>
00096 #include <qptrlist.h>
00097 #include <qfont.h>
00098 #include <qvaluevector.h>
00099 
00100 /******************************************************************/
00101 /* Class: KWDocument                                           */
00102 /******************************************************************/
00103 
00104 class KWDocument : public KoDocument, public KoTextZoomHandler
00105 {
00106     Q_OBJECT
00107     Q_PROPERTY( double ptColumnWidth READ ptColumnWidth )
00108     Q_PROPERTY( double ptColumnSpacing READ ptColumnSpacing )
00109     Q_PROPERTY( double gridX READ gridX WRITE setGridX )
00110     Q_PROPERTY( double gridY READ gridY WRITE setGridY )
00111     Q_PROPERTY( bool snapToGrid READ snapToGrid WRITE setSnapToGrid )
00112     Q_PROPERTY( double indentValue READ indentValue WRITE setIndentValue )
00113     Q_PROPERTY( int nbPagePerRow READ nbPagePerRow WRITE setNbPagePerRow )
00114     Q_PROPERTY( double defaultColumnSpacing READ defaultColumnSpacing WRITE setDefaultColumnSpacing )
00115     Q_PROPERTY( int maxRecentFiles READ maxRecentFiles )
00116     Q_PROPERTY( QString globalLanguage READ globalLanguage WRITE setGlobalLanguage )
00117     Q_PROPERTY( bool globalHyphenation READ globalHyphenation WRITE setGlobalHyphenation )
00118     Q_PROPERTY( bool insertDirectCursor READ insertDirectCursor WRITE setInsertDirectCursor )
00119     Q_PROPERTY( QStringList personalExpressionPath READ personalExpressionPath WRITE setPersonalExpressionPath )
00120     Q_PROPERTY( bool viewFormattingBreak READ viewFormattingBreak WRITE setViewFormattingBreak )
00121     Q_PROPERTY( bool viewFormattingTabs READ viewFormattingTabs WRITE setViewFormattingTabs )
00122     Q_PROPERTY( bool viewFormattingSpace READ viewFormattingSpace WRITE setViewFormattingSpace )
00123     Q_PROPERTY( bool viewFormattingEndParag READ viewFormattingEndParag WRITE setViewFormattingEndParag )
00124     Q_PROPERTY( bool cursorInProtectedArea READ cursorInProtectedArea WRITE setCursorInProtectedArea )
00125     Q_PROPERTY( bool pgUpDownMovesCaret READ pgUpDownMovesCaret WRITE setPgUpDownMovesCaret )
00126     Q_PROPERTY( bool allowAutoFormat READ allowAutoFormat WRITE setAllowAutoFormat )
00127     Q_PROPERTY( int undoRedoLimit READ undoRedoLimit WRITE setUndoRedoLimit )
00128 
00129 public:
00130     friend class KWOasisLoader;
00131     friend class KWStartupWidget;
00132 
00133     KWDocument( QWidget *parentWidget = 0, const char *widname = 0, QObject* parent = 0, const char* name = 0, bool singleViewMode = false );
00134     ~KWDocument();
00135 
00136     enum ProcessingType {WP = 0, DTP = 1};
00137 
00138     static const int CURRENT_SYNTAX_VERSION;
00139 
00140 public:
00141     virtual bool initDoc(InitDocFlags flags, QWidget* parentWidget=0);
00142 
00143     virtual bool loadOasis( const QDomDocument& doc, KoOasisStyles& oasisStyles, const QDomDocument& settings, KoStore* store );
00144 
00154     enum {  STYLE_FRAME_AUTO = 20, STYLE_FRAME_USER,
00155             STYLE_TABLE_CELL_AUTO, STYLE_TABLE_CELL_USER,
00156             STYLE_TABLE, STYLE_TABLE_COLUMN, STYLE_TABLE_ROW };
00157 
00158     virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter );
00159 
00160     virtual int supportedSpecialFormats() const;
00161 
00162     enum SaveFlag { SaveAll, SaveSelected }; // kpresenter will also have SavePage
00163 
00167     QDragObject* dragSelected( const QValueList<KWFrameView*> &selectedFrames);
00171     QDragObject* dragSelected( QWidget *parent, KWTextFrameSet* fs );
00172 
00173     virtual bool loadXML( QIODevice *, const QDomDocument & dom );
00174     virtual bool loadChildren( KoStore *store );
00175     virtual QDomDocument saveXML();
00176     void processPictureRequests();
00177     void processAnchorRequests();
00178     bool processFootNoteRequests();
00179 
00180     int syntaxVersion( ) const { return m_syntaxVersion; }
00181 
00183     void progressItemLoaded();
00184 
00188     virtual void paintContent( QPainter& painter, const QRect& rect, bool transparent = false, double zoomX = 1.0, double zoomY = 1.0 );
00189 
00190     virtual QPixmap generatePreview( const QSize &size );
00191 
00196     void createEmptyRegion( const QRect & crect, QRegion & emptyRegion, KWViewMode * viewMode );
00201     void eraseEmptySpace( QPainter * painter, const QRegion & emptySpaceRegion, const QBrush & brush );
00202 
00203     virtual void setEmpty();
00204 
00205     virtual void addView( KoView *view );
00206     virtual void removeView( KoView *view );
00207 
00208     virtual void addShell( KoMainWindow *shell );
00209 
00210     KWPartFrameSet* insertObject( const KoRect& rect, KoDocumentEntry& e, QWidget* parentWidget );
00211 
00214     KWDocumentChild* createChildDoc( const KoRect& rect, KoDocument* childDoc );
00215 
00216     void setPageLayout( const KoPageLayout& layout, const KoColumns& cl, const KoKWHeaderFooter& hf, bool updateViews = true );
00217 
00218     void getPageLayout( KoPageLayout& layout, KoColumns& cl, KoKWHeaderFooter& hf );
00219 
00220     KWTextFrameSet * textFrameSet ( unsigned int num ) const;
00222     KWFrameSet *frameSet( unsigned int num )
00223     { return m_lstFrameSet.at( num ); }
00224 
00226     KWFrameSet * frameSetByName( const QString & name );
00227 
00229     unsigned int frameSetCount() const
00230     { return m_lstFrameSet.count(); }
00231 
00233     QString generateFramesetName( const QString & templateName );
00234 
00236     QPtrListIterator<KWFrameSet> framesetsIterator() const { return QPtrListIterator<KWFrameSet>(m_lstFrameSet); }
00237 
00238     QValueList<KoTextObject *> visibleTextObjects(KWViewMode *viewmode) const;
00239 
00241     void addFrameSet( KWFrameSet *f, bool finalize = true );
00243     void removeFrameSet( KWFrameSet *f );
00244 
00247     void deleteTable( KWTableFrameSet *groupManager );
00248     void deleteFrame( KWFrame * frame );
00249 
00251     unsigned int paperHeight(int pageNum) const;
00253     unsigned int paperWidth(int pageNum) const;
00255     unsigned int pageTop( int pgNum ) const;
00256     double ptColumnWidth() const;
00257     double ptColumnSpacing() const { return m_pageColumns.ptColumnSpacing; }
00258     double ptFootnoteBodySpacing() const { return m_pageHeaderFooter.ptFootNoteBodySpacing; }
00259 
00260     unsigned int numColumns() const { return m_pageColumns.columns; }
00261 
00262     void repaintAllViews( bool erase = false );
00266     void repaintAllViewsExcept( KWView *view, bool erase = false );
00267 
00268 
00272     void delayedRepaintAllViews();
00273 
00277     void delayedRecalcFrames( int fromPage );
00278 
00282     QPixmap* doubleBufferPixmap( const QSize& );
00288     void maybeDeleteDoubleBufferPixmap();
00289 
00294     void frameChanged( KWFrame * frame );
00295     void framesChanged( const QPtrList<KWFrame> & frames, KWView * view = 0L );
00296 
00297     QString uniqueFramesetName( const QString& oldName );
00303     void pasteFrames( QDomElement topElem, KMacroCommand * macroCmd, bool copyFootNote = false, bool dontCreateFootNote = false, bool selectFrames = true );
00304 
00305     void insertEmbedded( KoStore *store, QDomElement topElem, KMacroCommand * macroCmd, double offset );
00306     void completePasting();
00307     void completeOasisPasting();
00308     void saveOasisDocumentStyles( KoStore* store, KoGenStyles& mainStyles, KoSavingContext& savingContext, SaveFlag saveFlag, const QByteArray& headerFooterContent ) const;
00309 
00310     KoStyleCollection * styleCollection()const  { return m_styleColl;}
00311     KWFrameStyleCollection * frameStyleCollection()const  { return m_frameStyleColl;}
00312     KWTableStyleCollection * tableStyleCollection()const  { return m_tableStyleColl;}
00313     KWTableTemplateCollection * tableTemplateCollection()const  { return m_tableTemplateColl;}
00314 
00315     QFont defaultFont() const { return m_defaultFont; }
00316     void setDefaultFont( const QFont & newFont ) {
00317         m_defaultFont = newFont;
00318     }
00319 
00324     int pageCount() const;
00330     int startPage() const;
00335     int lastPage() const;
00336 
00337     KoPictureCollection *pictureCollection() { return m_pictureCollection; }
00338     KoVariableFormatCollection *variableFormatCollection()const { return m_varFormatCollection; }
00339 
00340     QValueList<KWView *> getAllViews() const { return m_lstViews; }
00341 
00350     KWPage* insertPage( int afterPageNum );
00355     KWPage* appendPage();
00361     void afterInsertPage( int num );
00367     QPtrList<KWFrame> framesToCopyOnNewPage( int afterPageNum ) const;
00368 
00372     void removePage( int num );
00373 
00377     void afterRemovePages();
00378 
00384     bool tryRemovingPages();
00385 
00386     ProcessingType processingType()const { return m_processingType;  }
00387     int frameSetNum( KWFrameSet* fs ) { return m_lstFrameSet.findRef( fs ); }
00388 
00389     void lowerMainFrames( int pageNum );
00390     void lowerMainFrames( int pageNum, int lowestZOrder );
00391 
00393     QPtrList<KWTextFrameSet> allTextFramesets( bool onlyReadWrite ) const;
00395     int numberOfTextFrameSet( KWFrameSet* fs, bool onlyReadWrite );
00397     KWFrameSet * textFrameSetFromIndex( unsigned int num, bool onlyReadWrite );
00398 
00401     virtual QValueList<KoTextDocument *> allTextDocuments() const;
00402 
00403 
00409     QPtrList<KWFrame> framesInPage( int pageNum , bool sorted=true) const;
00410 
00411 
00416     int maxZOrder( int pageNum ) const;
00417 
00418     void updateAllFrames( int flags = 0xff /* see KWFrameSet::UpdateFramesFlags */ );
00419 
00420     // The grid is in _pt_ now
00421     double gridX()const { return m_gridX; }
00422     double gridY()const { return m_gridY; }
00423     void setGridX(double gridx);
00424     void setGridY(double gridy) { m_gridY = gridy; }
00425 
00426     void updateGridButton();
00427 
00428     bool showGrid() const { return m_bShowGrid; }
00429     void setShowGrid ( bool grid ) { m_bShowGrid = grid; }
00430 
00431     bool snapToGrid() const { return m_bSnapToGrid; }
00432     void setSnapToGrid( bool b ) { m_bSnapToGrid = b; }
00433 
00434     // Currently unused. Not sure we want to go that way, now that we have
00435     // paragLayoutChanged and formatChanged in applyStyleChange.
00436     //int applyStyleChangeMask() { return styleMask; }
00437     //void setApplyStyleChangeMask( int f ) { styleMask = f; }
00438 
00439     // paragLayoutChanged is a set of flags for the parag layout - see the enum in KWParagLayout
00440     // formatChanged is a set of flags from KoTextFormat
00441     // If both are -1, it means the style has been deleted.
00442     void applyStyleChange( KoStyleChangeDefMap changed );
00443     void updateAllStyleLists();
00444     void updateStyleListOrder( const QStringList &list );
00445 
00446     void updateAllFrameStyleLists();
00447     void updateAllTableStyleLists();
00448 
00449     bool isHeaderVisible() const { return m_headerVisible; }
00450     bool isFooterVisible() const { return m_footerVisible; }
00451     void setHeaderVisible( bool h );
00452     void setFooterVisible( bool f );
00453     bool hasEndNotes() const;
00454 
00456     void recalcFrames( int fromPage = 0, int toPage = -1, uint flags = 0 );
00457 
00458     KoHFType headerType() const { return m_pageHeaderFooter.header; }
00459     KoHFType footerType() const { return m_pageHeaderFooter.footer; }
00460     const KoKWHeaderFooter& headerFooterInfo() const { return m_pageHeaderFooter; }
00461 
00462     void setFrameCoords( double x, double y, double w, double h );
00463 
00464     void addCommand( KCommand * cmd );
00465 
00466     KoCommandHistory * commandHistory() const { return m_commandHistory; }
00467     KoAutoFormat * autoFormat() const { return m_autoFormat; }
00468 
00473     void addTextImageRequest( KWTextImage *img );
00478     void addPictureRequest( KWPictureFrameSet *fs );
00483     void addAnchorRequest( const QString &framesetName, const KWAnchorPosition &anchorPos );
00488     void addFootNoteRequest( const QString &framesetName, KWFootNoteVariable* var );
00489 
00491     KWFrameSet *loadFrameSet( QDomElement framesetElem, bool loadFrames = true , bool loadFootnote = true);
00492     void loadEmbeddedObjects( QDomElement& word );
00493     void saveEmbeddedObjects( QDomElement& parentElem, const QPtrList<KoDocumentChild>& childList );
00494     void loadEmbedded( const QDomElement &embedded );
00495 
00496     void recalcVariables( int type );
00497 
00498     KWVariableCollection *variableCollection() const { return m_varColl; }
00499 
00500     KWMailMergeDataBase *mailMergeDataBase() const { return m_slDataBase; }
00501     int mailMergeRecord() const;
00502     void setMailMergeRecord( int r );
00503 
00504     bool backgroundSpellCheckEnabled() const;
00505     void enableBackgroundSpellCheck( bool b );
00506 
00507     bool canRemovePage( int num );
00508 
00516     virtual void setZoomAndResolution( int zoom, int dpiX, int dpiY );
00517 
00518     void newZoomAndResolution( bool updateViews, bool forPrint );
00519 
00525     QString viewModeType() const { return m_viewModeType; }
00526 
00530     KWViewMode* layoutViewMode() const { return m_layoutViewMode; }
00531 
00535     void switchViewMode( const QString& newViewMode );
00536 
00537 
00539     static QString getAttribute(QDomElement &element, const char *attributeName, const QString &defaultValue)
00540       {
00541           return element.attribute( attributeName, defaultValue );
00542       }
00543 
00544     static int getAttribute(QDomElement &element, const char *attributeName, int defaultValue)
00545     {
00546         QString value;
00547         if ( ( value = element.attribute( attributeName ) ) != QString::null )
00548             return value.toInt();
00549         else
00550             return defaultValue;
00551     }
00552 
00553     static double getAttribute(QDomElement &element, const char *attributeName, double defaultValue)
00554     {
00555         QString value;
00556         if ( ( value = element.attribute( attributeName ) ) != QString::null )
00557             return value.toDouble();
00558         else
00559             return defaultValue;
00560     }
00561 
00562 #ifndef NDEBUG
00563     void printStyleDebug();
00564     void printDebug();
00565 #endif
00566 
00568     void layout();
00569 
00570     // This settings has to be here [instead of KWView] because we need to
00571     // format paragraphs slightly differently (to add room for the CR char)
00572     bool viewFormattingChars() const { return m_viewFormattingChars; }
00573     void setViewFormattingChars(bool b) { m_viewFormattingChars=b; }
00574 
00575     bool viewFormattingEndParag() const { return m_viewFormattingEndParag; }
00576     void setViewFormattingEndParag(bool b) { m_viewFormattingEndParag=b; }
00577 
00578     bool viewFormattingSpace() const { return m_viewFormattingSpace; }
00579     void setViewFormattingSpace(bool b) { m_viewFormattingSpace=b; }
00580 
00581     bool viewFormattingTabs() const { return m_viewFormattingTabs; }
00582     void setViewFormattingTabs(bool b) { m_viewFormattingTabs=b; }
00583 
00584     bool viewFormattingBreak() const { return m_viewFormattingBreak; }
00585     void setViewFormattingBreak(bool b) { m_viewFormattingBreak=b; }
00586 
00587     // Also view properties, but stored, loaded and saved here (lacking a more global object).
00588     bool viewFrameBorders() const { return m_viewFrameBorders; }
00589     void setViewFrameBorders( bool b );
00590     void setShowRuler(bool ruler){ m_bShowRuler=ruler; }
00591     bool showRuler() const { return m_bShowRuler; }
00592 
00593     bool showStatusBar() const { return m_bShowStatusBar;}
00594     void setShowStatusBar( bool status ) { m_bShowStatusBar = status;}
00595 
00596     bool showScrollBar() const { return m_bShowScrollBar; }
00597     void setShowScrollBar( bool status ) { m_bShowScrollBar = status;}
00598 
00599     bool pgUpDownMovesCaret() const { return m_pgUpDownMovesCaret; }
00600     void setPgUpDownMovesCaret( bool b ) { m_pgUpDownMovesCaret = b; }
00601 
00602     bool showdocStruct() const {return  m_bShowDocStruct;}
00603     void setShowDocStruct(bool b){m_bShowDocStruct=b;}
00604 
00605     bool allowAutoFormat() const { return m_bAllowAutoFormat; }
00606     void setAllowAutoFormat(bool b){ m_bAllowAutoFormat=b; }
00607 
00608     bool insertDirectCursor() const { return m_bInsertDirectCursor; }
00609     void setInsertDirectCursor(bool b);
00610 
00611 
00612     // in pt
00613     double indentValue()const { return m_indent; }
00614     void setIndentValue(double ind) { m_indent=ind; }
00615 
00616     int nbPagePerRow() const{ return m_iNbPagePerRow; }
00617     void setNbPagePerRow(int nb) { m_iNbPagePerRow=nb; }
00618 
00619     int maxRecentFiles() const { return m_maxRecentFiles; }
00620 
00621 
00622     // in pt
00623     double defaultColumnSpacing()const{ return m_defaultColumnSpacing ;}
00624     void setDefaultColumnSpacing(double val){ m_defaultColumnSpacing=val; }
00631     KFormula::Document* formulaDocument( bool init = true );
00632 
00633     void reorganizeGUI();
00635     void terminateEditing( KWFrameSet * frameSet )
00636         { emit sig_terminateEditing( frameSet ); }
00637 
00638     void clearUndoRedoInfos();
00639 
00640     void refreshDocStructure(FrameSetType);
00641     void refreshDocStructure(int);
00642 
00643     int typeItemDocStructure(FrameSetType type);
00644 
00645     void refreshMenuExpression();
00646 
00647     void refreshMenuCustomVariable();
00648 
00649     void updateZoomRuler();
00650 
00652     void setTocPresent(bool hasToc);
00654     bool tocPresent(){return m_hasTOC;}
00655 
00656     QString sectionTitle( int pageNum ) const;
00657 
00658     void updateRulerFrameStartEnd();
00659 
00663     static QColor resolveTextColor( const QColor & col, QPainter * painter );
00664     static QColor defaultTextColor( QPainter * painter );
00665     static QColor resolveBgColor( const QColor & col, QPainter * painter = 0 );
00666     static QBrush resolveBgBrush( const QBrush & brush, QPainter * painter = 0 );
00667     static QColor defaultBgColor( QPainter * painter );
00668 
00669 
00670     virtual DCOPObject* dcopObject();
00671 
00672     int undoRedoLimit() const;
00673     void setUndoRedoLimit(int val);
00674 
00675     void updateContentsSize(){emit newContentsSize();}
00676 
00677     void refreshGUIButton();
00678 
00679     void initConfig();
00680     void saveConfig();
00681     void startBackgroundSpellCheck();
00682     void reactivateBgSpellChecking();
00683 
00684     void updateHeaderButton();
00685     void updateFooterButton();
00686 
00687     QStringList spellCheckIgnoreList() const { return m_spellCheckIgnoreList; }
00688     void setSpellCheckIgnoreList( const QStringList& lst );
00689     void addSpellCheckIgnoreWord( const QString & );
00690 
00691     void updateTextFrameSetEdit();
00692     void changeFootNoteConfig();
00693     void displayFootNoteFieldCode();
00694 
00695 
00696     double tabStopValue() const { return m_tabStop; }
00697     void setTabStopValue ( double tabStop );
00698 
00699     void changeBgSpellCheckingState( bool b );
00700 
00701     // To position the cursor when opening a document
00702     QString initialFrameSet() const; 
00703     int initialCursorParag() const;
00704     int initialCursorIndex() const;
00706     void deleteInitialEditingInfo();
00707 
00708     bool cursorInProtectedArea()const;
00709     void setCursorInProtectedArea( bool b );
00710 
00711     SeparatorLinePos footNoteSeparatorLinePosition()const { return m_footNoteSeparatorLinePos;}
00712     void setFootNoteSeparatorLinePosition(SeparatorLinePos pos) {m_footNoteSeparatorLinePos = pos;}
00713 
00714     int footNoteSeparatorLineLength() const { return m_iFootNoteSeparatorLineLength;}
00715     void setFootNoteSeparatorLineLength( int length){  m_iFootNoteSeparatorLineLength = length;}
00716 
00717     double footNoteSeparatorLineWidth() const { return m_footNoteSeparatorLineWidth;}
00718     void setFootNoteSeparatorLineWidth( double width){  m_footNoteSeparatorLineWidth=width;}
00719 
00720     SeparatorLineLineType footNoteSeparatorLineType()const { return m_footNoteSeparatorLineType;}
00721     void setFootNoteSeparatorLineType( SeparatorLineLineType type) {m_footNoteSeparatorLineType = type;}
00722 
00723     const KoTextBookmarkList* bookmarkList() const { return m_bookmarkList; }
00724     void insertBookmark( const QString &name, KoTextParag *startparag, KoTextParag *endparag, int start, int end );
00725     void deleteBookmark( const QString &name );
00726     void renameBookmark( const QString &oldname, const QString &newName );
00727 
00728     const KoTextBookmark * bookmarkByName( const QString & name ) const;
00729     QStringList listOfBookmarkName(KWViewMode * viewMode) const;
00730 
00731     void paragraphDeleted( KoTextParag *parag, KWFrameSet *frm);
00732     void paragraphModified(KoTextParag* parag, int /*KoTextParag::ParagModifyType*/ type, int start, int lenght);
00733 
00734     void initBookmarkList();
00735     void loadImagesFromStore( KoStore *store );
00736     void loadPictureMap ( QDomElement& domElement );
00737 
00738     void testAndCloseAllFrameSetProtectedContent();
00739     void updateRulerInProtectContentMode();
00740 
00741     KoPageLayout pageLayout(int pageNumber = 0) const;
00742 
00743     QStringList personalExpressionPath() const { return m_personalExpressionPath;}
00744     void setPersonalExpressionPath( const QStringList & );
00745 
00746 
00747     void updateDirectCursorButton();
00748 
00749     QString globalLanguage()const { return m_globalLanguage; }
00750     void setGlobalLanguage( const QString & lang ){m_globalLanguage = lang;}
00751     void addWordToDictionary( const QString & );
00752 
00753     bool globalHyphenation() const { return m_bGlobalHyphenation; }
00754     void setGlobalHyphenation ( bool hyphen );
00755 
00756     KWLoadingInfo* createLoadingInfo();
00757     KWLoadingInfo* loadingInfo() const { return m_loadingInfo; }
00758     void deleteLoadingInfo();
00759 
00760     KFormula::DocumentWrapper* formulaDocumentWrapper() { return m_formulaDocumentWrapper; }
00761 
00762     KWPageManager *pageManager() const { return m_pageManager; }
00763 
00764     KWBgSpellCheck* backSpeller() const { return m_bgSpellCheck; }
00765 
00767     bool loadOasisPageLayout( const QString& masterPageName, KoOasisContext& context );
00768 
00769     // end of public methods
00770 signals:
00771 
00773     void pageLayoutChanged( const KoPageLayout& );
00774 
00776     void newContentsSize();
00777 
00781     void mainTextHeightChanged();
00782 
00784     void numPagesChanged();
00785 
00786     void docStructureChanged(int);
00787     void sig_terminateEditing( KWFrameSet * fs );
00788 
00789     void sig_refreshMenuCustomVariable();
00790 
00791     void sigFrameSetAdded(KWFrameSet*);
00792     void sigFrameSetRemoved(KWFrameSet*);
00793 
00794 public slots:
00795     void slotRepaintChanged( KWFrameSet * frameset );
00796     void framesChanged( const QValueList<KWFrame*> &frames);
00797 
00799     void invalidate(const KWFrameSet *skipThisFrameSet=0);
00800 
00801     virtual void initEmpty();
00802 
00803 protected slots:
00804     void slotRecalcFrames();
00805     void slotRepaintAllViews();
00806     void slotDocumentRestored();
00807     void slotCommandExecuted();
00808     void slotDocumentInfoModifed();
00809     void slotChapterParagraphFormatted( KoTextParag* parag );
00810     void saveDialogShown(); 
00811 
00812     virtual void openExistingFile( const QString& file );
00813     virtual void openTemplate( const QString& file );
00814 
00815 private slots:
00817     void updateFramesChanged();
00818 
00819 protected:
00820     void nextParagraphNeedingCheck();
00822     void fixZOrders();
00823     QString checkSectionTitleInParag( KoTextParag* parag, KWTextFrameSet*, int pageNum ) const;
00824     KoView* createViewInstance( QWidget* parent, const char* name );
00825 
00826     virtual bool completeLoading( KoStore* store );
00827     virtual bool completeSaving( KoStore *store );
00828 
00829     void loadFrameSets( const QDomElement &framesets );
00830     void loadStyleTemplates( const QDomElement &styles );
00831     void saveStyle( KoParagStyle *sty, QDomElement parentElem );
00832     void saveFrameStyle( KWFrameStyle *sty, QDomElement parentElem );
00833     void saveTableStyle( KWTableStyle *sty, QDomElement parentElem );
00834 
00835     void loadFrameStyleTemplates( const QDomElement &styles );
00836     void loadDefaultFrameStyleTemplates();
00837     void loadTableStyleTemplates( const QDomElement &styles );
00838     void loadDefaultTableStyleTemplates();
00839     void loadDefaultTableTemplates();
00840     bool loadMasterPageStyle( const QString& masterPageName, KoOasisContext& context );
00841 
00842     void saveOasisBody( KoXmlWriter& writer, KoSavingContext& context ) const;
00843     void saveOasisCustomFied( KoXmlWriter &writer )const;
00844 
00845     QValueList<KoPictureKey> savePictureList();
00846 
00848     QDragObject* dragSelectedPrivate( QWidget *parent, const QValueList<KWFrameView*> &selectedFrames, KWTextFrameSet* fs);
00863     bool saveOasisHelper( KoStore* store, KoXmlWriter* manifestWriter, SaveFlag saveFlag,
00864                     const QValueList<KWFrameView*> &selectedFrames,
00865                     QString* plainText = 0, KoPicture* picture = 0, KWTextFrameSet* fs = 0 );
00866 
00867     void saveOasisSettings( KoXmlWriter &settingsWriter ) const;
00868     void saveSelectedFrames( KoXmlWriter& bodyWriter,
00869                              KoSavingContext& savingContext, QValueList<KoPictureKey>& pictureList,
00870                              const QValueList<KWFrameView*> &selectedFrames, QString* plainText ) const;
00871 
00872     // inherited from KoDocument
00873     QWidget* createCustomDocumentWidget(QWidget *parent);
00874 
00875 private:
00876     void clear();
00877     void endOfLoading();
00878 
00879     class FramesChangedHandler {
00880         public:
00881             FramesChangedHandler(KWDocument *parent);
00882             void addFrame(KWFrame*);
00883             void addFrameSet(KWFrameSet*);
00884             void execute();
00885         private:
00886             KWDocument *m_parent;
00887             QValueList<KWFrameSet*> m_frameSets;
00888             bool m_needLayout;
00889     };
00890 
00891     // Variables:
00892     QValueList<KWView *> m_lstViews;
00893 
00894     KoColumns m_pageColumns;
00895     KoKWHeaderFooter m_pageHeaderFooter;
00896 
00897     KoPictureCollection* m_pictureCollection;
00898 
00899     QPtrList<KWFrameSet> m_lstFrameSet;
00900 
00901     unsigned int m_itemsLoaded;
00902     unsigned int m_nrItemsToLoad;
00903 
00904     ProcessingType m_processingType;
00905     double m_gridX, m_gridY;
00906 
00907     DCOPObject *dcop;
00908 
00909     KoCommandHistory * m_commandHistory;
00910     KoAutoFormat * m_autoFormat;
00911 
00912     // ===== Legacy loading stuff, remove when switching to OASIS =====
00914     QString m_urlIntern;
00915 
00916     QMap<KoPictureKey, QString> m_pictureMap;
00917 
00919     QPtrList<KWTextImage> m_textImageRequests;
00920     QPtrList<KWPictureFrameSet> m_pictureRequests;
00921     QMap<QString, KWAnchorPosition> m_anchorRequests;
00922     QMap<QString, KWFootNoteVariable *> m_footnoteVarRequests; 
00923     // ===== End of legacy loading stuff =====
00924 
00925     QMap<QString,QString> * m_pasteFramesetsMap;
00926 
00927     KoVariableFormatCollection *m_varFormatCollection;
00928     KWMailMergeDataBase *m_slDataBase;
00929     int slRecordNum;
00930 
00936     int m_syntaxVersion;
00937 
00938     QFont m_defaultFont;
00939     bool m_headerVisible, m_footerVisible;
00940     bool m_viewFrameBorders;
00941     bool m_bShowRuler;
00942     bool m_bShowDocStruct;
00943     bool m_hasTOC;
00944     bool m_bShowStatusBar;
00945     bool m_pgUpDownMovesCaret;
00946     bool m_repaintAllViewsPending;
00947     bool m_bAllowAutoFormat;
00948     bool m_bShowScrollBar;
00949     bool m_cursorInProtectectedArea;
00950     bool m_bInsertDirectCursor;
00951     bool m_bHasEndNotes;
00952 
00953     bool m_viewFormattingChars;
00954     bool m_viewFormattingEndParag;
00955     bool m_viewFormattingSpace;
00956     bool m_viewFormattingTabs;
00957     bool m_viewFormattingBreak;
00958 
00962     KFormula::DocumentWrapper* m_formulaDocumentWrapper;
00963 
00964     double m_indent; 
00965     double m_defaultColumnSpacing;
00966 
00967     int m_iNbPagePerRow;
00968     int m_maxRecentFiles;
00969     int m_recalcFramesPending;
00970 
00972     QString m_viewModeType;
00974     KWViewMode* m_layoutViewMode;
00975     KWVariableCollection *m_varColl;
00976     KWBgSpellCheck *m_bgSpellCheck;
00977     KoStyleCollection *m_styleColl;
00978     KWFrameStyleCollection *m_frameStyleColl;
00979     KWTableStyleCollection *m_tableStyleColl;
00980     KWTableTemplateCollection *m_tableTemplateColl;
00981 
00982 
00983     SeparatorLinePos m_footNoteSeparatorLinePos;
00985     int m_iFootNoteSeparatorLineLength;
00986 
00987     double m_footNoteSeparatorLineWidth;
00988 
00989     SeparatorLineLineType m_footNoteSeparatorLineType;
00990 
00993     QValueVector< QString > m_sectionTitles;
00994 
00995     double m_tabStop;
00996     QStringList m_spellCheckIgnoreList; // per-document
00997     QStringList m_spellCheckPersonalDict; // per-user
00998     QPixmap* m_bufPixmap;
00999 
01000     KWLoadingInfo* m_loadingInfo;
01001 
01002     class InitialEditing;
01004     InitialEditing *m_initialEditing;
01005 
01006     KoTextBookmarkList* m_bookmarkList;
01007 
01008     QStringList m_personalExpressionPath;
01009     QString m_globalLanguage;
01010     bool m_bGlobalHyphenation;
01011     bool m_bGeneratingPreview;
01012 
01013     bool m_bShowGrid;
01014     bool m_bSnapToGrid;
01015 
01016     KWPageManager *m_pageManager;
01017     FramesChangedHandler *m_framesChangedHandler;
01018 };
01019 
01020 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys