2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-10-23 01:25:22 +04:00
|
|
|
#ifndef nsIContentSerializer_h
|
|
|
|
#define nsIContentSerializer_h
|
2000-09-10 01:47:23 +04:00
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-05-04 17:19:54 +04:00
|
|
|
class nsIContent;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-10-23 01:25:22 +04:00
|
|
|
namespace mozilla {
|
2017-04-27 13:27:03 +03:00
|
|
|
class Encoding;
|
2010-10-23 01:25:22 +04:00
|
|
|
namespace dom {
|
2018-03-19 22:15:39 +03:00
|
|
|
class Comment;
|
2019-01-02 16:05:23 +03:00
|
|
|
class Document;
|
2018-03-13 23:24:01 +03:00
|
|
|
class DocumentType;
|
2010-10-23 01:25:22 +04:00
|
|
|
class Element;
|
2018-03-19 22:15:39 +03:00
|
|
|
class ProcessingInstruction;
|
2010-10-23 01:25:22 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2000-09-10 01:47:23 +04:00
|
|
|
|
|
|
|
#define NS_ICONTENTSERIALIZER_IID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2015-01-13 21:50:12 +03:00
|
|
|
0xb1ee32f2, 0xb8c4, 0x49b9, { \
|
|
|
|
0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 \
|
|
|
|
} \
|
|
|
|
}
|
2000-09-10 01:47:23 +04:00
|
|
|
|
|
|
|
class nsIContentSerializer : public nsISupports {
|
2017-07-06 15:00:35 +03:00
|
|
|
public:
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID)
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2017-04-27 13:27:03 +03:00
|
|
|
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
|
|
|
|
const mozilla::Encoding* aEncoding, bool aIsCopying,
|
2017-06-12 22:20:44 +03:00
|
|
|
bool aIsWholeDocument, bool* aNeedsPerformatScanning) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset, nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-05-04 17:19:54 +04:00
|
|
|
NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, int32_t aStartOffset,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aEndOffset, nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2018-03-19 22:15:39 +03:00
|
|
|
NS_IMETHOD AppendProcessingInstruction(
|
|
|
|
mozilla::dom::ProcessingInstruction* aPI, int32_t aStartOffset,
|
2002-03-24 02:54:46 +03:00
|
|
|
int32_t aEndOffset, nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2018-03-19 22:15:39 +03:00
|
|
|
NS_IMETHOD AppendComment(mozilla::dom::Comment* aComment,
|
|
|
|
int32_t aStartOffset, int32_t aEndOffset,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2018-03-13 23:24:01 +03:00
|
|
|
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
|
2002-03-24 02:54:46 +03:00
|
|
|
nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-10-23 01:25:22 +04:00
|
|
|
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
|
|
|
|
mozilla::dom::Element* aOriginalElement,
|
2002-03-24 02:54:46 +03:00
|
|
|
nsAString& aStr) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-10-23 01:25:22 +04:00
|
|
|
NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement,
|
2002-03-24 02:54:46 +03:00
|
|
|
nsAString& aStr) = 0;
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 14:57:30 +04:00
|
|
|
|
2002-03-24 02:54:46 +03:00
|
|
|
NS_IMETHOD Flush(nsAString& aStr) = 0;
|
2002-08-13 22:41:16 +04:00
|
|
|
|
|
|
|
/**
|
2017-07-06 15:00:35 +03:00
|
|
|
* Append any items in the beginning of the document that won't be
|
|
|
|
* serialized by other methods. XML declaration is the most likely
|
2002-08-13 22:41:16 +04:00
|
|
|
* thing this method can produce.
|
|
|
|
*/
|
2019-01-02 16:05:23 +03:00
|
|
|
NS_IMETHOD AppendDocumentStart(mozilla::dom::Document* aDocument,
|
|
|
|
nsAString& aStr) = 0;
|
2017-06-12 22:20:44 +03:00
|
|
|
|
|
|
|
// If Init() sets *aNeedsPerformatScanning to true, then these methods are
|
|
|
|
// called when elements are started and ended, before AppendElementStart
|
|
|
|
// and AppendElementEnd, respectively. They are supposed to be used to
|
|
|
|
// allow the implementer to keep track of whether the element is
|
|
|
|
// preformatted.
|
|
|
|
NS_IMETHOD ScanElementForPreformat(mozilla::dom::Element* aElement) = 0;
|
|
|
|
NS_IMETHOD ForgetElementForPreformat(mozilla::dom::Element* aElement) = 0;
|
2000-09-10 01:47:23 +04:00
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID)
|
|
|
|
|
2000-09-14 03:57:52 +04:00
|
|
|
#define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \
|
|
|
|
"@mozilla.org/layout/contentserializer;1?mimetype="
|
2000-09-10 01:47:23 +04:00
|
|
|
|
2010-10-23 01:25:22 +04:00
|
|
|
#endif /* nsIContentSerializer_h */
|