2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-03-15 00:57:32 +00:00
|
|
|
|
|
|
|
#ifndef AggregatePlaceholderTxn_h__
|
|
|
|
#define AggregatePlaceholderTxn_h__
|
|
|
|
|
|
|
|
#include "EditAggregateTxn.h"
|
2000-01-31 10:30:12 +00:00
|
|
|
#include "nsEditorUtils.h"
|
1999-09-29 20:08:15 +00:00
|
|
|
#include "nsIAbsorbingTransaction.h"
|
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsWeakPtr.h"
|
|
|
|
#include "nsWeakReference.h"
|
2007-01-11 14:38:02 +00:00
|
|
|
#include "nsAutoPtr.h"
|
1999-03-15 00:57:32 +00:00
|
|
|
|
1999-09-29 20:08:15 +00:00
|
|
|
class nsHTMLEditor;
|
1999-10-26 18:54:47 +00:00
|
|
|
class IMETextTxn;
|
1999-09-29 20:08:15 +00:00
|
|
|
|
1999-03-15 00:57:32 +00:00
|
|
|
/**
|
|
|
|
* An aggregate transaction that knows how to absorb all subsequent
|
|
|
|
* transactions with the same name. This transaction does not "Do" anything.
|
|
|
|
* But it absorbs other transactions via merge, and can undo/redo the
|
|
|
|
* transactions it has absorbed.
|
|
|
|
*/
|
1999-09-29 20:08:15 +00:00
|
|
|
|
|
|
|
class PlaceholderTxn : public EditAggregateTxn,
|
|
|
|
public nsIAbsorbingTransaction,
|
|
|
|
public nsSupportsWeakReference
|
1999-03-15 00:57:32 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-09-29 20:08:15 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
1999-03-15 00:57:32 +00:00
|
|
|
PlaceholderTxn();
|
|
|
|
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PlaceholderTxn, EditAggregateTxn)
|
1999-09-29 20:08:15 +00:00
|
|
|
// ------------ EditAggregateTxn -----------------------
|
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_DECL_EDITTXN
|
1999-09-29 20:08:15 +00:00
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_IMETHOD RedoTransaction();
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);
|
2001-03-09 14:23:59 +00:00
|
|
|
|
1999-09-29 20:08:15 +00:00
|
|
|
// ------------ nsIAbsorbingTransaction -----------------------
|
|
|
|
|
2012-07-23 10:27:22 +00:00
|
|
|
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
|
|
|
|
nsEditor* aEditor);
|
1999-09-29 20:08:15 +00:00
|
|
|
|
|
|
|
NS_IMETHOD GetTxnName(nsIAtom **aName);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD StartSelectionEquals(nsSelectionState *aSelState, bool *aResult);
|
1999-09-29 20:08:15 +00:00
|
|
|
|
|
|
|
NS_IMETHOD EndPlaceHolderBatch();
|
|
|
|
|
|
|
|
NS_IMETHOD ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress);
|
1999-03-15 00:57:32 +00:00
|
|
|
|
1999-10-26 18:54:47 +00:00
|
|
|
NS_IMETHOD Commit();
|
|
|
|
|
2000-01-31 10:30:12 +00:00
|
|
|
NS_IMETHOD RememberEndingSelection();
|
1999-03-15 00:57:32 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
1999-09-29 20:08:15 +00:00
|
|
|
/** the presentation shell, which we'll need to get the selection */
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mAbsorb; // do we auto absorb any and all transaction?
|
1999-10-26 18:54:47 +00:00
|
|
|
nsWeakPtr mForwarding;
|
|
|
|
IMETextTxn *mIMETextTxn; // first IME txn in this placeholder - used for IME merging
|
2005-11-25 21:57:13 +00:00
|
|
|
// non-owning for now - can't nsCOMPtr it due to broken transaction interfaces
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCommitted; // do we stop auto absorbing any matching placeholder txns?
|
2000-01-31 10:30:12 +00:00
|
|
|
// these next two members store the state of the selection in a safe way.
|
|
|
|
// selection at the start of the txn is stored, as is the selection at the end.
|
2001-03-09 14:23:59 +00:00
|
|
|
// This is so that UndoTransaction() and RedoTransaction() can restore the
|
|
|
|
// selection properly.
|
2007-01-11 14:38:02 +00:00
|
|
|
nsAutoPtr<nsSelectionState> mStartSel; // use a pointer because this is constructed before we exist
|
2000-01-31 10:30:12 +00:00
|
|
|
nsSelectionState mEndSel;
|
2012-07-23 10:27:22 +00:00
|
|
|
nsEditor* mEditor; /** the editor for this transaction */
|
1999-03-15 00:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|