2004-01-28 21:04:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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/. */
|
2013-03-22 00:05:19 +00:00
|
|
|
|
2002-10-22 05:28:36 +00:00
|
|
|
#ifndef nsXMLPrettyPrinter_h__
|
|
|
|
#define nsXMLPrettyPrinter_h__
|
|
|
|
|
2004-01-28 21:04:33 +00:00
|
|
|
#include "nsStubDocumentObserver.h"
|
2002-10-22 05:28:36 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2013-03-22 00:05:19 +00:00
|
|
|
class nsIDocument;
|
|
|
|
|
2004-01-28 21:04:33 +00:00
|
|
|
class nsXMLPrettyPrinter : public nsStubDocumentObserver
|
2002-10-22 05:28:36 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXMLPrettyPrinter();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2004-01-28 21:04:33 +00:00
|
|
|
|
2007-07-12 20:05:45 +00:00
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
|
2010-10-20 07:41:05 +00:00
|
|
|
|
2002-10-22 05:28:36 +00:00
|
|
|
/**
|
|
|
|
* This will prettyprint the document if the document is loaded in a
|
|
|
|
* displayed window.
|
|
|
|
*
|
|
|
|
* @param aDocument document to prettyprint
|
2007-05-31 01:42:48 +00:00
|
|
|
* @param [out] aDidPrettyPrint if true, and error not returned, actually
|
|
|
|
* went ahead with prettyprinting the document.
|
2002-10-22 05:28:36 +00:00
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult PrettyPrint(nsIDocument* aDocument, bool* aDidPrettyPrint);
|
2002-10-22 05:28:36 +00:00
|
|
|
|
2011-05-31 21:26:13 +00:00
|
|
|
/**
|
|
|
|
* Unhook the prettyprinter
|
|
|
|
*/
|
|
|
|
void Unhook();
|
2002-10-22 05:28:36 +00:00
|
|
|
private:
|
2014-06-25 02:09:15 +00:00
|
|
|
virtual ~nsXMLPrettyPrinter();
|
|
|
|
|
2002-10-22 05:28:36 +00:00
|
|
|
/**
|
|
|
|
* Signals for unhooking by setting mUnhookPending if the node changed is
|
|
|
|
* non-anonymous content.
|
|
|
|
*
|
|
|
|
* @param aContent content that has changed
|
|
|
|
*/
|
|
|
|
void MaybeUnhook(nsIContent* aContent);
|
|
|
|
|
|
|
|
nsIDocument* mDocument; //weak. Set as long as we're observing the document
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mUnhookPending;
|
2002-10-22 05:28:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter);
|
|
|
|
|
|
|
|
#endif //nsXMLPrettyPrinter_h__
|