Changed IsNodeBlock to NodeIsBlock for JS. Fixed all compiler warnings. Added Advanced property Edit files

This commit is contained in:
cmanske%netscape.com 1999-09-01 19:58:25 +00:00
parent ee1bdd4cef
commit ba11acdca2
18 changed files with 169 additions and 37 deletions

View File

@ -159,14 +159,9 @@ nsHTMLEditor::DeleteTable()
if(NS_FAILED(GetChildOffset(table, tableParent, tableOffset)))
return NS_ERROR_FAILURE;
// Place selection just before the table
nsCOMPtr<nsIDOMSelection>selection;
res = nsEditor::GetSelection(getter_AddRefs(selection));
if (NS_FAILED(res) || !selection)
return res;
res = DeleteNode(table);
// Place selection just before the table
selection->Collapse(tableParent, tableOffset);
}
return res;

View File

@ -671,7 +671,7 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
}
NS_IMETHODIMP
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType)
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, nsIDiskDocument::ESaveFileType aSaveFileType)
{
if (!aFileSpec)
return NS_ERROR_NULL_POINTER;
@ -688,11 +688,8 @@ nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveC
nsAutoString useDocCharset("");
typedef enum {eSaveFileText = 0, eSaveFileHTML = 1 } ESaveFileType;
res = diskDoc->SaveFile(aFileSpec, aReplaceExisting, aSaveCopy,
aSaveFileType == eSaveFileText ? nsIDiskDocument::eSaveFileText : nsIDiskDocument::eSaveFileHTML,
useDocCharset);
aSaveFileType, useDocCharset);
if (NS_SUCCEEDED(res))
DoAfterDocumentSave();
@ -2095,10 +2092,10 @@ nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, PRUint32 &aCount)
// Non-static version for the nsIEditor interface and JavaScript
NS_IMETHODIMP
nsEditor::IsNodeBlock(nsIDOMNode *aNode, PRBool *aIsBlock)
nsEditor::NodeIsBlock(nsIDOMNode *aNode, PRBool &aIsBlock)
{
if (!aNode || !aIsBlock) { return NS_ERROR_NULL_POINTER; }
return IsNodeBlock(aNode, *aIsBlock);
if (!aNode) { return NS_ERROR_NULL_POINTER; }
return IsNodeBlock(aNode, aIsBlock);
}
// The list of block nodes is shorter, so do the real work here...

View File

@ -27,6 +27,7 @@
#include "nsIEditorIMESupport.h"
#include "nsIDOMDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDOMSelection.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMEventListener.h"
@ -124,7 +125,7 @@ public:
NS_IMETHOD GetDocumentModified(PRBool *outDocModified);
NS_IMETHOD GetDocumentCharacterSet(PRUnichar** characterSet);
NS_IMETHOD SetDocumentCharacterSet(const PRUnichar* characterSet);
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType);
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, nsIDiskDocument::ESaveFileType aSaveFileType);
// these are pure virtual in this base class
NS_IMETHOD Cut() = 0;
@ -412,7 +413,7 @@ public:
static nsresult IsNodeBlock(nsIDOMNode *aNode, PRBool &aIsBlock);
/** This version is for exposure to JavaScript */
NS_IMETHOD IsNodeBlock(nsIDOMNode *aNode, PRBool *aIsBlock);
NS_IMETHOD NodeIsBlock(nsIDOMNode *aNode, PRBool &aIsBlock);
/** returns the closest block parent of aNode, not including aNode itself.
* can return null, for example if aNode is in a document fragment.

View File

@ -1150,7 +1150,7 @@ SkipFilters:
// TODO: Get the file type (from the extension?) the user set for the file
// How do we do this in an XP way???
// For now, just save as HTML type
res = editor->SaveFile(&docFileSpec, replacing, saveCopy, nsIEditor::eSaveFileHTML);
res = editor->SaveFile(&docFileSpec, replacing, saveCopy, nsIDiskDocument::eSaveFileHTML);
if (NS_FAILED(res))
{
Alert(GetString("SaveFileFailed"), GetString("SaveDocument"));
@ -1305,7 +1305,7 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType
}
NS_IMETHODIMP
nsEditorShell::IsNodeBlock(nsIDOMNode *node, PRBool *_retval)
nsEditorShell::NodeIsBlock(nsIDOMNode *node, PRBool *_retval)
{
if (!node || !_retval) { return NS_ERROR_NULL_POINTER; }
nsresult rv = NS_NOINTERFACE;
@ -1317,7 +1317,7 @@ nsEditorShell::IsNodeBlock(nsIDOMNode *node, PRBool *_retval)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor)
rv = editor->IsNodeBlock(node, _retval);
rv = editor->NodeIsBlock(node, *_retval);
}
break;

View File

@ -1150,7 +1150,7 @@ SkipFilters:
// TODO: Get the file type (from the extension?) the user set for the file
// How do we do this in an XP way???
// For now, just save as HTML type
res = editor->SaveFile(&docFileSpec, replacing, saveCopy, nsIEditor::eSaveFileHTML);
res = editor->SaveFile(&docFileSpec, replacing, saveCopy, nsIDiskDocument::eSaveFileHTML);
if (NS_FAILED(res))
{
Alert(GetString("SaveFileFailed"), GetString("SaveDocument"));
@ -1305,7 +1305,7 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType
}
NS_IMETHODIMP
nsEditorShell::IsNodeBlock(nsIDOMNode *node, PRBool *_retval)
nsEditorShell::NodeIsBlock(nsIDOMNode *node, PRBool *_retval)
{
if (!node || !_retval) { return NS_ERROR_NULL_POINTER; }
nsresult rv = NS_NOINTERFACE;
@ -1317,7 +1317,7 @@ nsEditorShell::IsNodeBlock(nsIDOMNode *node, PRBool *_retval)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor)
rv = editor->IsNodeBlock(node, _retval);
rv = editor->NodeIsBlock(node, *_retval);
}
break;

View File

@ -295,7 +295,7 @@ interface nsIEditorShell : nsISupports
* Tests if a node is a BLOCK element according the the HTML 4.0 DTD
* This does NOT consider CSS effect on display type
*/
boolean IsNodeBlock(in nsIDOMNode node);
boolean NodeIsBlock(in nsIDOMNode node);
void BeginBatchChanges();
void EndBatchChanges();

