kexi

manager.h

00001 /***************************************************************************
00002  * This file is part of the KDE project
00003  * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
00004  * copyright (C) 2005 by Tobi Krebs (tobi.krebs@gmail.com)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KOMACRO_MANAGER_H
00021 #define KOMACRO_MANAGER_H
00022 
00023 #include <qmap.h>
00024 #include <qguardedptr.h>
00025 #include <ksharedptr.h>
00026 #include <kxmlguiclient.h>
00027 #include <kstaticdeleter.h>
00028 
00029 #include "komacro_export.h"
00030 
00031 class QObject;
00032 class QDomElement;
00033 
00034 namespace KoMacro {
00035 
00036     // Forward declarations.
00037     class Action;
00038     class Macro;
00039 
00075     class KOMACRO_EXPORT Manager
00076     {
00077             friend class KStaticDeleter< ::KoMacro::Manager >;
00078         private:
00079 
00086             explicit Manager(KXMLGUIClient* const xmlguiclient);
00087 
00091             virtual ~Manager();
00092 
00093         public:
00094 
00100             static void init(KXMLGUIClient* xmlguiclient);
00101 
00107             static Manager* self();
00108 
00113             KXMLGUIClient* guiClient() const;
00114 
00119             bool hasMacro(const QString& macroname);
00120 
00125             KSharedPtr<Macro> getMacro(const QString& macroname);
00126 
00137             void addMacro(const QString& macroname, KSharedPtr<Macro> macro);
00138 
00144             void removeMacro(const QString& macroname);
00145 
00153             KSharedPtr<Macro> createMacro(const QString& macroname);
00154 
00155 #if 0
00167             KSharedPtr<Action> createAction(const QDomElement& element);
00168 #endif
00169 
00175             KSharedPtr<Action> action(const QString& name) const;
00176 
00180             QMap<QString, KSharedPtr<Action> > actions() const;
00181 
00185             QStringList actionNames() const;
00186 
00191             void publishAction(KSharedPtr<Action> action);
00192 
00197             void publishObject(const QString& name, QObject* object);
00198 
00203             QGuardedPtr<QObject> object(const QString& name) const;
00204 
00208             QMap<QString, QGuardedPtr<QObject> > objects() const;
00209 
00210         private:
00212             class Private;
00214             Private* const d;
00215     };
00216 
00217 }
00218 
00219 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys