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/plugins/scripting/kspreadcore/kspreadcoremodule.cpp | |
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/plugins/scripting/kspreadcore/kspreadcoremodule.cpp')
-rw-r--r-- | kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp new file mode 100644 index 000000000..acfd0b2bd --- /dev/null +++ b/kspread/plugins/scripting/kspreadcore/kspreadcoremodule.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2005 Cyrille Berger <cberger@cberger.net> + * Copyright (c) 2006 Isaac Clerencia <isaac@warp.es> + * + * This program 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 program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "kspreadcoremodule.h" + +#include <kdebug.h> + +//#include <api/variant.h> +#include <api/qtobject.h> +#include <main/manager.h> + +#include "krs_doc.h" + +extern "C" +{ + /** + * Exported an loadable function as entry point to use + * the \a KexiAppModule. + */ + Kross::Api::Object* init_module(Kross::Api::Manager* manager) + { + return new Kross::KSpreadCore::KSpreadCoreModule(manager); + } +} + + +using namespace Kross::KSpreadCore; + +KSpreadCoreModule::KSpreadCoreModule(Kross::Api::Manager* manager) + : Kross::Api::Module("kspreadcore") , m_manager(manager) +{ + QMap<QString, Object::Ptr> children = manager->getChildren(); + kdDebug() << " there are " << children.size() << endl; + for(QMap<QString, Object::Ptr>::const_iterator it = children.begin(); it != children.end(); it++) + { + kdDebug() << it.key() << " " << it.data() << endl; + } + + // Wrap doc + Kross::Api::Object::Ptr kspreaddocument = manager->getChild("KSpreadDocument"); + if(! kspreaddocument) { + KSpread::Doc* doc = new KSpread::Doc(); + addChild( new Kross::KSpreadCore::Doc(doc) ); + } + else { + Kross::Api::QtObject* kspreaddocumentqt = dynamic_cast< Kross::Api::QtObject* >( kspreaddocument.data() ); + if(kspreaddocumentqt) { + KSpread::Doc* document = dynamic_cast< ::KSpread::Doc* >( kspreaddocumentqt->getObject() ); + if(document) { + addChild( new Doc(document) ); + } else { + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception("There was no 'KSpreadDocument' published.") ); + } + } + } +} + +KSpreadCoreModule::~KSpreadCoreModule() +{ +} + + +const QString KSpreadCoreModule::getClassName() const +{ + return "Kross::KSpreadCore::KSpreadCoreModule"; +} |