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