/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                Copyright (c) 2002-2008 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg Melashenko
 *--------------------------------------------------------------------------
 * @purpose:  Declaration of the class IUndoService
 *--------------------------------------------------------------------------
 * @created: Friday, February 20, 2004 10:57:03
 */

#if !defined(IUndoService_h_included)
#define IUndoService_h_included
//forward declaration of this class might require
namespace services
{ class IUndoService; };
#include <zmodeler.h>
#include <core/coreTypes.h>
#include <services/zmServices.h>
#include <services/IService.h>
#include <core/layout/IUndoTreeNavigator.h>
#include <core/undo/IUndoBlock.h>
#include <core/IProcParams.h>


namespace services
{
  
  class IUndoService : public services::IService
  {
  public:
    virtual ZRESULT getRootNavigator(core::layout::IUndoTreeNavigator** ppNav)=0;
    virtual ZRESULT getCurrentNavigator(core::layout::IUndoTreeNavigator** ppNav)=0;
    /* returns ZRESULT_OK if branch recording was started and was not comitted. */
    virtual ZRESULT isRecording(void)=0;
    virtual ZRESULT markSave(void)=0;
    /* returns ZRESULT_OK if any changes were made since last
     * markSave() call. */
    virtual ZRESULT isModified(void)=0;
    virtual ZRESULT addUndoBlock(ZString strName, core::undo::IUndoBlock* pBuf)=0;
    virtual ZRESULT createCommonUndo(core::undo::eCommonUndo type, ZString strName, core::IProcParams* pParams, ZBlackBox* pBox=NULL)=0;
    virtual ZRESULT registerCommonUndo(core::undo::eCommonUndo type, ZString strClass)=0;
    /* Provides name of current undo (last added). This can be used
     * by interactive tools to test whether it (the tool) was the last who
     * added data into undo stack and, if so, reject adding new backup
     * data. Modifying color with color slider is an example of use. */
    virtual ZRESULT getLastUndoName(ZString& strName)=0;
    virtual ZRESULT getChainLimit(long& nLength)=0;
    virtual ZRESULT setChainLimit(long nLength)=0;
    virtual ZRESULT discardRedo(void)=0;
    virtual ZRESULT discardUndo(void)=0;
    virtual ZRESULT beginBranch(ZString strName)=0;
    virtual ZRESULT commitBranch(void)=0;
    virtual ZRESULT rollbackBranch(void)=0;
    virtual ZRESULT getUndoName(ZString& strName)=0;
    virtual ZRESULT getRedoName(ZString& strName)=0;
    virtual ZRESULT performUndo(void)=0;
    virtual ZRESULT performRedo(void)=0;
  
  };//class IUndoService
};//services

#endif
