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