21#ifndef __kpresenter_doc_h__
22#define __kpresenter_doc_h__
34class KoCommandHistory;
35class KoTextZoomHandler;
38class KoVariableFormatCollection;
39class KPrVariableCollection;
54#include <KoDocument.h>
55#include <KoDocumentChild.h>
60#include <tqvaluelist.h>
61#include <tqdatetime.h>
63#include <KoPageLayoutDia.h>
66#include <KoStyleStack.h>
67#include <KoPictureCollection.h>
68#include "KPrGradientCollection.h"
69#include <KoTextZoomHandler.h>
70#include <KoStyleCollection.h>
71#include <KoCommandHistory.h>
81class KoStyleCollection;
83class KPrChild :
public KoDocumentChild
88 KPrChild( KPrDocument *_kpr, KoDocument* _doc,
const TQRect& _rect );
89 KPrChild( KPrDocument *_kpr );
93 KPrDocument* parent()
const {
return m_parent; }
95 virtual KoDocument *hitTest(
const TQPoint &,
const TQWMatrix & );
98 KPrDocument *m_parent;
101class KPrDocument :
public KoDocument
105 TQ_PROPERTY(
int maxRecentFiles READ maxRecentFiles )
106 TQ_PROPERTY(
int undoRedoLimit READ undoRedoLimit WRITE setUndoRedoLimit )
107 TQ_PROPERTY(
double indentValue READ getIndentValue WRITE setIndentValue )
108 TQ_PROPERTY(
int getLeftBorder READ getLeftBorder )
109 TQ_PROPERTY(
int getTopBorder READ getTopBorder )
110 TQ_PROPERTY(
int getBottomBorder READ getBottomBorder )
111 TQ_PROPERTY(
int getRightBorder READ getRightBorder )
112 TQ_PROPERTY(
bool cursorInProtectedArea READ cursorInProtectedArea WRITE setCursorInProtectedArea )
113 TQ_PROPERTY(
bool insertDirectCursor READ insertDirectCursor WRITE setInsertDirectCursor )
114 TQ_PROPERTY( TQString picturePath READ picturePath WRITE setPicturePath )
115 TQ_PROPERTY( TQString globalLanguage READ globalLanguage WRITE setGlobalLanguage )
116 TQ_PROPERTY(
bool globalHyphenation READ globalHyphenation WRITE setGlobalHyphenation )
117 TQ_PROPERTY(
double tabStopValue READ tabStopValue WRITE setTabStopValue )
118 TQ_PROPERTY(
bool snapToGrid READ snapToGrid WRITE setSnapToGrid )
119 TQ_PROPERTY(
bool backgroundSpellCheckEnabled READ backgroundSpellCheckEnabled WRITE enableBackgroundSpellCheck )
120 TQ_PROPERTY(
bool spInfiniteLoop READ spInfiniteLoop WRITE setInfiniteLoop )
121 TQ_PROPERTY(
bool spShowEndOfPresentationSlide READ spShowEndOfPresentationSlide WRITE setShowEndOfPresentationSlide )
122 TQ_PROPERTY(
bool spManualSwitch READ spManualSwitch WRITE setManualSwitch )
123 TQ_PROPERTY(
bool presentationDuration READ presentationDuration WRITE setPresentationDuration )
124 TQ_PROPERTY( TQColor gridColor READ gridColor WRITE setGridColor )
125 TQ_PROPERTY( TQColor txtBackCol READ txtBackCol WRITE setTxtBackCol )
130 KPrDocument( TQWidget *parentWidget = 0,
const char *widgetName = 0, TQObject* doc = 0,
131 const char* name = 0,
bool singleViewMode =
false );
135 virtual void paintContent( TQPainter& painter,
const TQRect& rect,
bool transparent =
false,
136 double zoomX = 1.0,
double zoomY = 1.0 );
139 virtual TQDomDocument saveXML();
140 virtual bool completeSaving( KoStore* _store );
141 virtual bool saveOasis( KoStore* store, KoXmlWriter* manifestWriter );
143 enum SaveFlag { SaveAll, SaveSelected, SavePage };
144 void saveOasisDocumentStyles( KoStore* store, KoGenStyles& mainStyles, TQFile* masterStyles,
145 KoSavingContext & savingContext, SaveFlag saveFlag = SaveAll )
const;
146 enum { STYLE_BACKGROUNDPAGE = 20, STYLE_BACKGROUNDPAGEAUTO, STYLE_GRADIENT,STYLE_OBJECTANIMATION, STYLE_STROKE, STYLE_MARKER, STYLE_PICTURE, STYLE_PRESENTATIONSTICKYOBJECT };
149 virtual bool loadOasis(
const TQDomDocument& doc, KoOasisStyles& styles,
const TQDomDocument&, KoStore* store );
154 void loadOasisObject( KPrPage * page, TQDomNode & drawPage, KoOasisContext & context, KPrGroupObject *groupObject = 0L);
156 virtual bool loadXML(
const TQDomDocument& doc );
157 virtual bool loadXML( TQIODevice *,
const TQDomDocument & doc );
158 virtual bool loadChildren( KoStore* _store );
160 virtual int supportedSpecialFormats()
const;
162 virtual bool initDoc(InitDocFlags flags, TQWidget* parentWidget=0);
163 virtual void setEmpty();
165 virtual void addView( KoView *_view );
166 virtual void removeView( KoView *_view );
169 void setPageLayout(
const KoPageLayout &);
171 virtual TQPixmap generatePreview(
const TQSize &size );
173 virtual void addShell( KoMainWindow *shell );
176 void createHeaderFooter();
177 void updateHeaderFooterPosition();
179 const TQPtrList<KPrPage> & getPageList()
const {
return m_pageList;}
182 KPrPage * masterPage()
const {
return m_masterPage; }
183 KPrPage * activePage()
const;
185 TQPtrList<KPrPage>& pageList() {
return m_pageList;}
187 void insertPixmapKey( KoPictureKey key );
189 void insertObjectInPage(
double offset, KPrObject *_obj,
int pos = -1);
191 void setGridValue(
double rx,
double ry,
bool _replace =
true );
194 TQColor txtBackCol()
const {
return _txtBackCol; }
195 void setTxtBackCol(
const TQColor &c ) { _otxtBackCol = _txtBackCol; _txtBackCol = c; }
198 unsigned int getRndX()
const {
return _xRnd; }
199 unsigned int getRndY()
const {
return _yRnd; }
202 bool spInfiniteLoop()
const {
return _spInfiniteLoop; }
203 bool spShowEndOfPresentationSlide()
const {
return _spShowEndOfPresentationSlide; }
204 bool spManualSwitch()
const {
return _spManualSwitch; }
205 bool presentationDuration()
const {
return _showPresentationDuration; }
206 void setInfiniteLoop(
bool il ) { _spInfiniteLoop = il; }
207 void setShowEndOfPresentationSlide(
bool shw ) { _spShowEndOfPresentationSlide = shw; }
208 void setManualSwitch(
bool ms ) { _spManualSwitch = ms; }
209 void setPresentationDuration(
bool pd ) { _showPresentationDuration = pd; }
213 TQRect getPageRect(
bool decBorders =
true )
const;
215 void insertObject(KPrChild* ch ){ insertChild(ch);}
217 void savePage(
const TQString &file,
int pgnum,
bool ignore =
false );
219 void pastePage(
const TQMimeSource * data,
int pgnum );
221 TQString templateFileName(
bool chooseTemplate,
const TQString &theFile );
223 int insertNewPage(
const TQString &cmdName,
int _page, InsertPos _insPos,
bool chooseTemplate,
const TQString &theFile );
229 void insertPage( KPrPage *page,
int currentPageNum,
int insertPageNum );
234 void takePage( KPrPage *page,
int pageNum );
235 void deletePage(
int _page );
236 void copyPageToClipboard(
int pgnum );
239 void repaint(
bool );
241 void repaint(
const TQRect& );
242 void repaint( KPrObject* );
249 TQValueList<int> getPageEffectSteps(
unsigned int );
251 TQPen presPen()
const {
return _presPen; }
252 void setPresPen( TQPen p ) {_presPen = p; }
254 void restoreBackground( KPrPage * );
255 KCommand * loadPastedObjs(
const TQString &in, KPrPage* _page );
257 void deSelectAllObj();
258 void deSelectObj(KPrObject *obj);
259 void updateHeaderFooterButton();
261 KoPictureCollection *pictureCollection(){
return &m_pictureCollection; }
264 KoAutoFormat * getAutoFormat()
const {
return m_autoFormat; }
266 void replaceObjs(
bool createUndoRedo =
true );
268 int getLeftBorder()
const;
269 int getTopBorder()
const;
270 int getBottomBorder()
const;
271 int getRightBorder()
const;
273 void enableEmbeddedParts(
bool f );
275 KPrTextObject *header()
const {
return _header; }
276 KPrTextObject *footer()
const {
return _footer; }
278 void setHeader(
bool b );
279 void setFooter(
bool b );
281 void setDisplayObjectMasterPage(
bool b );
282 void setDisplayBackground(
bool b );
284 bool isHeader(
const KPrObject *obj)
const;
285 bool isFooter(
const KPrObject *obj)
const;
286 bool isHeaderFooter(
const KPrObject *obj)
const;
289 bool isSlideSelected(
int pgNum) ;
291 TQValueList<int> selectedSlides();
292 TQString selectedForPrinting();
294 virtual DCOPObject* dcopObject();
299 KoStyleCollection * styleCollection()
const {
return m_styleColl;}
302 void updateAllStyleLists();
303 void applyStyleChange( KoStyleChangeDefMap changed );
304 void updateStyleListOrder(
const TQStringList &list );
306 void addCommand( KCommand * cmd );
308 KoTextZoomHandler* zoomHandler()
const {
return m_zoomHandler; }
309 TQFont defaultFont()
const {
return m_defaultFont; }
310 void setDefaultFont(
const TQFont & newFont) {
311 m_defaultFont = newFont;
318 bool showStatusBar()
const {
return m_bShowStatusBar;}
319 void setShowStatusBar(
bool _status ) { m_bShowStatusBar = _status;}
321 bool showGrid()
const {
return m_bShowGrid; }
322 void setShowGrid (
bool _grid ) { m_bShowGrid = _grid; }
324 double tabStopValue()
const {
return m_tabStop; }
325 void setTabStopValue (
double _tabStop );
328 double getIndentValue()
const {
return m_indent; }
329 void setIndentValue(
double _ind) { m_indent=_ind; }
331 int maxRecentFiles()
const {
return m_maxRecentFiles; }
333 KoVariableFormatCollection *variableFormatCollection()
const {
return m_varFormatCollection; }
335 void recalcVariables(
int type );
337 void recalcPageNum();
339 KPrVariableCollection *getVariableCollection()
const {
return m_varColl;}
341 void refreshMenuCustomVariable();
343 void setShowRuler(
bool _ruler){ m_bShowRuler=_ruler; }
344 bool showRuler()
const {
return m_bShowRuler; }
346 void reorganizeGUI();
348 int undoRedoLimit()
const;
349 void setUndoRedoLimit(
int _val);
353 void updateRulerPageLayout();
355 unsigned int getPageNums()
const {
return m_pageList.count(); }
358 void terminateEditing( KPrTextObject * textObj )
359 { emit sig_terminateEditing( textObj ); }
360 KPrPage * initialActivePage()
const;
362 KPrView *firstView()
const;
364 void displayActivePage(KPrPage * _page);
366 void updateZoomRuler();
367 void newZoomAndResolution(
bool updateViews,
bool forPrint );
369 void movePageTo(
int oldPos,
int newPos );
371 void updateSideBarItem( KPrPage * page );
372 KPrPage * findPage(KPrObject *
object);
373 KPrPage * findPage(TQPtrList<KPrObject> &objects);
375 void refreshAllNoteBar(
int page,
const TQString &text, KPrView *exceptView);
376 void refreshAllNoteBarMasterPage(
const TQString &text, KPrView *exceptView);
379 bool backgroundSpellCheckEnabled()
const;
380 void enableBackgroundSpellCheck(
bool b );
382 void startBackgroundSpellCheck();
385 void reactivateBgSpellChecking(
bool refreshTextObj=
false);
386 TQPtrList<KoTextObject> allTextObjects()
const;
387 TQValueList<KoTextObject *> visibleTextObjects( )
const;
390 virtual TQValueList<KoTextDocument *> allTextDocuments()
const;
392 bool allowAutoFormat()
const {
return m_bAllowAutoFormat; }
393 void setAllowAutoFormat(
bool _b){ m_bAllowAutoFormat=_b; }
397 bool viewFormattingChars()
const {
return m_bViewFormattingChars; }
398 void setViewFormattingChars(
bool _b) { m_bViewFormattingChars=_b; }
401 bool showGuideLines()
const {
return m_bShowGuideLines; }
402 void setShowGuideLines(
bool b );
409 TQValueList<double> &horizontalGuideLines() {
return m_hGuideLines; }
416 TQValueList<double> &verticalGuideLines() {
return m_vGuideLines; }
423 void horizontalGuideLines(
const TQValueList<double> &lines );
430 void verticalGuideLines(
const TQValueList<double> &lines );
438 void addGuideLine( TQt::Orientation o,
double pos );
440 void updateGuideLineButton();
442 void updateGridButton();
444 double getGridX()
const {
return m_gridX; }
445 void setGridX(
double _x) { m_gridX=_x; }
447 double getGridY()
const {
return m_gridY; }
448 void setGridY(
double _y) { m_gridY=_y; }
450 bool snapToGrid()
const {
return m_bSnapToGrid; }
451 void setSnapToGrid(
bool _b ) { m_bSnapToGrid = _b; }
453 TQColor gridColor()
const {
return m_gridColor; }
454 void setGridColor(
const TQColor & _col ) { m_gridColor = _col; }
456 TQStringList spellCheckIgnoreList()
const {
return m_spellCheckIgnoreList; }
457 void setSpellCheckIgnoreList(
const TQStringList& lst );
458 void addSpellCheckIgnoreWord(
const TQString & );
460 KoCommandHistory * commandHistory()
const {
return m_commandHistory; }
461 void updateObjectStatusBarItem();
462 void updateObjectSelected();
463 void layout(KPrObject *kpobject);
465 void changeBgSpellCheckingState(
bool b );
467 bool cursorInProtectedArea()
const;
468 void setCursorInProtectedArea(
bool b );
470 void insertFile(
const TQString & file );
472 void spellCheckParagraphDeleted( KoTextParag *_parag, KPrTextObject *frm);
474 void loadPictureMap (
const TQDomElement& domElement );
475 void updateRulerInProtectContentMode();
476 void updatePresentationButton();
477 void refreshGroupButton();
479 TQString picturePath()
const {
return m_picturePath; }
480 void setPicturePath(
const TQString & _path ) { m_picturePath = _path ; }
482 bool insertDirectCursor()
const {
return m_bInsertDirectCursor; }
483 void setInsertDirectCursor(
bool _b);
484 void updateDirectCursorButton();
486 TQString globalLanguage()
const {
return m_globalLanguage; }
487 void setGlobalLanguage(
const TQString & _lang ){m_globalLanguage = _lang;}
489 bool globalHyphenation()
const {
return m_bGlobalHyphenation; }
490 void setGlobalHyphenation (
bool _hyphen ) { m_bGlobalHyphenation = _hyphen; }
492 void addWordToDictionary(
const TQString & word);
494 void loadImagesFromStore( KoStore *_store );
495 void saveEmbeddedObject(KPrPage *page,
const TQPtrList<KoDocumentChild>& childList ,TQDomDocument &doc,TQDomElement &presenter );
496 void insertEmbedded( KoStore *store, TQDomElement elem, KMacroCommand * macroCmd, KPrPage *page,
int pos );
498 KPrBgSpellCheck* backSpeller()
const {
return m_bgSpellCheck; }
500 void setCustomSlideShows(
const CustomSlideShowMap & customSlideShows );
501 TQValueList <KPrPage *> customListPage(
const TQStringList & lst,
bool loadOasis=
false );
504 TQString presentationName()
const {
return m_presentationName; }
505 void setPresentationName(
const TQString &_name ) { m_presentationName = _name; }
507 TQStringList presentationList();
511 TQValueList<int> displaySelectedSlides();
512 TQValueList<int> listOfDisplaySelectedSlides(
const TQValueList<KPrPage*>& lst );
513 void testCustomSlideShow(
const TQValueList<KPrPage *> &pages, KPrView *view );
514 void clearTestCustomSlideShow();
516 const CustomSlideShowMap & customSlideShows() {
return m_customListSlideShow; }
519 void movePage(
int from,
int to );
520 void copyPage(
int from );
522 void selectPage(
int pgNum,
bool select );
523 void clipboardDataChanged();
525 void slotRepaintChanged( KPrTextObject * );
527 static void writeAutomaticStyles( KoXmlWriter& contentWriter, KoGenStyles& mainStyles, KoSavingContext& context,
bool stylesDotXml );
529 void slotGuideLinesChanged( KoView *view );
531 virtual void initEmpty();
534 void enablePaste(
bool );
535 void sig_refreshMenuCustomVariable();
536 void pageNumChanged();
537 void sig_updateRuler();
538 void sig_terminateEditing( KPrTextObject * );
539 void sig_updateMenuBar();
542 void slotDocumentRestored();
543 void slotCommandExecuted();
544 void slotDocumentInfoModifed();
546 virtual void openExistingFile(
const TQString& file );
547 virtual void openTemplate(
const TQString& file );
550 KoView* createViewInstance( TQWidget* parent,
const char* name );
551 void testAndCloseAllTextObjectProtectedContent();
556 virtual bool saveChildren( KoStore* _store );
558 void loadStyleTemplates(
const TQDomElement &styles );
559 void saveStyle( KoParagStyle *sty, TQDomElement parentElem );
561 TQDomDocumentFragment saveBackground( TQDomDocument& );
562 TQDomElement saveObjects( TQDomDocument &doc );
563 TQDomElement saveTitle( TQDomDocument &doc );
564 TQDomElement saveNote( TQDomDocument &doc );
565 TQDomElement saveAttribute( TQDomDocument &doc );
566 TQDomElement saveUsedSoundFileToXML( TQDomDocument &_doc, TQStringList _list );
567 void loadTextStyle(
const TQDomElement& domElement );
568 void saveEmbeddedObject(KPrPage *page, KoDocumentChild *chl,TQDomDocument &doc,TQDomElement &presenter,
double offset );
569 void saveGuideLines( TQDomDocument &doc, TQDomElement& element );
571 void loadBackground(
const TQDomElement &element );
572 void loadGuideLines(
const TQDomElement &element );
573 KCommand * loadObjects(
const TQDomElement &element,
bool paste=
false );
574 void loadTitle(
const TQDomElement &element );
575 void loadNote(
const TQDomElement &element );
576 void loadUsedSoundFileFromXML(
const TQDomElement &element );
578 virtual bool completeLoading( KoStore* );
579 void makeUsedPixmapList();
580 void makeUsedSoundFileList();
582 void saveUsedSoundFileToStore( KoStore *_store, TQStringList _list );
583 void loadUsedSoundFileFromStore( KoStore *_store, TQStringList _list );
584 void fillStyleStack(
const TQDomElement&
object, KoOasisContext & context,
const char* family );
588 int createPresentationAnimation(
const TQDomElement& element,
int order = 0 ,
bool increaseOrder =
true);
590 void saveOasisPresentationSettings( KoXmlWriter &contentTmpWriter, TQMap<int, TQString> &page2name );
591 void loadOasisPresentationSettings( TQDomNode &settingsDoc );
592 void saveOasisPresentationCustomSlideShow( KoXmlWriter &contentTmpWriter, TQMap<int, TQString> &page2name );
593 void loadOasisPresentationCustomSlideShow( TQDomNode &settingsDoc );
595 void loadOasisHeaderFooter( TQDomNode & drawPage, KoOasisContext & context);
597 void saveOasisSettings( KoXmlWriter &contentTmpWriter );
598 void loadOasisSettings(
const TQDomDocument&settingsDoc );
600 void saveOasisCustomFied( KoXmlWriter &writer )
const;
602 void loadOasisIgnoreList(
const KoOasisSettings& settings );
605 void compatibilityFromOldFileFormat();
607 void parseOasisGuideLines(
const TQString &str );
613 void pageOrderChanged();
617 bool _spInfiniteLoop, _spShowEndOfPresentationSlide, _spManualSwitch, _showPresentationDuration;
624 TQColor _otxtBackCol;
627 int objStartY, objStartNum;
631 KoPictureCollection m_pictureCollection;
634 KPrTextObject *_header, *_footer;
636 TQMap<KoPictureKey, TQString> m_pictureMap;
638 CustomSlideShowMap m_customListSlideShow;
641 KoPageLayout __pgLayout;
646 TQValueList<KoPictureKey> usedPictures;
647 TQStringList usedSoundFile, haveNotOwnDiskSoundFile;
648 TQPtrList<KTempFile> tmpSoundFileList;
652 TQString m_tempFileInClipboard;
655 KoCommandHistory * m_commandHistory;
656 KoTextZoomHandler* m_zoomHandler;
657 TQFont m_defaultFont;
658 KoAutoFormat * m_autoFormat;
661 bool m_bShowStatusBar;
662 bool m_bAllowAutoFormat;
663 bool m_bShowGuideLines;
664 bool m_bViewFormattingChars;
672 int m_maxRecentFiles;
673 bool m_cursorInProtectectedArea;
674 KoVariableFormatCollection *m_varFormatCollection;
675 KPrVariableCollection *m_varColl;
680 TQValueList<double> m_hGuideLines;
682 TQValueList<double> m_vGuideLines;
684 TQPtrList<KPrPage> m_pageList;
685 TQPtrList<KPrPage> m_deletedPageList;
687 TQStringList m_spellCheckIgnoreList;
688 TQStringList m_spellCheckPersonalDict;
694 int m_insertFilePage;
695 KPrPage *m_initialActivePage;
696 KPrPage *m_pageWhereLoadObject;
697 KPrPage *m_masterPage;
698 KPrBgSpellCheck *m_bgSpellCheck;
699 KoStyleCollection *m_styleColl;
700 KPrObject *bgObjSpellChecked;
701 TQString m_picturePath;
702 bool m_bInsertDirectCursor;
703 TQString m_globalLanguage;
704 TQString m_presentationName;
705 bool m_bGlobalHyphenation;
707 TQValueList<int> *m_customListTest;
711 int m_childCountBeforeInsert;
Class: KPrGradientCollection Holds a collection of gradients, and is able to provide a gradient for a...
Temporary information used only during loading.