MWAWPageSpan.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef MWAWPAGESPAN_H
35 #define MWAWPAGESPAN_H
36 
37 #include <vector>
38 
39 #include "libmwaw_internal.hxx"
40 
41 #include "MWAWFont.hxx"
42 
43 class WPXPropertyList;
44 
47 {
48 public:
50  enum Type { HEADER, FOOTER, UNDEF };
52  enum Occurence { ODD, EVEN, ALL, NEVER };
55 
57  MWAWHeaderFooter(Type const type=UNDEF, Occurence const occurence=NEVER);
61  bool isDefined() const {
62  return m_type != UNDEF;
63  }
65  void send(MWAWContentListener *listener) const;
67  bool operator==(MWAWHeaderFooter const &headerFooter) const;
69  bool operator!=(MWAWHeaderFooter const &headerFooter) const {
70  return !operator==(headerFooter);
71  }
73  void insertPageNumberParagraph(MWAWContentListener *listener) const;
74 
75 public:
81  double m_height;
90 };
91 
92 typedef shared_ptr<MWAWHeaderFooter> MWAWHeaderFooterPtr;
93 
96 {
97  friend class MWAWContentListener;
98 public:
104  };
105 public:
107  MWAWPageSpan();
109  virtual ~MWAWPageSpan();
110 
112  double getFormLength() const {
113  return m_formLength;
114  }
116  double getFormWidth() const {
117  return m_formWidth;
118  }
121  return m_formOrientation;
122  }
124  double getMarginLeft() const {
125  return m_margins[libmwaw::Left];
126  }
128  double getMarginRight() const {
129  return m_margins[libmwaw::Right];
130  }
132  double getMarginTop() const {
133  return m_margins[libmwaw::Top];
134  }
136  double getMarginBottom() const {
137  return m_margins[libmwaw::Bottom];
138  }
140  double getPageLength() const {
142  }
144  double getPageWidth() const {
146  }
149  return m_backgroundColor;
150  }
151  int getPageNumber() const {
152  return m_pageNumber;
153  }
154  int getPageSpan() const {
155  return m_pageSpan;
156  }
157 
159  void setHeaderFooter(MWAWHeaderFooter const &headerFooter);
161  void setFormLength(const double formLength) {
162  m_formLength = formLength;
163  }
165  void setFormWidth(const double formWidth) {
166  m_formWidth = formWidth;
167  }
169  void setFormOrientation(const FormOrientation formOrientation) {
170  m_formOrientation = formOrientation;
171  }
173  void setMarginLeft(const double marginLeft) {
174  m_margins[libmwaw::Left] = (marginLeft > 0) ? marginLeft : 0.01;
175  }
177  void setMarginRight(const double marginRight) {
178  m_margins[libmwaw::Right] = (marginRight > 0) ? marginRight : 0.01;
179  }
181  void setMarginTop(const double marginTop) {
182  m_margins[libmwaw::Top] =(marginTop > 0) ? marginTop : 0.01;
183  }
185  void setMarginBottom(const double marginBottom) {
186  m_margins[libmwaw::Bottom] = (marginBottom > 0) ? marginBottom : 0.01;
187  }
190  if (margin <= 0.0) margin = 0.01;
191  if (wh&libmwaw::LeftBit)
192  m_margins[libmwaw::Left]=margin;
193  if (wh&libmwaw::RightBit)
194  m_margins[libmwaw::Right]=margin;
195  if (wh&libmwaw::TopBit)
196  m_margins[libmwaw::Top]=margin;
197  if (wh&libmwaw::BottomBit)
198  m_margins[libmwaw::Bottom]=margin;
199  }
201  void checkMargins();
204  m_backgroundColor=color;
205  }
207  void setPageNumber(const int pageNumber) {
208  m_pageNumber = pageNumber;
209  }
211  void setPageSpan(const int pageSpan) {
212  m_pageSpan = pageSpan;
213  }
215  bool operator==(shared_ptr<MWAWPageSpan> const &pageSpan) const;
217  bool operator!=(shared_ptr<MWAWPageSpan> const &pageSpan) const {
218  return !operator==(pageSpan);
219  }
220 protected:
221  // interface with MWAWContentListener
223  void getPageProperty(WPXPropertyList &pList) const;
225  void sendHeaderFooters(MWAWContentListener *listener) const;
226 
227 protected:
234 private:
239  double m_margins[4];
245  std::vector<MWAWHeaderFooter> m_headerFooterList;
248 };
249 
250 #endif
251 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Wed Jul 10 2013 18:02:03 for libmwaw by doxygen 1.8.4