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 
45 {
46 public:
48  enum Type { HEADER, FOOTER, UNDEF };
50  enum Occurrence { ODD, EVEN, ALL, NEVER };
53 
55  MWAWHeaderFooter(Type const type=UNDEF, Occurrence const occurrence=NEVER);
59  bool isDefined() const
60  {
61  return m_type != UNDEF;
62  }
64  void send(MWAWListener *listener) const;
66  bool operator==(MWAWHeaderFooter const &headerFooter) const;
68  bool operator!=(MWAWHeaderFooter const &headerFooter) const
69  {
70  return !operator==(headerFooter);
71  }
73  void insertPageNumberParagraph(MWAWListener *listener) const;
74 
75 public:
81  double m_height;
90 };
91 
92 typedef shared_ptr<MWAWHeaderFooter> MWAWHeaderFooterPtr;
93 
96 {
97 public:
103  };
104 public:
106  MWAWPageSpan();
108  virtual ~MWAWPageSpan();
109 
111  double getFormLength() const
112  {
113  return m_formLength;
114  }
116  double getFormWidth() const
117  {
118  return m_formWidth;
119  }
122  {
123  return m_formOrientation;
124  }
126  double getMarginLeft() const
127  {
128  return m_margins[libmwaw::Left];
129  }
131  double getMarginRight() const
132  {
133  return m_margins[libmwaw::Right];
134  }
136  double getMarginTop() const
137  {
138  return m_margins[libmwaw::Top];
139  }
141  double getMarginBottom() const
142  {
143  return m_margins[libmwaw::Bottom];
144  }
146  double getPageLength() const
147  {
149  }
151  double getPageWidth() const
152  {
154  }
157  {
158  return m_backgroundColor;
159  }
160  int getPageNumber() const
161  {
162  return m_pageNumber;
163  }
164  int getPageSpan() const
165  {
166  return m_pageSpan;
167  }
168 
170  void setHeaderFooter(MWAWHeaderFooter const &headerFooter);
172  void setFormLength(const double formLength)
173  {
174  m_formLength = formLength;
175  }
177  void setFormWidth(const double formWidth)
178  {
179  m_formWidth = formWidth;
180  }
182  void setFormOrientation(const FormOrientation formOrientation)
183  {
184  m_formOrientation = formOrientation;
185  }
187  void setMarginLeft(const double marginLeft)
188  {
189  m_margins[libmwaw::Left] = (marginLeft >= 0) ? marginLeft : 0.01;
190  }
192  void setMarginRight(const double marginRight)
193  {
194  m_margins[libmwaw::Right] = (marginRight >= 0) ? marginRight : 0.01;
195  }
197  void setMarginTop(const double marginTop)
198  {
199  m_margins[libmwaw::Top] =(marginTop >= 0) ? marginTop : 0.01;
200  }
202  void setMarginBottom(const double marginBottom)
203  {
204  m_margins[libmwaw::Bottom] = (marginBottom >= 0) ? marginBottom : 0.01;
205  }
208  {
209  if (margin < 0.0) margin = 0.01;
210  if (wh&libmwaw::LeftBit)
211  m_margins[libmwaw::Left]=margin;
212  if (wh&libmwaw::RightBit)
213  m_margins[libmwaw::Right]=margin;
214  if (wh&libmwaw::TopBit)
215  m_margins[libmwaw::Top]=margin;
216  if (wh&libmwaw::BottomBit)
217  m_margins[libmwaw::Bottom]=margin;
218  }
220  void checkMargins();
222  void setPageName(librevenge::RVNGString const &name)
223  {
224  m_name=name;
225  }
227  bool hasPageName() const
228  {
229  return !m_name.empty();
230  }
232  librevenge::RVNGString const &getPageName() const
233  {
234  return m_name;
235  }
237  void setMasterPageName(librevenge::RVNGString const &name)
238  {
239  m_masterName=name;
240  }
242  bool hasMasterPageName() const
243  {
244  return !m_masterName.empty();
245  }
247  librevenge::RVNGString const &getMasterPageName() const
248  {
249  return m_masterName;
250  }
253  {
254  m_backgroundColor=color;
255  }
257  void setPageNumber(const int pageNumber)
258  {
259  m_pageNumber = pageNumber;
260  }
262  void setPageSpan(const int pageSpan)
263  {
264  m_pageSpan = pageSpan;
265  }
267  bool operator==(shared_ptr<MWAWPageSpan> const &pageSpan) const;
269  bool operator!=(shared_ptr<MWAWPageSpan> const &pageSpan) const
270  {
271  return !operator==(pageSpan);
272  }
273 
274  // interface with MWAWListener
276  void getPageProperty(librevenge::RVNGPropertyList &pList) const;
278  void sendHeaderFooters(MWAWListener *listener) const;
280  void sendHeaderFooters(MWAWListener *listener, MWAWHeaderFooter::Occurrence occurrence) const;
281 
282 protected:
289 private:
294  double m_margins[4];
296  librevenge::RVNGString m_name;
298  librevenge::RVNGString m_masterName;
304  std::vector<MWAWHeaderFooter> m_headerFooterList;
307 };
308 
309 #endif
310 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:50 for libmwaw by doxygen 1.8.4