/*************************************************************************
 *
 *  $RCSfile: wrt_undo.cxx,v $
 *
 *  $Revision: 1.1.1.1 $
 *
 *  last change: $Author: hr $ $Date: 2000/09/18 17:14:54 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifdef PRECOMPILED
#include "filt_pch.hxx"
#endif

#pragma hdrstop

#ifdef __MWERKS__
#define private public
#endif

#ifndef _STREAM_HXX //autogen
#include <tools/stream.hxx>
#endif


#include "doc.hxx"
#include "wrt_undo.hxx"
#include "undobj.hxx"
#include "docary.hxx"




SwUndoWriter::SwUndoWriter()  {}



__EXPORT SwUndoWriter::~SwUndoWriter() {}



ULONG SwUndoWriter::WriteStream()
{
	// keine Daten ??
	if( !pDoc->pUndos->Count() )
		return 0;

	//$ long nFlags = rStrm().setf( ios::fixed, ios::floatfield );
	//$ rStrm().precision( 3 );

	// Undo-Aktionen vorhanden
	if( pDoc->nUndoPos )
	{
		Strm() << "======= Undo-Aktionen =========\n";
		SwUndo* pUndo;
		for( USHORT n = pDoc->nUndoPos; n; )
		{
			pUndo = pDoc->pUndos->operator[](--n);
			(*aUndoFnTab[ pUndo->GetId() - UNDO_STD_BEGIN ])( *this, *pUndo );
		}
	}
	// Redo-Aktionen vorhanden
	if( pDoc->nUndoPos < pDoc->pUndos->Count()  )
	{
		Strm() << "======= Redo-Aktionen =========\n";
		SwUndo* pUndo;
		for( USHORT n = pDoc->nUndoPos; n < pDoc->pUndos->Count(); ++n )
		{
			pUndo = pDoc->pUndos->operator[](n);
			(*aUndoFnTab[ pUndo->GetId() - UNDO_STD_BEGIN ])( *this, *pUndo );
		}
	}

//     Out_SwDoc( pDebug, *pDoc->GetUndoNds() );

	Strm() << '\0';

	return 0;
}


#ifndef PRODUCT

void GetUndoWriter( const String&, WriterRef& xRet )
{
	xRet = new SwUndoWriter;
}

#endif

/*************************************************************************

	  $Log: wrt_undo.cxx,v $
	  Revision 1.1.1.1  2000/09/18 17:14:54  hr
	  initial import
	
	  Revision 1.25  2000/09/18 16:04:41  willem.vandorp
	  OpenOffice header added.
	
	  Revision 1.24  2000/03/03 16:10:12  pl
	  #73771# workaround for c50 intel compiler
	
	  Revision 1.23  1999/06/16 17:51:20  JP
	  Change interface of base class Writer
	

	  Rev 1.22   16 Jun 1999 19:51:20   JP
   Change interface of base class Writer

	  Rev 1.21   04 May 1999 15:00:34   JP
   FilterExportklasse Writer von SvRef abgeleitet, damit sie immer zerstoert wird

	  Rev 1.20   26 Nov 1997 14:13:24   MA
   headerfiles

	  Rev 1.19   03 Nov 1997 14:05:22   MA
   precomp entfernt

	  Rev 1.18   01 Sep 1997 19:14:26   MA
   includes

	  Rev 1.17   28 Jun 1996 14:32:26   MA
   includes

	  Rev 1.16   14 Dec 1995 23:04:00   JP
   Filter Umstellung: ErrorHandling und Read/Write-Parameter

	  Rev 1.15   24 Nov 1995 17:24:16   OM
   PCH->PRECOMPILED

	  Rev 1.14   19 Jun 1995 10:14:08   KH
   define private public (nur fuer __MWERKS__)

	  Rev 1.13   16 May 1995 14:28:56   ER
   private->public weg: so nicht!

	  Rev 1.12   09 May 1995 17:19:00   KH
   private -> public

	  Rev 1.11   24 Feb 1995 00:11:28   ER
   sexport

	  Rev 1.10   13 Jan 1995 10:51:40   JP
   Initialisierung und Erkennung der spz. Reader/Writer umgestellt

	  Rev 1.9   15 Dec 1994 20:50:22   SWG
   *ARR* Ersetzungen, svmem, __far_data etc.

	  Rev 1.8   25 Oct 1994 15:25:14   MA
   PreHdr.

	  Rev 1.7   28 Sep 1994 20:11:48   JP
   Umstellung auf Sfx-Items, FS_Stream durch SvStream ersetzt

	  Rev 1.6   21 Sep 1994 18:00:06   PK
   einbau sv-streams

	  Rev 1.5   24 Mar 1994 19:04:44   JP
   Writer::Write - zus. Parameter

	  Rev 1.4   28 Jan 1994 11:29:18   MI
   TCOV() entfernt, SW_... nach SEG_... umbenannt

	  Rev 1.3   13 Jan 1994 08:29:02   MI
   Segmentierung per #define ermoeglicht

	  Rev 1.2   10 Jan 1994 08:36:50   MI
   Segmentierungs-Problem

	  Rev 1.1   09 Jan 1994 20:07:58   MI
   Provisorische Segmentierung

	  Rev 1.0   06 Jan 1994 09:35:30   JP
   Initial revision.

*************************************************************************/


