Back to index

lightning-sunbird  0.9+nobinonly
nsIEditor.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is the Mozilla browser.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications, Inc.
00020  * Portions created by the Initial Developer are Copyright (C) 1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Daniel Glazman <glazman@netscape.com>
00025  *   Akkana Peck <akkana@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "nsISupports.idl"
00042 #include "domstubs.idl"
00043 
00044 interface nsIURI;
00045 interface nsIAtom;
00046 interface nsISelection;
00047 interface nsISelectionController;
00048 interface nsIDocumentStateListener;
00049 interface nsIOutputStream;
00050 interface nsITransactionManager;
00051 interface nsITransaction;
00052 interface nsIEditorObserver;
00053 interface nsIEditActionListener;
00054 interface nsIInlineSpellChecker;
00055 
00056 %{C++
00057 class nsIPresShell;
00058 class nsIContent;
00059 typedef short EDirection;
00060 %}
00061 
00062 
00063 [ptr] native nsIPresShellPtr(nsIPresShell);
00064 [ptr] native nsIContentPtr(nsIContent);
00065 
00066 [scriptable, uuid(D4882FFB-E927-408b-96BE-D4391B456FA9)]
00067 
00068 interface nsIEditor  : nsISupports
00069 {
00070 %{C++
00071   typedef short EDirection;
00072 %}
00073   const short eNone = 0;
00074   const short eNext = 1;
00075   const short ePrevious = 2;
00076   const short eNextWord = 3;
00077   const short ePreviousWord = 4;
00078   const short eToBeginningOfLine = 5;
00079   const short eToEndOfLine = 6;
00080 
00081   readonly attribute nsISelection selection;
00082 
00098   [noscript] void init(in nsIDOMDocument doc, in nsIPresShellPtr shell,
00099                        in nsIContentPtr aRoot,
00100                        in nsISelectionController aSelCon,
00101                        in unsigned long aFlags);
00102 
00103   void setAttributeOrEquivalent(in nsIDOMElement element,
00104                                 in AString sourceAttrName,
00105                                 in AString sourceAttrValue,
00106                                 in boolean aSuppressTransaction);
00107   void removeAttributeOrEquivalent(in nsIDOMElement element,
00108                                    in DOMString sourceAttrName,
00109                                    in boolean aSuppressTransaction);
00110 
00115   void postCreate();
00116 
00121   void preDestroy();
00122 
00124   attribute unsigned long flags;
00125 
00129   attribute string contentsMIMEType;
00130 
00132   readonly attribute boolean isDocumentEditable;
00133 
00137   readonly attribute nsIDOMDocument document;
00138 
00141   readonly attribute  nsIDOMElement rootElement;
00142 
00146   readonly attribute nsISelectionController selectionController;
00147 
00148 
00149   /* ------------ Selected content removal -------------- */
00150 
00156   void deleteSelection(in short action);
00157 
00158 
00159   /* ------------ Document info and file methods -------------- */
00160   
00162   readonly attribute boolean documentIsEmpty;
00163   
00165   readonly attribute boolean documentModified;
00166 
00168   attribute ACString documentCharacterSet;
00169 
00173   void resetModificationCount();
00174 
00179   long getModificationCount();
00180 
00186   void incrementModificationCount(in long aModCount);
00187   
00188   /* ------------ Transaction methods -------------- */
00189 
00192   readonly attribute nsITransactionManager transactionManager;
00193 
00201   void doTransaction(in nsITransaction txn);
00202 
00203 
00212   void enableUndo(in boolean enable);
00213 
00224   void undo(in unsigned long count);
00225 
00231   void canUndo(out boolean isEnabled, out boolean canUndo);
00232 
00243   void redo(in unsigned long count);
00244 
00250   void canRedo(out boolean isEnabled, out boolean canRedo);
00251 
00262   void beginTransaction();
00263 
00270   void endTransaction();
00271 
00272   void beginPlaceHolderTransaction(in nsIAtom name);
00273   void endPlaceHolderTransaction();
00274   boolean shouldTxnSetSelection();
00275 
00284   void setShouldTxnSetSelection(in boolean should);
00285 
00286   /* ------------ Inline Spell Checking methods -------------- */
00287 
00288   readonly attribute nsIInlineSpellChecker inlineSpellChecker;
00289 
00290   /* ------------ Clipboard methods -------------- */
00291 
00297   void cut();
00298 
00302   boolean canCut();
00303   
00309   void copy();
00310   
00313   boolean canCopy();
00314   
00318   void paste(in long aSelectionType);
00319 
00323   boolean canPaste(in long aSelectionType);
00324 
00325   /* ------------ Selection methods -------------- */
00326 
00328   void selectAll();
00329 
00331   void beginningOfDocument();
00332 
00334   void endOfDocument();
00335 
00336    /* ------------ Drag/Drop methods -------------- */
00337   
00342   boolean canDrag(in nsIDOMEvent aEvent);
00343  
00348   void doDrag(in nsIDOMEvent aEvent);
00349  
00354   void insertFromDrop(in nsIDOMEvent aEvent);
00355 
00356   /* ------------ Node manipulation methods -------------- */
00357 
00367   void setAttribute(in nsIDOMElement aElement, in AString attributestr,
00368                     in AString attvalue);
00369 
00380   boolean getAttributeValue(in nsIDOMElement aElement, 
00381                             in AString attributestr, 
00382                             out AString resultValue);
00383 
00391   void removeAttribute(in nsIDOMElement aElement, 
00392                        in AString aAttribute);
00393 
00406   void cloneAttribute(in AString aAttribute,
00407                       in nsIDOMNode aDestNode, in nsIDOMNode aSourceNode);
00408 
00420   void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
00421 
00430   nsIDOMNode createNode(in AString tag,
00431                         in nsIDOMNode parent,
00432                         in long position);
00433 
00444   void insertNode(in nsIDOMNode node,
00445                   in nsIDOMNode parent,
00446                   in long       aPosition);
00447 
00448 
00459   void splitNode(in nsIDOMNode existingRightNode,
00460                  in long      offset,
00461                  out nsIDOMNode newLeftNode);
00462 
00473   void joinNodes(in nsIDOMNode leftNode,
00474                  in nsIDOMNode rightNode,
00475                  in nsIDOMNode parent);
00476 
00481   void deleteNode(in nsIDOMNode child);
00482 
00488   void markNodeDirty(in nsIDOMNode node);
00489 
00490 /* ---------- direction controller ---------- */
00491 
00496   void switchTextDirection();
00497 
00498 /* ------------ Output methods -------------- */
00499 
00504   AString outputToString(in AString formatType,
00505                          in unsigned long flags);
00506   void outputToStream(in nsIOutputStream aStream,
00507                       in AString formatType,
00508                       in ACString charsetOverride,
00509                       in unsigned long flags);
00510 
00511 
00512   /* ------------ Various listeners methods -------------- */
00513 
00515   void addEditorObserver(in nsIEditorObserver observer);
00516 
00518   void removeEditorObserver(in nsIEditorObserver observer);
00519 
00521   void addEditActionListener(in nsIEditActionListener listener);
00522 
00524   void removeEditActionListener(in nsIEditActionListener listener);
00525 
00527   void addDocumentStateListener(in nsIDocumentStateListener listener);
00528 
00530   void removeDocumentStateListener(in nsIDocumentStateListener listener);
00531 
00532 
00533   /* ------------ Debug methods -------------- */
00534 
00538   void dumpContentTree();
00539 
00541   void debugDumpContent() ;
00542 
00543   /* Run unit tests. Noop in optimized builds */
00544   void debugUnitTests(out long outNumTests, out long  outNumTestsFailed);
00545 };
00546 
00556 [scriptable, uuid(60fbf998-e021-4f81-bdf0-749cc651e221)]
00557 interface nsIEditor_MOZILLA_1_8_BRANCH : nsIEditor
00558 {
00567   nsIInlineSpellChecker getInlineSpellCheckerOptionally(in boolean autoCreate);
00568 
00573   void syncRealTimeSpell();
00574 
00580   void setSpellcheckUserOverride(in boolean enable);
00581 };