gecko-dev/editor/txmgr/public/nsITransactionManager.h

107 строки
3.3 KiB
C
Исходник Обычный вид История

1998-11-19 01:29:44 +03:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsITransactionManager_h__
#define nsITransactionManager_h__
1998-11-19 01:29:44 +03:00
#include "nsISupports.h"
#include "nsIOutputStream.h"
1998-11-19 04:40:53 +03:00
#include "nsITransaction.h"
#include "nsITransactionListener.h"
1998-11-19 01:29:44 +03:00
/*
Transaction Manager interface to outside world
*/
#define NS_ITRANSACTIONMANAGER_IID \
1998-11-19 01:29:44 +03:00
{ /* 58E330C2-7B48-11d2-98B9-00805F297D89 */ \
0x58e330c2, 0x7b48, 0x11d2, \
{ 0x98, 0xb9, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } };
/**
* A transaction manager specific interface.
* <P>
* It's implemented by an object that tracks transactions.
*/
class nsITransactionManager : public nsISupports{
public:
/**
* Places a transaction on the do stack and calls it's Do() method.
* <P>
* This method calls the transaction's AddRef() method.
1998-11-19 04:40:53 +03:00
* The transaction's Release() method will be called when the undo or redo
* stack is pruned or when the transaction manager is destroyed.
* @param aTransaction the transaction to do.
*/
virtual nsresult Do(nsITransaction *aTransaction) = 0;
/**
* Pops the topmost transaction on the do stack, pushes it on the undo
* stack, then calls it's Undo() method.
*/
virtual nsresult Undo(void) = 0;
/**
* Pops the topmost transaction on the undo stack, pushes it on the redo
* stack, then calls it's Redo() method.
1998-11-19 01:29:44 +03:00
*/
virtual nsresult Redo(void) = 0;
1998-11-19 01:29:44 +03:00
/**
* Returns the number of items on the undo stack.
* @param aNumItems will contain number of items.
1998-11-19 01:29:44 +03:00
*/
virtual nsresult GetNumberOfUndoItems(PRInt32 *aNumItems) = 0;
1998-11-19 01:29:44 +03:00
/**
* Returns the number of items on the redo stack.
* @param aNumItems will contain number of items.
1998-11-19 01:29:44 +03:00
*/
virtual nsresult GetNumberOfRedoItems(PRInt32 *aNumItems) = 0;
1998-11-19 01:29:44 +03:00
/**
* Writes a stream representation of the transaction manager and it's
* execution stacks. Calls the Write() method of each transaction on the
* execution stacks.
* @param aOutputStream the stream to write to.
1998-11-19 04:40:53 +03:00
*/
virtual nsresult Write(nsIOutputStream *aOutputStream) = 0;
1998-11-19 04:40:53 +03:00
/**
* Adds a listener to the transaction manager's notification list. Listeners
* are notified whenever a transaction is done, undone, or redone.
* <P>
* The listener's AddRef() method is called.
* @param aListener the lister to add.
1998-11-19 04:40:53 +03:00
*/
virtual nsresult AddListener(nsITransactionListener *aListener) = 0;
1998-11-19 04:40:53 +03:00
/**
* Removes a listener from the transaction manager's notification list.
* <P>
* The listener's Release() method is called.
* @param aListener the lister to remove.
1998-11-19 01:29:44 +03:00
*/
virtual nsresult RemoveListener(nsITransactionListener *aListener) = 0;
1998-11-19 01:29:44 +03:00
};
#endif // nsITransactionManager_h__
1998-11-19 01:29:44 +03:00