kspread Library API Documentation

kspread_dlg_goto.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999-2003 Laurent Montel <montel@kde.org>
00003              (C) 2003 Philipp Mueller <philipp.mueller@gmx.de>
00004              (C) 2003 Ariya Hidayat <ariya@kde.org>
00005              (C) 2003 Norbert Andres <nandres@web.de>
00006              (C) 1999 Stephan Kulow <coolo@kde.org>
00007              (C) 1998-2000 Torben Weis <weis@kde.org>
00008 
00009    This library is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Library General Public
00011    License as published by the Free Software Foundation; either
00012    version 2 of the License, or (at your option) any later version.
00013 
00014    This library is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Library General Public License for more details.
00018 
00019    You should have received a copy of the GNU Library General Public License
00020    along with this library; see the file COPYING.LIB.  If not, write to
00021    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00022    Boston, MA 02111-1307, USA.
00023 */
00024 
00025 
00026 #include "kspread_dlg_goto.h"
00027 #include "kspread_canvas.h"
00028 #include "kspread_doc.h"
00029 #include "kspread_util.h"
00030 #include "kspread_view.h"
00031 #include "kspread_locale.h"
00032 
00033 #include <klineedit.h>
00034 
00035 #include <qlabel.h>
00036 
00037 #include <qlayout.h>
00038 
00039 
00040 KSpreadGotoDlg::KSpreadGotoDlg( KSpreadView* parent, const char* name )
00041     : KDialogBase( parent, name, TRUE,i18n("Goto Cell"),Ok|Cancel )
00042 {
00043   m_pView = parent;
00044   QWidget *page = new QWidget( this );
00045   setMainWidget(page);
00046   QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() );
00047 
00048   QLabel *label = new QLabel(i18n("Enter cell:"), page);
00049   lay1->addWidget(label);
00050 
00051   m_nameCell = new KLineEdit( page );
00052   lay1->addWidget(m_nameCell);
00053 
00054   m_nameCell->setFocus();
00055   enableButtonOK( false );
00056 
00057   connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00058   connect( m_nameCell, SIGNAL(textChanged ( const QString & )),
00059            this, SLOT(textChanged ( const QString & )));
00060 }
00061 
00062 void KSpreadGotoDlg::textChanged ( const QString &_text )
00063 {
00064     enableButtonOK(!_text.isEmpty());
00065 }
00066 
00067 void KSpreadGotoDlg::slotOk()
00068 {
00069     m_pView->doc()->emitBeginOperation( false );
00070 
00071     QString tmp_upper;
00072     tmp_upper=m_nameCell->text().upper();
00073     bool result = true;
00074     if ( tmp_upper.contains( ':' ) ) //Selection entered in location widget
00075         result = m_pView->canvasWidget()->gotoLocation( KSpreadRange( tmp_upper, m_pView->doc()->map() ) );
00076     else //Location entered in location widget
00077         result = m_pView->canvasWidget()->gotoLocation( KSpreadPoint( tmp_upper, m_pView->doc()->map() ) );
00078 
00079     m_pView->slotUpdateView( m_pView->activeSheet() );
00080 
00081     if ( result )
00082         accept();
00083     else
00084         m_nameCell->clear();
00085 }
00086 
00087 #include "kspread_dlg_goto.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