epoc32/include/editorundo.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/editorundo.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,164 +0,0 @@
     1.4 -// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 -// All rights reserved.
     1.6 -// This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 -// which accompanies this distribution, and is available
     1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 -//
    1.11 -// Initial Contributors:
    1.12 -// Nokia Corporation - initial contribution.
    1.13 -//
    1.14 -// Contributors:
    1.15 -//
    1.16 -// Description:
    1.17 -//
    1.18 -
    1.19 -#ifndef EDITORUNDO_H_
    1.20 -#define EDITORUNDO_H_
    1.21 -
    1.22 -#include "unified_editor.h"
    1.23 -
    1.24 -namespace UndoSystem
    1.25 -/**
    1.26 -@internalTechnology
    1.27 -*/
    1.28 -{
    1.29 -class CCommandManager;
    1.30 -class MNotUndoableGatekeeper;
    1.31 -}
    1.32 -
    1.33 -class CEditorCommandFactory;
    1.34 -
    1.35 -/**
    1.36 -MUnifiedEditor decorator that adds undo functionality.
    1.37 -It passes commands transparently to the editor it is constructed upon, while
    1.38 -storing the operations so that they can be undone and redone. Calling a
    1.39 -non-const method of MUnifiedEditor wipes all 'Redo' operations.
    1.40 -The undo and redo operations are only guaranteed to be accurate if the
    1.41 -underlying editor satisfies certain conditions.
    1.42 -
    1.43 -@since App-frameworks6.1
    1.44 -@internalAll
    1.45 -*/
    1.46 -class CEditorWithUndo : public CBase,
    1.47 -	public MUnifiedEditor,
    1.48 -	private MUnifiedEditor::MStyleSupport,
    1.49 -	private MUnifiedEditor::MPictureSupport,
    1.50 -	private MUnifiedEditor::MClipboardSupport
    1.51 -
    1.52 -	{
    1.53 -public:
    1.54 -	~CEditorWithUndo();
    1.55 -
    1.56 -	/**
    1.57 -	 * Creates a CEditorWithUndo. It does not own the aEditor.
    1.58 -	 */
    1.59 -	IMPORT_C static CEditorWithUndo* NewL(MUnifiedEditor& aEditor);
    1.60 -	/**
    1.61 -	 * Creates a CEditorWithUndo, using the aSharedUndoSystem. This allows
    1.62 -	 * many objects to stay in synchronization when each is accessed
    1.63 -	 * seperately.
    1.64 -	 * The aEditor is not owned.
    1.65 -	 */
    1.66 -	IMPORT_C static CEditorWithUndo* NewL(MUnifiedEditor& aEditor,
    1.67 -		UndoSystem::CCommandManager* aSharedUndoSystem);
    1.68 -	/**
    1.69 -	 * Undoes one operation or batch of operations. If one operation in the
    1.70 -	 * middle of a batch leaves, this function will leave, but the underlying
    1.71 -	 * editor will not necessarily be in the same state as it was in before
    1.72 -	 * the call. However, all operations will still be stored, and so the
    1.73 -	 * previous state is still recoverable with a call to RedoL() or a
    1.74 -	 * further call to UndoL will complete the operation (resource acquisition
    1.75 -	 * permitting).
    1.76 -	 */
    1.77 -	IMPORT_C void UndoL();
    1.78 -	/**
    1.79 -	 * Redoes one operation or batch of operations. If one operation in the
    1.80 -	 * middle of a batch leaves, this function will leave, but the underlying
    1.81 -	 * editor will not necessarily be in the same state as it was in before
    1.82 -	 * the call. However, all operations will still be stored, and so the
    1.83 -	 * previous state is still recoverable with a call to UndoL() or a
    1.84 -	 * further call to RedoL will complete the operation (resource acquisition
    1.85 -	 * permitting).
    1.86 -	 */
    1.87 -	IMPORT_C void RedoL();
    1.88 -	/**
    1.89 -	 * Returns ETrue iff UndoL() would have an effect
    1.90 -	 */
    1.91 -	IMPORT_C TBool CanUndo() const;
    1.92 -	/**
    1.93 -	 * Returns ETrue iff RedoL() would have an effect
    1.94 -	 */
    1.95 -	IMPORT_C TBool CanRedo() const;
    1.96 -	/**
    1.97 -	 * Wipes all undo and redo operations
    1.98 -	 */
    1.99 -	IMPORT_C void ResetUndo();
   1.100 -	/**
   1.101 -	 * Sets limits on the 'undo depth'. This is the numbet of times that
   1.102 -	 * successive calls to UndoL() have an effect. When a depth of
   1.103 -	 * aMaxItems is reached, the undo depth is reset to aMinItems.
   1.104 -	 */
   1.105 -	IMPORT_C void SetMaxItems(TInt aMaxItems);
   1.106 -	/**
   1.107 -	 * Sets a gatekeper for the undo system. This will be called whenever an
   1.108 -	 * operation is attempted that cannot be undone for any reason.
   1.109 -	 * The gatekeeper therefore has an oportunity to suppress execution and
   1.110 -	 * keep the current undo operations stored.
   1.111 -	 * NULL may be passed to restore default behaviour.
   1.112 -	 * Returns the old gatekeeper.
   1.113 -	 */
   1.114 -	IMPORT_C UndoSystem::MNotUndoableGatekeeper*
   1.115 -		SetGatekeeper(UndoSystem::MNotUndoableGatekeeper*);
   1.116 -
   1.117 -	// From MUnifiedEditor
   1.118 -	MTmOptionalInterface* Interface(TUint aId);
   1.119 -	void InsertTextL(TInt aPos, const TDesC& aText, const TDesC* aStyle,
   1.120 -		const TTmCharFormatLayer*, const RTmParFormatLayer*);
   1.121 -	void DeleteTextL(TInt aPos,TInt aLength);
   1.122 -	void SetBaseFormatL(const TTmCharFormat&, const RTmParFormat&);
   1.123 -	void SetCharFormatL(TInt aPos, TInt aLength, const TTmCharFormatLayer&);
   1.124 -	void SetParFormatL(TInt aPos, TInt aLength, const RTmParFormatLayer&);
   1.125 -	void DeleteCharFormatL(TInt aPos, TInt aLength);
   1.126 -	void DeleteParFormatL(TInt aPos, TInt aLength);
   1.127 -	TInt DocumentLength() const;
   1.128 -	void GetText(TInt aPos, TPtrC& aText) const;
   1.129 -	void GetBaseFormatL(TTmCharFormat&, RTmParFormat&) const;
   1.130 -	void GetCharFormat(TInt aPos, TFormatLevel aLevel,
   1.131 -		TTmCharFormatLayer& aFormat,TInt& aRunLength) const;
   1.132 -	void GetParFormatL(TInt aPos, TFormatLevel aLevel,
   1.133 -		RTmParFormatLayer& aFormat, TInt& aRunLength) const;
   1.134 -
   1.135 -private:
   1.136 -	// from MStyleSupport
   1.137 -	TInt CreateStyleL(const RTmStyle&);
   1.138 -	TInt ChangeStyleL(const RTmStyle&);
   1.139 -	TInt SetStyleL(TInt aPos, TInt aLength, const TDesC&);
   1.140 -	TInt RenameStyleL(const TDesC& aOldName, const TDesC& aNewName);
   1.141 -	TInt DeleteStyleL(const TDesC& aName);
   1.142 -	TInt StyleCount() const;
   1.143 -	void GetStyle(TInt aPos, TPtrC& aName, TInt& aRunLength) const;
   1.144 -	TInt GetStyleByNameL(const TDesC& aName, RTmStyle&) const;
   1.145 -	TInt GetStyleByIndexL(TInt aIndex, RTmStyle&) const;
   1.146 -
   1.147 -	// from MPictureSupport
   1.148 -	void InsertPictureL(TInt aPos, const TPictureHeader&);
   1.149 -	void DropPictureL(TInt aPos);
   1.150 -	void Picture(TInt aPos, TPictureHeader&) const;
   1.151 -
   1.152 -	// from MClipboardSupport
   1.153 -	void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDictionary,
   1.154 -		TInt aPos, TInt aLength) const;
   1.155 -	void PasteFromStoreL(const CStreamStore& aStore,
   1.156 -		const CStreamDictionary& aDictionary, TInt aPos);
   1.157 -
   1.158 -	CEditorWithUndo();
   1.159 -	void ConstructL(MUnifiedEditor& aEditorBasedOn,
   1.160 -		UndoSystem::CCommandManager* aSharedUndoSystem);
   1.161 -
   1.162 -	CEditorCommandFactory*			iFactory;
   1.163 -	MUnifiedEditor*						iBaseEditor;
   1.164 -	UndoSystem::CCommandManager*	iCommandManager;
   1.165 -	};
   1.166 -
   1.167 -#endif	// EDITORUNDO_H_