Back to index

lightning-sunbird  0.9+nobinonly
nsIHTMLEditor.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Daniel Glazman <glazman@netscape.com>
00024  *   Akkana Peck <akkana@netscape.com>
00025  *   Kathleen Brade <brade@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 nsIAtom;
00045 interface nsISupportsArray;
00046 interface nsISelection;
00047 interface nsIContentFilter;
00048 
00049 %{C++
00050 #define NS_EDITOR_ELEMENT_NOT_FOUND \
00051   NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_EDITOR, 1)
00052 
00053 %}
00054 [scriptable, uuid(afc36593-5787-4420-93d9-b2c0ccbf0cad)]
00055 
00056 interface nsIHTMLEditor : nsISupports
00057 {
00058 %{C++
00059   typedef short EAlignment;
00060 %}
00061 
00062   // used by GetAlignment()
00063   const short eLeft = 0;
00064   const short eCenter = 1;
00065   const short eRight = 2;
00066   const short eJustify = 3;
00067   
00068   
00069   /* ------------ Inline property methods -------------- */
00070 
00071 
00083   void addDefaultProperty(in nsIAtom aProperty, 
00084                           in AString aAttribute, 
00085                           in AString aValue);
00086 
00098   void removeDefaultProperty(in nsIAtom aProperty, 
00099                              in AString aAttribute, 
00100                              in AString aValue);
00101 
00106   void removeAllDefaultProperties();
00107 
00120   void setCSSInlineProperty(in nsIAtom aProperty, 
00121                             in AString aAttribute,
00122                             in AString aValue);
00123   void setInlineProperty(in nsIAtom aProperty, 
00124                          in AString aAttribute,
00125                          in AString aValue);
00126 
00147   void getInlineProperty(in nsIAtom aProperty, 
00148                          in AString  aAttribute,
00149                          in AString  aValue,
00150                          out boolean aFirst,
00151                          out boolean aAny,
00152                          out boolean aAll);
00153 
00154   AString getInlinePropertyWithAttrValue(in nsIAtom aProperty, 
00155                                            in AString  aAttribute,
00156                                            in AString  aValue,
00157                                            out boolean aFirst,
00158                                            out boolean aAny,
00159                                            out boolean aAll);
00160                              
00165   void removeAllInlineProperties();
00166 
00167 
00185   void removeInlineProperty(in nsIAtom aProperty, in AString  aAttribute);
00186 
00192   void increaseFontSize();
00193 
00199   void decreaseFontSize();
00200 
00201   /* ------------ Drag/Drop methods -------------- */
00202 
00207   boolean canDrag(in nsIDOMEvent aEvent);
00208 
00213   void doDrag(in nsIDOMEvent aEvent);
00214 
00219   void insertFromDrop(in nsIDOMEvent aEvent);
00220 
00221   /* ------------ HTML content methods -------------- */
00222 
00229   boolean nodeIsBlock(in nsIDOMNode node);
00230 
00236   void insertHTML(in AString aInputString);
00237 
00238 
00243   void pasteNoFormatting(in long aSelectionType);
00244 
00251   void rebuildDocumentFromSource(in AString aSourceString);
00252 
00267   void insertHTMLWithContext(in AString aInputString,
00268                              in AString aContextStr,
00269                              in AString aInfoStr,
00270                              in AString aFlavor,
00271                              in nsIDOMDocument aSourceDoc,
00272                              in nsIDOMNode aDestinationNode,
00273                              in long aDestinationOffset,
00274                              in boolean aDeleteSelection);
00275 
00276 
00289   void insertElementAtSelection(in nsIDOMElement aElement,
00290                                 in boolean aDeleteSelection);
00291 
00295   void setDocumentTitle(in AString aTitle);
00296 
00304   void updateBaseURL();
00305 
00306 
00307   /* ------------ Selection manipulation -------------- */
00308   /* Should these be moved to nsISelection? */
00309   
00315   void selectElement(in nsIDOMElement aElement);
00316 
00329   void setCaretAfterElement(in nsIDOMElement aElement);
00330 
00335   void setParagraphFormat(in AString aParagraphFormat);
00336 
00343   AString getParagraphState(out boolean aMixed);
00344 
00351   AString getFontFaceState(out boolean aMixed);
00352   
00358   AString getFontColorState(out boolean aMixed);
00359 
00365   AString getBackgroundColorState(out boolean aMixed);
00366 
00372   AString getHighlightColorState(out boolean aMixed);
00373 
00383   void getListState(out boolean aMixed, out boolean aOL, out boolean aUL,
00384                     out boolean aDL);
00385   
00394   void getListItemState(out boolean aMixed, out boolean aLI,
00395                         out boolean aDT, out boolean aDD);
00396   
00404   void getAlignment(out boolean aMixed, out short aAlign);
00405   
00410   void getIndentState(out boolean aCanIndent, out boolean aCanOutdent);
00411 
00416   void makeOrChangeList(in AString aListType, in boolean entireList,
00417                         in AString aBulletType);
00418 
00423   void removeList(in AString aListType);
00424 
00429   void indent(in AString aIndent);
00430 
00435   void  align(in AString aAlign);
00436 
00457   nsIDOMElement getElementOrParentByTagName(in AString aTagName,
00458                                             in nsIDOMNode aNode);
00459 
00479   nsIDOMElement getSelectedElement(in AString aTagName);
00480 
00484   AString getHeadContentsAsHTML();
00485 
00489   void replaceHeadContentsWithHTML(in AString aSourceToInsert);
00490 
00508   nsIDOMElement createElementWithDefaults(in AString aTagName);
00509 
00515   void insertLinkAroundSelection(in nsIDOMElement aAnchorElement);
00516 
00522   void setBackgroundColor(in AString aColor);
00523 
00524 
00534   void setBodyAttribute(in AString aAttr, in AString aValue);
00535   
00540   void ignoreSpuriousDragEvent(in boolean aIgnoreSpuriousDragEvent);
00541 
00549   nsISupportsArray getLinkedObjects();
00550 
00557   attribute boolean isCSSEnabled;
00558 
00563   void addInsertionListener(in nsIContentFilter inFilter);
00564 
00569   void removeInsertionListener(in nsIContentFilter inFilter);
00570 
00586   nsIDOMElement createAnonymousElement(in AString aTag, in nsIDOMNode aParentNode,
00587                                        in AString aAnonClass, in boolean aIsCreatedHidden);
00588 
00593   nsIDOMElement getSelectionContainer();
00594 
00600   void checkSelectionStateForAnonymousButtons(in nsISelection aSelection);
00601 
00602   boolean isAnonymousElement(in nsIDOMElement aElement);
00603 
00610   attribute boolean returnInParagraphCreatesNewParagraph;
00611 };
00612