/src/libstaroffice/src/lib/STOFFPageSpan.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
2 | | |
3 | | /* libstaroffice |
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 STOFFPAGESPAN_H |
35 | | #define STOFFPAGESPAN_H |
36 | | |
37 | | #include <map> |
38 | | #include <vector> |
39 | | |
40 | | #include "libstaroffice_internal.hxx" |
41 | | |
42 | | #include "STOFFFont.hxx" |
43 | | #include "STOFFSection.hxx" |
44 | | |
45 | | class STOFFListener; |
46 | | |
47 | | /** a class which stores the header/footer */ |
48 | | class STOFFHeaderFooter |
49 | | { |
50 | | public: |
51 | | //! the different type |
52 | | enum Type { R_Left=0, R_Center, R_Right, R_All }; |
53 | | //! constructor |
54 | | STOFFHeaderFooter() |
55 | 29.1k | { |
56 | 29.1k | } |
57 | | //! destructor |
58 | | ~STOFFHeaderFooter() |
59 | 57.6k | { |
60 | 57.6k | } |
61 | | //! operator== |
62 | | bool operator==(STOFFHeaderFooter const &headerFooter) const; |
63 | | //! operator!= |
64 | | bool operator!=(STOFFHeaderFooter const &headerFooter) const |
65 | 0 | { |
66 | 0 | return !operator==(headerFooter); |
67 | 0 | } |
68 | | /** send to header to the listener */ |
69 | | void send(STOFFListener *listener, bool header) const; |
70 | | //! the document data: left, center, right, all |
71 | | STOFFSubDocumentPtr m_subDocument[4]; |
72 | | }; |
73 | | |
74 | | /** A class which defines the page properties */ |
75 | | class STOFFPageSpan |
76 | | { |
77 | | public: |
78 | | /** the zone type */ |
79 | | enum ZoneType { Page=0, Header, Footer }; |
80 | | public: |
81 | | //! constructor |
82 | | STOFFPageSpan(); |
83 | 266k | STOFFPageSpan(STOFFPageSpan const &)=default; |
84 | 298 | STOFFPageSpan(STOFFPageSpan &&)=default; |
85 | 667k | STOFFPageSpan &operator=(STOFFPageSpan const &)=default; |
86 | 333k | STOFFPageSpan &operator=(STOFFPageSpan &&)=default; |
87 | | //! destructor |
88 | | ~STOFFPageSpan(); |
89 | | |
90 | | //! add a header on some page: occurrence must be odd|right, even|left, first, last or all |
91 | | void addHeaderFooter(bool header, std::string const &occurrence, STOFFHeaderFooter const &hf); |
92 | | //! operator== |
93 | | bool operator==(std::shared_ptr<STOFFPageSpan> const &pageSpan) const; |
94 | | //! operator!= |
95 | | bool operator!=(std::shared_ptr<STOFFPageSpan> const &pageSpan) const |
96 | 0 | { |
97 | 0 | return !operator==(pageSpan); |
98 | 0 | } |
99 | | |
100 | | // interface with STOFFListener |
101 | | |
102 | | //! add the page properties in pList |
103 | | void getPageProperty(librevenge::RVNGPropertyList &pList) const; |
104 | | //! send the page's headers/footers if some exists |
105 | | void sendHeaderFooters(STOFFListener *listener) const; |
106 | | |
107 | | //! the number of page |
108 | | int m_pageSpan; |
109 | | //! the document, header and footer property list |
110 | | librevenge::RVNGPropertyList m_propertiesList[3]; |
111 | | //! the map occurrence to header/footer document |
112 | | std::map<std::string, STOFFHeaderFooter> m_occurrenceHFMap[2]; |
113 | | //! the main section |
114 | | STOFFSection m_section; |
115 | | //! the page number ( or -1) |
116 | | int m_pageNumber; |
117 | | }; |
118 | | |
119 | | #endif |
120 | | // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |