Scribus
Open source desktop publishing at your fingertips
scpage.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  page.h - description
9  -------------------
10  begin : Sat Apr 7 2001
11  copyright : (C) 2001 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 
24 #ifndef SCPAGE_H
25 #define SCPAGE_H
26 
27 #include <utility>
28 
29 #include <QList>
30 
31 #include "scribusapi.h"
32 #include "undostate.h"
33 #include "scribusstructs.h"
34 #include "guidemanagercore.h"
35 
36 class PageItem;
37 class QString;
38 class UndoManager;
39 class UndoState;
40 class ScribusDoc;
41 
42 
46 class SCRIBUS_API ScPage : public UndoObject, public SingleObservable<ScPage>
47 {
48 public:
49  ScPage(const double x, const double y, const double b, const double h);
50  ~ScPage();
51  double xOffset() const { return m_xOffset; }
52  double yOffset() const { return m_yOffset; }
53  double width() const { return m_width; }
54  double height() const { return m_height; }
55  double initialWidth() const { return m_initialWidth; }
56  double initialHeight() const { return m_initialHeight; }
57  int orientation() const { return m_orientation; }
58  void setXOffset(const double);
59  void setYOffset(const double);
60  void setWidth(const double);
61  void setHeight(const double);
62  void setInitialWidth(const double);
63  void setInitialHeight(const double);
64  void setOrientation(int);
65  void copySizingProperties(ScPage *sourcePage, const MarginStruct& pageMargins);
66  MarginStruct margins() const { return Margins; }
67  double leftMargin() const { return Margins.left(); }
68  double topMargin() const { return Margins.top(); }
69  double bottomMargin() const { return Margins.bottom(); }
70  double rightMargin() const { return Margins.right(); }
71 
73  MarginStruct initialMargins;
75  int LeftPg;
77  QString MPageNam;
78 
79  QString m_pageSize;
80  int marginPreset;
81  ScribusDoc* doc() const { return m_Doc; }
82  void setDocument(ScribusDoc* doc);
83  int pageNr() const { return m_pageNr; }
84  void setPageNr(int pageNr);
85  const QString& pageSectionNumber() const { return m_pageSectionNumber; }
86  void setPageSectionNumber(const QString&);
88  const QString& pageName() const {return m_PageName;};
89  void setPageName(const QString& newName);
90  void restore(UndoState* state, bool isUndo);
91 
97  mutable QList<PageItem*> FromMaster;
100  PDFPresentationData PresentVals;
101 
102 protected:
103  UndoManager * const undoManager;
104  void restorePageItemCreation(ScItemState<PageItem*> *state, bool isUndo);
105  void restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, bool isUndo);
106  void restorePageAttributes(SimpleState *state, bool isUndo);
107  void restorePageItemConversion(ScItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo);
108  void restorePageItemConversionToSymbol(ScItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo);
109 
110  double m_xOffset;
111  double m_yOffset;
112  double m_width;
113  double m_height;
114  double m_initialWidth;
115  double m_initialHeight;
116  int m_pageNr;
117  int m_orientation;
119  QString m_PageName;
120  ScribusDoc* m_Doc;
121  QString m_pageSectionNumber;
122 };
123 
124 Q_DECLARE_METATYPE(ScPage*);
125 
126 #endif
Definition: scribusstructs.h:171
double right
Definition: api_document.h:119
int LeftPg
Definition: scpage.h:75
GuideManagerCore guides
Guides lists and basic operations.
Definition: scpage.h:99
Pagemargins and bleeds.
Definition: margins.h:25
double left
Definition: api_document.h:118
Definition: scpage.h:46
UndoState describes an undoable state (action).
Definition: undostate.h:59
Definition: observable.h:159
double top
Definition: api_document.h:117
Core manipulation with the guides. Basic idea:
Definition: guidemanagercore.h:36
the Document Class
Definition: scribusdoc.h:90
Definition: undostate.h:291
Superclass for all objects that are wanted to have undoable actions.
Definition: undoobject.h:59
const QString & pageName() const
Return the page's name.
Definition: scpage.h:88
double bottom
Definition: api_document.h:120
QString MPageNam
Name of the master page that this page uses.
Definition: scpage.h:77
Definition: pageitem.h:92
UndoManager handles the undo stack.
Definition: undomanager.h:81
QList< PageItem * > FromMaster
As a bit of a dirty hack, we declare this mutable so it can be altered even while the object is `cons...
Definition: scpage.h:97
Definition: api_document.h:114
QString m_PageName
Name of this page, currently only allowed to be used by a master page.
Definition: scpage.h:119
SimpleState provides a simple implementation of the UndoState.
Definition: undostate.h:145
virtual void restore(UndoState *state, bool isUndo)=0
Method used when an undo/redo is requested.