mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
First Checked In.
This commit is contained in:
parent
62e9ec43a0
commit
57c7eba0a0
325
editor/provisional/nsIEditor.h
Normal file
325
editor/provisional/nsIEditor.h
Normal file
@ -0,0 +1,325 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIEditor_h__
|
||||
#define nsIEditor_h__
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
#define NS_IEDITOR_IID \
|
||||
{/* A3C5EE71-742E-11d2-8F2C-006008310194*/ \
|
||||
0xa3c5ee71, 0x742e, 0x11d2, \
|
||||
{0x8f, 0x2c, 0x0, 0x60, 0x8, 0x31, 0x1, 0x94} }
|
||||
|
||||
|
||||
class nsIEditor : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEDITOR_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Init is to tell the implementation of nsIEditor to begin its services
|
||||
* @param aDoc The dom document interface being observed
|
||||
* @param aPresShell TEMP: The presentation shell displaying the document
|
||||
* once events can tell us from what pres shell they originated,
|
||||
* this will no longer be necessary and the editor will no longer be
|
||||
* linked to a single pres shell.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell )=0;
|
||||
|
||||
/**
|
||||
* PostCreate should be called after Init, and is the time that the editor tells
|
||||
* its documentStateObservers that the document has been created.
|
||||
*/
|
||||
NS_IMETHOD PostCreate()=0;
|
||||
|
||||
/** return the edit flags for this editor */
|
||||
NS_IMETHOD GetFlags(PRUint32 *aFlags)=0;
|
||||
|
||||
/** set the edit flags for this editor. May be called at any time. */
|
||||
NS_IMETHOD SetFlags(PRUint32 aFlags)=0;
|
||||
|
||||
/**
|
||||
* return the DOM Document this editor is associated with
|
||||
*
|
||||
* @param aDoc [OUT] the dom interface being observed, refcounted
|
||||
*/
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc)=0;
|
||||
|
||||
/**
|
||||
* return the presentation shell this editor is associated with
|
||||
*
|
||||
* @param aPS [OUT] the pres shell, refcounted
|
||||
*/
|
||||
NS_IMETHOD GetPresShell(nsIPresShell **aPS)=0;
|
||||
|
||||
/**
|
||||
* return the DOM Selection for the presentation shell that has focus
|
||||
* (or most recently had focus.)
|
||||
* @param aSelection [OUT] the dom interface for the selection
|
||||
*/
|
||||
NS_IMETHOD GetSelection(nsIDOMSelection **aSelection)=0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SetAttribute() sets the attribute of aElement.
|
||||
* No checking is done to see if aAttribute is a legal attribute of the node,
|
||||
* or if aValue is a legal value of aAttribute.
|
||||
*
|
||||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to set
|
||||
* @param aValue the value to set aAttribute to
|
||||
*/
|
||||
NS_IMETHOD SetAttribute(nsIDOMElement * aElement,
|
||||
const nsString& aAttribute,
|
||||
const nsString& aValue)=0;
|
||||
|
||||
/**
|
||||
* GetAttributeValue() retrieves the attribute's value for aElement.
|
||||
*
|
||||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to get
|
||||
* @param aResultValue the value of aAttribute. only valid if aResultIsSet is PR_TRUE
|
||||
* @param aResultIsSet PR_TRUE if aAttribute is set on the current node, PR_FALSE if it is not.
|
||||
*/
|
||||
NS_IMETHOD GetAttributeValue(nsIDOMElement * aElement,
|
||||
const nsString& aAttribute,
|
||||
nsString& aResultValue,
|
||||
PRBool& aResultIsSet)=0;
|
||||
|
||||
/**
|
||||
* RemoveAttribute() deletes aAttribute from the attribute list of aElement.
|
||||
* If aAttribute is not an attribute of aElement, nothing is done.
|
||||
*
|
||||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to get
|
||||
*/
|
||||
NS_IMETHOD RemoveAttribute(nsIDOMElement * aElement,
|
||||
const nsString& aAttribute)=0;
|
||||
|
||||
/**
|
||||
* CreateNode instantiates a new element of type aTag and inserts it into aParent at aPosition.
|
||||
* @param aTag The type of object to create
|
||||
* @param aParent The node to insert the new object into
|
||||
* @param aPosition The place in aParent to insert the new node
|
||||
* @param aNewNode [OUT] The node created. Caller must release aNewNode.
|
||||
*/
|
||||
NS_IMETHOD CreateNode(const nsString& aTag,
|
||||
nsIDOMNode * aParent,
|
||||
PRInt32 aPosition,
|
||||
nsIDOMNode ** aNewNode)=0;
|
||||
|
||||
/**
|
||||
* InsertNode inserts aNode into aParent at aPosition.
|
||||
* No checking is done to verify the legality of the insertion. That is the
|
||||
* responsibility of the caller.
|
||||
* @param aNode The DOM Node to insert.
|
||||
* @param aParent The node to insert the new object into
|
||||
* @param aPosition The place in aParent to insert the new node
|
||||
* 0=first child, 1=second child, etc.
|
||||
* any number > number of current children = last child
|
||||
*/
|
||||
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
|
||||
nsIDOMNode * aParent,
|
||||
PRInt32 aPosition)=0;
|
||||
|
||||
|
||||
/**
|
||||
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes
|
||||
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
|
||||
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
|
||||
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
|
||||
*/
|
||||
NS_IMETHOD SplitNode(nsIDOMNode *aExistingRightNode,
|
||||
PRInt32 aOffset,
|
||||
nsIDOMNode **aNewLeftNode)=0;
|
||||
|
||||
/**
|
||||
* JoinNodes() takes 2 nodes and merge their content|children.
|
||||
* @param aNodeToKeep The left node. It will remain after the join.
|
||||
* @param aNodeToJoin The right node.
|
||||
* There is no requirement that the two nodes be of the same type.
|
||||
* @param aParent The parent of aExistingRightNode
|
||||
* @param aNodeToKeepIsFirst if PR_TRUE, the contents|children of aNodeToKeep come before the
|
||||
* contents|children of aNodeToJoin, otherwise their positions are switched.
|
||||
*/
|
||||
NS_IMETHOD JoinNodes(nsIDOMNode *aLeftNode,
|
||||
nsIDOMNode *aRightNode,
|
||||
nsIDOMNode *aParent)=0;
|
||||
|
||||
|
||||
/* ------------ Transaction methods -------------- */
|
||||
|
||||
/** Do() fires a transaction. It is provided here so clients can create their own transactions.
|
||||
* If a transaction manager is present, it is used.
|
||||
* Otherwise, the transaction is just executed directly.
|
||||
*
|
||||
* @param aTxn the transaction to execute
|
||||
*/
|
||||
NS_IMETHOD Do(nsITransaction *aTxn)=0;
|
||||
|
||||
|
||||
/** turn the undo system on or off
|
||||
* @param aEnable if PR_TRUE, the undo system is turned on if it is available
|
||||
* if PR_FALSE the undo system is turned off if it was previously on
|
||||
* @return if aEnable is PR_TRUE, returns NS_OK if the undo system could be initialized properly
|
||||
* if aEnable is PR_FALSE, returns NS_OK.
|
||||
*/
|
||||
NS_IMETHOD EnableUndo(PRBool aEnable)=0;
|
||||
|
||||
/** Undo reverses the effects of the last Do operation, if Undo is enabled in the editor.
|
||||
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
|
||||
* If a transaction manager is present, it is told to undo and the result of
|
||||
* that undo is returned.
|
||||
* Otherwise, the Undo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Undo(PRUint32 aCount)=0;
|
||||
|
||||
/** returns state information about the undo system.
|
||||
* @param aIsEnabled [OUT] PR_TRUE if undo is enabled
|
||||
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is currently ready to be undone.
|
||||
*/
|
||||
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
|
||||
|
||||
/** Redo reverses the effects of the last Undo operation
|
||||
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
|
||||
* If a transaction manager is present, it is told to redo and the result of the previously undone
|
||||
* transaction is reapplied to the document.
|
||||
* If no transaction is available for Redo, or if the document has no transaction manager,
|
||||
* the Redo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Redo(PRUint32 aCount)=0;
|
||||
|
||||
/** returns state information about the redo system.
|
||||
* @param aIsEnabled [OUT] PR_TRUE if redo is enabled
|
||||
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is currently ready to be redone.
|
||||
*/
|
||||
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
|
||||
|
||||
/** BeginTransaction is a signal from the caller to the editor that the caller will execute multiple updates
|
||||
* to the content tree that should be treated as a single logical operation,
|
||||
* in the most efficient way possible.<br>
|
||||
* All transactions executed between a call to BeginTransaction and EndTransaction will be undoable as
|
||||
* an atomic action.<br>
|
||||
* EndTransaction must be called after BeginTransaction.<br>
|
||||
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginUpdate.
|
||||
*/
|
||||
NS_IMETHOD BeginTransaction()=0;
|
||||
|
||||
/** EndTransaction is a signal to the editor that the caller is finished updating the content model.<br>
|
||||
* BeginUpdate must be called before EndTransaction is called.<br>
|
||||
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginTransaction.
|
||||
*/
|
||||
NS_IMETHOD EndTransaction()=0;
|
||||
|
||||
|
||||
/* ------------ Clipboard methods -------------- */
|
||||
|
||||
/** cut the currently selected text, putting it into the OS clipboard
|
||||
* What if no text is selected?
|
||||
* What about mixed selections?
|
||||
* What are the clipboard formats?
|
||||
*/
|
||||
NS_IMETHOD Cut()=0;
|
||||
|
||||
/** copy the currently selected text, putting it into the OS clipboard
|
||||
* What if no text is selected?
|
||||
* What about mixed selections?
|
||||
* What are the clipboard formats?
|
||||
*/
|
||||
NS_IMETHOD Copy()=0;
|
||||
|
||||
/** paste the text in the OS clipboard at the cursor position, replacing
|
||||
* the selected text (if any)
|
||||
*/
|
||||
NS_IMETHOD Paste()=0;
|
||||
|
||||
|
||||
/* ------------ Document info methods -------------- */
|
||||
|
||||
/** Returns true if the document is modifed and needs saving */
|
||||
NS_IMETHOD GetDocumentModified(PRBool *outDocModified)=0;
|
||||
|
||||
/** get the length of the document in characters */
|
||||
NS_IMETHOD GetDocumentLength(PRInt32 *aCount)=0;
|
||||
|
||||
|
||||
|
||||
/* ------------ Output methods -------------- */
|
||||
|
||||
/**
|
||||
* Output methods flags:
|
||||
*/
|
||||
enum {
|
||||
EditorOutputSelectionOnly = 1,
|
||||
EditorOutputFormatted = 2,
|
||||
EditorOutputNoDoctype = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* Output methods:
|
||||
* aFormatType is a mime type, like text/plain.
|
||||
*/
|
||||
NS_IMETHOD OutputToString(nsString& aOutputString,
|
||||
const nsString& aFormatType,
|
||||
PRUint32 aFlags) = 0;
|
||||
NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
|
||||
const nsString& aFormatType,
|
||||
const nsString* aCharsetOverride,
|
||||
PRUint32 aFlags) = 0;
|
||||
|
||||
|
||||
|
||||
/* ------------ Various listeners methods -------------- */
|
||||
|
||||
/** add an EditActionListener to the editors list of listeners. */
|
||||
NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener)=0;
|
||||
|
||||
/** Remove an EditActionListener from the editor's list of listeners. */
|
||||
NS_IMETHOD RemoveEditActionListener(nsIEditActionListener *aListener)=0;
|
||||
|
||||
/** Add a DocumentStateListener to the editors list of doc state listeners. */
|
||||
NS_IMETHOD AddDocumentStateListener(nsIDocumentStateListener *aListener)=0;
|
||||
|
||||
/** Remove a DocumentStateListener to the editors list of doc state listeners. */
|
||||
NS_IMETHOD RemoveDocumentStateListener(nsIDocumentStateListener *aListener)=0;
|
||||
|
||||
|
||||
/* ------------ Debug methods -------------- */
|
||||
|
||||
/**
|
||||
* And a debug method -- show us what the tree looks like right now
|
||||
*/
|
||||
NS_IMETHOD DumpContentTree() = 0;
|
||||
|
||||
/** Dumps a text representation of the content tree to standard out */
|
||||
NS_IMETHOD DebugDumpContent() const =0;
|
||||
|
||||
/* Run unit tests. Noop in optimized builds */
|
||||
NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)=0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //nsIEditor_h__
|
||||
|
57
editor/provisional/nsIEditorIMESupport.h
Normal file
57
editor/provisional/nsIEditorIMESupport.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIEditorIMESupport_h__
|
||||
#define nsIEditorIMESupport_h__
|
||||
|
||||
|
||||
#define NS_IEDITORIMESUPPORT_IID \
|
||||
( /* {4805e680-49b9-11d3-9ce4-ed60bd6cb5bc} */ \
|
||||
0x4805e680, 0x49b9, 0x11d3 \
|
||||
{ 0x9c, 0xe4, 0xed, 0x60, 0xbd, 0x6c, 0xb5, 0xbc } }
|
||||
|
||||
|
||||
class nsIEditorIMESupport : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEDITORIMESUPPORT_IID; return iid; }
|
||||
|
||||
|
||||
/**
|
||||
* BeginComposition() Handles the start of inline input composition.
|
||||
*/
|
||||
|
||||
NS_IMETHOD BeginComposition(void) = 0;
|
||||
|
||||
/**
|
||||
* SetCompositionString() Sets the inline input composition string.
|
||||
* BeginComposition must be called prior to this.
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIDOMTextRangeList* aTextRangeList) = 0;
|
||||
|
||||
/**
|
||||
* BeginComposition() Handles the end of inline input composition.
|
||||
*/
|
||||
|
||||
NS_IMETHOD EndComposition(void) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIEditorIMESupport_h__
|
46
editor/provisional/nsIEditorLogging.h
Normal file
46
editor/provisional/nsIEditorLogging.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIEditorLogging_h__
|
||||
#define nsIEditorLogging_h__
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
#define NS_IEDITORLOGGING_IID \
|
||||
{ /* 4805e681-49b9-11d3-9ce4-ed60bd6cb5bc} */ \
|
||||
0x4805e681, 0x49b9, 0x11d3, \
|
||||
{ 0x9c, 0xe4, 0xed, 0x60, 0xbd, 0x6c, 0xb5, 0xbc } }
|
||||
|
||||
|
||||
class nsIEditorLogging : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEDITORLOGGING_IID; return iid; }
|
||||
|
||||
|
||||
/* Start logging */
|
||||
NS_IMETHOD StartLogging(nsIFileSpec *aLogFile)=0;
|
||||
|
||||
/* Stop logging */
|
||||
NS_IMETHOD StopLogging()=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIEditorLogging_h__
|
63
editor/provisional/nsIEditorStyleSheets.h
Normal file
63
editor/provisional/nsIEditorStyleSheets.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIEditorStyleSheets_h__
|
||||
#define nsIEditorStyleSheets_h__
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
class nsString;
|
||||
class nsICSSStyleSheet;
|
||||
|
||||
#define NS_IEDITORSTYLESHEETS_IID \
|
||||
{ /* 4805e682-49b9-11d3-9ce4-ed60bd6cb5bc} */ \
|
||||
0x4805e682, 0x49b9, 0x11d3, \
|
||||
{ 0x9c, 0xe4, 0xed, 0x60, 0xbd, 0x6c, 0xb5, 0xbc } }
|
||||
|
||||
|
||||
class nsIEditorStyleSheets : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEDITORSTYLESHEETS_IID; return iid; }
|
||||
|
||||
/** load and apply the style sheet, specified by aURL, to
|
||||
* the editor's document. This can involve asynchronous
|
||||
* network I/O
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
*/
|
||||
NS_IMETHOD ApplyStyleSheet(const nsString& aURL)=0;
|
||||
|
||||
/** Add the given Style Sheet to the editor's document
|
||||
* This is always synchronous
|
||||
* @param aSheet The style sheet to be applied.
|
||||
*/
|
||||
NS_IMETHOD AddStyleSheet(nsICSSStyleSheet* aSheet)=0;
|
||||
|
||||
/** Remove the given Style Sheet from the editor's document
|
||||
* This is always synchronous
|
||||
* @param aSheet The style sheet to be applied.
|
||||
*/
|
||||
NS_IMETHOD RemoveStyleSheet(nsICSSStyleSheet* aSheet)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIEditorStyleSheets_h__
|
||||
|
300
editor/provisional/nsIHighLevelHTMLEditor.h
Normal file
300
editor/provisional/nsIHighLevelHTMLEditor.h
Normal file
@ -0,0 +1,300 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL")=0; you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIHighLevelHTMLEditor_h__
|
||||
#define nsIHighLevelHTMLEditor_h__
|
||||
|
||||
|
||||
#define NS_IHIGHLEVELHTMLEDITOR_IID \
|
||||
{ /* 4805e683-49b9-11d3-9ce4-ed60bd6cb5bc} */ \
|
||||
0x4805e683, 0x49b9, 0x11d3, \
|
||||
{ 0x9c, 0xe4, 0xed, 0x60, 0xbd, 0x6c, 0xb5, 0xbc } }
|
||||
|
||||
|
||||
class nsIHighLevelHTMLEditor : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IHIGHLEVELHTMLEDITOR_IID; return iid; }
|
||||
|
||||
|
||||
|
||||
/* ------------ Inline property methods -------------- */
|
||||
|
||||
|
||||
/**
|
||||
* SetInlineProperty() sets the aggregate properties on the current selection
|
||||
*
|
||||
* @param aProperty the property to set on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
* @param aValue if aAttribute is not null, the value of the attribute. May be null.
|
||||
* Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
|
||||
*/
|
||||
NS_IMETHOD SetInlineProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue)=0;
|
||||
|
||||
/**
|
||||
* GetInlineProperty() gets the aggregate properties of the current selection.
|
||||
* All object in the current selection are scanned and their attributes are
|
||||
* represented in a list of Property object.
|
||||
*
|
||||
* @param aProperty the property to get on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
* @param aValue if aAttribute is not null, the value of the attribute. May be null.
|
||||
* Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
|
||||
* @param aFirst [OUT] PR_TRUE if the first text node in the selection has the property
|
||||
* @param aAny [OUT] PR_TRUE if any of the text nodes in the selection have the property
|
||||
* @param aAll [OUT] PR_TRUE if all of the text nodes in the selection have the property
|
||||
*/
|
||||
NS_IMETHOD GetInlineProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue,
|
||||
PRBool &aFirst, PRBool &aAny, PRBool &aAll)=0;
|
||||
|
||||
/**
|
||||
* RemoveInlineProperty() deletes the properties from all text in the current selection.
|
||||
* If aProperty is not set on the selection, nothing is done.
|
||||
*
|
||||
* @param aProperty the property to reomve from the selection
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
* nsIEditProperty::allAttributes is special. It indicates that
|
||||
* all content-based text properties are to be removed from the selection.
|
||||
*/
|
||||
NS_IMETHOD RemoveInlineProperty(nsIAtom *aProperty, const nsString *aAttribute)=0;
|
||||
|
||||
|
||||
/* ------------ HTML content methods -------------- */
|
||||
|
||||
/**
|
||||
* Insert a break into the content model.<br>
|
||||
* The interpretation of a break is up to the rule system:
|
||||
* it may enter a character, split a node in the tree, etc.
|
||||
*/
|
||||
NS_IMETHOD InsertBreak()=0;
|
||||
|
||||
/**
|
||||
* InsertText() Inserts a string at the current location, given by the selection.
|
||||
* If the selection is not collapsed, the selection is deleted and the insertion
|
||||
* takes place at the resulting collapsed selection.
|
||||
*
|
||||
* NOTE: what happens if the string contains a CR?
|
||||
*
|
||||
* @param aString the string to be inserted
|
||||
*/
|
||||
NS_IMETHOD InsertText(const nsString& aStringToInsert)=0;
|
||||
|
||||
/** Insert an element, which may have child nodes, at the selection
|
||||
* Used primarily to insert a new element for various insert element dialogs,
|
||||
* but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
|
||||
* be useful for other elements.
|
||||
*
|
||||
* @param aElement The element to insert
|
||||
* @param aDeleteSelection Delete the selection before inserting
|
||||
* If aDeleteSelection is PR_FALSE, then the element is inserted
|
||||
* after the end of the selection for all element except
|
||||
* Named Anchors, which insert before the selection
|
||||
*/
|
||||
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)=0;
|
||||
|
||||
|
||||
/* ------------ Selected content removal -------------- */
|
||||
|
||||
/**
|
||||
* DeleteSelection removes all nodes in the current selection.
|
||||
* @param aDir if eLTR, delete to the right (for example, the DEL key)
|
||||
* if eRTL, delete to the left (for example, the BACKSPACE key)
|
||||
*/
|
||||
typedef enum {
|
||||
eDoNothing,
|
||||
eDeleteRight,
|
||||
eDeleteLeft
|
||||
} ECollapsedSelectionAction;
|
||||
|
||||
NS_IMETHOD DeleteSelection(nsIEditor::ECollapsedSelectionAction aAction)=0;
|
||||
|
||||
/**
|
||||
* DeleteSelectionAndCreateNode combines DeleteSelection and CreateNode
|
||||
* It deletes only if there is something selected (doesn't do DEL, BACKSPACE action)
|
||||
* @param aTag The type of object to create
|
||||
* @param aNewNode [OUT] The node created. Caller must release aNewNode.
|
||||
*/
|
||||
NS_IMETHOD ReplaceSelectionWithNewNode(const nsString& aTag, nsIDOMNode ** aNewNode)=0;
|
||||
|
||||
/* ------------ Selection manipulation -------------- */
|
||||
/* Should these be moved to nsIDOMSelection? */
|
||||
|
||||
/** Set the selection at the suppled element
|
||||
*
|
||||
* @param aElement An element in the document
|
||||
*/
|
||||
NS_IMETHOD SelectElement(nsIDOMElement* aElement)=0;
|
||||
|
||||
/** Create a collapsed selection just after aElement
|
||||
*
|
||||
* XXX could we parameterize SelectElement(before/select/after>?
|
||||
*
|
||||
* The selection is set to parent-of-aElement with an
|
||||
* offset 1 greater than aElement's offset
|
||||
* but it enforces the HTML 4.0 DTD "CanContain" rules, so it should
|
||||
* be useful for other elements.
|
||||
*
|
||||
* @param aElement An element in the document
|
||||
*/
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement)=0;
|
||||
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetParagraphFormat(const nsString& aParagraphFormat)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParagraphStyle(nsStringArray *aTagList)=0;
|
||||
|
||||
/** Add a block parent node around the selected content.
|
||||
* Only legal nestings are allowed.
|
||||
* An example of use is for indenting using blockquote nodes.
|
||||
*
|
||||
* @param aParentTag The tag from which the new parent is created.
|
||||
*/
|
||||
NS_IMETHOD AddBlockParent(nsString& aParentTag)=0;
|
||||
|
||||
/** Replace the block parent node around the selected content with a new block
|
||||
* parent node of type aParentTag.
|
||||
* Only legal replacements are allowed.
|
||||
* An example of use are is transforming H1 to LI ("paragraph type transformations").
|
||||
* For containing block transformations (transforming UL to OL, for example),
|
||||
* the caller should RemoveParent("UL"), set the selection appropriately,
|
||||
* and call AddBlockParent("OL").
|
||||
*
|
||||
* @param aParentTag The tag from which the new parent is created.
|
||||
*/
|
||||
NS_IMETHOD ReplaceBlockParent(nsString& aParentTag)=0;
|
||||
|
||||
/** remove the paragraph style from the selection */
|
||||
NS_IMETHOD RemoveParagraphStyle()=0;
|
||||
|
||||
/** remove block parent of type aTagToRemove from the selection.
|
||||
* if aTagToRemove is null, the nearest enclosing block that
|
||||
* is <B>not</B> a root is removed.
|
||||
*/
|
||||
NS_IMETHOD RemoveParent(const nsString &aParentTag)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertList(const nsString& aListType)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Indent(const nsString& aIndent)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Align(const nsString& aAlign)=0;
|
||||
|
||||
/** Return the input node or a parent matching the given aTagName,
|
||||
* starting the search at the supplied node.
|
||||
* An example of use is for testing if a node is in a table cell
|
||||
* given a selection anchor node.
|
||||
*
|
||||
* @param aTagName The HTML tagname
|
||||
* Special input values for Links and Named anchors:
|
||||
* Use "link" or "href" to get a link node
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
*
|
||||
* @param aNode The node in the document to start the search
|
||||
* If it is null, the anchor node of the current selection is used
|
||||
*/
|
||||
NS_IMETHOD GetElementOrParentByTagName(const nsString& aTagName, nsIDOMNode *aNode, nsIDOMElement** aReturn)=0;
|
||||
|
||||
/** Return an element only if it is the only node selected,
|
||||
* such as an image, horizontal rule, etc.
|
||||
* The exception is a link, which is more like a text attribute:
|
||||
* The Ancho tag is returned if the selection is within the textnode(s)
|
||||
* that are children of the "A" node.
|
||||
* This could be a collapsed selection, i.e., a caret within the link text.
|
||||
*
|
||||
* @param aTagName The HTML tagname
|
||||
* Special input values for Links and Named anchors:
|
||||
* Use "link" or "href" to get a link node
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
*/
|
||||
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn)=0;
|
||||
|
||||
/** Return a new element with default attribute values
|
||||
*
|
||||
* This does not rely on the selection, and is not sensitive to context.
|
||||
*
|
||||
* Used primarily to supply new element for various insert element dialogs
|
||||
* (Image, Link, NamedAnchor, Table, and HorizontalRule
|
||||
* are the only returned elements as of 7/25/99)
|
||||
*
|
||||
* @param aTagName The HTML tagname
|
||||
* Special input values for Links and Named anchors:
|
||||
* Use "link" or "href" to get a link node
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
*/
|
||||
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn)=0;
|
||||
|
||||
/** Save the attributes of a Horizontal Rule in user preferences
|
||||
* These prefs are used when the user inserts a new Horizontal line
|
||||
*
|
||||
* XXX this functionality should move to the editorShell.
|
||||
*
|
||||
* @param aElement An HR element
|
||||
*/
|
||||
NS_IMETHOD SaveHLineSettings(nsIDOMElement* aElement)=0;
|
||||
|
||||
/** Insert an link element as the parent of the current selection
|
||||
* be useful for other elements.
|
||||
*
|
||||
* @param aElement An "A" element with a non-empty "href" attribute
|
||||
*/
|
||||
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)=0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIHighLevelHTMLEditor_h__
|
101
editor/provisional/nsITableEditor.h
Normal file
101
editor/provisional/nsITableEditor.h
Normal file
@ -0,0 +1,101 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL")=0; you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsITableEditor_h__
|
||||
#define nsITableEditor_h__
|
||||
|
||||
|
||||
#define NS_ITABLEEDITOR_IID \
|
||||
{ /* 4805e684-49b9-11d3-9ce4-ed60bd6cb5bc} */ \
|
||||
0x4805e684, 0x49b9, 0x11d3, \
|
||||
{ 0x9c, 0xe4, 0xed, 0x60, 0xbd, 0x6c, 0xb5, 0xbc } }
|
||||
|
||||
|
||||
class nsITableEditor : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ITABLEEDITOR_IID; return iid; }
|
||||
|
||||
/* ------------ Table editing Methods -------------- */
|
||||
|
||||
/** Not implemented yet
|
||||
*/
|
||||
NS_IMETHOD InsertTable()=0;
|
||||
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter)=0;
|
||||
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter)=0;
|
||||
NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter)=0;
|
||||
NS_IMETHOD DeleteTable()=0;
|
||||
NS_IMETHOD DeleteTableCell(PRInt32 aNumber)=0;
|
||||
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber)=0;
|
||||
NS_IMETHOD DeleteTableRow(PRInt32 aNumber)=0;
|
||||
NS_IMETHOD JoinTableCells(PRBool aCellToRight)=0;
|
||||
|
||||
/** Get the row an column index from the layout's cellmap
|
||||
* If aTable is null, it will try to find enclosing table of selection ancho
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell, PRInt32& aRowIndex, PRInt32& aColIndex)=0;
|
||||
|
||||
/** Get the number of rows and columns in a table from the layout's cellmap
|
||||
* If aTable is null, it will try to find enclosing table of selection ancho
|
||||
* Note that all rows in table will not have this many because of
|
||||
* ROWSPAN effects or if table is not "rectangular" (has short rows)
|
||||
*/
|
||||
NS_IMETHOD GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& aColCount)=0;
|
||||
|
||||
/** Get a cell element at cellmap grid coordinates
|
||||
* A cell that spans across multiple cellmap locations will
|
||||
* be returned multiple times, once for each location it occupies
|
||||
*
|
||||
* @param aTable A table in the document
|
||||
* @param aRowIndex, aColIndex The 0-based cellmap indexes
|
||||
*
|
||||
* Note that this returns NS_TABLELAYOUT_CELL_NOT_FOUND
|
||||
* when a cell is not found at the given indexes,
|
||||
* but this passes the NS_SUCCEEDED() test,
|
||||
* so you can scan for all cells in a row or column
|
||||
* by iterating through the appropriate indexes
|
||||
* until the returned aCell is null
|
||||
*/
|
||||
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement* &aCell)=0;
|
||||
|
||||
/** Get a cell at cellmap grid coordinates and associated data
|
||||
* A cell that spans across multiple cellmap locations will
|
||||
* be returned multiple times, once for each location it occupies
|
||||
* Examine the returned aStartRowIndex and aStartColIndex to see
|
||||
* if it is in the same layout column or layout row:
|
||||
* A "layout row" is all cells sharing the same top edge
|
||||
* A "layout column" is all cells sharing the same left edge
|
||||
* This is important to determine what to do when inserting or deleting a column or row
|
||||
*
|
||||
* @param aTable A table in the document
|
||||
* @param aRowIndex, aColIndex The 0-based cellmap indexes
|
||||
*
|
||||
* Note that this returns NS_TABLELAYOUT_CELL_NOT_FOUND
|
||||
* when a cell is not found at the given indexes (see note for GetCellAt())
|
||||
*/
|
||||
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement* &aCell,
|
||||
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
||||
PRInt32& aRowSpan, PRInt32& aColSpan, PRBool& aIsSelected)=0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // nsITableEditor_h__
|
Loading…
Reference in New Issue
Block a user