View File

@ -671,7 +671,7 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
}
NS_IMETHODIMP
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType)
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, nsIDiskDocument::ESaveFileType aSaveFileType)
{
if (!aFileSpec)
return NS_ERROR_NULL_POINTER;
@ -688,11 +688,8 @@ nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveC
nsAutoString useDocCharset("");
typedef enum {eSaveFileText = 0, eSaveFileHTML = 1 } ESaveFileType;
res = diskDoc->SaveFile(aFileSpec, aReplaceExisting, aSaveCopy,
aSaveFileType == eSaveFileText ? nsIDiskDocument::eSaveFileText : nsIDiskDocument::eSaveFileHTML,
useDocCharset);
aSaveFileType, useDocCharset);
if (NS_SUCCEEDED(res))
DoAfterDocumentSave();
@ -2095,10 +2092,10 @@ nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, PRUint32 &aCount)
// Non-static version for the nsIEditor interface and JavaScript
NS_IMETHODIMP
nsEditor::IsNodeBlock(nsIDOMNode *aNode, PRBool *aIsBlock)
nsEditor::NodeIsBlock(nsIDOMNode *aNode, PRBool &aIsBlock)
{
if (!aNode || !aIsBlock) { return NS_ERROR_NULL_POINTER; }
return IsNodeBlock(aNode, *aIsBlock);
if (!aNode) { return NS_ERROR_NULL_POINTER; }
return IsNodeBlock(aNode, aIsBlock);
}
// The list of block nodes is shorter, so do the real work here...

View File

