kspread

kspread_dlg_pasteinsert.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Norbert Andres <nandres@web.de>
00003              (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
00004              (C) 2002 John Dailey <dailey@vt.edu>
00005              (C) 2000-2002 Laurent Montel <montel@kde.org>
00006    
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include <qlayout.h>
00024 #include <klocale.h>
00025 #include <kbuttonbox.h>
00026 #include <qbuttongroup.h>
00027 #include <kdebug.h>
00028 #include <qradiobutton.h>
00029 #include <qcheckbox.h>
00030 
00031 #include "kspread_dlg_pasteinsert.h"
00032 #include "kspread_canvas.h"
00033 #include "kspread_doc.h"
00034 #include "kspread_sheet.h"
00035 #include "kspread_view.h"
00036 #include "selection.h"
00037 
00038 using namespace KSpread;
00039 
00040 PasteInsertDialog::PasteInsertDialog( View* parent, const char* name,const QRect &_rect)
00041     : KDialogBase( parent, name, TRUE,i18n("Paste Inserting Cells"),Ok|Cancel )
00042 {
00043   m_pView = parent;
00044   rect=_rect;
00045 
00046   QWidget *page = new QWidget( this );
00047   setMainWidget(page);
00048   QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() );
00049 
00050   QButtonGroup *grp = new QButtonGroup( 1, QGroupBox::Horizontal, i18n("Insert"),page);
00051   grp->setRadioButtonExclusive( TRUE );
00052   grp->layout();
00053   lay1->addWidget(grp);
00054   rb1 = new QRadioButton( i18n("Move towards right"), grp );
00055   rb2 = new QRadioButton( i18n("Move towards bottom"), grp );
00056   rb1->setChecked(true);
00057 
00058   connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00059 }
00060 
00061 void PasteInsertDialog::slotOk()
00062 {
00063     m_pView->doc()->emitBeginOperation( false );
00064     if( rb1->isChecked() )
00065       m_pView->activeSheet()->paste( m_pView->selectionInfo()->lastRange(),
00066                                      true, Paste::Normal, Paste::OverWrite,
00067                                      true, -1 );
00068     else if( rb2->isChecked() )
00069       m_pView->activeSheet()->paste( m_pView->selectionInfo()->lastRange(),
00070                                      true, Paste::Normal, Paste::OverWrite,
00071                                      true, +1 );
00072 
00073     m_pView->slotUpdateView( m_pView->activeSheet() );
00074     accept();
00075 }
00076 
00077 #include "kspread_dlg_pasteinsert.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys