26#include <tqlineedit.h>
28#include <tdemessagebox.h>
30#include "kspread_doc.h"
31#include "kspread_locale.h"
32#include "kspread_sheet.h"
33#include "kspread_view.h"
36#include "kspread_dlg_area.h"
40AreaDialog::AreaDialog( View * parent, const char * name, const TQPoint & _marker )
41 : KDialogBase( parent, name, true, i18n( "Area Name"), Ok | Cancel )
46 TQWidget * page = new TQWidget( this );
48 TQVBoxLayout * lay1 = new TQVBoxLayout( page, 0, spacingHint() );
50 TQLabel * label = new TQLabel( i18n( "Enter the area name:"), page );
51 lay1->addWidget( label );
53 m_areaName = new TQLineEdit(page);
54 m_areaName->setMinimumWidth( m_areaName->sizeHint().width() * 3 );
56 lay1->addWidget( m_areaName );
57 m_areaName->setFocus();
58 connect ( m_areaName, TQ_SIGNAL(textChanged ( const TQString & )), this, TQ_SLOT(slotAreaNamechanged( const TQString &)));
59 connect( this, TQ_SIGNAL( okClicked() ), this, TQ_SLOT( slotOk() ) );
60 enableButtonOK(!m_areaName->text().isEmpty());
64void AreaDialog::slotAreaNamechanged( const TQString & text)
66 enableButtonOK(!text.isEmpty());
69void AreaDialog::slotOk()
71 TQString tmp(m_areaName->text());
76 TQRect rect( m_pView->selectionInfo()->selection() );
78 TQValueList<Reference>::Iterator it;
79 TQValueList<Reference> area = m_pView->doc()->listArea();
80 for ( it = area.begin(); it != area.end(); ++it )
82 if(tmp == (*it).ref_name)
87 m_pView->doc()->emitBeginOperation( false );
88 m_pView->doc()->addAreaName(rect, tmp, m_pView->activeSheet()->sheetName());
89 m_pView->slotUpdateView( m_pView->activeSheet() );
93 KMessageBox::error( this, i18n( "This name is already used."));
97 KMessageBox::error( this, i18n( "Area text is empty.") );
101#include "kspread_dlg_area.moc"
The View class displays a KSpread document.
|