Add GetEmbeddedObjects API for mail/news
git-svn-id: svn://10.0.0.236/trunk@40122 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2246,7 +2246,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
||||
(parentSelectedNode != bodyElement))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> bodyNode = do_QueryInterface(bodyElement);
|
||||
PRBool isInline = PR_TRUE;
|
||||
isInline = PR_TRUE;
|
||||
while (isInline)
|
||||
{
|
||||
// Get parent of the top node to split
|
||||
@@ -2589,6 +2589,67 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray* aNodeList)
|
||||
{
|
||||
if (!aNodeList)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
#if 0
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#else
|
||||
nsresult res;
|
||||
|
||||
res = NS_NewISupportsArray(&aNodeList);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsCOMPtr<nsIContentIterator> iter;
|
||||
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
||||
nsIContentIterator::GetIID(),
|
||||
getter_AddRefs(iter));
|
||||
if ((NS_SUCCEEDED(res)) && iter)
|
||||
{
|
||||
// get the root content
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
||||
nsEditor::GetDocument(getter_AddRefs(domdoc));
|
||||
if (!domdoc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc (do_QueryInterface(domdoc));
|
||||
if (!doc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rootContent = doc->GetRootContent();
|
||||
|
||||
iter->Init(rootContent);
|
||||
|
||||
// loop through the content iterator for each content node
|
||||
nsCOMPtr<nsIContent> content;
|
||||
res = iter->CurrentNode(getter_AddRefs(content));
|
||||
|
||||
while (NS_COMFALSE == iter->IsDone())
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node (do_QueryInterface(content));
|
||||
if (node)
|
||||
{
|
||||
nsAutoString tagName;
|
||||
node->GetNodeName(tagName);
|
||||
tagName.ToLowerCase();
|
||||
|
||||
// See if it's an image or an embed
|
||||
if (tagName == "img" || tagName == "embed")
|
||||
aNodeList->AppendElement(node);
|
||||
}
|
||||
iter->Next();
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
|
||||
@@ -164,6 +164,9 @@ public:
|
||||
NS_IMETHOD SetCaretInTableCell(nsIDOMElement* aElement, PRBool* caretIsSet);
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
|
||||
|
||||
// MHTML helper methods
|
||||
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray* aNodeList);
|
||||
|
||||
// Table Editing (implemented in EditTable.cpp)
|
||||
NS_IMETHOD CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
|
||||
NS_IMETHOD GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
|
||||
|
||||
@@ -760,6 +760,12 @@ nsJSEditorLog::SetCaretAfterElement(nsIDOMElement* aElement)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSEditorLog::GetEmbeddedObjects(nsISupportsArray* aNodeList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSEditorLog::InsertTable()
|
||||
{
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
||||
NS_IMETHOD SelectElement(nsIDOMElement* aElement);
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
|
||||
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray* aNodeList);
|
||||
NS_IMETHOD InsertTable();
|
||||
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
|
||||
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
|
||||
|
||||
@@ -2246,7 +2246,7 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
||||
(parentSelectedNode != bodyElement))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> bodyNode = do_QueryInterface(bodyElement);
|
||||
PRBool isInline = PR_TRUE;
|
||||
isInline = PR_TRUE;
|
||||
while (isInline)
|
||||
{
|
||||
// Get parent of the top node to split
|
||||
@@ -2589,6 +2589,67 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement)
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray* aNodeList)
|
||||
{
|
||||
if (!aNodeList)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
#if 0
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#else
|
||||
nsresult res;
|
||||
|
||||
res = NS_NewISupportsArray(&aNodeList);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
nsCOMPtr<nsIContentIterator> iter;
|
||||
res = nsComponentManager::CreateInstance(kCContentIteratorCID, nsnull,
|
||||
nsIContentIterator::GetIID(),
|
||||
getter_AddRefs(iter));
|
||||
if ((NS_SUCCEEDED(res)) && iter)
|
||||
{
|
||||
// get the root content
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
||||
nsEditor::GetDocument(getter_AddRefs(domdoc));
|
||||
if (!domdoc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc (do_QueryInterface(domdoc));
|
||||
if (!doc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rootContent = doc->GetRootContent();
|
||||
|
||||
iter->Init(rootContent);
|
||||
|
||||
// loop through the content iterator for each content node
|
||||
nsCOMPtr<nsIContent> content;
|
||||
res = iter->CurrentNode(getter_AddRefs(content));
|
||||
|
||||
while (NS_COMFALSE == iter->IsDone())
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node (do_QueryInterface(content));
|
||||
if (node)
|
||||
{
|
||||
nsAutoString tagName;
|
||||
node->GetNodeName(tagName);
|
||||
tagName.ToLowerCase();
|
||||
|
||||
// See if it's an image or an embed
|
||||
if (tagName == "img" || tagName == "embed")
|
||||
aNodeList->AppendElement(node);
|
||||
}
|
||||
iter->Next();
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLEditor::CanContainTag(nsIDOMNode* aParent, const nsString &aTag)
|
||||
|
||||
@@ -164,6 +164,9 @@ public:
|
||||
NS_IMETHOD SetCaretInTableCell(nsIDOMElement* aElement, PRBool* caretIsSet);
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
|
||||
|
||||
// MHTML helper methods
|
||||
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray* aNodeList);
|
||||
|
||||
// Table Editing (implemented in EditTable.cpp)
|
||||
NS_IMETHOD CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
|
||||
NS_IMETHOD GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
|
||||
|
||||
@@ -99,7 +99,6 @@ public:
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText)=0;
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCitation)=0;
|
||||
|
||||
|
||||
NS_IMETHOD InsertHTML(const nsString &aInputString)=0;
|
||||
|
||||
/**
|
||||
@@ -187,6 +186,9 @@ public:
|
||||
NS_IMETHOD SelectElement(nsIDOMElement* aElement)=0;
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement)=0;
|
||||
|
||||
// MHTML helper methods
|
||||
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray* aNodeList)=0;
|
||||
|
||||
// Table editing Methods
|
||||
NS_IMETHOD InsertTable()=0;
|
||||
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter)=0;
|
||||
|
||||
Reference in New Issue
Block a user