kspread

kspread_dlg_goto.cpp
1/* This file is part of the KDE project
2 Copyright (C) 1999-2003 Laurent Montel <montel@kde.org>
3 (C) 2003 Philipp Mueller <philipp.mueller@gmx.de>
4 (C) 2003 Ariya Hidayat <ariya@kde.org>
5 (C) 2003 Norbert Andres <nandres@web.de>
6 (C) 1999 Stephan Kulow <coolo@kde.org>
7 (C) 1998-2000 Torben Weis <weis@kde.org>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#include <tqlabel.h>
26#include <tqlayout.h>
27
28#include <klineedit.h>
29
30#include "kspread_canvas.h"
31#include "kspread_doc.h"
32#include "kspread_locale.h"
33#include "kspread_util.h"
34#include "kspread_view.h"
35#include "selection.h"
36
37#include "kspread_dlg_goto.h"
38
39using namespace KSpread;
40
41GotoDialog::GotoDialog( View* parent, const char* name )
42 : KDialogBase( parent, name, true, i18n("Goto Cell"), Ok|Cancel )
43{
44 m_pView = parent;
45 TQWidget *page = new TQWidget( this );
46 setMainWidget(page);
47 TQVBoxLayout *lay1 = new TQVBoxLayout( page, 0, spacingHint() );
48
49 TQLabel *label = new TQLabel(i18n("Enter cell:"), page);
50 lay1->addWidget(label);
51
52 m_nameCell = new KLineEdit( page );
53 lay1->addWidget(m_nameCell);
54
55 m_nameCell->setFocus();
56 enableButtonOK( false );
57
58 connect( this, TQ_SIGNAL( okClicked() ), this, TQ_SLOT( slotOk() ) );
59 connect( m_nameCell, TQ_SIGNAL(textChanged ( const TQString & )),
60 this, TQ_SLOT(textChanged ( const TQString & )));
61}
62
63void GotoDialog::textChanged ( const TQString &_text )
64{
65 enableButtonOK(!_text.isEmpty());
66}
67
68void GotoDialog::slotOk()
69{
70 m_pView->doc()->emitBeginOperation( false );
71
72 TQString tmp_upper;
73 tmp_upper=m_nameCell->text().upper();
74 Region region(m_pView, tmp_upper);
75 if ( region.isValid() )
76 {
77 m_pView->selectionInfo()->initialize(region);
78 accept();
79 }
80 else
81 {
82 m_nameCell->clear();
83 }
84 m_pView->slotUpdateView( m_pView->activeSheet() );
85}
86
87#include "kspread_dlg_goto.moc"
The one for all class for points and ranges.
Definition region.h:44
The View class displays a KSpread document.
The KSpread namespace.
Definition commands.h:39