kpresenter

KPrDuplicateObjDia.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002 Montel Laurent <lmontel@mandrakesoft.com>
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; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include <tdelocale.h>
21#include <tqvbox.h>
22#include <tqlayout.h>
23#include <tqlabel.h>
24#include <tqbuttongroup.h>
25
26#include "KPrDuplicateObjDia.h"
27#include "KPrPage.h"
28#include <knuminput.h>
29#include <tqlineedit.h>
30#include <KoUnit.h>
31#include <knumvalidator.h>
32#include "KPrDocument.h"
33#include <kseparator.h>
34#include <KoUnitWidgets.h>
35
36KPrDuplicatObjDia::KPrDuplicatObjDia( TQWidget *parent, KPrDocument * _doc, const char *name)
37 : KDialogBase( parent, name, true, "", Ok | Cancel, Ok, true )
38{
39 m_doc=_doc;
40 KoUnit::Unit unit = m_doc->unit();
41
42 KoRect pageRect = m_doc->masterPage()->getPageRect();
43
44 setCaption( i18n("Duplicate Object") );
45
46 TQVBox *page = makeVBoxMainWidget();
47 TQLabel *lab=new TQLabel(i18n("Number of copies:"), page);
48
49 m_nbCopy = new KIntNumInput( 1, page );
50 m_nbCopy->setRange( 1 , 10, 1);
51
52 KSeparator *tmp=new KSeparator(page);
53 lab=new TQLabel(i18n("Rotation angle:"), page);
54
55 m_rotation = new KDoubleNumInput( page, "customInput" );
56 m_rotation->setRange(0.0, 360, 1, false);
57
58 tmp=new KSeparator(page);
59
60 lab=new TQLabel(i18n("Increase width:"), page);
61 m_increaseX= new KoUnitDoubleSpinBox( page );
62 m_increaseX->setMinValue(0.0);
63 m_increaseX->setMaxValue(pageRect.width());
64 m_increaseX->changeValue( 1 );
65 m_increaseX->setUnit(unit);
66
67 lab=new TQLabel(i18n("Increase height:"), page);
68 m_increaseY= new KoUnitDoubleSpinBox( page );
69 m_increaseY->setMinValue(0.0);
70 m_increaseY->setMaxValue(pageRect.height());
71 m_increaseY->changeValue( 1 );
72 m_increaseY->setUnit(unit);
73
74 tmp=new KSeparator(page);
75 lab=new TQLabel(i18n("Move X:"), page);
76 m_moveX= new KoUnitDoubleSpinBox( page );
77 m_moveX->setMinValue(0.0);
78 m_moveX->setMaxValue(pageRect.width());
79 m_moveX->changeValue( 20.0 );
80 m_moveX->setUnit(unit);
81
82
83 lab=new TQLabel(i18n("Move Y:"), page);
84 m_moveY= new KoUnitDoubleSpinBox( page );
85 m_moveY->setMinValue(0.0);
86 m_moveY->setMaxValue(pageRect.height());
87 m_moveY->changeValue( 20.0 );
88 m_moveY->setUnit(unit);
89
90 resize( 200,100 );
91}
92
93int KPrDuplicatObjDia::nbCopy() const
94{
95 return m_nbCopy->value();
96}
97
98double KPrDuplicatObjDia::angle() const
99{
100 return m_rotation->value();
101}
102
103double KPrDuplicatObjDia::increaseX() const
104{
105 return TQMAX(0, m_increaseX->value());
106}
107
108double KPrDuplicatObjDia::increaseY() const
109{
110 return TQMAX(0, m_increaseY->value());
111}
112
113double KPrDuplicatObjDia::moveX() const
114{
115 return TQMAX(0, m_moveX->value());
116}
117
118double KPrDuplicatObjDia::moveY() const
119{
120 return TQMAX(0, m_moveY->value());
121}
122
123
124#include "KPrDuplicateObjDia.moc"