Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

TransactionState Class Reference

TransactionState provides a container where multiple UndoStates can be stored. More...

#include <undomanager.h>

Inheritance diagram for TransactionState:

Inheritance graph
[legend]
Collaboration diagram for TransactionState:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 TransactionState ()
 Creates a new TransactionState instance.
 ~TransactionState ()
 Destroys the TransactionState instance.
void pushBack (UndoObject *target, UndoState *state)
 Add a new UndoState object to the transaction.
uint sizet ()
 Returns the count of the UndoState objects in this transaction.
void useActionName ()
 Use the name from last action added to this TransactionState.
UndoStateat (int index)
 Returns an UndoState object at index.
bool contains (int uid) const
 Returns true if this transaction contains UndoObject with the id uid.
bool containsOnly (int uid) const
 Tells if this transaction contains only UndoObject with ID uid.
UndoObjectreplace (ulong uid, UndoObject *newUndoObject)
 Replace object with id uid with new UndoObject newUndoObject.
void undo ()
 undo all UndoStates in this transaction
void redo ()
 redo all UndoStates in this transaction

Private Attributes

uint size_
 Number of undo states stored in this transaction.
std::vector< UndoState * > states_
 vector to keep the states in


Detailed Description

TransactionState provides a container where multiple UndoStates can be stored.

as a single action which then appears in the attached UndoGuis.

Author:
Riku Leino riku@scribus.info
Date:
January 2005

Definition at line 56 of file undomanager.h.


Constructor & Destructor Documentation

TransactionState::TransactionState (  ) 

Creates a new TransactionState instance.

Definition at line 681 of file undomanager.cpp.

References size_.

TransactionState::~TransactionState (  ) 

Destroys the TransactionState instance.

Definition at line 764 of file undomanager.cpp.

References states_.


Member Function Documentation

void TransactionState::pushBack ( UndoObject target,
UndoState state 
)

Add a new UndoState object to the transaction.

Parameters:
state state to be added to the transaction

Definition at line 714 of file undomanager.cpp.

References UndoState::setUndoObject(), size_, and states_.

uint TransactionState::sizet (  ) 

Returns the count of the UndoState objects in this transaction.

Returns:
count of the UndoState objects in this transaction

Definition at line 724 of file undomanager.cpp.

References size_.

Referenced by at(), UndoTransaction::commit(), redo(), and undo().

void TransactionState::useActionName (  ) 

Use the name from last action added to this TransactionState.

Definition at line 729 of file undomanager.cpp.

References UndoState::getName(), UndoState::setName(), size_, and states_.

Referenced by UndoTransaction::commit().

UndoState * TransactionState::at ( int  index  ) 

Returns an UndoState object at index.

Parameters:
index index from where an UndoState object is returned. If index is out of scope NULL will be rerturned.
Returns:
UndoState object from index or NULL if index is out of scope.

Definition at line 686 of file undomanager.cpp.

References sizet(), and states_.

Referenced by redo(), and undo().

bool TransactionState::contains ( int  uid  )  const

Returns true if this transaction contains UndoObject with the id uid.

otherwise returns false.

Returns:
true if this transaction contains UndoObject with the ide uid

otherwise returns false.

Definition at line 694 of file undomanager.cpp.

References UndoObject::getUId(), states_, and UndoState::undoObject().

Referenced by UndoStack::getNextRedo(), and UndoStack::getNextUndo().

bool TransactionState::containsOnly ( int  uid  )  const

Tells if this transaction contains only UndoObject with ID uid.

If a transaction contains only single UndoObject it will be safe to include it in the object specific undo.

Parameters:
uid UndoObject's id to look for
Returns:
true if this transaction only contains actions of the UndoObject whose id is uid

Definition at line 704 of file undomanager.cpp.

References UndoObject::getUId(), states_, and UndoState::undoObject().

Referenced by UndoManager::setState().

UndoObject * TransactionState::replace ( ulong  uid,
UndoObject newUndoObject 
)

Replace object with id uid with new UndoObject newUndoObject.

Parameters:
uid id of the object that is wanted to be replaced
newUndoObject object that is used for replacing
Returns:
UndoObject which was replaced

Definition at line 735 of file undomanager.cpp.

References replace(), states_, and UndoState::undoObject().

Referenced by replace(), and UndoManager::replaceObject().

void TransactionState::undo (  )  [virtual]

undo all UndoStates in this transaction

Reimplemented from UndoState.

Definition at line 752 of file undomanager.cpp.

References at(), sizet(), and UndoState::undo().

void TransactionState::redo (  )  [virtual]

redo all UndoStates in this transaction

Reimplemented from UndoState.

Definition at line 758 of file undomanager.cpp.

References at(), UndoState::redo(), and sizet().


Member Data Documentation

uint TransactionState::size_ [private]

Number of undo states stored in this transaction.

Definition at line 116 of file undomanager.h.

Referenced by pushBack(), sizet(), TransactionState(), and useActionName().

std::vector<UndoState*> TransactionState::states_ [private]

vector to keep the states in

Definition at line 118 of file undomanager.h.

Referenced by at(), contains(), containsOnly(), pushBack(), replace(), useActionName(), and ~TransactionState().


The documentation for this class was generated from the following files:
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.