File indexing completed on 2024-05-05 12:57:27
0001 /* 0002 * Copyright (C) 2010-2015 by Stephen Allewell 0003 * steve.allewell@gmail.com 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 */ 0010 0011 #ifndef Page_H 0012 #define Page_H 0013 0014 #include <QDataStream> 0015 #include <QList> 0016 #include <QMargins> 0017 #include <QPrinter> 0018 0019 class Document; 0020 class Element; 0021 class QPainter; 0022 0023 class Page : public QPageLayout 0024 { 0025 public: 0026 explicit Page(QPageSize pageSize = QPageSize(QPageSize::A4), QPageLayout::Orientation orientation = QPageLayout::Portrait); 0027 Page(const Page &); 0028 ~Page(); 0029 0030 Page &operator=(const Page &); 0031 0032 int pageNumber() const; 0033 const QList<Element *> elements() const; 0034 0035 void setPageNumber(int); 0036 0037 void addElement(Element *); 0038 void removeElement(Element *); 0039 0040 void render(Document *, QPainter *) const; 0041 0042 Element *itemAt(const QPoint &) const; 0043 0044 friend QDataStream &operator<<(QDataStream &, const Page &); 0045 friend QDataStream &operator>>(QDataStream &, Page &); 0046 0047 friend class PagePropertiesDlg; 0048 0049 private: 0050 void readElements(QDataStream &); 0051 0052 static const int version = 102; 0053 0054 int m_pageNumber; 0055 0056 QList<Element *> m_elements; 0057 }; 0058 0059 #endif // Page_H