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/kchart/kchart_factory.cc

83 lines
1.7 KiB

/**
* $Id: kchart_factory.cc 483001 2005-11-24 18:27:18Z dfaure $
*
* Kalle Dalheimer <kalle@kde.org>
*/
#include "kchart_factory.h"
#include "kchart_aboutdata.h"
#include "kchart_part.h"
#include <klocale.h>
#include <kinstance.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kstandarddirs.h>
namespace KChart
{
KInstance *KChartFactory::s_global = 0;
KAboutData *KChartFactory::s_aboutData = 0;
KChartFactory::KChartFactory( TQObject* tqparent, const char* name )
: KoFactory( tqparent, name )
{
global();
}
KChartFactory::~KChartFactory()
{
delete s_aboutData;
s_aboutData = 0;
delete s_global;
s_global = 0;
}
KParts::Part* KChartFactory::createPartObject( TQWidget *tqparentWidget,
const char *widgetName,
TQObject* tqparent,
const char* name,
const char *classname,
const TQStringList & )
{
bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
KChartPart *part = new KChartPart( tqparentWidget, widgetName, tqparent, name,
!bWantKoDocument );
if ( !bWantKoDocument )
part->setReadWrite( false );
return part;
}
KAboutData* KChartFactory::aboutData()
{
if( !s_aboutData )
s_aboutData = newKChartAboutData();
return s_aboutData;
}
KInstance* KChartFactory::global()
{
if ( !s_global )
{
s_global = new KInstance(aboutData());
s_global->dirs()->addResourceType( "kchart_template",
KStandardDirs::kde_default("data") + "kchart/templates/");
// Tell the iconloader about share/apps/koffice/icons
s_global->iconLoader()->addAppDir("koffice");
}
return s_global;
}
} //namespace KChart
#include <kchart_factory.moc>