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-01-06 20:30:13 +00:00
|
|
|
|
|
|
|
#ifndef ChangeAttributeTxn_h__
|
|
|
|
#define ChangeAttributeTxn_h__
|
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
#include "EditTxn.h" // base class
|
2015-03-21 16:28:04 +00:00
|
|
|
#include "mozilla/Attributes.h" // override
|
2014-08-29 11:43:23 +00:00
|
|
|
#include "nsCOMPtr.h" // nsCOMPtr members
|
|
|
|
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED
|
|
|
|
#include "nsISupportsImpl.h" // NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
#include "nsString.h" // nsString members
|
2012-07-13 06:33:42 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
class nsIAtom;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Element;
|
1999-01-06 20:30:13 +00:00
|
|
|
|
|
|
|
/**
|
2014-08-29 11:43:23 +00:00
|
|
|
* A transaction that changes an attribute of a content node. This transaction
|
|
|
|
* covers add, remove, and change attribute.
|
1999-01-06 20:30:13 +00:00
|
|
|
*/
|
|
|
|
class ChangeAttributeTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
2014-08-29 11:43:23 +00:00
|
|
|
/** @param aElement the element whose attribute will be changed
|
1999-02-15 18:25:30 +00:00
|
|
|
* @param aAttribute the name of the attribute to change
|
2014-08-29 11:43:23 +00:00
|
|
|
* @param aValue the new value for aAttribute, or null to remove
|
1999-02-15 18:25:30 +00:00
|
|
|
*/
|
2014-08-29 11:43:23 +00:00
|
|
|
ChangeAttributeTxn(Element& aElement, nsIAtom& aAttribute,
|
|
|
|
const nsAString* aValue);
|
1999-01-21 01:51:09 +00:00
|
|
|
|
2011-02-19 22:18:37 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeAttributeTxn, EditTxn)
|
1999-01-06 20:30:13 +00:00
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_DECL_EDITTXN
|
1999-01-06 20:30:13 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD RedoTransaction() override;
|
1999-09-21 22:31:27 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
private:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~ChangeAttributeTxn();
|
1999-01-21 01:51:09 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
/** The element to operate upon */
|
|
|
|
nsCOMPtr<Element> mElement;
|
|
|
|
|
|
|
|
/** The attribute to change */
|
|
|
|
nsCOMPtr<nsIAtom> mAttribute;
|
1999-01-07 01:02:16 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
/** The value to set the attribute to (ignored if mRemoveAttribute==true) */
|
1999-01-06 20:30:13 +00:00
|
|
|
nsString mValue;
|
1999-01-07 01:02:16 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
/** True if the operation is to remove mAttribute from mElement */
|
|
|
|
bool mRemoveAttribute;
|
1999-01-07 01:02:16 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
/** True if the mAttribute was set on mElement at the time of execution */
|
|
|
|
bool mAttributeWasSet;
|
1999-01-07 01:02:16 +00:00
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
/** The value to set the attribute to for undo */
|
|
|
|
nsString mUndoValue;
|
1999-01-06 20:30:13 +00:00
|
|
|
};
|
|
|
|
|
2014-08-29 11:43:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-06 20:30:13 +00:00
|
|
|
#endif
|