32#include "kspread_view.h"
33#include "kspread_doc.h"
34#include "kspread_map.h"
37#include "kspread_dlg_show.h"
41ShowDialog::ShowDialog(
View* parent,
const char* name )
42 : KDialogBase( parent, name,true,i18n(
"Show Sheet"),Ok|Cancel )
45 TQWidget *page =
new TQWidget(
this );
47 TQVBoxLayout *lay1 =
new TQVBoxLayout( page, 0, spacingHint() );
49 TQLabel *label =
new TQLabel( i18n(
"Select hidden sheets to show:"), page );
50 lay1->addWidget( label );
52 list=
new TQListBox(page);
53 lay1->addWidget( list );
55 list->setSelectionMode(TQListBox::Multi);
57 TQStringList::Iterator it;
58 TQStringList tabsList=m_pView->doc()->map()->hiddenSheets();
59 for ( it = tabsList.begin(); it != tabsList.end(); ++it )
62 list->insertItem(text);
65 enableButtonOK(
false);
66 connect(
this, TQ_SIGNAL( okClicked() ),
this, TQ_SLOT( slotOk() ) );
67 connect( list, TQ_SIGNAL(doubleClicked(TQListBoxItem *)),
this,TQ_SLOT(slotDoubleClicked(TQListBoxItem *)));
72void ShowDialog::slotDoubleClicked(TQListBoxItem *)
79void ShowDialog::slotOk()
81 m_pView->doc()->emitBeginOperation(
false );
83 TQStringList listSheet;
85 for (
int i=0; i < list->numRows(); i++)
87 if (list->isSelected(i))
89 listSheet.append( list->text(i));
95 if ( listSheet.count()==0 )
99 KMacroCommand *macroUndo=
new KMacroCommand( i18n(
"Show Sheet") );
100 for ( TQStringList::Iterator it = listSheet.begin(); it != listSheet.end(); ++it )
102 sheet=m_pView->doc()->map()->findSheet( *it );
103 KCommand* command =
new ShowSheetCommand( sheet );
104 macroUndo->addCommand( command );
106 m_pView->doc()->addCommand( macroUndo );
107 macroUndo->execute();
108 m_pView->slotUpdateView( m_pView->activeSheet() );
112#include "kspread_dlg_show.moc"
The View class displays a KSpread document.