KOffice – TDE office suite
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.

kformula_factory.cc 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "kformula_factory.h"
  2. #include "kformula_doc.h"
  3. #include "kformula_aboutdata.h"
  4. #include <kinstance.h>
  5. #include <kiconloader.h>
  6. #include <tdefiledialog.h>
  7. #include <tdeglobal.h>
  8. #include <kstandarddirs.h>
  9. #include <tdelocale.h>
  10. #include <tqstringlist.h>
  11. K_EXPORT_COMPONENT_FACTORY( libkformulapart, KFormulaFactory )
  12. TDEInstance* KFormulaFactory::s_global = 0;
  13. TDEAboutData* KFormulaFactory::s_aboutData = 0;
  14. TDEAboutData* KFormulaFactory::aboutData()
  15. {
  16. if( !s_aboutData )
  17. s_aboutData=newKFormulaAboutData();
  18. return s_aboutData;
  19. }
  20. KFormulaFactory::KFormulaFactory( TQObject* parent, const char* name )
  21. : KoFactory( parent, name )
  22. {
  23. // Create our instance, so that it becomes TDEGlobal::instance if the
  24. // main app is KFormula.
  25. (void)global();
  26. }
  27. KFormulaFactory::~KFormulaFactory()
  28. {
  29. delete s_aboutData;
  30. s_aboutData=0;
  31. delete s_global;
  32. s_global = 0L;
  33. }
  34. KParts::Part* KFormulaFactory::createPartObject( TQWidget *parentWidget, const char *widgetName, TQObject* parent, const char* name, const char* classname, const TQStringList & )
  35. {
  36. bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
  37. KFormulaDoc *doc = new KFormulaDoc( parentWidget, widgetName, parent, name, !bWantKoDocument );
  38. if ( !bWantKoDocument )
  39. doc->setReadWrite( false );
  40. return doc;
  41. }
  42. TDEInstance* KFormulaFactory::global()
  43. {
  44. if ( !s_global )
  45. {
  46. s_global = new TDEInstance(aboutData());
  47. s_global->dirs()->addResourceType( "toolbar",
  48. TDEStandardDirs::kde_default("data") + "koffice/toolbar/");
  49. // Tell the iconloader about share/apps/koffice/icons*/
  50. s_global->iconLoader()->addAppDir("koffice");
  51. }
  52. return s_global;
  53. }
  54. #include "kformula_factory.moc"