kspread

kspread_dlg_angle.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Norbert Andres<nandres@web.de>
00003              (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
00004              (C) 2002 Ariya Hidayat <ariya@kde.org>
00005              (C) 1999-2002 Laurent Montel <montel@kde.org>
00006              (C) 1998-1999 Torben Weis <weis@kde.org> 
00007 
00008    This library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public
00010    License as published by the Free Software Foundation; either
00011    version 2 of the License, or (at your option) any later version.
00012 
00013    This library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public License
00019    along with this library; see the file COPYING.LIB.  If not, write to
00020    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #include <qlayout.h>
00025 #include <qpushbutton.h>
00026 
00027 #include <kbuttonbox.h>
00028 #include <kdebug.h>
00029 #include <klocale.h>
00030 #include <knuminput.h>
00031 
00032 #include <kspread_cell.h>
00033 #include <kspread_doc.h>
00034 #include <kspread_sheet.h>
00035 #include <kspread_view.h>
00036 
00037 #include "kspread_dlg_angle.h"
00038 
00039 using namespace KSpread;
00040 
00041 AngleDialog::AngleDialog(View* parent, const char* name, const QPoint &_marker)
00042     : KDialogBase( parent, name,TRUE,i18n("Change Angle" ), Ok|Cancel|Default )
00043 {
00044   m_pView=parent;
00045   marker=_marker;
00046 
00047   QWidget *page = new QWidget( this );
00048   setMainWidget(page);
00049 
00050   QVBoxLayout *lay = new QVBoxLayout( page, 0, spacingHint() );
00051   m_pAngle = new KIntNumInput( page );
00052   m_pAngle->setRange( -90, 90, 1 );
00053   m_pAngle->setLabel( i18n("Angle:") );
00054   m_pAngle->setSuffix(" ");
00055   lay->addWidget( m_pAngle );
00056 
00057   QWidget* spacer = new QWidget( page );
00058   spacer->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ) );
00059   lay->addWidget( spacer );
00060 
00061   m_pAngle->setFocus();
00062 
00063   connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00064 
00065   Cell *cell = m_pView->activeSheet()->cellAt( marker.x(), marker.y() );
00066   int angle=-(cell->format()->getAngle(marker.x(), marker.y()));
00067   m_pAngle->setValue( angle );
00068 }
00069 
00070 void AngleDialog::slotOk()
00071 {
00072     m_pView->doc()->emitBeginOperation( false );
00073     m_pView->activeSheet()->setSelectionAngle(m_pView->selectionInfo(), -m_pAngle->value());
00074     m_pView->slotUpdateView( m_pView->activeSheet() );
00075     // m_pView->doc()->emitEndOperation();
00076 
00077     accept();
00078 }
00079 
00080 void AngleDialog::slotDefault()
00081 {
00082     m_pAngle->setValue( 0 );
00083 }
00084 
00085 
00086 #include "kspread_dlg_angle.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys