kpresenter
KPrFactory.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "KPrFactory.h"
00022 #include "KPrDocument.h"
00023 #include "KPrAboutData.h"
00024
00025 #include <kstandarddirs.h>
00026 #include <kinstance.h>
00027
00028
00029 KInstance* KPrFactory::s_global = 0;
00030 KAboutData* KPrFactory::s_aboutData = 0;
00031
00032 KPrFactory::KPrFactory( QObject* parent, const char* name )
00033 : KoFactory( parent, name )
00034 {
00035 (void)global();
00036 }
00037
00038 KPrFactory::~KPrFactory()
00039 {
00040 delete s_aboutData;
00041 s_aboutData=0;
00042 delete s_global;
00043 s_global=0;
00044 }
00045
00046 KParts::Part* KPrFactory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject* parent,
00047 const char* name, const char* classname, const QStringList & )
00048 {
00049 bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
00050
00051 KPrDocument *doc = new KPrDocument( parentWidget, widgetName, parent, name, !bWantKoDocument );
00052
00053 if ( !bWantKoDocument )
00054 doc->setReadWrite( false );
00055
00056 return doc;
00057 }
00058
00059 KAboutData* KPrFactory::aboutData()
00060 {
00061 if( !s_aboutData )
00062 s_aboutData=newKPresenterAboutData();
00063 return s_aboutData;
00064 }
00065
00066 KInstance* KPrFactory::global()
00067 {
00068 if ( !s_global )
00069 {
00070 s_global = new KInstance(aboutData());
00071
00072 s_global->dirs()->addResourceType("kpresenter_template",
00073 KStandardDirs::kde_default("data") + "kpresenter/templates/");
00074 s_global->dirs()->addResourceType("autoforms",
00075 KStandardDirs::kde_default("data") + "kpresenter/autoforms/");
00076 s_global->dirs()->addResourceType("slideshow",
00077 KStandardDirs::kde_default("data") + "kpresenter/slideshow/");
00078
00079 s_global->iconLoader()->addAppDir("koffice");
00080 }
00081 return s_global;
00082 }
00083
00084 #include "KPrFactory.moc"
|