зеркало из https://github.com/mozilla/gecko-dev.git
bug fix for 67985 - needed methods for nsEditor impl
r=jfrancis sr=sfraser
This commit is contained in:
Родитель
a540a46a90
Коммит
37f2712320
|
@ -315,6 +315,20 @@ nsEditor::PreDestroy()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetFlags(PRUint32 *aFlags)
|
||||
{
|
||||
*aFlags = mFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SetFlags(PRUint32 aFlags)
|
||||
{
|
||||
mFlags = aFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocument(nsIDOMDocument **aDoc)
|
||||
{
|
||||
|
@ -360,6 +374,13 @@ nsEditor::GetSelectionController(nsISelectionController **aSel)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DeleteSelection(EDirection aAction)
|
||||
{
|
||||
return DeleteSelectionImpl(aAction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetSelection(nsISelection **aSelection)
|
||||
|
@ -680,6 +701,26 @@ NS_IMETHODIMP nsEditor::ShouldTxnSetSelection(PRBool *aResult)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocumentIsEmpty(PRBool *aDocumentIsEmpty)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
nsresult res = GetRootElement(getter_AddRefs(rootElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!rootElement) return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(rootElement);
|
||||
nsCOMPtr<nsIDOMNode> firstChild;
|
||||
res = rootNode->GetFirstChild(getter_AddRefs(firstChild));
|
||||
|
||||
if(NS_SUCCEEDED(res))
|
||||
*aDocumentIsEmpty = PR_TRUE;
|
||||
else
|
||||
*aDocumentIsEmpty = PR_FALSE;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// XXX: the rule system should tell us which node to select all on (ie, the root, or the body)
|
||||
NS_IMETHODIMP nsEditor::SelectAll()
|
||||
{
|
||||
|
@ -921,6 +962,63 @@ nsEditor::SaveFile(nsIFile *aFileSpec, PRBool aReplaceExisting,
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Cut()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCut(PRBool &aCanCut)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Copy()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCopy(PRBool &aCanCopy)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanDrag(nsIDOMEvent *aEvent, PRBool &aCanDrag)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DoDrag(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::InsertFromDrop(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, const nsString& aValue)
|
||||
{
|
||||
|
|
|
@ -129,13 +129,14 @@ public:
|
|||
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
|
||||
NS_IMETHOD PostCreate();
|
||||
NS_IMETHOD PreDestroy();
|
||||
NS_IMETHOD GetFlags(PRUint32 *aFlags) = 0;
|
||||
NS_IMETHOD SetFlags(PRUint32 aFlags) = 0;
|
||||
NS_IMETHOD GetFlags(PRUint32 *aFlags);
|
||||
NS_IMETHOD SetFlags(PRUint32 aFlags);
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
|
||||
NS_IMETHOD GetRootElement(nsIDOMElement **aElement);
|
||||
NS_IMETHOD GetPresShell(nsIPresShell **aPS);
|
||||
NS_IMETHOD GetSelectionController(nsISelectionController **aSel);
|
||||
NS_IMETHOD GetSelection(nsISelection **aSelection);
|
||||
NS_IMETHOD DeleteSelection(EDirection aAction);
|
||||
|
||||
NS_IMETHOD EnableUndo(PRBool aEnable);
|
||||
NS_IMETHOD GetTransactionManager(nsITransactionManager* *aTxnManager);
|
||||
|
@ -152,8 +153,7 @@ public:
|
|||
NS_IMETHOD EndPlaceHolderTransaction();
|
||||
NS_IMETHOD ShouldTxnSetSelection(PRBool *aResult);
|
||||
|
||||
// pure virtual, because the definition of 'empty' depends on the doc type
|
||||
NS_IMETHOD GetDocumentIsEmpty(PRBool *aDocumentIsEmpty)=0;
|
||||
NS_IMETHOD GetDocumentIsEmpty(PRBool *aDocumentIsEmpty);
|
||||
|
||||
// file handling
|
||||
NS_IMETHOD GetDocumentModified(PRBool *outDocModified);
|
||||
|
@ -161,13 +161,15 @@ public:
|
|||
NS_IMETHOD SetDocumentCharacterSet(const PRUnichar* characterSet);
|
||||
NS_IMETHOD SaveFile(nsIFile *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, const nsString& aFormat);
|
||||
|
||||
// these are pure virtual in this base class
|
||||
NS_IMETHOD Cut() = 0;
|
||||
NS_IMETHOD CanCut(PRBool &aCanCut)=0;
|
||||
NS_IMETHOD Copy() = 0;
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy)=0;
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType) = 0;
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)=0;
|
||||
NS_IMETHOD Cut();
|
||||
NS_IMETHOD CanCut(PRBool &aCanCut);
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste);
|
||||
NS_IMETHOD CanDrag(nsIDOMEvent *aEvent, PRBool &aCanDrag);
|
||||
NS_IMETHOD DoDrag(nsIDOMEvent *aEvent);
|
||||
NS_IMETHOD InsertFromDrop(nsIDOMEvent *aEvent);
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
|
||||
|
|
|
@ -315,6 +315,20 @@ nsEditor::PreDestroy()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetFlags(PRUint32 *aFlags)
|
||||
{
|
||||
*aFlags = mFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SetFlags(PRUint32 aFlags)
|
||||
{
|
||||
mFlags = aFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocument(nsIDOMDocument **aDoc)
|
||||
{
|
||||
|
@ -360,6 +374,13 @@ nsEditor::GetSelectionController(nsISelectionController **aSel)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DeleteSelection(EDirection aAction)
|
||||
{
|
||||
return DeleteSelectionImpl(aAction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetSelection(nsISelection **aSelection)
|
||||
|
@ -680,6 +701,26 @@ NS_IMETHODIMP nsEditor::ShouldTxnSetSelection(PRBool *aResult)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::GetDocumentIsEmpty(PRBool *aDocumentIsEmpty)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
nsresult res = GetRootElement(getter_AddRefs(rootElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!rootElement) return NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(rootElement);
|
||||
nsCOMPtr<nsIDOMNode> firstChild;
|
||||
res = rootNode->GetFirstChild(getter_AddRefs(firstChild));
|
||||
|
||||
if(NS_SUCCEEDED(res))
|
||||
*aDocumentIsEmpty = PR_TRUE;
|
||||
else
|
||||
*aDocumentIsEmpty = PR_FALSE;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// XXX: the rule system should tell us which node to select all on (ie, the root, or the body)
|
||||
NS_IMETHODIMP nsEditor::SelectAll()
|
||||
{
|
||||
|
@ -921,6 +962,63 @@ nsEditor::SaveFile(nsIFile *aFileSpec, PRBool aReplaceExisting,
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Cut()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCut(PRBool &aCanCut)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Copy()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanCopy(PRBool &aCanCopy)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CanDrag(nsIDOMEvent *aEvent, PRBool &aCanDrag)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::DoDrag(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::InsertFromDrop(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, const nsString& aValue)
|
||||
{
|
||||
|
|
|
@ -129,13 +129,14 @@ public:
|
|||
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
|
||||
NS_IMETHOD PostCreate();
|
||||
NS_IMETHOD PreDestroy();
|
||||
NS_IMETHOD GetFlags(PRUint32 *aFlags) = 0;
|
||||
NS_IMETHOD SetFlags(PRUint32 aFlags) = 0;
|
||||
NS_IMETHOD GetFlags(PRUint32 *aFlags);
|
||||
NS_IMETHOD SetFlags(PRUint32 aFlags);
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
|
||||
NS_IMETHOD GetRootElement(nsIDOMElement **aElement);
|
||||
NS_IMETHOD GetPresShell(nsIPresShell **aPS);
|
||||
NS_IMETHOD GetSelectionController(nsISelectionController **aSel);
|
||||
NS_IMETHOD GetSelection(nsISelection **aSelection);
|
||||
NS_IMETHOD DeleteSelection(EDirection aAction);
|
||||
|
||||
NS_IMETHOD EnableUndo(PRBool aEnable);
|
||||
NS_IMETHOD GetTransactionManager(nsITransactionManager* *aTxnManager);
|
||||
|
@ -152,8 +153,7 @@ public:
|
|||
NS_IMETHOD EndPlaceHolderTransaction();
|
||||
NS_IMETHOD ShouldTxnSetSelection(PRBool *aResult);
|
||||
|
||||
// pure virtual, because the definition of 'empty' depends on the doc type
|
||||
NS_IMETHOD GetDocumentIsEmpty(PRBool *aDocumentIsEmpty)=0;
|
||||
NS_IMETHOD GetDocumentIsEmpty(PRBool *aDocumentIsEmpty);
|
||||
|
||||
// file handling
|
||||
NS_IMETHOD GetDocumentModified(PRBool *outDocModified);
|
||||
|
@ -161,13 +161,15 @@ public:
|
|||
NS_IMETHOD SetDocumentCharacterSet(const PRUnichar* characterSet);
|
||||
NS_IMETHOD SaveFile(nsIFile *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, const nsString& aFormat);
|
||||
|
||||
// these are pure virtual in this base class
|
||||
NS_IMETHOD Cut() = 0;
|
||||
NS_IMETHOD CanCut(PRBool &aCanCut)=0;
|
||||
NS_IMETHOD Copy() = 0;
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy)=0;
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType) = 0;
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)=0;
|
||||
NS_IMETHOD Cut();
|
||||
NS_IMETHOD CanCut(PRBool &aCanCut);
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste);
|
||||
NS_IMETHOD CanDrag(nsIDOMEvent *aEvent, PRBool &aCanDrag);
|
||||
NS_IMETHOD DoDrag(nsIDOMEvent *aEvent);
|
||||
NS_IMETHOD InsertFromDrop(nsIDOMEvent *aEvent);
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче