F:/KPlato/koffice/libs/kofficeui/KoPageLayoutHeader.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2005 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; version 2.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public License
00014  * along with this library; see the file COPYING.LIB.  If not, write to
00015  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  * Boston, MA 02110-1301, USA.
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 }

Généré le Wed Nov 22 23:41:05 2006 pour KPlato par  doxygen 1.5.1-p1