diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kspread/dialogs/kspread_dlg_special.cc | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kspread/dialogs/kspread_dlg_special.cc')
-rw-r--r-- | kspread/dialogs/kspread_dlg_special.cc | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/kspread/dialogs/kspread_dlg_special.cc b/kspread/dialogs/kspread_dlg_special.cc new file mode 100644 index 00000000..3c9426c7 --- /dev/null +++ b/kspread/dialogs/kspread_dlg_special.cc @@ -0,0 +1,135 @@ +/* This file is part of the KDE project + Copyright (C) 1999-2004 Laurent Montel <montel@kde.org> + (C) 2003 Norbert Andres <nandres@web.de> + (C) 2002 Philipp Mueller <philipp.mueller@gmx.de> + (C) 2002 John Dailey <dailey@vt.edu> + (C) 1998-1999 Torben Weis <weis@kde.org> + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include <qlayout.h> +#include <qbuttongroup.h> +#include <qradiobutton.h> + +#include <klocale.h> + +#include "kspread_canvas.h" +#include "kspread_doc.h" +#include "kspread_sheet.h" +#include "kspread_view.h" +#include "selection.h" + +#include "kspread_dlg_special.h" + +using namespace KSpread; + +SpecialDialog::SpecialDialog( View* parent, const char* name ) + : KDialogBase( parent, name, TRUE,i18n("Special Paste"),Ok|Cancel ) +{ + m_pView = parent; + QWidget *page = new QWidget( this ); + setMainWidget(page); + QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() ); + + QButtonGroup *grp = new QButtonGroup( 1, QGroupBox::Horizontal, i18n( "Paste What" ),page ); + grp->setRadioButtonExclusive( TRUE ); + grp->layout(); + lay1->addWidget(grp); + rb1 = new QRadioButton( i18n("Everything"), grp ); + rb2 = new QRadioButton( i18n("Text"), grp ); + rb3 = new QRadioButton( i18n("Format"), grp ); + rb10 = new QRadioButton( i18n("Comment"), grp ); + rb11 = new QRadioButton( i18n("Result"), grp ); + + rb4 = new QRadioButton( i18n("Everything without border"), grp ); + rb1->setChecked(true); + + grp = new QButtonGroup( 1, QGroupBox::Horizontal, i18n("Operation"),page); + grp->setRadioButtonExclusive( TRUE ); + grp->layout(); + lay1->addWidget(grp); + + + rb5 = new QRadioButton( i18n("Overwrite"), grp ); + rb6 = new QRadioButton( i18n("Addition"), grp ); + rb7 = new QRadioButton( i18n("Subtraction"), grp ); + rb8 = new QRadioButton( i18n("Multiplication"), grp ); + rb9 = new QRadioButton( i18n("Division"), grp ); + rb5->setChecked(true); + + // cb = new QCheckBox(i18n("Transpose"),this); + // cb->layout(); + // lay1->addWidget(cb); + + connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) ); + connect( rb3, SIGNAL( toggled( bool ) ), this, SLOT( slotToggled( bool ) ) ); + connect( rb10, SIGNAL( toggled( bool ) ), this, SLOT( slotToggled( bool ) ) ); +} + +void SpecialDialog::slotOk() +{ + Paste::Mode sp = Paste::Normal; + Paste::Operation op = Paste::OverWrite; + + /* if( rb1->isChecked() ) + sp = cb->isChecked() ? NormalAndTranspose : Normal; + else if( rb2->isChecked() ) + sp = cb->isChecked() ? TextAndTranspose : Text; + else if( rb3->isChecked() ) + sp = cb->isChecked() ? FormatAndTranspose : Format; + else if( rb4->isChecked() ) + sp = cb->isChecked() ? NoBorderAndTranspose : NoBorder; */ + + if( rb1->isChecked() ) + sp = Paste::Normal; + else if( rb2->isChecked() ) + sp = Paste::Text; + else if( rb3->isChecked() ) + sp = Paste::Format; + else if( rb4->isChecked() ) + sp = Paste::NoBorder; + else if( rb10->isChecked() ) + sp = Paste::Comment; + else if( rb11->isChecked() ) + sp = Paste::Result; + + if( rb5->isChecked() ) + op = Paste::OverWrite; + if( rb6->isChecked() ) + op = Paste::Add; + if( rb7->isChecked() ) + op = Paste::Sub; + if( rb8->isChecked() ) + op = Paste::Mul; + if( rb9->isChecked() ) + op = Paste::Div; + + m_pView->doc()->emitBeginOperation( false ); + m_pView->activeSheet()->paste( m_pView->selectionInfo()->lastRange(), true, sp, op ); + m_pView->slotUpdateView( m_pView->activeSheet() ); + accept(); +} + +void SpecialDialog::slotToggled( bool b ) +{ + rb5->setEnabled( !b ); + rb6->setEnabled( !b ); + rb7->setEnabled( !b ); + rb8->setEnabled( !b ); + rb9->setEnabled( !b ); +} + +#include "kspread_dlg_special.moc" |