KoPageLayoutHeader.cpp
1/* This file is part of the KDE project
2 * Copyright (C) 2005 Thomas Zander <zander@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; version 2.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public License
14 * along with this library; see the file COPYING.LIB. If not, write to
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
19#include <KoPageLayoutHeader.h>
20#include <KoPageLayoutHeader.moc>
21#include <KoUnitWidgets.h>
22
23#include <tqlayout.h>
24#include <tqcheckbox.h>
25
27 : KoPageLayoutHeaderBase(parent) {
28 m_headerFooters = kwhf;
29 TQHBoxLayout *lay = new TQHBoxLayout(headerSpacingPane);
30 m_headerSpacing = new KoUnitDoubleSpinBox( headerSpacingPane, 0.0, 999.0, 0.5, kwhf.ptHeaderBodySpacing, unit );
31 lay->addWidget(m_headerSpacing);
32
33 lay = new TQHBoxLayout(footerSpacingPane);
34 m_footerSpacing = new KoUnitDoubleSpinBox( footerSpacingPane, 0.0, 999.0, 0.5, kwhf.ptFooterBodySpacing, unit );
35 lay->addWidget(m_footerSpacing);
36
37 lay = new TQHBoxLayout(footnotePane);
38 m_footnoteSpacing = new KoUnitDoubleSpinBox( footnotePane, 0.0, 999.0, 0.5, kwhf.ptFootNoteBodySpacing, unit );
39 lay->addWidget(m_footnoteSpacing);
40
41 if ( kwhf.header == HF_FIRST_DIFF || kwhf.header == HF_FIRST_EO_DIFF )
42 rhFirst->setChecked( true );
43 if ( kwhf.header == HF_EO_DIFF || kwhf.header == HF_FIRST_EO_DIFF )
44 rhEvenOdd->setChecked( true );
45 if ( kwhf.footer == HF_FIRST_DIFF || kwhf.footer == HF_FIRST_EO_DIFF )
46 rfFirst->setChecked( true );
47 if ( kwhf.footer == HF_EO_DIFF || kwhf.footer == HF_FIRST_EO_DIFF )
48 rfEvenOdd->setChecked( true );
49}
50
52 if ( rhFirst->isChecked() && rhEvenOdd->isChecked() )
53 m_headerFooters.header = HF_FIRST_EO_DIFF;
54 else if ( rhFirst->isChecked() )
55 m_headerFooters.header = HF_FIRST_DIFF;
56 else if ( rhEvenOdd->isChecked() )
57 m_headerFooters.header = HF_EO_DIFF;
58 else
59 m_headerFooters.header = HF_SAME;
60
61 m_headerFooters.ptHeaderBodySpacing = m_headerSpacing->value();
62 m_headerFooters.ptFooterBodySpacing = m_footerSpacing->value();
63 m_headerFooters.ptFootNoteBodySpacing = m_footnoteSpacing->value();
64 if ( rfFirst->isChecked() && rfEvenOdd->isChecked() )
65 m_headerFooters.footer = HF_FIRST_EO_DIFF;
66 else if ( rfFirst->isChecked() )
67 m_headerFooters.footer = HF_FIRST_DIFF;
68 else if ( rfEvenOdd->isChecked() )
69 m_headerFooters.footer = HF_EO_DIFF;
70 else
71 m_headerFooters.footer = HF_SAME;
72 return m_headerFooters;
73}
KoPageLayoutHeader(TQWidget *parent, KoUnit::Unit unit, const KoKWHeaderFooter &kwhf)
Contructor.
const KoKWHeaderFooter & headerFooter()
Spin box for double precision numbers with unit display.
double value(void) const
Unit
Length units supported by KOffice.
Definition KoUnit.h:63
structure for KWord header-footer