1 | /* This file is part of the KDE project |
2 | Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> |
3 | Copyright 2003 Philipp Müller <philipp.mueller@gmx.de> |
4 | Copyright 1998, 1999 Torben Weis <weis@kde.org>, |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef CALLIGRA_SHEETS_HEADER_FOOTER |
23 | #define CALLIGRA_SHEETS_HEADER_FOOTER |
24 | |
25 | #include <KoPageLayout.h> |
26 | |
27 | #include <QString> |
28 | |
29 | #include "calligra_sheets_export.h" |
30 | |
31 | namespace Calligra |
32 | { |
33 | namespace Sheets |
34 | { |
35 | class Sheet; |
36 | |
37 | class CALLIGRA_SHEETS_ODF_EXPORT |
38 | { |
39 | public: |
40 | explicit (Sheet* sheet); |
41 | (); |
42 | |
43 | QString (int _p, const QString &_t)const { |
44 | if (m_headLeft.isNull()) return "" ; |
45 | return completeHeading(m_headLeft, _p, _t); |
46 | } |
47 | QString (int _p, const QString &_t)const { |
48 | if (m_headMid.isNull()) return "" ; |
49 | return completeHeading(m_headMid, _p, _t); |
50 | } |
51 | QString (int _p, const QString &_t)const { |
52 | if (m_headRight.isNull()) return "" ; |
53 | return completeHeading(m_headRight, _p, _t); |
54 | } |
55 | QString (int _p, const QString &_t)const { |
56 | if (m_footLeft.isNull()) return "" ; |
57 | return completeHeading(m_footLeft, _p, _t); |
58 | } |
59 | QString (int _p, const QString &_t)const { |
60 | if (m_footMid.isNull()) return "" ; |
61 | return completeHeading(m_footMid, _p, _t); |
62 | } |
63 | QString (int _p, const QString &_t)const { |
64 | if (m_footRight.isNull()) return "" ; |
65 | return completeHeading(m_footRight, _p, _t); |
66 | } |
67 | |
68 | QString ()const { |
69 | if (m_headLeft.isNull()) return "" ; return m_headLeft; |
70 | } |
71 | QString ()const { |
72 | if (m_headMid.isNull()) return "" ; return m_headMid; |
73 | } |
74 | QString ()const { |
75 | if (m_headRight.isNull()) return "" ; return m_headRight; |
76 | } |
77 | QString ()const { |
78 | if (m_footLeft.isNull()) return "" ; return m_footLeft; |
79 | } |
80 | QString ()const { |
81 | if (m_footMid.isNull()) return "" ; return m_footMid; |
82 | } |
83 | QString ()const { |
84 | if (m_footRight.isNull()) return "" ; return m_footRight; |
85 | } |
86 | |
87 | /** |
88 | * Replaces in _text all _search text parts by _replace text parts. |
89 | * Included is a test to not change if _search == _replace. |
90 | * The arguments should not include neither the beginning "<" nor the leading ">", this is already |
91 | * included internally. |
92 | */ |
93 | void (QString &_text, const QString &_search, const QString &_replace) const; |
94 | |
95 | /** |
96 | * Replaces in _text all page macros by the i18n-version of the macros |
97 | */ |
98 | QString (const QString &_text) const; |
99 | |
100 | /** |
101 | * Replaces in _text all i18n-versions of the page macros by the internal version of the macros |
102 | */ |
103 | QString (const QString &_text) const; |
104 | |
105 | /** |
106 | * Sets the head and foot line of the print out |
107 | */ |
108 | void (const QString &_headl, const QString &_headm, const QString &_headr, |
109 | const QString &, const QString &, const QString &); |
110 | |
111 | private: |
112 | /** |
113 | * Replaces macros like <name>, <file>, <date> etc. in the string and |
114 | * returns the modified one. |
115 | * |
116 | * @param _page is the page number for which the heading is produced. |
117 | * @param _Sheet is the name of the Sheet for which we generate the headings. |
118 | */ |
119 | QString (const QString &_data, int _page, const QString &_sheet) const ; |
120 | |
121 | Sheet *; |
122 | |
123 | /** |
124 | * Header string. The string may contains makros. That means |
125 | * it has to be processed before printing. |
126 | */ |
127 | QString ; |
128 | |
129 | /** |
130 | * Header string. The string may contains makros. That means |
131 | * it has to be processed before printing. |
132 | */ |
133 | QString ; |
134 | |
135 | /** |
136 | * Header string. The string may contains makros. That means |
137 | * it has to be processed before printing. |
138 | */ |
139 | QString ; |
140 | |
141 | /** |
142 | * Footer string. The string may contains makros. That means |
143 | * it has to be processed before printing. |
144 | */ |
145 | QString ; |
146 | |
147 | /** |
148 | * Footer string. The string may contains makros. That means |
149 | * it has to be processed before printing. |
150 | */ |
151 | QString ; |
152 | |
153 | /** |
154 | * Footer string. The string may contains makros. That means |
155 | * it has to be processed before printing. |
156 | */ |
157 | QString ; |
158 | }; |
159 | |
160 | } // namespace Sheets |
161 | } // namespace Calligra |
162 | |
163 | #endif // CALLIGRA_SHEETS_HEADER_FOOTER |
164 | |