michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsIContentSerializer_h michael@0: #define nsIContentSerializer_h michael@0: michael@0: #include "nsISupports.h" michael@0: michael@0: class nsIContent; michael@0: class nsIDocument; michael@0: class nsAString; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class Element; michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #define NS_ICONTENTSERIALIZER_IID \ michael@0: { 0xb1ee32f2, 0xb8c4, 0x49b9, \ michael@0: { 0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 } } michael@0: michael@0: class nsIContentSerializer : public nsISupports { michael@0: public: michael@0: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID) michael@0: michael@0: NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn, michael@0: const char* aCharSet, bool aIsCopying, michael@0: bool aIsWholeDocument) = 0; michael@0: michael@0: NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset, michael@0: int32_t aEndOffset, nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, michael@0: int32_t aStartOffset, int32_t aEndOffset, michael@0: nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendProcessingInstruction(nsIContent* aPI, michael@0: int32_t aStartOffset, michael@0: int32_t aEndOffset, michael@0: nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset, michael@0: int32_t aEndOffset, nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendDoctype(nsIContent *aDoctype, michael@0: nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, michael@0: mozilla::dom::Element* aOriginalElement, michael@0: nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, michael@0: nsAString& aStr) = 0; michael@0: michael@0: NS_IMETHOD Flush(nsAString& aStr) = 0; michael@0: michael@0: /** michael@0: * Append any items in the beginning of the document that won't be michael@0: * serialized by other methods. XML declaration is the most likely michael@0: * thing this method can produce. michael@0: */ michael@0: NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, michael@0: nsAString& aStr) = 0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID) michael@0: michael@0: #define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \ michael@0: "@mozilla.org/layout/contentserializer;1?mimetype=" michael@0: michael@0: #endif /* nsIContentSerializer_h */