00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <KoPageLayoutHeader.h>
00020 #include <KoPageLayoutHeader.moc>
00021 #include <KoUnitWidgets.h>
00022
00023 #include <QCheckBox>
00024 #include <QHBoxLayout>
00025
00026 KoPageLayoutHeader::KoPageLayoutHeader(QWidget *parent, KoUnit::Unit unit, const KoKWHeaderFooter &kwhf)
00027 : QWidget(parent)
00028 {
00029 m_headerFooters = kwhf;
00030
00031 m_headerSpacing = new KoUnitDoubleSpinBox( grpHeader, 0.0, 999.0, 0.5, kwhf.ptHeaderBodySpacing, unit );
00032 m_footerSpacing = new KoUnitDoubleSpinBox( grpFooter, 0.0, 999.0, 0.5, kwhf.ptFooterBodySpacing, unit );
00033 m_footnoteSpacing = new KoUnitDoubleSpinBox( grpFootEndnote, 0.0, 999.0, 0.5, kwhf.ptFootNoteBodySpacing, unit );
00034
00035 QHBoxLayout* lay = new QHBoxLayout( grpHeader );
00036 lay->addWidget( lblHeaderDesc );
00037 lay->addWidget( m_headerSpacing );
00038 lay->setAlignment( m_headerSpacing, Qt::AlignRight );
00039
00040 lay = new QHBoxLayout( grpFooter );
00041 lay->addWidget( lblFooterDesc );
00042 lay->addWidget( m_footerSpacing );
00043 lay->setAlignment( m_footerSpacing, Qt::AlignRight );
00044
00045 lay = new QHBoxLayout( grpFootEndnote );
00046 lay->addWidget( lblFootEndnoteDesc );
00047 lay->addWidget( m_footnoteSpacing );
00048 lay->setAlignment( m_footnoteSpacing, Qt::AlignRight );
00049
00050 if ( kwhf.header == HF_FIRST_DIFF || kwhf.header == HF_FIRST_EO_DIFF )
00051 rhFirst->setChecked( true );
00052 if ( kwhf.header == HF_EO_DIFF || kwhf.header == HF_FIRST_EO_DIFF )
00053 rhEvenOdd->setChecked( true );
00054 if ( kwhf.footer == HF_FIRST_DIFF || kwhf.footer == HF_FIRST_EO_DIFF )
00055 rfFirst->setChecked( true );
00056 if ( kwhf.footer == HF_EO_DIFF || kwhf.footer == HF_FIRST_EO_DIFF )
00057 rfEvenOdd->setChecked( true );
00058
00059 setupUi( this );
00060 }
00061
00062 const KoKWHeaderFooter& KoPageLayoutHeader::headerFooter() {
00063 if ( rhFirst->isChecked() && rhEvenOdd->isChecked() )
00064 m_headerFooters.header = HF_FIRST_EO_DIFF;
00065 else if ( rhFirst->isChecked() )
00066 m_headerFooters.header = HF_FIRST_DIFF;
00067 else if ( rhEvenOdd->isChecked() )
00068 m_headerFooters.header = HF_EO_DIFF;
00069 else
00070 m_headerFooters.header = HF_SAME;
00071
00072 m_headerFooters.ptHeaderBodySpacing = m_headerSpacing->value();
00073 m_headerFooters.ptFooterBodySpacing = m_footerSpacing->value();
00074 m_headerFooters.ptFootNoteBodySpacing = m_footnoteSpacing->value();
00075 if ( rfFirst->isChecked() && rfEvenOdd->isChecked() )
00076 m_headerFooters.footer = HF_FIRST_EO_DIFF;
00077 else if ( rfFirst->isChecked() )
00078 m_headerFooters.footer = HF_FIRST_DIFF;
00079 else if ( rfEvenOdd->isChecked() )
00080 m_headerFooters.footer = HF_EO_DIFF;
00081 else
00082 m_headerFooters.footer = HF_SAME;
00083 return m_headerFooters;
00084 }