michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef SetDocTitleTxn_h__ michael@0: #define SetDocTitleTxn_h__ michael@0: michael@0: #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN michael@0: #include "nsString.h" // for nsString michael@0: #include "nscore.h" // for NS_IMETHOD, nsAString, etc michael@0: michael@0: class nsIHTMLEditor; michael@0: michael@0: /** michael@0: * A transaction that changes the document's title, michael@0: * which is a text node under the tag in a page's <head> section michael@0: * provides default concrete behavior for all nsITransaction methods. michael@0: */ michael@0: class SetDocTitleTxn : public EditTxn michael@0: { michael@0: public: michael@0: /** Initialize the transaction. michael@0: * @param aEditor the object providing core editing operations michael@0: * @param aValue the new value for document title michael@0: */ michael@0: NS_IMETHOD Init(nsIHTMLEditor *aEditor, michael@0: const nsAString *aValue); michael@0: SetDocTitleTxn(); michael@0: private: michael@0: nsresult SetDomTitle(const nsAString& aTitle); michael@0: michael@0: public: michael@0: NS_DECL_EDITTXN michael@0: michael@0: NS_IMETHOD RedoTransaction(); michael@0: NS_IMETHOD GetIsTransient(bool *aIsTransient); michael@0: michael@0: protected: michael@0: michael@0: /** the editor that created this transaction */ michael@0: nsIHTMLEditor* mEditor; michael@0: michael@0: /** The new title string */ michael@0: nsString mValue; michael@0: michael@0: /** The previous title string to use for undo */ michael@0: nsString mUndoValue; michael@0: michael@0: /** Set true if we dont' really change the title during Do() */ michael@0: bool mIsTransient; michael@0: }; michael@0: michael@0: #endif