~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kspread/HeaderFooter.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 KSPREAD_HEADER_FOOTER
 
23
#define KSPREAD_HEADER_FOOTER
 
24
 
 
25
#include <KoPageLayout.h>
 
26
 
 
27
#include <QString>
 
28
 
 
29
#include "kspread_export.h"
 
30
 
 
31
namespace KSpread
 
32
{
 
33
class Sheet;
 
34
 
 
35
class KSPREAD_EXPORT HeaderFooter
 
36
{
 
37
public:
 
38
    explicit HeaderFooter(Sheet* sheet);
 
39
    ~HeaderFooter();
 
40
 
 
41
    QString headLeft(int _p, const QString &_t)const {
 
42
        if (m_headLeft.isNull()) return "";
 
43
        return completeHeading(m_headLeft, _p, _t);
 
44
    }
 
45
    QString headMid(int _p, const QString &_t)const {
 
46
        if (m_headMid.isNull()) return "";
 
47
        return completeHeading(m_headMid, _p, _t);
 
48
    }
 
49
    QString headRight(int _p, const QString &_t)const {
 
50
        if (m_headRight.isNull()) return "";
 
51
        return completeHeading(m_headRight, _p, _t);
 
52
    }
 
53
    QString footLeft(int _p, const QString &_t)const {
 
54
        if (m_footLeft.isNull()) return "";
 
55
        return completeHeading(m_footLeft, _p, _t);
 
56
    }
 
57
    QString footMid(int _p, const QString &_t)const {
 
58
        if (m_footMid.isNull()) return "";
 
59
        return completeHeading(m_footMid, _p, _t);
 
60
    }
 
61
    QString footRight(int _p, const QString &_t)const {
 
62
        if (m_footRight.isNull()) return "";
 
63
        return completeHeading(m_footRight, _p, _t);
 
64
    }
 
65
 
 
66
    QString headLeft()const {
 
67
        if (m_headLeft.isNull()) return ""; return m_headLeft;
 
68
    }
 
69
    QString headMid()const {
 
70
        if (m_headMid.isNull()) return ""; return m_headMid;
 
71
    }
 
72
    QString headRight()const {
 
73
        if (m_headRight.isNull()) return ""; return m_headRight;
 
74
    }
 
75
    QString footLeft()const {
 
76
        if (m_footLeft.isNull()) return ""; return m_footLeft;
 
77
    }
 
78
    QString footMid()const {
 
79
        if (m_footMid.isNull()) return ""; return m_footMid;
 
80
    }
 
81
    QString footRight()const {
 
82
        if (m_footRight.isNull()) return ""; return m_footRight;
 
83
    }
 
84
 
 
85
    /**
 
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.
 
90
     */
 
91
    void replaceHeadFootLineMacro(QString &_text, const QString &_search, const QString &_replace) const;
 
92
 
 
93
    /**
 
94
     * Replaces in _text all page macros by the i18n-version of the macros
 
95
     */
 
96
    QString localizeHeadFootLine(const QString &_text) const;
 
97
 
 
98
    /**
 
99
     * Replaces in _text all i18n-versions of the page macros by the internal version of the macros
 
100
     */
 
101
    QString delocalizeHeadFootLine(const QString &_text) const;
 
102
 
 
103
    /**
 
104
     * Sets the head and foot line of the print out
 
105
     */
 
106
    void setHeadFootLine(const QString &_headl, const QString &_headm, const QString &_headr,
 
107
                         const QString &_footl, const QString &_footm, const QString &_footr);
 
108
 
 
109
private:
 
110
    /**
 
111
     * Replaces macros like <name>, <file>, <date> etc. in the string and
 
112
     * returns the modified one.
 
113
     *
 
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.
 
116
     */
 
117
    QString completeHeading(const QString &_data, int _page, const QString &_sheet) const ;
 
118
 
 
119
    Sheet *m_pSheet;
 
120
 
 
121
    /**
 
122
     * Header string. The string may contains makros. That means
 
123
     * it has to be processed before printing.
 
124
     */
 
125
    QString m_headLeft;
 
126
 
 
127
    /**
 
128
     * Header string. The string may contains makros. That means
 
129
     * it has to be processed before printing.
 
130
     */
 
131
    QString m_headRight;
 
132
 
 
133
    /**
 
134
     * Header string. The string may contains makros. That means
 
135
     * it has to be processed before printing.
 
136
     */
 
137
    QString m_headMid;
 
138
 
 
139
    /**
 
140
     * Footer string. The string may contains makros. That means
 
141
     * it has to be processed before printing.
 
142
     */
 
143
    QString m_footLeft;
 
144
 
 
145
    /**
 
146
     * Footer string. The string may contains makros. That means
 
147
     * it has to be processed before printing.
 
148
     */
 
149
    QString m_footRight;
 
150
 
 
151
    /**
 
152
     * Footer string. The string may contains makros. That means
 
153
     * it has to be processed before printing.
 
154
     */
 
155
    QString m_footMid;
 
156
};
 
157
 
 
158
} // namespace KSpread
 
159
 
 
160
#endif // KSPREAD_HEADER_FOOTER