|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef SetDocTitleTxn_h__ |
|
7 #define SetDocTitleTxn_h__ |
|
8 |
|
9 #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN |
|
10 #include "nsString.h" // for nsString |
|
11 #include "nscore.h" // for NS_IMETHOD, nsAString, etc |
|
12 |
|
13 class nsIHTMLEditor; |
|
14 |
|
15 /** |
|
16 * A transaction that changes the document's title, |
|
17 * which is a text node under the <title> tag in a page's <head> section |
|
18 * provides default concrete behavior for all nsITransaction methods. |
|
19 */ |
|
20 class SetDocTitleTxn : public EditTxn |
|
21 { |
|
22 public: |
|
23 /** Initialize the transaction. |
|
24 * @param aEditor the object providing core editing operations |
|
25 * @param aValue the new value for document title |
|
26 */ |
|
27 NS_IMETHOD Init(nsIHTMLEditor *aEditor, |
|
28 const nsAString *aValue); |
|
29 SetDocTitleTxn(); |
|
30 private: |
|
31 nsresult SetDomTitle(const nsAString& aTitle); |
|
32 |
|
33 public: |
|
34 NS_DECL_EDITTXN |
|
35 |
|
36 NS_IMETHOD RedoTransaction(); |
|
37 NS_IMETHOD GetIsTransient(bool *aIsTransient); |
|
38 |
|
39 protected: |
|
40 |
|
41 /** the editor that created this transaction */ |
|
42 nsIHTMLEditor* mEditor; |
|
43 |
|
44 /** The new title string */ |
|
45 nsString mValue; |
|
46 |
|
47 /** The previous title string to use for undo */ |
|
48 nsString mUndoValue; |
|
49 |
|
50 /** Set true if we dont' really change the title during Do() */ |
|
51 bool mIsTransient; |
|
52 }; |
|
53 |
|
54 #endif |