kspread Library API Documentation

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., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.
00022 */
00023 
00024 #include "kspread_dlg_angle.h"
00025 #include <kspread_cell.h>
00026 #include <kspread_view.h>
00027 #include <kspread_doc.h>
00028 #include <kspread_sheet.h>
00029 
00030 #include <qlayout.h>
00031 #include <qpushbutton.h>
00032 
00033 #include <kbuttonbox.h>
00034 #include <kdebug.h>
00035 #include <klocale.h>
00036 #include <knuminput.h>
00037 
00038 KSpreadAngle::KSpreadAngle( KSpreadView* parent, const char* name,const QPoint &_marker)
00039     : KDialogBase( parent, name,TRUE,i18n("Change Angle" ), Ok|Cancel|Default )
00040 {
00041   m_pView=parent;
00042   marker=_marker;
00043 
00044   QWidget *page = new QWidget( this );
00045   setMainWidget(page);
00046 
00047   QVBoxLayout *lay = new QVBoxLayout( page, 0, spacingHint() );
00048   m_pAngle = new KIntNumInput( page );
00049   m_pAngle->setRange( -90, 90, 1 );
00050   m_pAngle->setLabel( i18n("Angle:") );
00051   m_pAngle->setSuffix(" °");
00052   lay->addWidget( m_pAngle );
00053 
00054   QWidget* spacer = new QWidget( page );
00055   spacer->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ) );
00056   lay->addWidget( spacer );
00057 
00058   m_pAngle->setFocus();
00059 
00060   connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00061 
00062   KSpreadCell *cell = m_pView->activeSheet()->cellAt( marker.x(), marker.y() );
00063   int angle=-(cell->getAngle(marker.x(), marker.y()));
00064   m_pAngle->setValue( angle );
00065 }
00066 
00067 void KSpreadAngle::slotOk()
00068 {
00069     m_pView->doc()->emitBeginOperation( false );
00070     m_pView->activeSheet()->setSelectionAngle(m_pView->selectionInfo(), -m_pAngle->value());
00071     m_pView->slotUpdateView( m_pView->activeSheet() );
00072     // m_pView->doc()->emitEndOperation();
00073 
00074     accept();
00075 }
00076 
00077 void KSpreadAngle::slotDefault()
00078 {
00079     m_pAngle->setValue( 0 );
00080 }
00081 
00082 
00083 #include "kspread_dlg_angle.moc"
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:42:54 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003