summaryrefslogtreecommitdiffstats
path: root/kpresenter/KPrDocument.h
blob: 58374c7f713f9b227d052ff760a2c601250c097a (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
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
   Copyright (C) 2005-2006 Thorsten Zachmann <zachmann@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 __kpresenter_doc_h__
#define __kpresenter_doc_h__


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

class KoGenStyles;
class KPrView;
class DCOPObject;
class KCommand;
class KMacroCommand;
class KoCommandHistory;
class KoTextZoomHandler;
class KoAutoFormat;
class KoVariable;
class KoVariableFormatCollection;
class KPrVariableCollection;
class KTempFile;
class KoParagStyle;
class KPrBgSpellCheck;
class KoTextParag;
class KoTextObject;
class KPrLoadingInfo;
class KPrGroupObject;

class KoOasisContext;
class KoOasisSettings;
class KoXmlWriter;
class TQFile;
class KoSavingContext;

#include <KoDocument.h>
#include <KoDocumentChild.h>

#include <tqptrlist.h>
#include <tqobject.h>
#include <tqstring.h>
#include <tqvaluelist.h>
#include <tqdatetime.h>
#include <tqdict.h>
#include <KoPageLayoutDia.h>

#include "global.h"
#include <KoStyleStack.h>
#include <KoPictureCollection.h>
#include "KPrGradientCollection.h"
#include <KoTextZoomHandler.h>
#include <KoStyleCollection.h> // for KoStyleChangeDefMap
#include <KoCommandHistory.h>

class KoDocumentEntry;
class KPrTextObject;
class KPrPartObject;
class KPrPage;
class KPrObject;
class KPrDocument;

class KoParagStyle;
class KoStyleCollection;

class KPrChild : public KoDocumentChild
{
public:

    // constructor - destructor
    KPrChild( KPrDocument *_kpr, KoDocument* _doc, const TQRect& _rect );
    KPrChild( KPrDocument *_kpr );
    ~KPrChild();

    // get parent
    KPrDocument* parent()const { return m_parent; }

    virtual KoDocument *hitTest( const TQPoint &, const TQWMatrix & );

protected:
    KPrDocument *m_parent;
};

class KPrDocument : public KoDocument
{
    Q_OBJECT
  
    TQ_PROPERTY( int maxRecentFiles READ maxRecentFiles )
    TQ_PROPERTY( int undoRedoLimit READ undoRedoLimit WRITE setUndoRedoLimit )
    TQ_PROPERTY( double indentValue READ getIndentValue WRITE setIndentValue )
    TQ_PROPERTY( int getLeftBorder READ getLeftBorder )
    TQ_PROPERTY( int getTopBorder READ getTopBorder )
    TQ_PROPERTY( int getBottomBorder READ getBottomBorder )
    TQ_PROPERTY( int getRightBorder READ getRightBorder )
    TQ_PROPERTY( bool cursorInProtectedArea READ cursorInProtectedArea WRITE setCursorInProtectedArea )
    TQ_PROPERTY( bool insertDirectCursor READ insertDirectCursor WRITE setInsertDirectCursor )
    TQ_PROPERTY( TQString picturePath READ picturePath WRITE setPicturePath )
    TQ_PROPERTY( TQString globalLanguage READ globalLanguage WRITE setGlobalLanguage )
    TQ_PROPERTY( bool globalHyphenation READ globalHyphenation WRITE setGlobalHyphenation )
    TQ_PROPERTY( double tabStopValue READ tabStopValue WRITE setTabStopValue )
    TQ_PROPERTY( bool snapToGrid READ snapToGrid WRITE setSnapToGrid )
    TQ_PROPERTY( bool backgroundSpellCheckEnabled READ backgroundSpellCheckEnabled WRITE enableBackgroundSpellCheck )
    TQ_PROPERTY( bool spInfiniteLoop READ spInfiniteLoop WRITE setInfiniteLoop )
    TQ_PROPERTY( bool spShowEndOfPresentationSlide READ spShowEndOfPresentationSlide WRITE setShowEndOfPresentationSlide )
    TQ_PROPERTY( bool spManualSwitch READ spManualSwitch WRITE setManualSwitch )
    TQ_PROPERTY( bool presentationDuration READ presentationDuration WRITE setPresentationDuration )
    TQ_PROPERTY( TQColor gridColor READ gridColor WRITE setGridColor )
    TQ_PROPERTY( TQColor txtBackCol READ txtBackCol WRITE setTxtBackCol )


  public:
    // constructor - destructor
    KPrDocument( TQWidget *parentWidget = 0, const char *widgetName = 0, TQObject* doc = 0,
                   const char* name = 0, bool singleViewMode = false );
    ~KPrDocument();

    // Drawing
    virtual void paintContent( TQPainter& painter, const TQRect& rect, bool transparent = false,
                               double zoomX = 1.0, double zoomY = 1.0 );

    // save
    virtual TQDomDocument saveXML();
    virtual bool completeSaving( KoStore* _store );
    virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter );

    enum SaveFlag { SaveAll, SaveSelected, SavePage };
    void saveOasisDocumentStyles( KoStore* store, KoGenStyles& mainStyles, TQFile* masterStyles, 
                                  KoSavingContext & savingContext, SaveFlag saveFlag = SaveAll ) const;
    enum { STYLE_BACKGROUNDPAGE = 20, STYLE_BACKGROUNDPAGEAUTO, STYLE_GRADIENT,STYLE_OBJECTANIMATION, STYLE_STROKE, STYLE_MARKER, STYLE_PICTURE, STYLE_PRESENTATIONSTICKYOBJECT };

    // load
    virtual bool loadOasis( const TQDomDocument& doc, KoOasisStyles& styles, const TQDomDocument&, KoStore* store );
    /*
     * Load oasis object
     * @param pos: we use -1 for sticky page.
     */
    void loadOasisObject( KPrPage * page, TQDomNode & drawPage, KoOasisContext & context, KPrGroupObject *groupObject = 0L);

    virtual bool loadXML( const TQDomDocument& doc );
    virtual bool loadXML( TQIODevice *, const TQDomDocument & doc );
    virtual bool loadChildren( KoStore* _store );

    virtual int supportedSpecialFormats() const;

    virtual bool initDoc(InitDocFlags flags, TQWidget* parentWidget=0);
    virtual void setEmpty();

    virtual void addView( KoView *_view );
    virtual void removeView( KoView *_view );

    // page layout
    void setPageLayout( const KoPageLayout &);

    virtual TQPixmap generatePreview( const TQSize &size );

    virtual void addShell( KoMainWindow *shell );

    //header-footer
    void createHeaderFooter();
    void updateHeaderFooterPosition();

    const TQPtrList<KPrPage> & getPageList() const {return m_pageList;}

    // @return the master page
    KPrPage * masterPage() const { return m_masterPage; }
    KPrPage * activePage()const;
    // We need one that's not const, due to TQPtrList::at() not being const
    TQPtrList<KPrPage>& pageList() { return m_pageList;}

    void insertPixmapKey( KoPictureKey key );

    void insertObjectInPage(double offset, KPrObject *_obj, int pos = -1);

    void setGridValue( double rx, double ry, bool _replace = true );

    // get - set options for editmodi
    TQColor txtBackCol() const { return _txtBackCol; }
    void setTxtBackCol( const TQColor &c ) { _otxtBackCol = _txtBackCol; _txtBackCol = c; }

    // get - set roundedness
    unsigned int getRndX() const { return _xRnd; }
    unsigned int getRndY() const { return _yRnd; }

    // get values for screenpresentations
    bool spInfiniteLoop() const { return _spInfiniteLoop; }
    bool spShowEndOfPresentationSlide() const { return _spShowEndOfPresentationSlide; }
    bool spManualSwitch() const { return _spManualSwitch; }
    bool presentationDuration() const { return _showPresentationDuration; }
    void setInfiniteLoop( bool il ) { _spInfiniteLoop = il; }
    void setShowEndOfPresentationSlide( bool shw ) { _spShowEndOfPresentationSlide = shw; }
    void setManualSwitch( bool ms ) { _spManualSwitch = ms; }
    void setPresentationDuration( bool pd ) { _showPresentationDuration = pd; }


    // size of page
    TQRect getPageRect( bool decBorders = true ) const;

    void insertObject(KPrChild* ch ){ insertChild(ch);}

    void savePage( const TQString &file, int pgnum, bool ignore = false );

    void pastePage( const TQMimeSource * data, int pgnum );

    TQString templateFileName(bool chooseTemplate, const TQString &theFile );

    int insertNewPage( const TQString &cmdName,int _page, InsertPos _insPos, bool chooseTemplate, const TQString &theFile );

    /**
     * insert page page and go to page insertPageNum on all views
     * which have currentPageNum as active page
     */
    void insertPage( KPrPage *page, int currentPageNum, int insertPageNum );
    /**
     * remove page page and go to page pageNum on all view which
     * had page as active page
     */
    void takePage( KPrPage *page, int pageNum );
    void deletePage( int _page );
    void copyPageToClipboard( int pgnum );

    // repaint all views
    void repaint( bool );

    void repaint( const TQRect& );
    void repaint( KPrObject* );

    // stuff for screen-presentations
    /**
     * return the list of steps for the selected page
     * where objects appear/disappear.
     */
    TQValueList<int> getPageEffectSteps( unsigned int );

    TQPen presPen() const { return _presPen; }
    void setPresPen( TQPen p ) {_presPen = p; }

    void restoreBackground( KPrPage * );
    KCommand * loadPastedObjs( const TQString &in, KPrPage* _page );

    void deSelectAllObj();
    void deSelectObj(KPrObject *obj);
    void updateHeaderFooterButton();

    KoPictureCollection *pictureCollection(){ return &m_pictureCollection; }
    KPrGradientCollection *gradientCollection() { return &_gradientCollection; }

    KoAutoFormat * getAutoFormat()const { return m_autoFormat; }

    void replaceObjs( bool createUndoRedo = true );

    int getLeftBorder() const;
    int getTopBorder() const;
    int getBottomBorder() const;
    int getRightBorder() const;

    void enableEmbeddedParts( bool f );

    KPrTextObject *header()const { return _header; }
    KPrTextObject *footer()const { return _footer; }

    void setHeader( bool b );
    void setFooter( bool b );

    void setDisplayObjectMasterPage( bool b );
    void setDisplayBackground( bool b );

    bool isHeader(const KPrObject *obj)const;
    bool isFooter(const KPrObject *obj)const;
    bool isHeaderFooter(const KPrObject *obj)const;

    // Returns true if the slide pgNum (0 based)
    bool isSlideSelected( int pgNum) ;
    // Returns the list of selected slides. Slide numbers are 0-based.
    TQValueList<int> selectedSlides();
    TQString selectedForPrinting();

    virtual DCOPObject* dcopObject();

    void initConfig();
    void saveConfig();

    KoStyleCollection * styleCollection()const { return m_styleColl;}


    void updateAllStyleLists();
    void applyStyleChange( KoStyleChangeDefMap changed );
    void updateStyleListOrder( const TQStringList &list );

    void addCommand( KCommand * cmd );

    KoTextZoomHandler* zoomHandler() const { return m_zoomHandler; }
    TQFont defaultFont() const { return m_defaultFont; }
    void setDefaultFont( const TQFont & newFont) {
        m_defaultFont = newFont;
    }

    /**
     * get custom tdespell config
     */

    bool showStatusBar() const { return m_bShowStatusBar;}
    void setShowStatusBar( bool _status ) { m_bShowStatusBar = _status;}

    bool showGrid() const { return m_bShowGrid; }
    void setShowGrid ( bool _grid ) { m_bShowGrid = _grid; }

    double tabStopValue() const { return m_tabStop; }
    void setTabStopValue ( double _tabStop );

    // in pt
    double getIndentValue()const { return m_indent; }
    void setIndentValue(double _ind) { m_indent=_ind; }

    int maxRecentFiles() const { return m_maxRecentFiles; }

    KoVariableFormatCollection *variableFormatCollection()const { return m_varFormatCollection; }

    void recalcVariables( int type );

    void recalcPageNum();

    KPrVariableCollection *getVariableCollection()const {return m_varColl;}

    void refreshMenuCustomVariable();

    void setShowRuler(bool _ruler){ m_bShowRuler=_ruler; }
    bool showRuler() const { return m_bShowRuler; }

    void reorganizeGUI();

    int undoRedoLimit() const;
    void setUndoRedoLimit(int _val);


    void updateRuler();
    void updateRulerPageLayout();

    unsigned int getPageNums() const { return m_pageList.count(); }

    // Tell all views to stop editing this frameset, if they were doing so
    void terminateEditing( KPrTextObject * textObj )
        { emit sig_terminateEditing( textObj ); }
    KPrPage * initialActivePage() const;

    KPrView *firstView() const;

    void displayActivePage(KPrPage * _page);

    void updateZoomRuler();
    void newZoomAndResolution( bool updateViews, bool forPrint );

    void movePageTo( int oldPos, int newPos );

    void updateSideBarItem( KPrPage * page );
    KPrPage * findPage(KPrObject *object);
    KPrPage * findPage(TQPtrList<KPrObject> &objects);

    void refreshAllNoteBar(int page, const TQString &text, KPrView *exceptView);
    void refreshAllNoteBarMasterPage(const TQString &text, KPrView *exceptView);


    bool backgroundSpellCheckEnabled() const;
    void enableBackgroundSpellCheck( bool b );

    void startBackgroundSpellCheck();

    //refresh obj when we active or disactive
    void reactivateBgSpellChecking(bool refreshTextObj=false);
    TQPtrList<KoTextObject> allTextObjects() const;
    TQValueList<KoTextObject *> visibleTextObjects( ) const;

    /// Reimplementation from KoDocument.
    virtual TQValueList<KoTextDocument *> allTextDocuments() const;

    bool allowAutoFormat() const { return m_bAllowAutoFormat; }
    void setAllowAutoFormat(bool _b){ m_bAllowAutoFormat=_b; }

    // This setting has to be here [instead of the view] because we need to
    // format paragraphs slightly differently (to add room for the CR char)
    bool viewFormattingChars() const { return m_bViewFormattingChars; }
    void setViewFormattingChars(bool _b) { m_bViewFormattingChars=_b; }


    bool showGuideLines() const { return m_bShowGuideLines; }
    void setShowGuideLines( bool b );

    /**
     * @brief Get the positions of the horizontal guide lines
     *
     * @return list of positions of the horizontal guide lines
     */
    TQValueList<double> &horizontalGuideLines() { return m_hGuideLines; }

    /**
     * @brief Get the positions of the vertical guide lines
     *
     * @return list of positions of the vertical guide lines
     */
    TQValueList<double> &verticalGuideLines() { return m_vGuideLines; }

    /**
     * @brief Set the positions of the horizontal guide lines
     *
     * @param lines a list of positions of the horizontal guide lines
     */
    void horizontalGuideLines( const TQValueList<double> &lines );

    /**
     * @brief Set the positions of the vertical guide lines
     *
     * @param lines a list of positions of the vertical guide lines
     */
    void verticalGuideLines( const TQValueList<double> &lines );

    /**
     * @brief Add a guide line
     *
     * @param p the orientation of the guide line
     * @param p the position of the guide line
     */
    void addGuideLine( Qt::Orientation o, double pos );

    void updateGuideLineButton();

    void updateGridButton();

    double getGridX()const { return m_gridX; }
    void setGridX(double _x) { m_gridX=_x; }

    double getGridY()const { return m_gridY; }
    void setGridY(double _y) { m_gridY=_y; }

    bool snapToGrid() const { return m_bSnapToGrid; }
    void setSnapToGrid( bool _b ) { m_bSnapToGrid = _b; }

    TQColor gridColor() const { return m_gridColor; }
    void setGridColor( const TQColor & _col ) { m_gridColor = _col; }

    TQStringList spellCheckIgnoreList() const { return m_spellCheckIgnoreList; }
    void setSpellCheckIgnoreList( const TQStringList& lst );
    void addSpellCheckIgnoreWord( const TQString & );

    KoCommandHistory * commandHistory()const { return m_commandHistory; }
    void updateObjectStatusBarItem();
    void updateObjectSelected();
    void layout(KPrObject *kpobject);
    void layout();
    void changeBgSpellCheckingState( bool b );

    bool cursorInProtectedArea()const;
    void setCursorInProtectedArea( bool b );

    void insertFile(const TQString & file );

    void spellCheckParagraphDeleted( KoTextParag *_parag,  KPrTextObject *frm);

    void loadPictureMap ( const TQDomElement& domElement );
    void updateRulerInProtectContentMode();
    void updatePresentationButton();
    void refreshGroupButton();

    TQString picturePath()const { return m_picturePath; }
    void setPicturePath( const TQString & _path ) { m_picturePath = _path ; }

    bool insertDirectCursor() const { return m_bInsertDirectCursor; }
    void setInsertDirectCursor(bool _b);
    void updateDirectCursorButton();

    TQString globalLanguage()const { return m_globalLanguage; }
    void setGlobalLanguage( const TQString & _lang ){m_globalLanguage = _lang;}

    bool globalHyphenation() const { return m_bGlobalHyphenation; }
    void setGlobalHyphenation ( bool _hyphen ) { m_bGlobalHyphenation = _hyphen; }

    void addWordToDictionary( const TQString & word);

    void loadImagesFromStore( KoStore *_store );
    void saveEmbeddedObject(KPrPage *page, const TQPtrList<KoDocumentChild>& childList ,TQDomDocument &doc,TQDomElement &presenter );
    void insertEmbedded( KoStore *store, TQDomElement elem, KMacroCommand * macroCmd, KPrPage *page, int pos );

    KPrBgSpellCheck* backSpeller() const { return m_bgSpellCheck; }

    void setCustomSlideShows( const CustomSlideShowMap & customSlideShows );
    TQValueList <KPrPage *> customListPage( const TQStringList & lst, bool loadOasis=false );


    TQString presentationName() const { return m_presentationName; }
    void setPresentationName( const TQString &_name ) { m_presentationName = _name; }

    TQStringList presentationList();
    //return list of slide which be displaying:
    //return selected slide when presentation name is empty
    //otherwise return list of custom slide show
    TQValueList<int> displaySelectedSlides();
    TQValueList<int> listOfDisplaySelectedSlides( const TQValueList<KPrPage*>& lst );
    void testCustomSlideShow( const TQValueList<KPrPage *> &pages, KPrView *view );
    void clearTestCustomSlideShow();

    const CustomSlideShowMap & customSlideShows() { return m_customListSlideShow; }

public slots:
    void movePage( int from, int to );
    void copyPage( int from );

    void selectPage( int pgNum, bool select );
    void clipboardDataChanged();

    void slotRepaintChanged( KPrTextObject * );

    static void writeAutomaticStyles( KoXmlWriter& contentWriter, KoGenStyles& mainStyles, KoSavingContext& context, bool stylesDotXml );

    void slotGuideLinesChanged( KoView *view );

    virtual void initEmpty();

signals:
    void enablePaste( bool );
    void sig_refreshMenuCustomVariable();
    void pageNumChanged();
    void sig_updateRuler();
    void sig_terminateEditing( KPrTextObject * );
    void sig_updateMenuBar();

protected slots:
    void slotDocumentRestored();
    void slotCommandExecuted();
    void slotDocumentInfoModifed();

    virtual void openExistingFile( const TQString& file );
    virtual void openTemplate( const TQString& file );

protected:
    KoView* createViewInstance( TQWidget* parent, const char* name );
    void testAndCloseAllTextObjectProtectedContent();
    // ************ functions ************
    /**
     * Overloaded function from @ref Document_impl. Saves all children.
     */
    virtual bool saveChildren( KoStore* _store );

    void loadStyleTemplates( const TQDomElement &styles );
    void saveStyle( KoParagStyle *sty, TQDomElement parentElem );

    TQDomDocumentFragment saveBackground( TQDomDocument& );
    TQDomElement saveObjects( TQDomDocument &doc );
    TQDomElement saveTitle( TQDomDocument &doc );
    TQDomElement saveNote( TQDomDocument &doc );
    TQDomElement saveAttribute( TQDomDocument &doc );
    TQDomElement saveUsedSoundFileToXML( TQDomDocument &_doc, TQStringList _list );
    void loadTextStyle( const TQDomElement& domElement );
    void saveEmbeddedObject(KPrPage *page, KoDocumentChild *chl,TQDomDocument &doc,TQDomElement &presenter, double offset );
    void saveGuideLines( TQDomDocument &doc, TQDomElement& element );

    void loadBackground( const TQDomElement &element );
    void loadGuideLines( const TQDomElement &element );
    KCommand * loadObjects( const TQDomElement &element,bool paste=false );
    void loadTitle( const TQDomElement &element );
    void loadNote( const TQDomElement &element );
    void loadUsedSoundFileFromXML( const TQDomElement &element );

    virtual bool completeLoading( KoStore* /* _store */ );
    void makeUsedPixmapList();
    void makeUsedSoundFileList();

    void saveUsedSoundFileToStore( KoStore *_store, TQStringList _list );
    void loadUsedSoundFileFromStore( KoStore *_store, TQStringList _list );
    void fillStyleStack( const TQDomElement& object, KoOasisContext & context, const char* family );
    /*
     * increaseOrder = true by default, put to false when we have group of animation
     */
    int createPresentationAnimation(const TQDomElement& element, int order = 0 ,bool increaseOrder = true);

    void saveOasisPresentationSettings( KoXmlWriter &contentTmpWriter, TQMap<int, TQString> &page2name );
    void loadOasisPresentationSettings( TQDomNode &settingsDoc );
    void saveOasisPresentationCustomSlideShow( KoXmlWriter &contentTmpWriter, TQMap<int, TQString> &page2name );
    void loadOasisPresentationCustomSlideShow( TQDomNode &settingsDoc );

    void loadOasisHeaderFooter( TQDomNode & drawPage, KoOasisContext & context);

    void saveOasisSettings( KoXmlWriter &contentTmpWriter );
    void loadOasisSettings( const TQDomDocument&settingsDoc );

    void saveOasisCustomFied( KoXmlWriter &writer )const;

    void loadOasisIgnoreList( const KoOasisSettings& settings );

    //we move presSpeed to each table => compatibility with old file format
    void compatibilityFromOldFileFormat();

    void parseOasisGuideLines( const TQString &str );

    /**
     * recalc the variables
     * update statusbar and sidebar menu
     */
    void pageOrderChanged();
    // ************ variables ************

    // screenpresentations
    bool _spInfiniteLoop, _spShowEndOfPresentationSlide, _spManualSwitch, _showPresentationDuration;

    // options
    int _xRnd, _yRnd;

    // options for editmode
    TQColor _txtBackCol;
    TQColor _otxtBackCol;

    bool _clean;
    int objStartY, objStartNum;

    TQPen _presPen;

    KoPictureCollection m_pictureCollection;
    KPrGradientCollection _gradientCollection;

    KPrTextObject *_header, *_footer;

    TQMap<KoPictureKey, TQString> m_pictureMap;

    CustomSlideShowMap m_customListSlideShow;


    KoPageLayout __pgLayout;
    int lastObj;

    TQString urlIntern;

    TQValueList<KoPictureKey> usedPictures;
    TQStringList usedSoundFile, haveNotOwnDiskSoundFile;
    TQPtrList<KTempFile> tmpSoundFileList;
    DCOPObject *dcop;

    int saveOnlyPage;
    TQString m_tempFileInClipboard;
    bool ignoreSticky;

    KoCommandHistory * m_commandHistory;
    KoTextZoomHandler* m_zoomHandler;
    TQFont m_defaultFont;
    KoAutoFormat * m_autoFormat;

    bool m_bShowRuler;
    bool m_bShowStatusBar;
    bool m_bAllowAutoFormat;
    bool m_bShowGuideLines;
    bool m_bViewFormattingChars;

    bool m_bShowGrid;

    bool m_bSnapToGrid;
    double m_indent; // in pt

    double m_tabStop;
    int m_maxRecentFiles;
    bool m_cursorInProtectectedArea;
    KoVariableFormatCollection *m_varFormatCollection;
    KPrVariableCollection *m_varColl;
    TQColor m_gridColor;
    bool _duplicatePage;
private:
    /// list of positions of horizontal guide lines
    TQValueList<double> m_hGuideLines;
    /// list of positions of vertical guide lines
    TQValueList<double> m_vGuideLines;

    TQPtrList<KPrPage> m_pageList;
    TQPtrList<KPrPage> m_deletedPageList;

    TQStringList m_spellCheckIgnoreList; // per-document
    TQStringList m_spellCheckPersonalDict; // per-user

    double m_gridX;
    double m_gridY;
    double oldGridX;
    double oldGridY;
    int m_insertFilePage;
    KPrPage *m_initialActivePage;
    KPrPage *m_pageWhereLoadObject;
    KPrPage *m_masterPage;
    KPrBgSpellCheck *m_bgSpellCheck;
    KoStyleCollection *m_styleColl;
    KPrObject *bgObjSpellChecked;
    TQString m_picturePath;
    bool  m_bInsertDirectCursor;
    TQString m_globalLanguage;
    TQString m_presentationName;
    bool m_bGlobalHyphenation;
    KPrLoadingInfo *m_loadingInfo;
    TQValueList<int> *m_customListTest;

    /// here the amount of existing children before inserting a page/file
    /// is saved, so that we load the correct children
    int m_childCountBeforeInsert;
};

#endif