@ -27,6 +27,7 @@
#include "nsIEditorIMESupport.h"
#include "nsIDOMDocument.h"
#include "nsIDiskDocument.h"
#include "nsIDOMSelection.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMEventListener.h"
@ -124,7 +125,7 @@ public:
NS_IMETHOD GetDocumentModified(PRBool *outDocModified);
NS_IMETHOD GetDocumentCharacterSet(PRUnichar** characterSet);
NS_IMETHOD SetDocumentCharacterSet(const PRUnichar* characterSet);
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType);
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, nsIDiskDocument::ESaveFileType aSaveFileType);
// these are pure virtual in this base class
NS_IMETHOD Cut() = 0;
@ -412,7 +413,7 @@ public:
static nsresult IsNodeBlock(nsIDOMNode *aNode, PRBool &aIsBlock);
/** This version is for exposure to JavaScript */
NS_IMETHOD IsNodeBlock(nsIDOMNode *aNode, PRBool *aIsBlock);
NS_IMETHOD NodeIsBlock(nsIDOMNode *aNode, PRBool &aIsBlock);
/** returns the closest block parent of aNode, not including aNode itself.
* can return null, for example if aNode is in a document fragment.

View File

@ -20,6 +20,7 @@
#define nsIEditor_h__
#include "nsISupports.h"
#include "nscore.h"
#include "nsIDiskDocument.h"
#define NS_IEDITOR_IID \
{/* A3C5EE71-742E-11d2-8F2C-006008310194*/ \
@ -45,8 +46,6 @@ class nsIEditor : public nsISupports
public:
static const nsIID& GetIID() { static nsIID iid = NS_IEDITOR_IID; return iid; }
typedef enum {eSaveFileText = 0, eSaveFileHTML = 1 } ESaveFileType;
/* An enum used to describe how to collpase a non-collapsed selection */
typedef enum {
eDoNothing,
@ -132,7 +131,7 @@ public:
* This would correspond to a 'Save Copy As' menu command
* (currently not in our UI)
*/
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType)=0;
NS_IMETHOD SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, nsIDiskDocument::ESaveFileType aSaveFileType)=0;
/* ------------ Transaction methods -------------- */
@ -242,7 +241,7 @@ public:
*
* @param aNode the node to test
*/
NS_IMETHOD IsNodeBlock(nsIDOMNode *aNode, PRBool *aIsBlock)=0;
NS_IMETHOD NodeIsBlock(nsIDOMNode *aNode, PRBool &aIsBlock)=0;
/**
* SetAttribute() sets the attribute of aElement.

View File

@ -0,0 +1,53 @@
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
//Cancel() is in EdDialogCommon.js
var tagname;
var element;
// dialog initialization code
function Startup()
{
if (!InitEditorShell())
return;
doSetOKCancel(onOK, null);
// Create dialog object to store controls for easy access
dialog = new Object;
// GET EACH CONTROL -- E.G.:
dialog.editBox = document.getElementById("editBox");
element = window.arguments[1]);
dump("*** Element passed into Advanced Edit: "+element+" ***\n");
// SET FOCUS TO FIRST CONTROL
//dialog.editBox.focus();
}
function onOK()
{
// Set attribute example:
// imageElement.setAttribute("src",dialog.srcInput.value);
return true; // do close the window
}

View File

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!-- May not need this here -->
<!-- <?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?> -->
<!DOCTYPE window SYSTEM "chrome://editor/locale/EdAdvancedEdit.dtd">
<xul:window class="dialog" title="&windowTitle.label;"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/TR/REC-html40"
onload = "Startup()"
align="vertical">
<!-- Methods common to all editor dialogs -->
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js">
</script>
<script language="JavaScript" src="chrome://editor/content/EdAdvancedEdit.js">
</script>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<xul:broadcaster id="args" value=""/>
<!-- from global dialogOverlay -->
<xul:box id="okCancelButtons"/>
</xul:window>

View File

@ -44,3 +44,5 @@ EdInsSrc.js
EdMessage.xul
EdMessage.js
EdDialogOverlay.xul
EdAdvancedEdit.xul
EdAdvancedEdit.js

View File

@ -49,6 +49,8 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/EdMessage.xul \
$(srcdir)/EdMessage.js \
$(srcdir)/EdDialogOverlay.xul \
$(srcdir)/EdAdvancedEdit.xul \
$(srcdir)/EdAdvancedEdit.js \
$(NULL)
install::

View File

@ -42,6 +42,10 @@ install::
$(MAKE_INSTALL) EdMessage.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdMessage.js $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdDialogOverlay.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdAdvancedEdit.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdAdvancedEdit.js $(DIST)\bin\chrome\editor\content\default
clobber::
rm -f $(DIST)\bin\chrome\editor\content\default\EdDialogCommon.js
@ -66,3 +70,5 @@ clobber::
rm -f $(DIST)\bin\chrome\editor\content\default\EdMessage.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdMessage.js
rm -f $(DIST)\bin\chrome\editor\content\default\EdDialogOverlay.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdAdvancedEdit.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdAdvancedEdit.js

View File

@ -0,0 +1,23 @@
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
-->
<!ENTITY windowTitle.label "Advanced Property Editor">

View File

@ -32,3 +32,5 @@ EditorSpellCheck.dtd
EditorTableProperties.dtd
EdNamedAnchorProperties.dtd
EdDialogOverlay.dtd
EdAdvancedEdit.dtd

View File

@ -37,6 +37,7 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/EditorTableProperties.dtd \
$(srcdir)/EdNamedAnchorProperties.dtd \
$(srcdir)/EdDialogOverlay.dtd \
$(srcdir)/EdAdvancedEdit.dtd \
$(NULL)
install::

View File

@ -30,6 +30,7 @@ install::
$(MAKE_INSTALL) EditorTableProperties.dtd $(DIST)\bin\chrome\editor\locale\en-US
$(MAKE_INSTALL) EdNamedAnchorProperties.dtd $(DIST)\bin\chrome\editor\locale\en-US
$(MAKE_INSTALL) EdDialogOverlay.dtd $(DIST)\bin\chrome\editor\locale\en-US
$(MAKE_INSTALL) EdAdvancedEdit.dtd $(DIST)\bin\chrome\editor\locale\en-US
clobber::
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EditorHLineProperties.dtd
@ -42,3 +43,6 @@ clobber::
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EditorTableProperties.dtd
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EdNamedAnchorProperties.dtd
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EdDialogOverlay.dtd
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EdAdvancedEdit.dtd