Warning, file /office/calligra/libs/kross/KoScriptingModule.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /*************************************************************************** 0002 * KoScriptingModule.cpp 0003 * This file is part of the KDE project 0004 * copyright (C) 2006-2007 Sebastian Sauer <mail@dipe.org> 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this program; see the file COPYING. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 ***************************************************************************/ 0021 0022 #include "KoScriptingModule.h" 0023 #include "KoScriptingOdf.h" 0024 0025 // calligra 0026 #include <KoMainWindow.h> 0027 #include <KoApplicationAdaptor.h> 0028 #include <KoPartAdaptor.h> 0029 #include <KoView.h> 0030 0031 /// \internal d-pointer class. 0032 class Q_DECL_HIDDEN KoScriptingModule::Private 0033 { 0034 public: 0035 KoScriptingModule *module; 0036 KoView *view; 0037 }; 0038 0039 KoScriptingModule::KoScriptingModule(QObject *parent, const QString &name) 0040 : QObject(parent) 0041 , d(new Private()) 0042 { 0043 setObjectName(name); 0044 d->view = dynamic_cast<KoView*>(parent); 0045 //if (d->view) KoMainWindow *mainwindow = d->view->mainWindow(); 0046 } 0047 0048 KoScriptingModule::~KoScriptingModule() 0049 { 0050 delete d; 0051 } 0052 0053 KoView *KoScriptingModule::view() const 0054 { 0055 return d->view; 0056 } 0057 0058 /* 0059 void KoScriptingModule::setView(KoView *view) 0060 { 0061 d->view = view; 0062 } 0063 */ 0064 0065 QObject *KoScriptingModule::application() 0066 { 0067 return qApp->findChild<KoApplicationAdaptor*>(); 0068 } 0069 0070 QWidget *KoScriptingModule::mainWindow() 0071 { 0072 return d->view ? d->view->mainWindow() : 0; 0073 } 0074 0075 QObject *KoScriptingModule::document() 0076 { 0077 KoDocument *kdoc = doc(); 0078 return kdoc ? kdoc->findChild<KoPartAdaptor*>() : 0; 0079 } 0080 0081 QObject *KoScriptingModule::store() 0082 { 0083 return new KoScriptingOdfStore(this, doc()); 0084 }