summaryrefslogtreecommitdiffstats
path: root/kformula/kformula_factory.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kformula/kformula_factory.cc
downloadkoffice-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 'kformula/kformula_factory.cc')
-rw-r--r--kformula/kformula_factory.cc70
1 files changed, 70 insertions, 0 deletions
diff --git a/kformula/kformula_factory.cc b/kformula/kformula_factory.cc
new file mode 100644
index 00000000..021f10de
--- /dev/null
+++ b/kformula/kformula_factory.cc
@@ -0,0 +1,70 @@
+#include "kformula_factory.h"
+#include "kformula_doc.h"
+#include "kformula_aboutdata.h"
+
+#include <kinstance.h>
+#include <kiconloader.h>
+
+#include <kfiledialog.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <klocale.h>
+
+#include <qstringlist.h>
+
+K_EXPORT_COMPONENT_FACTORY( libkformulapart, KFormulaFactory )
+
+KInstance* KFormulaFactory::s_global = 0;
+KAboutData* KFormulaFactory::s_aboutData = 0;
+
+KAboutData* KFormulaFactory::aboutData()
+{
+ if( !s_aboutData )
+ s_aboutData=newKFormulaAboutData();
+ return s_aboutData;
+}
+
+
+KFormulaFactory::KFormulaFactory( QObject* parent, const char* name )
+ : KoFactory( parent, name )
+{
+ // Create our instance, so that it becomes KGlobal::instance if the
+ // main app is KFormula.
+ (void)global();
+}
+
+KFormulaFactory::~KFormulaFactory()
+{
+ delete s_aboutData;
+ s_aboutData=0;
+ delete s_global;
+ s_global = 0L;
+}
+
+KParts::Part* KFormulaFactory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, const char* classname, const QStringList & )
+{
+ bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
+
+ KFormulaDoc *doc = new KFormulaDoc( parentWidget, widgetName, parent, name, !bWantKoDocument );
+
+ if ( !bWantKoDocument )
+ doc->setReadWrite( false );
+
+ return doc;
+}
+
+KInstance* KFormulaFactory::global()
+{
+ if ( !s_global )
+ {
+ s_global = new KInstance(aboutData());
+ s_global->dirs()->addResourceType( "toolbar",
+ KStandardDirs::kde_default("data") + "koffice/toolbar/");
+ // Tell the iconloader about share/apps/koffice/icons*/
+ s_global->iconLoader()->addAppDir("koffice");
+ }
+
+ return s_global;
+}
+
+#include "kformula_factory.moc"