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>,
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.
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.
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.
22
#ifndef KSPREAD_HEADER_FOOTER
23
#define KSPREAD_HEADER_FOOTER
25
#include <KoPageLayout.h>
29
#include "kspread_export.h"
35
class KSPREAD_EXPORT HeaderFooter
38
explicit HeaderFooter(Sheet* sheet);
41
QString headLeft(int _p, const QString &_t)const {
42
if (m_headLeft.isNull()) return "";
43
return completeHeading(m_headLeft, _p, _t);
45
QString headMid(int _p, const QString &_t)const {
46
if (m_headMid.isNull()) return "";
47
return completeHeading(m_headMid, _p, _t);
49
QString headRight(int _p, const QString &_t)const {
50
if (m_headRight.isNull()) return "";
51
return completeHeading(m_headRight, _p, _t);
53
QString footLeft(int _p, const QString &_t)const {
54
if (m_footLeft.isNull()) return "";
55
return completeHeading(m_footLeft, _p, _t);
57
QString footMid(int _p, const QString &_t)const {
58
if (m_footMid.isNull()) return "";
59
return completeHeading(m_footMid, _p, _t);
61
QString footRight(int _p, const QString &_t)const {
62
if (m_footRight.isNull()) return "";
63
return completeHeading(m_footRight, _p, _t);
66
QString headLeft()const {
67
if (m_headLeft.isNull()) return ""; return m_headLeft;
69
QString headMid()const {
70
if (m_headMid.isNull()) return ""; return m_headMid;
72
QString headRight()const {
73
if (m_headRight.isNull()) return ""; return m_headRight;
75
QString footLeft()const {
76
if (m_footLeft.isNull()) return ""; return m_footLeft;
78
QString footMid()const {
79
if (m_footMid.isNull()) return ""; return m_footMid;
81
QString footRight()const {
82
if (m_footRight.isNull()) return ""; return m_footRight;
86
* Replaces in _text all _search text parts by _replace text parts.
87
* Included is a test to not change if _search == _replace.
88
* The arguments should not include neither the beginning "<" nor the leading ">", this is already
89
* included internally.
91
void replaceHeadFootLineMacro(QString &_text, const QString &_search, const QString &_replace) const;
94
* Replaces in _text all page macros by the i18n-version of the macros
96
QString localizeHeadFootLine(const QString &_text) const;
99
* Replaces in _text all i18n-versions of the page macros by the internal version of the macros
101
QString delocalizeHeadFootLine(const QString &_text) const;
104
* Sets the head and foot line of the print out
106
void setHeadFootLine(const QString &_headl, const QString &_headm, const QString &_headr,
107
const QString &_footl, const QString &_footm, const QString &_footr);
111
* Replaces macros like <name>, <file>, <date> etc. in the string and
112
* returns the modified one.
114
* @param _page is the page number for which the heading is produced.
115
* @param _Sheet is the name of the Sheet for which we generate the headings.
117
QString completeHeading(const QString &_data, int _page, const QString &_sheet) const ;
122
* Header string. The string may contains makros. That means
123
* it has to be processed before printing.
128
* Header string. The string may contains makros. That means
129
* it has to be processed before printing.
134
* Header string. The string may contains makros. That means
135
* it has to be processed before printing.
140
* Footer string. The string may contains makros. That means
141
* it has to be processed before printing.
146
* Footer string. The string may contains makros. That means
147
* it has to be processed before printing.
152
* Footer string. The string may contains makros. That means
153
* it has to be processed before printing.
158
} // namespace KSpread
160
#endif // KSPREAD_HEADER_FOOTER