kpresenter

KPrDuplicateObjDia.cpp

00001 // -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
00002 /* This file is part of the KDE project
00003    Copyright (C)  2002 Montel Laurent <lmontel@mandrakesoft.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <klocale.h>
00022 #include <qvbox.h>
00023 #include <qlayout.h>
00024 #include <qlabel.h>
00025 #include <qbuttongroup.h>
00026 
00027 #include "KPrDuplicateObjDia.h"
00028 #include "KPrPage.h"
00029 #include <knuminput.h>
00030 #include <qlineedit.h>
00031 #include <KoUnit.h>
00032 #include <knumvalidator.h>
00033 #include "KPrDocument.h"
00034 #include <kseparator.h>
00035 #include <KoUnitWidgets.h>
00036 
00037 KPrDuplicatObjDia::KPrDuplicatObjDia( QWidget *parent, KPrDocument * _doc, const char *name)
00038     : KDialogBase( parent, name, true, "", Ok | Cancel, Ok, true )
00039 {
00040     m_doc=_doc;
00041     KoUnit::Unit unit = m_doc->unit();
00042 
00043     KoRect pageRect = m_doc->masterPage()->getPageRect();
00044 
00045     setCaption( i18n("Duplicate Object") );
00046 
00047     QVBox *page = makeVBoxMainWidget();
00048     QLabel *lab=new QLabel(i18n("Number of copies:"), page);
00049 
00050     m_nbCopy = new KIntNumInput( 1, page );
00051     m_nbCopy->setRange( 1 , 10, 1);
00052 
00053     KSeparator *tmp=new KSeparator(page);
00054     lab=new QLabel(i18n("Rotation angle:"), page);
00055 
00056     m_rotation = new KDoubleNumInput( page, "customInput" );
00057     m_rotation->setRange(0.0, 360, 1, false);
00058 
00059     tmp=new KSeparator(page);
00060 
00061     lab=new QLabel(i18n("Increase width:"), page);
00062     m_increaseX= new KoUnitDoubleSpinBox( page );
00063     m_increaseX->setMinValue(0.0);
00064     m_increaseX->setMaxValue(pageRect.width());
00065     m_increaseX->changeValue( 1 );
00066     m_increaseX->setUnit(unit);
00067 
00068     lab=new QLabel(i18n("Increase height:"), page);
00069     m_increaseY= new KoUnitDoubleSpinBox( page );
00070     m_increaseY->setMinValue(0.0);
00071     m_increaseY->setMaxValue(pageRect.height());
00072     m_increaseY->changeValue( 1 );
00073     m_increaseY->setUnit(unit);
00074 
00075     tmp=new KSeparator(page);
00076     lab=new QLabel(i18n("Move X:"), page);
00077     m_moveX= new KoUnitDoubleSpinBox( page );
00078     m_moveX->setMinValue(0.0);
00079     m_moveX->setMaxValue(pageRect.width());
00080     m_moveX->changeValue( 20.0 );
00081     m_moveX->setUnit(unit);
00082 
00083 
00084     lab=new QLabel(i18n("Move Y:"), page);
00085     m_moveY= new KoUnitDoubleSpinBox( page );
00086     m_moveY->setMinValue(0.0);
00087     m_moveY->setMaxValue(pageRect.height());
00088     m_moveY->changeValue( 20.0 );
00089     m_moveY->setUnit(unit);
00090 
00091     resize( 200,100 );
00092 }
00093 
00094 int KPrDuplicatObjDia::nbCopy() const
00095 {
00096     return m_nbCopy->value();
00097 }
00098 
00099 double KPrDuplicatObjDia::angle() const
00100 {
00101     return m_rotation->value();
00102 }
00103 
00104 double KPrDuplicatObjDia::increaseX() const
00105 {
00106     return QMAX(0, m_increaseX->value());
00107 }
00108 
00109 double KPrDuplicatObjDia::increaseY() const
00110 {
00111     return QMAX(0, m_increaseY->value());
00112 }
00113 
00114 double KPrDuplicatObjDia::moveX() const
00115 {
00116     return QMAX(0, m_moveX->value());
00117 }
00118 
00119 double KPrDuplicatObjDia::moveY() const
00120 {
00121     return QMAX(0, m_moveY->value());
00122 }
00123 
00124 
00125 #include "KPrDuplicateObjDia.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys