/* For general Scribus (>=1.3.2) copyright and licensing information please refer to the COPYING file provided with the program. Following this notice may exist a copyright and/or license notice that predates the release of Scribus 1.3.2 for which a new license (GPL+exception) is in place. */ /*!************************************************************************* page.h - description ------------------- begin : Sat Apr 7 2001 copyright : (C) 2001 by Franz Schmid email : Franz.Schmid@altmuehlnet.de ***************************************************************************/ /*!************************************************************************* * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef PAGE_H #define PAGE_H #include #include #include "scribusapi.h" #include "undostate.h" #include "scribusstructs.h" #include "guidemanagercore.h" class PageItem; class QString; class UndoManager; class UndoState; class ScribusDoc; /*! *@author Franz Schmid */ class SCRIBUS_API Page : public UndoObject, public SingleObservable { public: /*! * Create a new Page. * @param xOffset page's X offset * @param yOffset page's Y offset * @param width page's width * @param height page's height */ Page(const double xOffset, const double yOffset, const double width, const double height); ~Page(); /*! Get the page's X offset. */ double xOffset() const { return m_xOffset; } /*! Get the page's Y offset. */ double yOffset() const { return m_yOffset; } /*! Get the page's width. */ double width() const { return m_width; } /*! Get the page's height. */ double height() const { return m_height; } /*! Get the initial page's width. */ double initialWidth() const { return m_initialWidth; } /*! Get the initial page's height. */ double initialHeight() const { return m_initialHeight; } /*! Set the page's X offset. */ void setXOffset(const double); /*! Set the page's Y offset. */ void setYOffset(const double); /*! Set the page's width. */ void setWidth(const double); /*! Set the page's height. */ void setHeight(const double); /*! Set the initial page's width. */ void setInitialWidth(const double); /*! Set the initial page's height. */ void setInitialHeight(const double); //ivro: create functions to set margins and initial margins ? // void setMargins(MarginsStruct& margins); // void setInitialMargins(MarginStruct& margins); /*! Get the scribus document this page belongs to. */ ScribusDoc* doc() const { return m_Doc; } /*! Set the scribus document this page belongs to. */ void setDocument(ScribusDoc*); /*! Get the page's number. */ int pageNr() const { return m_pageNr; } /*! Set the page's number. */ void setPageNr(int); /*! Get the page's section number. */ const QString& pageSectionNumber() const { return m_pageSectionNumber; } /*! Set the page's section number. */ void setPageSectionNumber(const QString&); /*! Get the page's name. */ const QString& pageName() const {return m_PageName;}; /*! Set the page's name. */ void setPageName(const QString&); /*! * Copy page's sizing properties. * Copy X offset, Y offset, width, height, initial width and initial height from page * And uses pageMargins to set margins and initial margins * @param sourcePage page to copy * @param pageMargins margins to use */ void copySizingProperties(Page *sourcePage, const MarginStruct& pageMargins); public: MarginStruct Margins; /*!< Current page's margins. */ MarginStruct initialMargins; /*!< Initial page's margins. */ int LeftPg; /*!< Page's location in the document. 1 for left page, 0 for right page, 2 for middle page. */ //ivro: rename masterPageName ? QString MPageNam; /*!< Name of the Master page this page uses. */ QString m_pageSize; /*!< Page's size name. */ //ivro: use the scribusstruct PageOrientation enum ? int PageOri; /*!< Page's orientation. 0 = Portrait, 1 = Landscape. */ int marginPreset; void restore(UndoState* state, bool isUndo); /*! As a bit of a dirty hack, we declare this mutable so it can be altered even while the object is `const'. That's normally only for internal implementation, but in this case it at least lets us guarantee the rest of the object is unchanged in (eg) pdflib. This should be replaced with proper access methods later. */ mutable QList FromMaster; GuideManagerCore guides; /*!< Guides lists and basic operations. */ protected: UndoManager * const undoManager; void restorePageItemCreation(ItemState *state, bool isUndo); void restorePageItemDeletion(ItemState *state, bool isUndo); void restorePageItemConversion(ItemState >*state, bool isUndo); double m_xOffset; /*!< Page's X offset. */ double m_yOffset; /*!< Page's Y offset. */ double m_width; /*!< Page's width. */ double m_height; /*!< Page's height. */ double m_initialWidth; /*!< Initial page's width. */ double m_initialHeight; /*!< Initial page's height. */ int m_pageNr; /*!< Page's number. */ QString m_PageName; /*!< Page's name. */ ScribusDoc* m_Doc; /*!< Scribus document this page belongs to. */ QString m_pageSectionNumber; /*!< Page's section number. */ }; Q_DECLARE_METATYPE(Page*); #endif