kspread Library API Documentation

kspread_dlg_special.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999-2004 Laurent Montel <montel@kde.org>
00003              (C) 2003 Norbert Andres <nandres@web.de>
00004              (C) 2002 Philipp Mueller <philipp.mueller@gmx.de>
00005              (C) 2002 John Dailey <dailey@vt.edu>
00006              (C) 1998-1999 Torben Weis <weis@kde.org>
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., 59 Temple Place - Suite 330,
00020    Boston, MA 02111-1307, USA.
00021 */
00022 
00023 
00024 #include "kspread_dlg_special.h"
00025 #include "kspread_canvas.h"
00026 #include "kspread_doc.h"
00027 #include "kspread_sheet.h"
00028 #include "kspread_view.h"
00029 
00030 #include <qlayout.h>
00031 #include <klocale.h>
00032 #include <qbuttongroup.h>
00033 #include <qradiobutton.h>
00034 
00035 KSpreadspecial::KSpreadspecial( KSpreadView* parent, const char* name )
00036     : KDialogBase( parent, name, TRUE,i18n("Special Paste"),Ok|Cancel  )
00037 {
00038     m_pView = parent;
00039     QWidget *page = new QWidget( this );
00040     setMainWidget(page);
00041     QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() );
00042 
00043     QButtonGroup *grp = new QButtonGroup( 1, QGroupBox::Horizontal, i18n( "Paste What" ),page );
00044     grp->setRadioButtonExclusive( TRUE );
00045     grp->layout();
00046     lay1->addWidget(grp);
00047     rb1 = new QRadioButton( i18n("Everything"), grp );
00048     rb2 = new QRadioButton( i18n("Text"), grp );
00049     rb3 = new QRadioButton( i18n("Format"), grp );
00050     rb10 = new QRadioButton( i18n("Comment"), grp );
00051     rb11 = new QRadioButton( i18n("Result"), grp );
00052 
00053     rb4 = new QRadioButton( i18n("Everything without border"), grp );
00054     rb1->setChecked(true);
00055 
00056     grp = new QButtonGroup( 1, QGroupBox::Horizontal, i18n("Operation"),page);
00057     grp->setRadioButtonExclusive( TRUE );
00058     grp->layout();
00059     lay1->addWidget(grp);
00060 
00061 
00062     rb5 = new QRadioButton( i18n("Overwrite"), grp );
00063     rb6 = new QRadioButton( i18n("Addition"), grp );
00064     rb7 = new QRadioButton( i18n("Subtraction"), grp );
00065     rb8 = new QRadioButton( i18n("Multiplication"), grp );
00066     rb9 = new QRadioButton( i18n("Division"), grp );
00067     rb5->setChecked(true);
00068 
00069     // cb = new QCheckBox(i18n("Transpose"),this);
00070     // cb->layout();
00071     // lay1->addWidget(cb);
00072 
00073     connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00074     connect( rb3, SIGNAL( toggled( bool ) ), this, SLOT( slotToggled( bool ) ) );
00075     connect( rb10, SIGNAL( toggled( bool ) ), this, SLOT( slotToggled( bool ) ) );
00076 }
00077 
00078 void KSpreadspecial::slotOk()
00079 {
00080     PasteMode sp = Normal;
00081     Operation op = OverWrite;
00082 
00083     /* if( rb1->isChecked() )
00084     sp = cb->isChecked() ? NormalAndTranspose : Normal;
00085     else if( rb2->isChecked() )
00086     sp = cb->isChecked() ? TextAndTranspose : Text;
00087     else if( rb3->isChecked() )
00088     sp = cb->isChecked() ? FormatAndTranspose : Format;
00089     else if( rb4->isChecked() )
00090     sp = cb->isChecked() ? NoBorderAndTranspose : NoBorder; */
00091 
00092     if( rb1->isChecked() )
00093     sp = Normal;
00094     else if( rb2->isChecked() )
00095     sp = Text;
00096     else if( rb3->isChecked() )
00097     sp = Format;
00098     else if( rb4->isChecked() )
00099     sp = NoBorder;
00100     else if( rb10->isChecked() )
00101     sp = Comment;
00102     else if( rb11->isChecked() )
00103     sp = Result;
00104 
00105     if( rb5->isChecked() )
00106     op = OverWrite;
00107     if( rb6->isChecked() )
00108     op = Add;
00109     if( rb7->isChecked() )
00110     op = Sub;
00111     if( rb8->isChecked() )
00112     op = Mul;
00113     if( rb9->isChecked() )
00114     op = Div;
00115 
00116     m_pView->doc()->emitBeginOperation( false );
00117     m_pView->activeSheet()->paste( m_pView->selection(), true, sp, op );
00118     m_pView->slotUpdateView( m_pView->activeSheet() );
00119     accept();
00120 }
00121 
00122 void KSpreadspecial::slotToggled( bool b )
00123 {
00124     rb5->setEnabled( !b );
00125     rb6->setEnabled( !b );
00126     rb7->setEnabled( !b );
00127     rb8->setEnabled( !b );
00128     rb9->setEnabled( !b );
00129 }
00130 
00131 #include "kspread_dlg_special.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:43:02 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003