1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef STYLEMANAGER_H
#define STYLEMANAGER_H
#include <QPointer>
class QEvent;
#include "scrpalettebase.h"
#include "ui_stylemanager.h"
class StyleItem;
class ScribusDoc;
class ShortcutWidget;
class ScrAction;
struct Keys;
class SCRIBUS_API StyleManager : public ScrPaletteBase, Ui::StyleManager
{
Q_OBJECT
public:
StyleManager(QWidget *parent = 0, const char *name = "StyleManager");
~StyleManager();
virtual void changeEvent(QEvent *e);
void addStyle(StyleItem *item);
void updateColorList();
QMap<QString,Keys> keyMap();
public slots:
void setDoc(ScribusDoc *doc);
void languageChange();
void unitChange();
signals:
void closed();
protected:
void hideEvent(QHideEvent *e);
void closeEvent(QCloseEvent *e);
void showEvent(QShowEvent *e);
private:
QList<StyleItem*> m_items;
StyleItem *m_item;
QGridLayout *m_layout;
QTabWidget *m_widget;
ShortcutWidget *m_shortcutWidget;
QString m_currentType;
QMenu *m_newPopup;
QMenu *m_rightClickPopup;
QAction *m_rcpNewId;
QAction *m_rcpDeleteId;
QAction *m_rcpEditId;
QAction *m_rcpCloneId;
// QAction *m_rcpToScrapId;
ScrAction *m_selectedStyleAction;
bool m_isEditMode;
bool m_isStoryEditMode;
QPoint m_editPosition;
QString m_rcStyle;
QString m_rcType;
QString m_exitEditModeOk;
QString m_enterEditModeOk;
QString m_doneText;
QString m_editText;
ScribusDoc *m_doc;
PrefsContext *m_prefs;
QMap<QString, QPointer<ScrAction> > m_styleActions;
static const int NAME_COL = 0;
static const int SHORTCUT_COL = 1;
static const QString SEPARATOR;
void insertShortcutPage(QTabWidget *twidget);
bool nameIsUnique(const QString &name);
// will be used to map plural style name to it's singular
QMap<QString, QString> m_styleClassesPS;
QMap<QString, QString> m_styleClassesSP;
// QPair.first will be the type name (null if nothing is selected or
// if there are styles from more than one type in the selection)
// QPair.second will be the selected styles
QPair<QString, QStringList> namesFromSelection();
void loadType(const QString &name);
void addNewType(StyleItem *item, bool loadFromDoc = true);
void createNewStyle(const QString &typeName, const QString &fromParent = QString::null);
void reloadStyleView(bool loadFromDoc = true); // are the styles loaded from doc or from tmp cache
bool shortcutExists(const QString &keys);
void updateActionName(const QString &oldName, const QString &newName);
/* QPair.first = type name and QPair.second = style name */
void setSelection(const QList<QPair<QString, QString> > &selected);
void setOkButtonText();
private slots:
void slotOk();
void slotApply();
void slotDelete();
void slotImport();
void slotEdit();
void slotClone();
void slotNew();
//! \brief Open "New Style" widget from "New" GUI button.
void slotNewPopup(QAction *);
/*! \brief Overloaded slot for context QMenu handling.
QActions inserted by QMenu::addAction() can handle triggered() related slots only
*/
void slotNewPopup();
void slotScrap();
void slotRightClick(const QPoint &point);
void slotDoubleClick(QTreeWidgetItem * item, int column);
void slotNameChanged(const QString& name);
void slotShortcutChanged(const QString& shortcut);
void slotSetupWidget();
void slotApplyStyle(QTreeWidgetItem *item);
void slotApplyStyle(QTreeWidgetItem *newitem, QTreeWidgetItem *olditem);
void slotApplyStyle(QTreeWidgetItem *item, int column);
void slotDocSelectionChanged();
void slotDocStylesChanged();
void slotDirty();
void slotClean();
void slotApplyStyle(QString keyString); // keyString == styleClass$$$$styleName
};
#endif
|