editor/libeditor/base/SetDocTitleTxn.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/base/SetDocTitleTxn.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef SetDocTitleTxn_h__
    1.10 +#define SetDocTitleTxn_h__
    1.11 +
    1.12 +#include "EditTxn.h"                    // for EditTxn, NS_DECL_EDITTXN
    1.13 +#include "nsString.h"                   // for nsString
    1.14 +#include "nscore.h"                     // for NS_IMETHOD, nsAString, etc
    1.15 +
    1.16 +class nsIHTMLEditor;
    1.17 +
    1.18 +/**
    1.19 + * A transaction that changes the document's title,
    1.20 + *  which is a text node under the <title> tag in a page's <head> section
    1.21 + * provides default concrete behavior for all nsITransaction methods.
    1.22 + */
    1.23 +class SetDocTitleTxn : public EditTxn
    1.24 +{
    1.25 +public:
    1.26 +  /** Initialize the transaction.
    1.27 +    * @param aEditor the object providing core editing operations
    1.28 +    * @param aValue  the new value for document title
    1.29 +    */
    1.30 +  NS_IMETHOD Init(nsIHTMLEditor  *aEditor,
    1.31 +                  const nsAString *aValue);
    1.32 +  SetDocTitleTxn();
    1.33 +private:
    1.34 +  nsresult SetDomTitle(const nsAString& aTitle);
    1.35 +
    1.36 +public:
    1.37 +  NS_DECL_EDITTXN
    1.38 +
    1.39 +  NS_IMETHOD RedoTransaction();
    1.40 +  NS_IMETHOD GetIsTransient(bool *aIsTransient);
    1.41 +
    1.42 +protected:
    1.43 +
    1.44 +  /** the editor that created this transaction */
    1.45 +  nsIHTMLEditor*  mEditor;
    1.46 +  
    1.47 +  /** The new title string */
    1.48 +  nsString    mValue;
    1.49 +
    1.50 +  /** The previous title string to use for undo */
    1.51 +  nsString    mUndoValue;
    1.52 +
    1.53 +  /** Set true if we dont' really change the title during Do() */
    1.54 +  bool mIsTransient;
    1.55 +};
    1.56 +
    1.57 +#endif

mercurial