Back to index

scribus-ng  1.3.4.dfsg+svn20071115
actionmanager.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008     begin                : Jan 2005
00009     copyright            : (C) 2005 by Craig Bradney
00010     email                : cbradney@zip.com.au
00011  ***************************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 #ifndef ACTIONMANAGER_H
00022 #define ACTIONMANAGER_H
00023 
00024 #include <qkeysequence.h>
00025 #include <qobject.h>
00026 #include <qstring.h>
00027 #include <qstringlist.h>
00028 #include <qmap.h>
00029 #include <qpair.h>
00030 #include <qvaluevector.h>
00031 #include <qguardedptr.h>
00032 #include <qdict.h>
00033 
00034 #include "scribusapi.h"
00035 #include "scraction.h"
00036 
00037 class ScribusDoc;
00038 class ScribusMainWindow;
00039 class ScribusQApp;
00040 class ScribusView;
00041 class UndoManager;
00045 class SCRIBUS_API ActionManager : public QObject
00046 {
00047        Q_OBJECT
00048 
00049        friend class StoryEditor;
00050        public:
00051               ActionManager ( QObject * parent, const char * name );  
00052               ~ActionManager();
00053               void init(ScribusMainWindow *);
00054               static void createDefaultShortcuts();
00055               static QMap<QString, QKeySequence>* defaultShortcuts() {return &defKeys;};
00056               static void createDefaultMenus();
00057               static void createDefaultNonMenuActions();
00058               static QValueVector< QPair<QString, QStringList> >* defaultMenus() {return &defMenus;};
00059               static QValueVector< QPair<QString, QStringList> >* defaultNonMenuActions() {return &defNonMenuActions;};
00060               void createActions();
00061               void disconnectModeActions();
00062               void connectModeActions();
00063               void disconnectNewViewActions();
00064               void connectNewViewActions(ScribusView *);
00065               void disconnectNewDocActions();
00066               void connectNewDocActions(ScribusDoc *);
00067               void disconnectNewSelectionActions();
00068               void connectNewSelectionActions(ScribusView *,ScribusDoc *);
00069               void saveActionShortcutsPreEditMode();
00070               void restoreActionShortcutsPostEditMode();
00071               void enableActionStringList(QMap<QString, QGuardedPtr<ScrAction> > *actionMap, QStringList *list, bool enabled, bool checkingUnicode=false, const QString& fontName=QString::null);
00072               void enableUnicodeActions(QMap<QString, QGuardedPtr<ScrAction> > *actionMap, bool enabled, const QString& fontName=QString::null);
00073               void setPDFActions(ScribusView *);
00074               
00075        public slots:
00076               void languageChange();
00077               void handleMultipleSelections(bool isMultiple);
00078               
00079        protected:
00080               void initFileMenuActions();
00081               void initEditMenuActions();
00082               void initStyleMenuActions();
00083               void initItemMenuActions();
00084               void initInsertMenuActions();
00085               void initPageMenuActions();
00086               void initViewMenuActions();
00087               void initToolsMenuActions();
00088               void initExtrasMenuActions();
00089               void initWindowsMenuActions();
00090               void initScriptMenuActions();
00091               void initHelpMenuActions();
00092               static void initUnicodeActions(QMap<QString, QGuardedPtr<ScrAction> > *actionMap, QWidget *actionParent, QStringList *actionNamesList);
00093               void initSpecialActions();
00094               static void languageChangeUnicodeActions(QMap<QString, QGuardedPtr<ScrAction> > *actionMap);
00095        
00096               QPixmap noIcon;
00097               ScribusMainWindow *mainWindow;
00098               ScribusQApp *ScQApp;
00099               UndoManager *undoManager;
00100               QMap<QString, QGuardedPtr<ScrAction> > *scrActions;
00101               QDict<QActionGroup> *scrActionGroups;
00102               QStringList *modeActionNames;
00103               QStringList *nonEditActionNames;
00104               QStringList *unicodeCharActionNames;
00105               static QMap<QString, QKeySequence> defKeys;
00106               static QValueVector< QPair<QString, QStringList> > defMenus;
00107               static QValueVector< QPair<QString, QStringList> > defNonMenuActions;
00108 };
00109 
00110 #endif