|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsIContentSerializer_h |
|
7 #define nsIContentSerializer_h |
|
8 |
|
9 #include "nsISupports.h" |
|
10 |
|
11 class nsIContent; |
|
12 class nsIDocument; |
|
13 class nsAString; |
|
14 |
|
15 namespace mozilla { |
|
16 namespace dom { |
|
17 class Element; |
|
18 } // namespace dom |
|
19 } // namespace mozilla |
|
20 |
|
21 #define NS_ICONTENTSERIALIZER_IID \ |
|
22 { 0xb1ee32f2, 0xb8c4, 0x49b9, \ |
|
23 { 0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 } } |
|
24 |
|
25 class nsIContentSerializer : public nsISupports { |
|
26 public: |
|
27 |
|
28 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID) |
|
29 |
|
30 NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn, |
|
31 const char* aCharSet, bool aIsCopying, |
|
32 bool aIsWholeDocument) = 0; |
|
33 |
|
34 NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset, |
|
35 int32_t aEndOffset, nsAString& aStr) = 0; |
|
36 |
|
37 NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, |
|
38 int32_t aStartOffset, int32_t aEndOffset, |
|
39 nsAString& aStr) = 0; |
|
40 |
|
41 NS_IMETHOD AppendProcessingInstruction(nsIContent* aPI, |
|
42 int32_t aStartOffset, |
|
43 int32_t aEndOffset, |
|
44 nsAString& aStr) = 0; |
|
45 |
|
46 NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset, |
|
47 int32_t aEndOffset, nsAString& aStr) = 0; |
|
48 |
|
49 NS_IMETHOD AppendDoctype(nsIContent *aDoctype, |
|
50 nsAString& aStr) = 0; |
|
51 |
|
52 NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, |
|
53 mozilla::dom::Element* aOriginalElement, |
|
54 nsAString& aStr) = 0; |
|
55 |
|
56 NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, |
|
57 nsAString& aStr) = 0; |
|
58 |
|
59 NS_IMETHOD Flush(nsAString& aStr) = 0; |
|
60 |
|
61 /** |
|
62 * Append any items in the beginning of the document that won't be |
|
63 * serialized by other methods. XML declaration is the most likely |
|
64 * thing this method can produce. |
|
65 */ |
|
66 NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, |
|
67 nsAString& aStr) = 0; |
|
68 }; |
|
69 |
|
70 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID) |
|
71 |
|
72 #define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \ |
|
73 "@mozilla.org/layout/contentserializer;1?mimetype=" |
|
74 |
|
75 #endif /* nsIContentSerializer_h */ |