You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/kformula/kformula_factory.cc

71 lines
1.7 KiB

#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 <tqstringlist.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( TQObject* tqparent, const char* name )
: KoFactory( tqparent, 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( TQWidget *tqparentWidget, const char *widgetName, TQObject* tqparent, const char* name, const char* classname, const TQStringList & )
{
bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
KFormulaDoc *doc = new KFormulaDoc( tqparentWidget, widgetName, tqparent, 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"