38 #include "scribusapi.h"
39 #include "undoobject.h"
69 UndoState(
const QString& name,
const QString& description = 0, QPixmap* pixmap = 0);
77 virtual QString getName();
83 virtual void setName(
const QString &newName);
89 virtual QString getDescription();
95 virtual void setDescription(
const QString &newDescription);
101 virtual QPixmap* getPixmap();
107 virtual void setPixmap(QPixmap *newPixmap);
118 virtual void setUndoObject(
UndoObject *
object);
127 QString actionDescription_;
129 QPixmap *actionPixmap_;
155 SimpleState(
const QString& name,
const QString& description = 0, QPixmap* pixmap = 0);
164 bool contains(
const QString& key);
178 QString
get(
const QString& key,
const QString& def =
"");
195 int getInt(
const QString& key,
int def = 0);
212 uint getUInt(
const QString& key, uint def = 0);
228 double getDouble(
const QString& key,
double def = 0.0);
244 bool getBool(
const QString& key,
bool def =
false);
251 void set(
const QString& key,
const QString& value);
258 void set(
const QString& key,
int value);
265 void set(
const QString& key, uint value);
272 void set(
const QString& key,
double value);
279 void set(
const QString& key,
bool value);
283 QMap<QString, QVariant> values_;
285 QVariant variant(
const QString& key,
const QVariant& def);
294 ScItemState(
const QString& name,
const QString& description = 0, QPixmap* pixmap = 0)
297 void setItem(
const C &c) { item_ = c; }
298 C getItem()
const {
return item_; }
308 ScItemsState(
const QString& name,
const QString& description = 0, QPixmap* pixmap = 0)
311 void insertItem(QString itemname,
void * item) { pointerMap.insert(itemname, item); }
312 void* getItem(QString itemname)
const {
if (pointerMap.contains(itemname))
return pointerMap.value(itemname);
else return NULL;}
313 QList< QPair<void*, int> > insertItemPos;
315 QMap<QString,void*> pointerMap;
397 std::vector<UndoState*> states_;
void pushBack(UndoObject *target, UndoState *state)
Add a new UndoState object to the transaction.
Definition: undostate.cpp:245
bool contains(int uid) const
Returns true if this transaction contains UndoObject with the id uid
Definition: undostate.cpp:223
SimpleState(const QString &name, const QString &description=0, QPixmap *pixmap=0)
Creates a new SimpleState instance.
Definition: undostate.cpp:99
bool isTransaction()
To know if the state is a Transaction.
Definition: undostate.h:334
~TransactionState()
Destroys the TransactionState instance.
Definition: undostate.cpp:325
UndoState describes an undoable state (action).
Definition: undostate.h:59
Definition: undostate.h:305
virtual bool isTransaction()
To know if the state is a transaction.
Definition: undostate.h:116
UndoState * last() const
Returns the last UndoState in transaction.
Definition: undostate.cpp:216
UndoObject * replace(ulong uid, UndoObject *newUndoObject)
Replace object with id uid with new UndoObject newUndoObject.
Definition: undostate.cpp:266
TransactionState provides a container where multiple UndoStates can be stored.
Definition: undostate.h:326
void undo()
undo all UndoStates in this transaction
Definition: undostate.cpp:283
Definition: undostate.h:291
TransactionState()
Creates a new TransactionState instance.
Definition: undostate.cpp:203
Superclass for all objects that are wanted to have undoable actions.
Definition: undoobject.h:59
bool containsOnly(int uid) const
Tells if this transaction contains only UndoObject with ID uid.
Definition: undostate.cpp:234
void redo()
redo all UndoStates in this transaction
Definition: undostate.cpp:304
Definition: pageitem.h:92
UndoState * at(int index) const
Returns an UndoState object at index.
Definition: undostate.cpp:208
uint sizet() const
Returns the count of the UndoState objects in this transaction.
Definition: undostate.cpp:255
void useActionName()
Use the name from last action added to this TransactionState
Definition: undostate.cpp:260
SimpleState provides a simple implementation of the UndoState.
Definition: undostate.h:145