nsISelection.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/content/base/public/nsISelection.idl
  3. */
  4. #ifndef __gen_nsISelection_h__
  5. #define __gen_nsISelection_h__
  6. #ifndef __gen_nsISupports_h__
  7. #include "nsISupports.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. class nsIDOMNode; /* forward declaration */
  14. class nsIDOMRange; /* forward declaration */
  15. /* starting interface: nsISelection */
  16. #define NS_ISELECTION_IID_STR "b2c7ed59-8634-4352-9e37-5484c8b6e4e1"
  17. #define NS_ISELECTION_IID \
  18. {0xb2c7ed59, 0x8634, 0x4352, \
  19. { 0x9e, 0x37, 0x54, 0x84, 0xc8, 0xb6, 0xe4, 0xe1 }}
  20. /**
  21. * Interface for manipulating and querying the current selected range
  22. * of nodes within the document.
  23. *
  24. * @status FROZEN
  25. * @version 1.0
  26. */
  27. class NS_NO_VTABLE nsISelection : public nsISupports {
  28. public:
  29. NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISELECTION_IID)
  30. /**
  31. * The node representing one end of the selection.
  32. */
  33. /* readonly attribute nsIDOMNode anchorNode; */
  34. NS_IMETHOD GetAnchorNode(nsIDOMNode * *aAnchorNode) = 0;
  35. /**
  36. * The offset within the (text) node where the selection begins.
  37. */
  38. /* readonly attribute long anchorOffset; */
  39. NS_IMETHOD GetAnchorOffset(PRInt32 *aAnchorOffset) = 0;
  40. /**
  41. * The node with keyboard focus.
  42. */
  43. /* readonly attribute nsIDOMNode focusNode; */
  44. NS_IMETHOD GetFocusNode(nsIDOMNode * *aFocusNode) = 0;
  45. /**
  46. * The offset within the (text) node where focus starts.
  47. */
  48. /* readonly attribute long focusOffset; */
  49. NS_IMETHOD GetFocusOffset(PRInt32 *aFocusOffset) = 0;
  50. /**
  51. * Indicates if the selection is collapsed or not.
  52. */
  53. /* readonly attribute boolean isCollapsed; */
  54. NS_IMETHOD GetIsCollapsed(PRBool *aIsCollapsed) = 0;
  55. /**
  56. * Returns the number of ranges in the selection.
  57. */
  58. /* readonly attribute long rangeCount; */
  59. NS_IMETHOD GetRangeCount(PRInt32 *aRangeCount) = 0;
  60. /**
  61. * Returns the range at the specified index.
  62. */
  63. /* nsIDOMRange getRangeAt (in long index); */
  64. NS_IMETHOD GetRangeAt(PRInt32 index, nsIDOMRange **_retval) = 0;
  65. /**
  66. * Collapses the selection to a single point, at the specified offset
  67. * in the given DOM node. When the selection is collapsed, and the content
  68. * is focused and editable, the caret will blink there.
  69. * @param parentNode The given dom node where the selection will be set
  70. * @param offset Where in given dom node to place the selection (the offset into the given node)
  71. */
  72. /* void collapse (in nsIDOMNode parentNode, in long offset); */
  73. NS_IMETHOD Collapse(nsIDOMNode *parentNode, PRInt32 offset) = 0;
  74. /**
  75. * Extends the selection by moving the focus to the specified node and offset,
  76. * preserving the anchor postion. The new selection end result will always
  77. * be from the anchor to the new focus, regardless of direction.
  78. * @param parentNode The node where the selection will be extended to
  79. * @param offset Where in node to place the offset in the new focused node
  80. */
  81. /* void extend (in nsIDOMNode parentNode, in long offset); */
  82. NS_IMETHOD Extend(nsIDOMNode *parentNode, PRInt32 offset) = 0;
  83. /**
  84. * Collapses the whole selection to a single point at the start
  85. * of the current selection (irrespective of direction). If content
  86. * is focused and editable, the caret will blink there.
  87. */
  88. /* void collapseToStart (); */
  89. NS_IMETHOD CollapseToStart(void) = 0;
  90. /**
  91. * Collapses the whole selection to a single point at the end
  92. * of the current selection (irrespective of direction). If content
  93. * is focused and editable, the caret will blink there.
  94. */
  95. /* void collapseToEnd (); */
  96. NS_IMETHOD CollapseToEnd(void) = 0;
  97. /**
  98. * The value of entirelyContained determines the detail of the search to determine if
  99. * the selection contains the node. If entirelyContained is set to PR_TRUE, t
  100. * or false if
  101. * @param node The node where the selection will be extended to
  102. * @param entirelyContained Whether
  103. */
  104. /* boolean containsNode (in nsIDOMNode node, in boolean entirelyContained); */
  105. NS_IMETHOD ContainsNode(nsIDOMNode *node, PRBool entirelyContained, PRBool *_retval) = 0;
  106. /**
  107. * Adds all children of the specified node to the selection.
  108. * @param parentNode the parent of the children to be added to the selection.
  109. */
  110. /* void selectAllChildren (in nsIDOMNode parentNode); */
  111. NS_IMETHOD SelectAllChildren(nsIDOMNode *parentNode) = 0;
  112. /**
  113. * Adds a range to the current selection.
  114. */
  115. /* void addRange (in nsIDOMRange range); */
  116. NS_IMETHOD AddRange(nsIDOMRange *range) = 0;
  117. /**
  118. * Removes a range from the current selection.
  119. */
  120. /* void removeRange (in nsIDOMRange range); */
  121. NS_IMETHOD RemoveRange(nsIDOMRange *range) = 0;
  122. /**
  123. * Removes all ranges from the current selection.
  124. */
  125. /* void removeAllRanges (); */
  126. NS_IMETHOD RemoveAllRanges(void) = 0;
  127. /**
  128. * Deletes this selection from document the nodes belong to.
  129. */
  130. /* void deleteFromDocument (); */
  131. NS_IMETHOD DeleteFromDocument(void) = 0;
  132. /**
  133. * Modifies the cursor Bidi level after a change in keyboard direction
  134. * @param langRTL is PR_TRUE if the new language is right-to-left or
  135. * PR_FALSE if the new language is left-to-right.
  136. */
  137. /* void selectionLanguageChange (in boolean langRTL); */
  138. NS_IMETHOD SelectionLanguageChange(PRBool langRTL) = 0;
  139. /**
  140. * Returns the whole selection into a plain text string.
  141. */
  142. /* wstring toString (); */
  143. NS_IMETHOD ToString(PRUnichar **_retval) = 0;
  144. };
  145. /* Use this macro when declaring classes that implement this interface. */
  146. #define NS_DECL_NSISELECTION \
  147. NS_IMETHOD GetAnchorNode(nsIDOMNode * *aAnchorNode); \
  148. NS_IMETHOD GetAnchorOffset(PRInt32 *aAnchorOffset); \
  149. NS_IMETHOD GetFocusNode(nsIDOMNode * *aFocusNode); \
  150. NS_IMETHOD GetFocusOffset(PRInt32 *aFocusOffset); \
  151. NS_IMETHOD GetIsCollapsed(PRBool *aIsCollapsed); \
  152. NS_IMETHOD GetRangeCount(PRInt32 *aRangeCount); \
  153. NS_IMETHOD GetRangeAt(PRInt32 index, nsIDOMRange **_retval); \
  154. NS_IMETHOD Collapse(nsIDOMNode *parentNode, PRInt32 offset); \
  155. NS_IMETHOD Extend(nsIDOMNode *parentNode, PRInt32 offset); \
  156. NS_IMETHOD CollapseToStart(void); \
  157. NS_IMETHOD CollapseToEnd(void); \
  158. NS_IMETHOD ContainsNode(nsIDOMNode *node, PRBool entirelyContained, PRBool *_retval); \
  159. NS_IMETHOD SelectAllChildren(nsIDOMNode *parentNode); \
  160. NS_IMETHOD AddRange(nsIDOMRange *range); \
  161. NS_IMETHOD RemoveRange(nsIDOMRange *range); \
  162. NS_IMETHOD RemoveAllRanges(void); \
  163. NS_IMETHOD DeleteFromDocument(void); \
  164. NS_IMETHOD SelectionLanguageChange(PRBool langRTL); \
  165. NS_IMETHOD ToString(PRUnichar **_retval);
  166. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  167. #define NS_FORWARD_NSISELECTION(_to) \
  168. NS_IMETHOD GetAnchorNode(nsIDOMNode * *aAnchorNode) { return _to GetAnchorNode(aAnchorNode); } \
  169. NS_IMETHOD GetAnchorOffset(PRInt32 *aAnchorOffset) { return _to GetAnchorOffset(aAnchorOffset); } \
  170. NS_IMETHOD GetFocusNode(nsIDOMNode * *aFocusNode) { return _to GetFocusNode(aFocusNode); } \
  171. NS_IMETHOD GetFocusOffset(PRInt32 *aFocusOffset) { return _to GetFocusOffset(aFocusOffset); } \
  172. NS_IMETHOD GetIsCollapsed(PRBool *aIsCollapsed) { return _to GetIsCollapsed(aIsCollapsed); } \
  173. NS_IMETHOD GetRangeCount(PRInt32 *aRangeCount) { return _to GetRangeCount(aRangeCount); } \
  174. NS_IMETHOD GetRangeAt(PRInt32 index, nsIDOMRange **_retval) { return _to GetRangeAt(index, _retval); } \
  175. NS_IMETHOD Collapse(nsIDOMNode *parentNode, PRInt32 offset) { return _to Collapse(parentNode, offset); } \
  176. NS_IMETHOD Extend(nsIDOMNode *parentNode, PRInt32 offset) { return _to Extend(parentNode, offset); } \
  177. NS_IMETHOD CollapseToStart(void) { return _to CollapseToStart(); } \
  178. NS_IMETHOD CollapseToEnd(void) { return _to CollapseToEnd(); } \
  179. NS_IMETHOD ContainsNode(nsIDOMNode *node, PRBool entirelyContained, PRBool *_retval) { return _to ContainsNode(node, entirelyContained, _retval); } \
  180. NS_IMETHOD SelectAllChildren(nsIDOMNode *parentNode) { return _to SelectAllChildren(parentNode); } \
  181. NS_IMETHOD AddRange(nsIDOMRange *range) { return _to AddRange(range); } \
  182. NS_IMETHOD RemoveRange(nsIDOMRange *range) { return _to RemoveRange(range); } \
  183. NS_IMETHOD RemoveAllRanges(void) { return _to RemoveAllRanges(); } \
  184. NS_IMETHOD DeleteFromDocument(void) { return _to DeleteFromDocument(); } \
  185. NS_IMETHOD SelectionLanguageChange(PRBool langRTL) { return _to SelectionLanguageChange(langRTL); } \
  186. NS_IMETHOD ToString(PRUnichar **_retval) { return _to ToString(_retval); }
  187. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  188. #define NS_FORWARD_SAFE_NSISELECTION(_to) \
  189. NS_IMETHOD GetAnchorNode(nsIDOMNode * *aAnchorNode) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAnchorNode(aAnchorNode); } \
  190. NS_IMETHOD GetAnchorOffset(PRInt32 *aAnchorOffset) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAnchorOffset(aAnchorOffset); } \
  191. NS_IMETHOD GetFocusNode(nsIDOMNode * *aFocusNode) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFocusNode(aFocusNode); } \
  192. NS_IMETHOD GetFocusOffset(PRInt32 *aFocusOffset) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFocusOffset(aFocusOffset); } \
  193. NS_IMETHOD GetIsCollapsed(PRBool *aIsCollapsed) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsCollapsed(aIsCollapsed); } \
  194. NS_IMETHOD GetRangeCount(PRInt32 *aRangeCount) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRangeCount(aRangeCount); } \
  195. NS_IMETHOD GetRangeAt(PRInt32 index, nsIDOMRange **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRangeAt(index, _retval); } \
  196. NS_IMETHOD Collapse(nsIDOMNode *parentNode, PRInt32 offset) { return !_to ? NS_ERROR_NULL_POINTER : _to->Collapse(parentNode, offset); } \
  197. NS_IMETHOD Extend(nsIDOMNode *parentNode, PRInt32 offset) { return !_to ? NS_ERROR_NULL_POINTER : _to->Extend(parentNode, offset); } \
  198. NS_IMETHOD CollapseToStart(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CollapseToStart(); } \
  199. NS_IMETHOD CollapseToEnd(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CollapseToEnd(); } \
  200. NS_IMETHOD ContainsNode(nsIDOMNode *node, PRBool entirelyContained, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ContainsNode(node, entirelyContained, _retval); } \
  201. NS_IMETHOD SelectAllChildren(nsIDOMNode *parentNode) { return !_to ? NS_ERROR_NULL_POINTER : _to->SelectAllChildren(parentNode); } \
  202. NS_IMETHOD AddRange(nsIDOMRange *range) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddRange(range); } \
  203. NS_IMETHOD RemoveRange(nsIDOMRange *range) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveRange(range); } \
  204. NS_IMETHOD RemoveAllRanges(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveAllRanges(); } \
  205. NS_IMETHOD DeleteFromDocument(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteFromDocument(); } \
  206. NS_IMETHOD SelectionLanguageChange(PRBool langRTL) { return !_to ? NS_ERROR_NULL_POINTER : _to->SelectionLanguageChange(langRTL); } \
  207. NS_IMETHOD ToString(PRUnichar **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ToString(_retval); }
  208. #if 0
  209. /* Use the code below as a template for the implementation class for this interface. */
  210. /* Header file */
  211. class nsSelection : public nsISelection
  212. {
  213. public:
  214. NS_DECL_ISUPPORTS
  215. NS_DECL_NSISELECTION
  216. nsSelection();
  217. private:
  218. ~nsSelection();
  219. protected:
  220. /* additional members */
  221. };
  222. /* Implementation file */
  223. NS_IMPL_ISUPPORTS1(nsSelection, nsISelection)
  224. nsSelection::nsSelection()
  225. {
  226. /* member initializers and constructor code */
  227. }
  228. nsSelection::~nsSelection()
  229. {
  230. /* destructor code */
  231. }
  232. /* readonly attribute nsIDOMNode anchorNode; */
  233. NS_IMETHODIMP nsSelection::GetAnchorNode(nsIDOMNode * *aAnchorNode)
  234. {
  235. return NS_ERROR_NOT_IMPLEMENTED;
  236. }
  237. /* readonly attribute long anchorOffset; */
  238. NS_IMETHODIMP nsSelection::GetAnchorOffset(PRInt32 *aAnchorOffset)
  239. {
  240. return NS_ERROR_NOT_IMPLEMENTED;
  241. }
  242. /* readonly attribute nsIDOMNode focusNode; */
  243. NS_IMETHODIMP nsSelection::GetFocusNode(nsIDOMNode * *aFocusNode)
  244. {
  245. return NS_ERROR_NOT_IMPLEMENTED;
  246. }
  247. /* readonly attribute long focusOffset; */
  248. NS_IMETHODIMP nsSelection::GetFocusOffset(PRInt32 *aFocusOffset)
  249. {
  250. return NS_ERROR_NOT_IMPLEMENTED;
  251. }
  252. /* readonly attribute boolean isCollapsed; */
  253. NS_IMETHODIMP nsSelection::GetIsCollapsed(PRBool *aIsCollapsed)
  254. {
  255. return NS_ERROR_NOT_IMPLEMENTED;
  256. }
  257. /* readonly attribute long rangeCount; */
  258. NS_IMETHODIMP nsSelection::GetRangeCount(PRInt32 *aRangeCount)
  259. {
  260. return NS_ERROR_NOT_IMPLEMENTED;
  261. }
  262. /* nsIDOMRange getRangeAt (in long index); */
  263. NS_IMETHODIMP nsSelection::GetRangeAt(PRInt32 index, nsIDOMRange **_retval)
  264. {
  265. return NS_ERROR_NOT_IMPLEMENTED;
  266. }
  267. /* void collapse (in nsIDOMNode parentNode, in long offset); */
  268. NS_IMETHODIMP nsSelection::Collapse(nsIDOMNode *parentNode, PRInt32 offset)
  269. {
  270. return NS_ERROR_NOT_IMPLEMENTED;
  271. }
  272. /* void extend (in nsIDOMNode parentNode, in long offset); */
  273. NS_IMETHODIMP nsSelection::Extend(nsIDOMNode *parentNode, PRInt32 offset)
  274. {
  275. return NS_ERROR_NOT_IMPLEMENTED;
  276. }
  277. /* void collapseToStart (); */
  278. NS_IMETHODIMP nsSelection::CollapseToStart()
  279. {
  280. return NS_ERROR_NOT_IMPLEMENTED;
  281. }
  282. /* void collapseToEnd (); */
  283. NS_IMETHODIMP nsSelection::CollapseToEnd()
  284. {
  285. return NS_ERROR_NOT_IMPLEMENTED;
  286. }
  287. /* boolean containsNode (in nsIDOMNode node, in boolean entirelyContained); */
  288. NS_IMETHODIMP nsSelection::ContainsNode(nsIDOMNode *node, PRBool entirelyContained, PRBool *_retval)
  289. {
  290. return NS_ERROR_NOT_IMPLEMENTED;
  291. }
  292. /* void selectAllChildren (in nsIDOMNode parentNode); */
  293. NS_IMETHODIMP nsSelection::SelectAllChildren(nsIDOMNode *parentNode)
  294. {
  295. return NS_ERROR_NOT_IMPLEMENTED;
  296. }
  297. /* void addRange (in nsIDOMRange range); */
  298. NS_IMETHODIMP nsSelection::AddRange(nsIDOMRange *range)
  299. {
  300. return NS_ERROR_NOT_IMPLEMENTED;
  301. }
  302. /* void removeRange (in nsIDOMRange range); */
  303. NS_IMETHODIMP nsSelection::RemoveRange(nsIDOMRange *range)
  304. {
  305. return NS_ERROR_NOT_IMPLEMENTED;
  306. }
  307. /* void removeAllRanges (); */
  308. NS_IMETHODIMP nsSelection::RemoveAllRanges()
  309. {
  310. return NS_ERROR_NOT_IMPLEMENTED;
  311. }
  312. /* void deleteFromDocument (); */
  313. NS_IMETHODIMP nsSelection::DeleteFromDocument()
  314. {
  315. return NS_ERROR_NOT_IMPLEMENTED;
  316. }
  317. /* void selectionLanguageChange (in boolean langRTL); */
  318. NS_IMETHODIMP nsSelection::SelectionLanguageChange(PRBool langRTL)
  319. {
  320. return NS_ERROR_NOT_IMPLEMENTED;
  321. }
  322. /* wstring toString (); */
  323. NS_IMETHODIMP nsSelection::ToString(PRUnichar **_retval)
  324. {
  325. return NS_ERROR_NOT_IMPLEMENTED;
  326. }
  327. /* End of implementation class template. */
  328. #endif
  329. #endif /* __gen_nsISelection_h__ */