kspread

kspread_dlg_angle.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Norbert Andres<nandres@web.de>
3 (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
4 (C) 2002 Ariya Hidayat <ariya@kde.org>
5 (C) 1999-2002 Laurent Montel <montel@kde.org>
6 (C) 1998-1999 Torben Weis <weis@kde.org>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#include <tqlayout.h>
25#include <tqpushbutton.h>
26
27#include <kbuttonbox.h>
28#include <kdebug.h>
29#include <tdelocale.h>
30#include <knuminput.h>
31
32#include <kspread_cell.h>
33#include <kspread_doc.h>
34#include <kspread_sheet.h>
35#include <kspread_view.h>
36
37#include "kspread_dlg_angle.h"
38
39using namespace KSpread;
40
41AngleDialog::AngleDialog(View* parent, const char* name, const TQPoint &_marker)
42 : KDialogBase( parent, name,true,i18n("Change Angle" ), Ok|Cancel|Default )
43{
44 m_pView=parent;
45 marker=_marker;
46
47 TQWidget *page = new TQWidget( this );
48 setMainWidget(page);
49
50 TQVBoxLayout *lay = new TQVBoxLayout( page, 0, spacingHint() );
51 m_pAngle = new KIntNumInput( page );
52 m_pAngle->setRange( -90, 90, 1 );
53 m_pAngle->setLabel( i18n("Angle:") );
54 m_pAngle->setSuffix(" ");
55 lay->addWidget( m_pAngle );
56
57 TQWidget* spacer = new TQWidget( page );
58 spacer->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Expanding ) );
59 lay->addWidget( spacer );
60
61 m_pAngle->setFocus();
62
63 connect( this, TQ_SIGNAL( okClicked() ), this, TQ_SLOT( slotOk() ) );
64
65 Cell *cell = m_pView->activeSheet()->cellAt( marker.x(), marker.y() );
66 int angle=-(cell->format()->getAngle(marker.x(), marker.y()));
67 m_pAngle->setValue( angle );
68}
69
70void AngleDialog::slotOk()
71{
72 m_pView->doc()->emitBeginOperation( false );
73 m_pView->activeSheet()->setSelectionAngle(m_pView->selectionInfo(), -m_pAngle->value());
74 m_pView->slotUpdateView( m_pView->activeSheet() );
75 // m_pView->doc()->emitEndOperation();
76
77 accept();
78}
79
80void AngleDialog::slotDefault()
81{
82 m_pAngle->setValue( 0 );
83}
84
85
86#include "kspread_dlg_angle.moc"
For every cell in the spread sheet there is a Cell object.
void setValue(const Value &value)
Sets the value for this cell.
The View class displays a KSpread document.
The KSpread namespace.
Definition commands.h:39