~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to kchart/kchartPageLayout.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2002  Montel Laurent <lmontel@mandrakesoft.com>
 
3
   This library is free software; you can redistribute it and/or
 
4
   modify it under the terms of the GNU Library General Public
 
5
   License as published by the Free Software Foundation; either
 
6
   version 2 of the License, or (at your option) any later version.
 
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., 59 Temple Place - Suite 330,
 
16
   Boston, MA 02111-1307, USA.
 
17
*/
 
18
 
 
19
 
 
20
#include "kchartPageLayout.h"
 
21
#include "kchartPageLayout.moc"
 
22
#include "kchart_params.h"
 
23
#include <knumvalidator.h>
 
24
#include <qlineedit.h>
 
25
#include <qlayout.h>
 
26
#include <klocale.h>
 
27
#include <qlabel.h>
 
28
 
 
29
KChartPageLayout::KChartPageLayout( KChartParams* _params, QWidget* parent, const char* name )
 
30
        : KDialogBase( parent, name, TRUE,i18n("Page Layout"),KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Apply , KDialogBase::Ok,true )
 
31
{
 
32
    params=_params;
 
33
    QWidget *page = new QWidget( this );
 
34
    setMainWidget(page);
 
35
 
 
36
    setButtonText( KDialogBase::User1, i18n("&Reset") );
 
37
 
 
38
    QGridLayout *grid = new QGridLayout(page, 4, 2, KDialog::marginHint(), KDialog::spacingHint());
 
39
 
 
40
    QLabel *lab=new QLabel(i18n("Left:"),page);
 
41
    grid->addWidget(lab,0,0);
 
42
 
 
43
    leftBorder=new QLineEdit(page);
 
44
    leftBorder->setValidator( new KIntValidator( 0,9999,leftBorder ) );
 
45
    grid->addWidget(leftBorder,1,0);
 
46
 
 
47
    lab=new QLabel(i18n("Right:"),page);
 
48
    grid->addWidget(lab,0,1);
 
49
 
 
50
    rightBorder=new QLineEdit(page);
 
51
    rightBorder->setValidator( new KIntValidator( 0,9999,rightBorder ) );
 
52
    grid->addWidget(rightBorder,1,1);
 
53
 
 
54
    lab=new QLabel(i18n("Top:"),page);
 
55
    grid->addWidget(lab,2,0);
 
56
 
 
57
    topBorder=new QLineEdit(page);
 
58
    topBorder->setValidator( new KIntValidator( 0,9999,topBorder ) );
 
59
    grid->addWidget(topBorder,3,0);
 
60
 
 
61
    lab=new QLabel(i18n("Bottom:"),page);
 
62
    grid->addWidget(lab,2,1);
 
63
 
 
64
    bottomBorder=new QLineEdit(page);
 
65
    bottomBorder->setValidator( new KIntValidator( 0,9999,bottomBorder ) );
 
66
    grid->addWidget(bottomBorder,3,1);
 
67
 
 
68
    init();
 
69
    connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
 
70
    connect( this, SIGNAL( applyClicked() ), this, SLOT( slotApply() ) );
 
71
    connect( this, SIGNAL( user1Clicked() ), this ,SLOT( slotReset() ));
 
72
 
 
73
}
 
74
 
 
75
void KChartPageLayout::init()
 
76
{
 
77
    oldGlobalLeadingRight = params->globalLeadingRight();
 
78
    oldGlobalLeadingLeft = params->globalLeadingLeft();
 
79
    oldGlobalLeadingTop = params->globalLeadingTop();
 
80
    oldGlobalLeadingBottom = params->globalLeadingBottom();
 
81
    slotReset();
 
82
}
 
83
 
 
84
void KChartPageLayout::slotOk()
 
85
{
 
86
    slotApply();
 
87
    accept();
 
88
}
 
89
 
 
90
void KChartPageLayout::slotApply()
 
91
{
 
92
    params->setGlobalLeading( leftBorder->text().toInt(),topBorder->text().toInt() , rightBorder->text().toInt(), bottomBorder->text().toInt() );
 
93
    emit dataChanged();
 
94
}
 
95
 
 
96
void KChartPageLayout::slotReset()
 
97
{
 
98
    rightBorder->setText(QString::number(oldGlobalLeadingRight));
 
99
    leftBorder->setText(QString::number(oldGlobalLeadingLeft));
 
100
    topBorder->setText(QString::number(oldGlobalLeadingTop));
 
101
    bottomBorder->setText(QString::number(oldGlobalLeadingBottom));
 
102
}