nsIPlaintextEditor.idl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #include "nsISupports.idl"
  6. [scriptable, uuid(b74fb158-1265-4102-91eb-edd0136b49f8)]
  7. interface nsIPlaintextEditor : nsISupports
  8. {
  9. // XXX Why aren't these in nsIEditor?
  10. // only plain text entry is allowed via events
  11. const long eEditorPlaintextMask = 0x0001;
  12. // enter key and CR-LF handled specially
  13. const long eEditorSingleLineMask = 0x0002;
  14. // text is not entered into content, only a representative character
  15. const long eEditorPasswordMask = 0x0004;
  16. // editing events are disabled. Editor may still accept focus.
  17. const long eEditorReadonlyMask = 0x0008;
  18. // all events are disabled (like scrolling). Editor will not accept focus.
  19. const long eEditorDisabledMask = 0x0010;
  20. // text input is limited to certain character types, use mFilter
  21. const long eEditorFilterInputMask = 0x0020;
  22. // use mail-compose editing rules
  23. const long eEditorMailMask = 0x0040;
  24. // allow the editor to set font: monospace on the root node
  25. const long eEditorEnableWrapHackMask = 0x0080;
  26. // bit for widgets (form elements)
  27. const long eEditorWidgetMask = 0x0100;
  28. // this HTML editor should not create css styles
  29. const long eEditorNoCSSMask = 0x0200;
  30. // whether HTML document specific actions are executed or not.
  31. // e.g., if this flag is set, the editor doesn't handle Tab key.
  32. // besides, anchors of HTML are not clickable.
  33. const long eEditorAllowInteraction = 0x0400;
  34. // when this is set, the characters in password editor are always masked.
  35. // see bug 530367 for the detail.
  36. const long eEditorDontEchoPassword = 0x0800;
  37. // when this flag is set, the internal direction of the editor is RTL.
  38. // if neither of the direction flags are set, the direction is determined
  39. // from the text control's content node.
  40. const long eEditorRightToLeft = 0x1000;
  41. // when this flag is set, the internal direction of the editor is LTR.
  42. const long eEditorLeftToRight = 0x2000;
  43. // when this flag is set, the editor's text content is not spell checked.
  44. const long eEditorSkipSpellCheck = 0x4000;
  45. /*
  46. * The valid values for newlines handling.
  47. * Can't change the values unless we remove
  48. * use of the pref.
  49. */
  50. const long eNewlinesPasteIntact = 0;
  51. const long eNewlinesPasteToFirst = 1;
  52. const long eNewlinesReplaceWithSpaces = 2;
  53. const long eNewlinesStrip = 3;
  54. const long eNewlinesReplaceWithCommas = 4;
  55. const long eNewlinesStripSurroundingWhitespace = 5;
  56. /**
  57. * The length of the contents in characters.
  58. * XXX change this type to 'unsigned long'
  59. */
  60. readonly attribute long textLength;
  61. /**
  62. * The maximum number of characters allowed.
  63. * default: -1 (unlimited).
  64. */
  65. attribute long maxTextLength;
  66. /** Get and set the body wrap width.
  67. *
  68. * Special values:
  69. * 0 = wrap to window width
  70. * -1 = no wrap at all
  71. */
  72. attribute long wrapWidth;
  73. /**
  74. * Similar to the setter for wrapWidth, but just sets the editor
  75. * internal state without actually changing the content being edited
  76. * to wrap at that column. This should only be used by callers who
  77. * are sure that their content is already set up correctly.
  78. */
  79. void setWrapColumn(in long aWrapColumn);
  80. /** Get and set newline handling.
  81. *
  82. * Values are the constants defined above.
  83. */
  84. attribute long newlineHandling;
  85. /**
  86. * Inserts a string at the current location,
  87. * given by the selection.
  88. * If the selection is not collapsed, the selection is deleted
  89. * and the insertion takes place at the resulting collapsed selection.
  90. *
  91. * @param aString the string to be inserted
  92. */
  93. void insertText(in DOMString aStringToInsert);
  94. /**
  95. * Insert a line break into the content model.
  96. * The interpretation of a break is up to the implementation:
  97. * it may enter a character, split a node in the tree, etc.
  98. * This may be more efficient than calling InsertText with a newline.
  99. */
  100. void insertLineBreak();
  101. };