зеркало из https://github.com/mozilla/pjs.git
Removed string bundle code from nsEditor into EditorShell and added access for JavaScript. Moved most of Save document code into EditorShell and added filetype filters to save dialog. Placed Advanced Edit functionality in an overly file. Removed redundant entity strings, that are now in overlays, from DTD files.
This commit is contained in:
Родитель
73b718d4d5
Коммит
0da377feae
|
@ -106,10 +106,6 @@ static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
|
|||
// transaction manager
|
||||
static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
|
||||
#ifdef XP_PC
|
||||
#define TRANSACTION_MANAGER_DLL "txmgr.dll"
|
||||
#else
|
||||
|
@ -123,8 +119,6 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|||
#define NS_ERROR_EDITOR_NO_SELECTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,1)
|
||||
#define NS_ERROR_EDITOR_NO_TEXTNODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,2)
|
||||
|
||||
#define EDITOR_BUNDLE_URL "chrome://editor/content/editor.properties"
|
||||
|
||||
const char* nsEditor::kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
|
||||
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
|
||||
|
||||
|
@ -332,79 +326,6 @@ nsEditor::GetSelection(nsIDOMSelection **aSelection)
|
|||
return result;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
|
||||
NS_IMETHODIMP nsEditor::SaveDocument(PRBool saveAs, PRBool saveCopy)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
rv = GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
// this should really call out to the appcore for the display of the put file
|
||||
// dialog.
|
||||
|
||||
// find out if the doc already has a fileSpec associated with it.
|
||||
nsFileSpec docFileSpec;
|
||||
PRBool mustShowFileDialog = saveAs || (diskDoc->GetFileSpec(docFileSpec) == NS_ERROR_NOT_INITIALIZED);
|
||||
PRBool replacing = !saveAs;
|
||||
|
||||
if (mustShowFileDialog)
|
||||
{
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
rv = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_SUCCEEDED(rv) && fileWidget)
|
||||
{
|
||||
nsAutoString promptString("Save this document as:"); // XXX i18n, l10n
|
||||
nsFileDlgResults dialogResult;
|
||||
dialogResult = fileWidget->PutFile(nsnull, promptString, docFileSpec);
|
||||
if (dialogResult == nsFileDlgResults_Cancel)
|
||||
return NS_OK;
|
||||
|
||||
replacing = (dialogResult == nsFileDlgResults_Replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(0, "Failed to get file widget");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString useDocCharset("");
|
||||
rv = diskDoc->SaveFile(&docFileSpec, replacing, saveCopy, nsIDiskDocument::eSaveFileHTML,useDocCharset);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
// show some error dialog?
|
||||
NS_WARNING("Saving file failed");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditor::Save()
|
||||
{
|
||||
nsresult rv = SaveDocument(PR_FALSE, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = DoAfterDocumentSave();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditor::SaveAs(PRBool aSavingCopy)
|
||||
{
|
||||
return SaveDocument(PR_TRUE, aSavingCopy);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Do(nsITransaction *aTxn)
|
||||
{
|
||||
|
@ -749,6 +670,35 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType)
|
||||
{
|
||||
if (!aFileSpec)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
nsresult res = GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsAutoString useDocCharset("");
|
||||
|
||||
typedef enum {eSaveFileText = 0, eSaveFileHTML = 1 } ESaveFileType;
|
||||
|
||||
res = diskDoc->SaveFile(aFileSpec, aReplaceExisting, aSaveCopy,
|
||||
aSaveFileType == eSaveFileText ? nsIDiskDocument::eSaveFileText : nsIDiskDocument::eSaveFileHTML,
|
||||
useDocCharset);
|
||||
if (NS_SUCCEEDED(res))
|
||||
DoAfterDocumentSave();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3560,7 +3510,7 @@ nsEditor::SplitNodeDeep(nsIDOMNode *aNode,
|
|||
nodeAsText->GetLength(&textLen);
|
||||
PRBool bDoSplit = PR_FALSE;
|
||||
|
||||
if (!nodeAsText || (offset && (offset != textLen)))
|
||||
if (!nodeAsText || (offset && (offset != (PRInt32)textLen)))
|
||||
{
|
||||
bDoSplit = PR_TRUE;
|
||||
res = SplitNode(nodeToSplit, offset, getter_AddRefs(tempNode));
|
||||
|
@ -3642,25 +3592,6 @@ nsEditor::JoinNodeDeep(nsIDOMNode *aLeftNode,
|
|||
return res;
|
||||
}
|
||||
|
||||
// Get a string from the localized string resources
|
||||
nsresult nsEditor::GetString(const nsString& name, nsString& value)
|
||||
{
|
||||
nsresult result = NS_ERROR_NOT_INITIALIZED;
|
||||
value = "";
|
||||
if (mStringBundle && (name != ""))
|
||||
{
|
||||
#if 1
|
||||
const PRUnichar *ptrtmp = name.GetUnicode();
|
||||
PRUnichar *ptrv = nsnull;
|
||||
result = mStringBundle->GetStringFromName(ptrtmp, &ptrv);
|
||||
value = ptrv;
|
||||
#else
|
||||
result = mStringBundle->GetStringFromName(name, value);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult nsEditor::BeginUpdateViewBatch()
|
||||
{
|
||||
NS_PRECONDITION(mUpdateCount>=0, "bad state");
|
||||
|
@ -3796,7 +3727,6 @@ nsEditor::DoAfterDocumentSave()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
|
||||
const nsString& aAttribute,
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIPrivateTextRange.h"
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsITransactionManager.h"
|
||||
#include "TransactionFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -61,13 +59,11 @@ class JoinElementTxn;
|
|||
class EditAggregateTxn;
|
||||
class nsVoidArray;
|
||||
class nsISupportsArray;
|
||||
class nsIPref;
|
||||
class nsIStringBundleService;
|
||||
class nsIStringBundle;
|
||||
class nsILocale;
|
||||
class IMETextTxn;
|
||||
class AddStyleSheetTxn;
|
||||
class RemoveStyleSheetTxn;
|
||||
class nsFileSpec;
|
||||
|
||||
//This is the monitor for the editor.
|
||||
PRMonitor *GetEditorMonitor();
|
||||
|
@ -125,11 +121,10 @@ public:
|
|||
NS_IMETHOD EndTransaction();
|
||||
|
||||
// file handling
|
||||
NS_IMETHOD Save();
|
||||
NS_IMETHOD SaveAs(PRBool aSavingCopy);
|
||||
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);
|
||||
|
||||
// these are pure virtual in this base class
|
||||
NS_IMETHOD Cut() = 0;
|
||||
|
@ -361,10 +356,6 @@ protected:
|
|||
// document after a change via the DOM - gpk 2/13/99
|
||||
void HACKForceRedraw(void);
|
||||
|
||||
// file handling utils
|
||||
|
||||
NS_IMETHOD SaveDocument(PRBool saveAs, PRBool saveCopy);
|
||||
|
||||
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
|
||||
|
||||
public:
|
||||
|
@ -575,8 +566,6 @@ public:
|
|||
nsresult SplitNodeDeep(nsIDOMNode *aNode, nsIDOMNode *aSplitPointParent, PRInt32 aSplitPointOffset, PRInt32 *outOffset);
|
||||
nsresult JoinNodeDeep(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMSelection *aSelection);
|
||||
|
||||
nsresult GetString(const nsString& name, nsString& value);
|
||||
|
||||
nsresult BeginUpdateViewBatch(void);
|
||||
nsresult EndUpdateViewBatch(void);
|
||||
|
||||
|
@ -601,7 +590,6 @@ protected:
|
|||
|
||||
nsVoidArray* mActionListeners;
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
|
||||
PRInt8 mDocDirtyState; // -1 = not initialized
|
||||
|
||||
|
|
|
@ -101,7 +101,8 @@ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
|||
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
|
||||
static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kCSpellCheckerCID, NS_SPELLCHECKER_CID);
|
||||
static NS_DEFINE_IID(kFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
/* Define Interface IDs */
|
||||
#ifdef NECKO
|
||||
|
@ -112,6 +113,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|||
|
||||
#define APP_DEBUG 0
|
||||
|
||||
#define EDITOR_BUNDLE_URL "chrome://editor/content/editor.properties"
|
||||
|
||||
nsresult
|
||||
NS_NewEditorShell(nsIEditorShell** aEditorShell)
|
||||
|
@ -143,6 +145,7 @@ nsEditorShell::nsEditorShell()
|
|||
, mWrapColumn(0)
|
||||
, mSuggestedWordIndex(0)
|
||||
, mDictionaryIndex(0)
|
||||
, mStringBundle(0)
|
||||
{
|
||||
#ifdef APP_DEBUG
|
||||
printf("Created nsEditorShell\n");
|
||||
|
@ -249,6 +252,22 @@ nsEditorShell::Init()
|
|||
mEditorTypeString = editorType;
|
||||
mEditorTypeString.ToLowerCase();
|
||||
|
||||
nsIStringBundleService* service;
|
||||
|
||||
// Get pointer to our string bundle
|
||||
nsresult res = nsServiceManager::GetService(kCStringBundleServiceCID,
|
||||
nsIStringBundleService::GetIID(),
|
||||
(nsISupports**)&service);
|
||||
if (NS_SUCCEEDED(res) && service)
|
||||
{
|
||||
nsILocale* locale = nsnull;
|
||||
res = service->CreateBundle(EDITOR_BUNDLE_URL, locale,
|
||||
getter_AddRefs(mStringBundle));
|
||||
// We don't need to keep service around once we created the bundle
|
||||
nsServiceManager::ReleaseService(kCStringBundleServiceCID, service);
|
||||
} else {
|
||||
printf("ERROR: Failed to get StringBundle Service instance.\n");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -937,8 +956,6 @@ nsEditorShell::Open()
|
|||
// and return a "file:///" string
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
|
||||
result = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_FAILED(result) || !fileWidget)
|
||||
return result;
|
||||
|
@ -979,55 +996,128 @@ static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
|||
default:
|
||||
result = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Save()
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::SaveDocument(PRBool saveAs, PRBool saveCopy)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
nsresult res = NS_NOINTERFACE;
|
||||
|
||||
switch (mEditorType)
|
||||
{
|
||||
case ePlainTextEditorType:
|
||||
case eHTMLTextEditorType:
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->Save();
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
res = editor->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
// find out if the doc already has a fileSpec associated with it.
|
||||
nsFileSpec docFileSpec;
|
||||
PRBool mustShowFileDialog = saveAs || (diskDoc->GetFileSpec(docFileSpec) == NS_ERROR_NOT_INITIALIZED);
|
||||
PRBool replacing = !saveAs;
|
||||
|
||||
if (mustShowFileDialog)
|
||||
{
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
res = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_SUCCEEDED(res) && fileWidget)
|
||||
{
|
||||
nsAutoString promptString;
|
||||
GetString("SaveDocumentAs", promptString);
|
||||
|
||||
nsString* titles = nsnull;
|
||||
nsString* filters = nsnull;
|
||||
nsString* nextTitle;
|
||||
nsString* nextFilter;
|
||||
nsString HTMLFiles;
|
||||
nsString TextFiles;
|
||||
|
||||
titles = new nsString[2];
|
||||
if (!titles)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto SkipFilters;
|
||||
}
|
||||
filters = new nsString[2];
|
||||
if (!filters)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto SkipFilters;
|
||||
}
|
||||
nextTitle = titles;
|
||||
nextFilter = filters;
|
||||
// The names of the file types are localizable
|
||||
GetString("HTMLFiles", HTMLFiles);
|
||||
GetString("TextFiles", TextFiles);
|
||||
if (HTMLFiles.Length() == 0 || TextFiles.Length() == 0)
|
||||
goto SkipFilters;
|
||||
|
||||
*nextTitle++ = "HTML Files";
|
||||
*nextFilter++ = "*.htm; *.html; *.shtml";
|
||||
*nextTitle++ = "Text Files";
|
||||
*nextFilter++ = "*.txt";
|
||||
fileWidget->SetFilterList(2, titles, filters);
|
||||
SkipFilters:
|
||||
nsFileDlgResults dialogResult;
|
||||
dialogResult = fileWidget->PutFile(nsnull, promptString, docFileSpec);
|
||||
delete [] titles;
|
||||
delete [] filters;
|
||||
|
||||
if (dialogResult == nsFileDlgResults_Cancel)
|
||||
return NS_OK;
|
||||
|
||||
replacing = (dialogResult == nsFileDlgResults_Replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(0, "Failed to get file widget");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
// show some error dialog?
|
||||
NS_WARNING("Saving file failed");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
err = NS_ERROR_NOT_IMPLEMENTED;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return err;
|
||||
// These are for convenience so the params to SaveDocument aren't as opaque in the UI
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Save()
|
||||
{
|
||||
// Params: SaveAs, SavingCopy
|
||||
return SaveDocument(PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::SaveAs()
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
switch (mEditorType)
|
||||
{
|
||||
case ePlainTextEditorType:
|
||||
case eHTMLTextEditorType:
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->SaveAs(PR_FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
err = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return err;
|
||||
// Params: SaveAs, SavingCopy
|
||||
return SaveDocument(PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1094,16 +1184,30 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType
|
|||
|
||||
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
// TODO: WHERE TO WE PUT GLOBAL STRINGS TO BE LOCALIZED?
|
||||
nsString title(htmlFilter ? "Open HTML file" : "Select Image File");
|
||||
nsAutoString HTMLTitle;
|
||||
nsresult res = GetString("OpenHTMLFile", HTMLTitle);
|
||||
|
||||
// An empty string should just result in "Open" for the dialog
|
||||
nsAutoString title;
|
||||
if (NS_SUCCEEDED(res) && htmlFilter)
|
||||
{
|
||||
title = HTMLTitle;
|
||||
} else {
|
||||
nsAutoString ImageTitle;
|
||||
res = GetString("SelectImageFile", ImageTitle);
|
||||
|
||||
if (NS_SUCCEEDED(res) && imgFilter)
|
||||
title = ImageTitle;
|
||||
}
|
||||
|
||||
nsFileSpec fileSpec;
|
||||
// TODO: GET THE DEFAULT DIRECTORY FOR DIFFERENT TYPES FROM PREFERENCES
|
||||
nsFileSpec aDisplayDirectory;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kFileWidgetCID,
|
||||
nsnull,
|
||||
nsIFileWidget::GetIID(),
|
||||
(void**)&fileWidget);
|
||||
res = nsComponentManager::CreateInstance(kCFileWidgetCID,
|
||||
nsnull,
|
||||
nsIFileWidget::GetIID(),
|
||||
(void**)&fileWidget);
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
|
@ -1520,6 +1624,47 @@ nsEditorShell::FindNext()
|
|||
return DoFind(PR_TRUE);
|
||||
}
|
||||
|
||||
/* Get localized strings for UI from the Editor's string bundle */
|
||||
// Use this version from JavaScript:
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetString(const PRUnichar *name, PRUnichar **_retval)
|
||||
{
|
||||
if (!name || !_retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Never fail, just return an empty string
|
||||
nsString empty("");
|
||||
|
||||
if (mStringBundle)
|
||||
{
|
||||
if (NS_FAILED(mStringBundle->GetStringFromName(name, _retval)))
|
||||
*_retval = empty.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
} else {
|
||||
*_retval = empty.ToNewUnicode();
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
// Use this version within the shell:
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetString(const nsString& name, nsString& value)
|
||||
{
|
||||
value = "";
|
||||
if (mStringBundle && (name != ""))
|
||||
{
|
||||
const PRUnichar *ptrtmp = name.GetUnicode();
|
||||
PRUnichar *ptrv = nsnull;
|
||||
nsresult res = mStringBundle->GetStringFromName(ptrtmp, &ptrv);
|
||||
// Never fail, just return an empty string
|
||||
if (NS_SUCCEEDED(res))
|
||||
value = ptrv;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetDocumentCharacterSet(PRUnichar** characterSet)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsISpellChecker.h"
|
||||
#include "nsInterfaceState.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
class nsIBrowserWindow;
|
||||
class nsIWebShell;
|
||||
|
@ -53,6 +54,8 @@ class nsIWebShellWindow;
|
|||
class nsIPresShell;
|
||||
class nsIOutputStream;
|
||||
class nsISupportsArray;
|
||||
class nsIStringBundleService;
|
||||
class nsIStringBundle;
|
||||
|
||||
|
||||
#define NS_EDITORSHELL_CID \
|
||||
|
@ -157,7 +160,9 @@ class nsEditorShell : public nsIEditorShell,
|
|||
NS_IMETHOD CreateWindowWithURL(const char* urlStr);
|
||||
NS_IMETHOD PrepareDocumentForEditing(nsIURI *aUrl);
|
||||
NS_IMETHOD DoFind(PRBool aFindNext);
|
||||
|
||||
// Get a string from the string bundle file
|
||||
NS_IMETHOD GetString(const nsString& name, nsString& value);
|
||||
|
||||
// this returns an AddReffed nsIScriptContext. You must relase it.
|
||||
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
||||
|
||||
|
@ -183,7 +188,9 @@ class nsEditorShell : public nsIEditorShell,
|
|||
|
||||
// this is a holding pen for doc state listeners. They will be registered with
|
||||
// the editor when that gets created.
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
// Pointer to localized strings used for UI
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
};
|
||||
|
||||
#endif // nsEditorShell_h___
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIImage.h"
|
||||
|
@ -81,6 +80,7 @@
|
|||
// Misc
|
||||
#include "TextEditorTest.h"
|
||||
#include "nsEditorUtils.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "prprf.h"
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ public:
|
|||
NS_IMETHOD SetMaxTextLength(PRInt32 aMaxTextLength);
|
||||
NS_IMETHOD GetMaxTextLength(PRInt32& aMaxTextLength);
|
||||
|
||||
|
||||
NS_IMETHOD SetInlineProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,188 +0,0 @@
|
|||
/* -*- 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://wwwt.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 nsJSEditorLog_h__
|
||||
#define nsJSEditorLog_h__
|
||||
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
/** implementation of a transaction listener object.
|
||||
*
|
||||
*/
|
||||
class nsJSEditorLog : public nsIHTMLEditor
|
||||
{
|
||||
private:
|
||||
|
||||
nsCOMPtr<nsIFileSpec> mFileSpec;
|
||||
nsIEditor *mEditor;
|
||||
PRInt32 mLocked;
|
||||
PRInt32 mDepth;
|
||||
|
||||
public:
|
||||
|
||||
/** The default constructor.
|
||||
*/
|
||||
nsJSEditorLog(nsIEditor *aEditor, nsIFileSpec *aLogFile);
|
||||
|
||||
/** The default destructor.
|
||||
*/
|
||||
virtual ~nsJSEditorLog();
|
||||
|
||||
/* Macro for AddRef(), Release(), and QueryInterface() */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/* nsIHTMLEditor method implementations. */
|
||||
NS_IMETHOD Init(nsIDOMDocument *aDoc,
|
||||
nsIPresShell *aPresShell);
|
||||
NS_IMETHOD SetTextProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue);
|
||||
NS_IMETHOD GetTextProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue,
|
||||
PRBool &aFirst, PRBool &aAll, PRBool &aAny);
|
||||
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat);
|
||||
NS_IMETHOD SetParagraphFormat(const nsString& aParagraphFormat);
|
||||
NS_IMETHOD RemoveTextProperty(nsIAtom *aProperty, const nsString *aAttribute);
|
||||
NS_IMETHOD DeleteSelection(nsIEditor::ECollapsedSelectionAction aAction);
|
||||
NS_IMETHOD InsertText(const nsString& aStringToInsert);
|
||||
NS_IMETHOD InsertBreak();
|
||||
NS_IMETHOD EnableUndo(PRBool aEnable);
|
||||
NS_IMETHOD Undo(PRUint32 aCount);
|
||||
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
|
||||
NS_IMETHOD Redo(PRUint32 aCount);
|
||||
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
|
||||
NS_IMETHOD BeginTransaction();
|
||||
NS_IMETHOD EndTransaction();
|
||||
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
|
||||
NS_IMETHOD SelectAll();
|
||||
NS_IMETHOD BeginningOfDocument();
|
||||
NS_IMETHOD EndOfDocument();
|
||||
NS_IMETHOD ScrollUp(nsIAtom *aIncrement);
|
||||
NS_IMETHOD ScrollDown(nsIAtom *aIncrement);
|
||||
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
|
||||
|
||||
NS_IMETHOD Save();
|
||||
NS_IMETHOD SaveAs(PRBool aSavingCopy);
|
||||
|
||||
NS_IMETHOD Cut();
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD Paste();
|
||||
NS_IMETHOD PasteAsQuotation();
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation);
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText);
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCitation);
|
||||
|
||||
|
||||
NS_IMETHOD InsertHTML(const nsString &aInputString);
|
||||
|
||||
NS_IMETHOD OutputToString(nsString& aOutputString,
|
||||
const nsString& aFormatType,
|
||||
PRUint32 aFlags);
|
||||
NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
|
||||
const nsString& aFormatType,
|
||||
const nsString* aCharsetOverride,
|
||||
PRUint32 aFlags);
|
||||
|
||||
NS_IMETHOD ApplyStyleSheet(const nsString& aURL);
|
||||
|
||||
NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn);
|
||||
NS_IMETHOD SetBackgroundColor(const nsString& aColor);
|
||||
NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue);
|
||||
NS_IMETHOD GetParagraphStyle(nsStringArray *aTagList);
|
||||
NS_IMETHOD AddBlockParent(nsString& aParentTag);
|
||||
NS_IMETHOD ReplaceBlockParent(nsString& aParentTag);
|
||||
NS_IMETHOD RemoveParagraphStyle();
|
||||
NS_IMETHOD RemoveParent(const nsString &aParentTag);
|
||||
NS_IMETHOD InsertList(const nsString& aListType);
|
||||
NS_IMETHOD InsertHeader(const nsString& aHeaderType);
|
||||
NS_IMETHOD Indent(const nsString& aIndent);
|
||||
NS_IMETHOD Align(const nsString& aAlign);
|
||||
NS_IMETHOD GetElementOrParentByTagName(const nsString& aTagName, nsIDOMNode *aNode, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection);
|
||||
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
||||
NS_IMETHOD SelectElement(nsIDOMElement* aElement);
|
||||
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
|
||||
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray** aNodeList);
|
||||
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aColIndex, PRInt32 &aRowIndex);
|
||||
NS_IMETHOD GetTableSize(nsIDOMElement *aTable, PRInt32 &aRowCount, PRInt32 &aColCount);
|
||||
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement* &aCell);
|
||||
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement* &aCell,
|
||||
PRInt32& aStartRowIndex, PRInt32& aStartColIndex, PRInt32& aRowSpan, PRInt32& aColSpan, PRBool& aIsSelected);
|
||||
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
|
||||
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
|
||||
NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter);
|
||||
NS_IMETHOD DeleteTable();
|
||||
NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
|
||||
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
|
||||
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
||||
NS_IMETHOD JoinTableCells();
|
||||
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
||||
NS_IMETHOD BeginComposition(void);
|
||||
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
||||
NS_IMETHOD EndComposition(void);
|
||||
NS_IMETHOD StartLogging(nsIFileSpec *aLogFile);
|
||||
NS_IMETHOD StopLogging();
|
||||
|
||||
/* nsJSEditorLog public methods. */
|
||||
nsresult Write(const char *aBuffer);
|
||||
nsresult WriteInt(const char *aFormat, PRInt32 aInt);
|
||||
nsresult Flush();
|
||||
nsresult PrintUnicode(const nsString &aString);
|
||||
nsresult PrintSelection();
|
||||
nsresult PrintNode(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
||||
nsresult PrintElementNode(nsIDOMNode *aNode, PRInt32 aDepth);
|
||||
nsresult PrintTextNode(nsIDOMNode *aNode, PRInt32 aDepth);
|
||||
nsresult PrintAttributeNode(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
||||
nsresult PrintNodeChildren(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
||||
nsresult GetNodeTreeOffsets(nsIDOMNode *aNode, PRInt32 **aResult, PRInt32 *aLength);
|
||||
nsresult Lock();
|
||||
nsresult Unlock();
|
||||
};
|
||||
|
||||
class nsAutoJSEditorLogLock
|
||||
{
|
||||
nsJSEditorLog *mLog;
|
||||
|
||||
public:
|
||||
|
||||
nsAutoJSEditorLogLock(nsJSEditorLog *aLog)
|
||||
{
|
||||
mLog = aLog;
|
||||
|
||||
if (mLog)
|
||||
mLog->Lock();
|
||||
}
|
||||
|
||||
~nsAutoJSEditorLogLock()
|
||||
{
|
||||
if (mLog)
|
||||
mLog->Unlock();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // nsJSEditorLog_h__
|
|
@ -101,7 +101,8 @@ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
|||
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
|
||||
static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kCSpellCheckerCID, NS_SPELLCHECKER_CID);
|
||||
static NS_DEFINE_IID(kFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
/* Define Interface IDs */
|
||||
#ifdef NECKO
|
||||
|
@ -112,6 +113,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|||
|
||||
#define APP_DEBUG 0
|
||||
|
||||
#define EDITOR_BUNDLE_URL "chrome://editor/content/editor.properties"
|
||||
|
||||
nsresult
|
||||
NS_NewEditorShell(nsIEditorShell** aEditorShell)
|
||||
|
@ -143,6 +145,7 @@ nsEditorShell::nsEditorShell()
|
|||
, mWrapColumn(0)
|
||||
, mSuggestedWordIndex(0)
|
||||
, mDictionaryIndex(0)
|
||||
, mStringBundle(0)
|
||||
{
|
||||
#ifdef APP_DEBUG
|
||||
printf("Created nsEditorShell\n");
|
||||
|
@ -249,6 +252,22 @@ nsEditorShell::Init()
|
|||
mEditorTypeString = editorType;
|
||||
mEditorTypeString.ToLowerCase();
|
||||
|
||||
nsIStringBundleService* service;
|
||||
|
||||
// Get pointer to our string bundle
|
||||
nsresult res = nsServiceManager::GetService(kCStringBundleServiceCID,
|
||||
nsIStringBundleService::GetIID(),
|
||||
(nsISupports**)&service);
|
||||
if (NS_SUCCEEDED(res) && service)
|
||||
{
|
||||
nsILocale* locale = nsnull;
|
||||
res = service->CreateBundle(EDITOR_BUNDLE_URL, locale,
|
||||
getter_AddRefs(mStringBundle));
|
||||
// We don't need to keep service around once we created the bundle
|
||||
nsServiceManager::ReleaseService(kCStringBundleServiceCID, service);
|
||||
} else {
|
||||
printf("ERROR: Failed to get StringBundle Service instance.\n");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -937,8 +956,6 @@ nsEditorShell::Open()
|
|||
// and return a "file:///" string
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
|
||||
result = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_FAILED(result) || !fileWidget)
|
||||
return result;
|
||||
|
@ -979,55 +996,128 @@ static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
|||
default:
|
||||
result = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Save()
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::SaveDocument(PRBool saveAs, PRBool saveCopy)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
nsresult res = NS_NOINTERFACE;
|
||||
|
||||
switch (mEditorType)
|
||||
{
|
||||
case ePlainTextEditorType:
|
||||
case eHTMLTextEditorType:
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->Save();
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
res = editor->GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
// find out if the doc already has a fileSpec associated with it.
|
||||
nsFileSpec docFileSpec;
|
||||
PRBool mustShowFileDialog = saveAs || (diskDoc->GetFileSpec(docFileSpec) == NS_ERROR_NOT_INITIALIZED);
|
||||
PRBool replacing = !saveAs;
|
||||
|
||||
if (mustShowFileDialog)
|
||||
{
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
res = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_SUCCEEDED(res) && fileWidget)
|
||||
{
|
||||
nsAutoString promptString;
|
||||
GetString("SaveDocumentAs", promptString);
|
||||
|
||||
nsString* titles = nsnull;
|
||||
nsString* filters = nsnull;
|
||||
nsString* nextTitle;
|
||||
nsString* nextFilter;
|
||||
nsString HTMLFiles;
|
||||
nsString TextFiles;
|
||||
|
||||
titles = new nsString[2];
|
||||
if (!titles)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto SkipFilters;
|
||||
}
|
||||
filters = new nsString[2];
|
||||
if (!filters)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto SkipFilters;
|
||||
}
|
||||
nextTitle = titles;
|
||||
nextFilter = filters;
|
||||
// The names of the file types are localizable
|
||||
GetString("HTMLFiles", HTMLFiles);
|
||||
GetString("TextFiles", TextFiles);
|
||||
if (HTMLFiles.Length() == 0 || TextFiles.Length() == 0)
|
||||
goto SkipFilters;
|
||||
|
||||
*nextTitle++ = "HTML Files";
|
||||
*nextFilter++ = "*.htm; *.html; *.shtml";
|
||||
*nextTitle++ = "Text Files";
|
||||
*nextFilter++ = "*.txt";
|
||||
fileWidget->SetFilterList(2, titles, filters);
|
||||
SkipFilters:
|
||||
nsFileDlgResults dialogResult;
|
||||
dialogResult = fileWidget->PutFile(nsnull, promptString, docFileSpec);
|
||||
delete [] titles;
|
||||
delete [] filters;
|
||||
|
||||
if (dialogResult == nsFileDlgResults_Cancel)
|
||||
return NS_OK;
|
||||
|
||||
replacing = (dialogResult == nsFileDlgResults_Replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(0, "Failed to get file widget");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
// show some error dialog?
|
||||
NS_WARNING("Saving file failed");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
err = NS_ERROR_NOT_IMPLEMENTED;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return err;
|
||||
// These are for convenience so the params to SaveDocument aren't as opaque in the UI
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Save()
|
||||
{
|
||||
// Params: SaveAs, SavingCopy
|
||||
return SaveDocument(PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::SaveAs()
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
switch (mEditorType)
|
||||
{
|
||||
case ePlainTextEditorType:
|
||||
case eHTMLTextEditorType:
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->SaveAs(PR_FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
err = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
return err;
|
||||
// Params: SaveAs, SavingCopy
|
||||
return SaveDocument(PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1094,16 +1184,30 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType
|
|||
|
||||
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
// TODO: WHERE TO WE PUT GLOBAL STRINGS TO BE LOCALIZED?
|
||||
nsString title(htmlFilter ? "Open HTML file" : "Select Image File");
|
||||
nsAutoString HTMLTitle;
|
||||
nsresult res = GetString("OpenHTMLFile", HTMLTitle);
|
||||
|
||||
// An empty string should just result in "Open" for the dialog
|
||||
nsAutoString title;
|
||||
if (NS_SUCCEEDED(res) && htmlFilter)
|
||||
{
|
||||
title = HTMLTitle;
|
||||
} else {
|
||||
nsAutoString ImageTitle;
|
||||
res = GetString("SelectImageFile", ImageTitle);
|
||||
|
||||
if (NS_SUCCEEDED(res) && imgFilter)
|
||||
title = ImageTitle;
|
||||
}
|
||||
|
||||
nsFileSpec fileSpec;
|
||||
// TODO: GET THE DEFAULT DIRECTORY FOR DIFFERENT TYPES FROM PREFERENCES
|
||||
nsFileSpec aDisplayDirectory;
|
||||
|
||||
nsresult res = nsComponentManager::CreateInstance(kFileWidgetCID,
|
||||
nsnull,
|
||||
nsIFileWidget::GetIID(),
|
||||
(void**)&fileWidget);
|
||||
res = nsComponentManager::CreateInstance(kCFileWidgetCID,
|
||||
nsnull,
|
||||
nsIFileWidget::GetIID(),
|
||||
(void**)&fileWidget);
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
|
@ -1520,6 +1624,47 @@ nsEditorShell::FindNext()
|
|||
return DoFind(PR_TRUE);
|
||||
}
|
||||
|
||||
/* Get localized strings for UI from the Editor's string bundle */
|
||||
// Use this version from JavaScript:
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetString(const PRUnichar *name, PRUnichar **_retval)
|
||||
{
|
||||
if (!name || !_retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Never fail, just return an empty string
|
||||
nsString empty("");
|
||||
|
||||
if (mStringBundle)
|
||||
{
|
||||
if (NS_FAILED(mStringBundle->GetStringFromName(name, _retval)))
|
||||
*_retval = empty.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
} else {
|
||||
*_retval = empty.ToNewUnicode();
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
// Use this version within the shell:
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetString(const nsString& name, nsString& value)
|
||||
{
|
||||
value = "";
|
||||
if (mStringBundle && (name != ""))
|
||||
{
|
||||
const PRUnichar *ptrtmp = name.GetUnicode();
|
||||
PRUnichar *ptrv = nsnull;
|
||||
nsresult res = mStringBundle->GetStringFromName(ptrtmp, &ptrv);
|
||||
// Never fail, just return an empty string
|
||||
if (NS_SUCCEEDED(res))
|
||||
value = ptrv;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::GetDocumentCharacterSet(PRUnichar** characterSet)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsISpellChecker.h"
|
||||
#include "nsInterfaceState.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
class nsIBrowserWindow;
|
||||
class nsIWebShell;
|
||||
|
@ -53,6 +54,8 @@ class nsIWebShellWindow;
|
|||
class nsIPresShell;
|
||||
class nsIOutputStream;
|
||||
class nsISupportsArray;
|
||||
class nsIStringBundleService;
|
||||
class nsIStringBundle;
|
||||
|
||||
|
||||
#define NS_EDITORSHELL_CID \
|
||||
|
@ -157,7 +160,9 @@ class nsEditorShell : public nsIEditorShell,
|
|||
NS_IMETHOD CreateWindowWithURL(const char* urlStr);
|
||||
NS_IMETHOD PrepareDocumentForEditing(nsIURI *aUrl);
|
||||
NS_IMETHOD DoFind(PRBool aFindNext);
|
||||
|
||||
// Get a string from the string bundle file
|
||||
NS_IMETHOD GetString(const nsString& name, nsString& value);
|
||||
|
||||
// this returns an AddReffed nsIScriptContext. You must relase it.
|
||||
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
||||
|
||||
|
@ -183,7 +188,9 @@ class nsEditorShell : public nsIEditorShell,
|
|||
|
||||
// this is a holding pen for doc state listeners. They will be registered with
|
||||
// the editor when that gets created.
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
// Pointer to localized strings used for UI
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
};
|
||||
|
||||
#endif // nsEditorShell_h___
|
||||
|
|
|
@ -77,8 +77,23 @@ interface nsIEditorShell : nsISupports
|
|||
/* Commands */
|
||||
void NewWindow();
|
||||
void Open();
|
||||
|
||||
/**
|
||||
* @param saveAs false to try to save to existing file
|
||||
* If document is not already saved, it is treated as true
|
||||
* so filename is prompted.
|
||||
* @param saveCopy
|
||||
* true if we are saving off a copy of the document
|
||||
* without changing the disk file associated with the doc.
|
||||
* This would correspond to a 'Save Copy As' menu command
|
||||
* (currently not in our UI)
|
||||
*/
|
||||
void SaveDocument(in boolean saveAs, in boolean saveCopy);
|
||||
/** This is SaveDocument(false, false) */
|
||||
void Save();
|
||||
/** This is SaveDocument(true, false) */
|
||||
void SaveAs();
|
||||
|
||||
void CloseWindow();
|
||||
void Print();
|
||||
void Exit();
|
||||
|
@ -101,6 +116,10 @@ interface nsIEditorShell : nsISupports
|
|||
void Find();
|
||||
void FindNext();
|
||||
|
||||
/* General Utilities */
|
||||
/* Get string from the Editor's localized string bundle */
|
||||
wstring GetString(in wstring name);
|
||||
|
||||
/* Charset Menu */
|
||||
wstring GetDocumentCharacterSet();
|
||||
void SetDocumentCharacterSet(in wstring characterSet);
|
||||
|
|
|
@ -106,10 +106,6 @@ static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
|
|||
// transaction manager
|
||||
static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
|
||||
#ifdef XP_PC
|
||||
#define TRANSACTION_MANAGER_DLL "txmgr.dll"
|
||||
#else
|
||||
|
@ -123,8 +119,6 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
|||
#define NS_ERROR_EDITOR_NO_SELECTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,1)
|
||||
#define NS_ERROR_EDITOR_NO_TEXTNODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,2)
|
||||
|
||||
#define EDITOR_BUNDLE_URL "chrome://editor/content/editor.properties"
|
||||
|
||||
const char* nsEditor::kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
|
||||
const char* nsEditor::kMOZEditorBogusNodeValue="TRUE";
|
||||
|
||||
|
@ -332,79 +326,6 @@ nsEditor::GetSelection(nsIDOMSelection **aSelection)
|
|||
return result;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
|
||||
NS_IMETHODIMP nsEditor::SaveDocument(PRBool saveAs, PRBool saveCopy)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
rv = GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
// this should really call out to the appcore for the display of the put file
|
||||
// dialog.
|
||||
|
||||
// find out if the doc already has a fileSpec associated with it.
|
||||
nsFileSpec docFileSpec;
|
||||
PRBool mustShowFileDialog = saveAs || (diskDoc->GetFileSpec(docFileSpec) == NS_ERROR_NOT_INITIALIZED);
|
||||
PRBool replacing = !saveAs;
|
||||
|
||||
if (mustShowFileDialog)
|
||||
{
|
||||
nsCOMPtr<nsIFileWidget> fileWidget;
|
||||
rv = nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, nsIFileWidget::GetIID(), getter_AddRefs(fileWidget));
|
||||
if (NS_SUCCEEDED(rv) && fileWidget)
|
||||
{
|
||||
nsAutoString promptString("Save this document as:"); // XXX i18n, l10n
|
||||
nsFileDlgResults dialogResult;
|
||||
dialogResult = fileWidget->PutFile(nsnull, promptString, docFileSpec);
|
||||
if (dialogResult == nsFileDlgResults_Cancel)
|
||||
return NS_OK;
|
||||
|
||||
replacing = (dialogResult == nsFileDlgResults_Replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(0, "Failed to get file widget");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString useDocCharset("");
|
||||
rv = diskDoc->SaveFile(&docFileSpec, replacing, saveCopy, nsIDiskDocument::eSaveFileHTML,useDocCharset);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
// show some error dialog?
|
||||
NS_WARNING("Saving file failed");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditor::Save()
|
||||
{
|
||||
nsresult rv = SaveDocument(PR_FALSE, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = DoAfterDocumentSave();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEditor::SaveAs(PRBool aSavingCopy)
|
||||
{
|
||||
return SaveDocument(PR_TRUE, aSavingCopy);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::Do(nsITransaction *aTxn)
|
||||
{
|
||||
|
@ -749,6 +670,35 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::SaveFile(nsFileSpec *aFileSpec, PRBool aReplaceExisting, PRBool aSaveCopy, ESaveFileType aSaveFileType)
|
||||
{
|
||||
if (!aFileSpec)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// get the document
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
nsresult res = GetDocument(getter_AddRefs(doc));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(doc);
|
||||
if (!diskDoc)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
nsAutoString useDocCharset("");
|
||||
|
||||
typedef enum {eSaveFileText = 0, eSaveFileHTML = 1 } ESaveFileType;
|
||||
|
||||
res = diskDoc->SaveFile(aFileSpec, aReplaceExisting, aSaveCopy,
|
||||
aSaveFileType == eSaveFileText ? nsIDiskDocument::eSaveFileText : nsIDiskDocument::eSaveFileHTML,
|
||||
useDocCharset);
|
||||
if (NS_SUCCEEDED(res))
|
||||
DoAfterDocumentSave();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3560,7 +3510,7 @@ nsEditor::SplitNodeDeep(nsIDOMNode *aNode,
|
|||
nodeAsText->GetLength(&textLen);
|
||||
PRBool bDoSplit = PR_FALSE;
|
||||
|
||||
if (!nodeAsText || (offset && (offset != textLen)))
|
||||
if (!nodeAsText || (offset && (offset != (PRInt32)textLen)))
|
||||
{
|
||||
bDoSplit = PR_TRUE;
|
||||
res = SplitNode(nodeToSplit, offset, getter_AddRefs(tempNode));
|
||||
|
@ -3642,25 +3592,6 @@ nsEditor::JoinNodeDeep(nsIDOMNode *aLeftNode,
|
|||
return res;
|
||||
}
|
||||
|
||||
// Get a string from the localized string resources
|
||||
nsresult nsEditor::GetString(const nsString& name, nsString& value)
|
||||
{
|
||||
nsresult result = NS_ERROR_NOT_INITIALIZED;
|
||||
value = "";
|
||||
if (mStringBundle && (name != ""))
|
||||
{
|
||||
#if 1
|
||||
const PRUnichar *ptrtmp = name.GetUnicode();
|
||||
PRUnichar *ptrv = nsnull;
|
||||
result = mStringBundle->GetStringFromName(ptrtmp, &ptrv);
|
||||
value = ptrv;
|
||||
#else
|
||||
result = mStringBundle->GetStringFromName(name, value);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult nsEditor::BeginUpdateViewBatch()
|
||||
{
|
||||
NS_PRECONDITION(mUpdateCount>=0, "bad state");
|
||||
|
@ -3796,7 +3727,6 @@ nsEditor::DoAfterDocumentSave()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
|
||||
const nsString& aAttribute,
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIPrivateTextRange.h"
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsITransactionManager.h"
|
||||
#include "TransactionFactory.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -61,13 +59,11 @@ class JoinElementTxn;
|
|||
class EditAggregateTxn;
|
||||
class nsVoidArray;
|
||||
class nsISupportsArray;
|
||||
class nsIPref;
|
||||
class nsIStringBundleService;
|
||||
class nsIStringBundle;
|
||||
class nsILocale;
|
||||
class IMETextTxn;
|
||||
class AddStyleSheetTxn;
|
||||
class RemoveStyleSheetTxn;
|
||||
class nsFileSpec;
|
||||
|
||||
//This is the monitor for the editor.
|
||||
PRMonitor *GetEditorMonitor();
|
||||
|
@ -125,11 +121,10 @@ public:
|
|||
NS_IMETHOD EndTransaction();
|
||||
|
||||
// file handling
|
||||
NS_IMETHOD Save();
|
||||
NS_IMETHOD SaveAs(PRBool aSavingCopy);
|
||||
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);
|
||||
|
||||
// these are pure virtual in this base class
|
||||
NS_IMETHOD Cut() = 0;
|
||||
|
@ -361,10 +356,6 @@ protected:
|
|||
// document after a change via the DOM - gpk 2/13/99
|
||||
void HACKForceRedraw(void);
|
||||
|
||||
// file handling utils
|
||||
|
||||
NS_IMETHOD SaveDocument(PRBool saveAs, PRBool saveCopy);
|
||||
|
||||
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
|
||||
|
||||
public:
|
||||
|
@ -575,8 +566,6 @@ public:
|
|||
nsresult SplitNodeDeep(nsIDOMNode *aNode, nsIDOMNode *aSplitPointParent, PRInt32 aSplitPointOffset, PRInt32 *outOffset);
|
||||
nsresult JoinNodeDeep(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMSelection *aSelection);
|
||||
|
||||
nsresult GetString(const nsString& name, nsString& value);
|
||||
|
||||
nsresult BeginUpdateViewBatch(void);
|
||||
nsresult EndUpdateViewBatch(void);
|
||||
|
||||
|
@ -601,7 +590,6 @@ protected:
|
|||
|
||||
nsVoidArray* mActionListeners;
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
|
||||
PRInt8 mDocDirtyState; // -1 = not initialized
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIImage.h"
|
||||
|
@ -81,6 +80,7 @@
|
|||
// Misc
|
||||
#include "TextEditorTest.h"
|
||||
#include "nsEditorUtils.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "prprf.h"
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ public:
|
|||
NS_IMETHOD SetMaxTextLength(PRInt32 aMaxTextLength);
|
||||
NS_IMETHOD GetMaxTextLength(PRInt32& aMaxTextLength);
|
||||
|
||||
|
||||
NS_IMETHOD SetInlineProperty(nsIAtom *aProperty,
|
||||
const nsString *aAttribute,
|
||||
const nsString *aValue);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
#define NS_IEDITOR_IID \
|
||||
{/* A3C5EE71-742E-11d2-8F2C-006008310194*/ \
|
||||
0xa3c5ee71, 0x742e, 0x11d2, \
|
||||
|
@ -39,12 +38,14 @@ class nsITransaction;
|
|||
class nsIOutputStream;
|
||||
class nsIEditActionListener;
|
||||
class nsIDocumentStateListener;
|
||||
class nsFileSpec;
|
||||
|
||||
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 {
|
||||
|
@ -108,20 +109,7 @@ public:
|
|||
NS_IMETHOD DeleteSelection(ESelectionCollapseDirection aAction)=0;
|
||||
|
||||
|
||||
/* ------------ Document info methods -------------- */
|
||||
|
||||
/** Respond to the menu 'Save' command; this may put up save UI if the document
|
||||
* hasn't been saved yet.
|
||||
*/
|
||||
NS_IMETHOD Save()=0;
|
||||
|
||||
/** Respond to the menu 'Save As' command; this will put up save UI
|
||||
* @param aSavingCopy true if we are saving off a copy of the document
|
||||
* without changing the disk file associated with the doc.
|
||||
* This would correspond to a 'Save Copy As' menu command.
|
||||
*/
|
||||
NS_IMETHOD SaveAs(PRBool aSavingCopy)=0;
|
||||
|
||||
/* ------------ Document info and file methods -------------- */
|
||||
/** Returns true if the document is modifed and needs saving */
|
||||
NS_IMETHOD GetDocumentModified(PRBool *outDocModified)=0;
|
||||
|
||||
|
@ -131,6 +119,21 @@ public:
|
|||
/** Sets the current 'Save' document character set */
|
||||
NS_IMETHOD SetDocumentCharacterSet(const PRUnichar* characterSet)=0;
|
||||
|
||||
/** Save document to a file
|
||||
* Note: No UI is used
|
||||
* @param aFileSpec
|
||||
* The file to save to
|
||||
* @param aReplaceExisting
|
||||
* true if replacing an existing file, otherwise false.
|
||||
* If false and aFileSpec exists, SaveFile returns an error.
|
||||
* @param aSaveCopy
|
||||
* true if we are saving off a copy of the document
|
||||
* without changing the disk file associated with the doc.
|
||||
* 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;
|
||||
|
||||
/* ------------ Transaction methods -------------- */
|
||||
|
||||
/** Do() fires a transaction. It is provided here so clients can create their own transactions.
|
||||
|
|
|
@ -524,12 +524,14 @@ function EditorInsertText(textToInsert)
|
|||
|
||||
function EditorInsertHTML()
|
||||
{
|
||||
window.openDialog("chrome://editor/content/EdInsSrc.xul","InsSrcDlg", "chrome", "");
|
||||
window.openDialog("chrome://editor/content/EdInsSrc.xul","InsSrcDlg", "chrome,close,titlebar,modal", "");
|
||||
contentWindow.focus();
|
||||
}
|
||||
|
||||
function EditorInsertLink()
|
||||
{
|
||||
window.openDialog("chrome://editor/content/EdLinkProps.xul","LinkDlg", "chrome,close,titlebar,modal");
|
||||
dump("***************** Finished InsertLink dialog\n");
|
||||
contentWindow.focus();
|
||||
}
|
||||
|
||||
|
@ -720,13 +722,12 @@ function EditorToggleDisplayStyle()
|
|||
if (EditorDisplayStyle) {
|
||||
EditorDisplayStyle = false;
|
||||
styleSheet = "resource:/res/ua.css";
|
||||
//TODO: Where do we store localizable JS strings?
|
||||
buttonText = "Edit Mode";
|
||||
buttonText = editorShell.GetString("EditMode");
|
||||
}
|
||||
else {
|
||||
EditorDisplayStyle = true;
|
||||
styleSheet = "chrome://editor/content/EditorContent.css"
|
||||
buttonText = "Preview";
|
||||
buttonText = editorShell.GetString("Preview");
|
||||
}
|
||||
//TODO: THIS IS NOT THE RIGHT THING TO DO!
|
||||
EditorApplyStyleSheet(styleSheet);
|
||||
|
@ -749,18 +750,27 @@ function CheckSpelling()
|
|||
{
|
||||
dump("Check Spelling starting...\n");
|
||||
// Start the spell checker module. Return is first misspelled word
|
||||
firstMisspelledWord = spellChecker.StartSpellChecking();
|
||||
dump(firstMisspelledWord+"\n");
|
||||
if( firstMisspelledWord == "")
|
||||
{
|
||||
// No misspelled word - tell user
|
||||
window.openDialog("chrome://editor/content/EdMessage.xul", "NoSpellError", "chrome,close,titlebar,modal", "", "No misspelled word was found.", "Check Spelling");
|
||||
spellChecker.CloseSpellChecking();
|
||||
} else {
|
||||
dump("We found a MISSPELLED WORD\n");
|
||||
// Set spellChecker variable on window
|
||||
window.spellChecker = spellChecker;
|
||||
window.openDialog("chrome://editor/content/EdSpellCheck.xul", "SpellDlg", "chrome,close,titlebar,modal", "", firstMisspelledWord);
|
||||
try {
|
||||
firstMisspelledWord = spellChecker.StartSpellChecking();
|
||||
dump(firstMisspelledWord+"\n");
|
||||
if( firstMisspelledWord == "")
|
||||
{
|
||||
// No misspelled word - tell user
|
||||
window.openDialog("chrome://editor/content/EdMessage.xul", "NoSpellError",
|
||||
"chrome,close,titlebar,modal", "",
|
||||
editorShell.GetString("NoMisspelledWord"),
|
||||
editorShell.GetString("CheckSpelling"));
|
||||
|
||||
spellChecker.CloseSpellChecking();
|
||||
} else {
|
||||
dump("We found a MISSPELLED WORD\n");
|
||||
// Set spellChecker variable on window
|
||||
window.spellChecker = spellChecker;
|
||||
window.openDialog("chrome://editor/content/EdSpellCheck.xul", "SpellDlg", "chrome,close,titlebar,modal", "", firstMisspelledWord);
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
dump("*** Exception error from Spell Checker\n");
|
||||
}
|
||||
}
|
||||
contentWindow.focus();
|
||||
|
|
|
@ -1,2 +1,14 @@
|
|||
More=More
|
||||
Fewer=Fewer
|
||||
OpenHTMLFile=Open HTML File
|
||||
SelectImageFile=Select Image File
|
||||
SaveDocumentAs=Save Document As
|
||||
LinkImage=Link Image:
|
||||
EditMode=Edit Mode
|
||||
Preview=Preview
|
||||
CorrectSpelling=(correct spelling)
|
||||
NoSuggestedWords=(no suggested words)
|
||||
NoMisspelledWord=No misspelled word was found.
|
||||
CheckSpelling=Check Spelling
|
||||
HTMLFiles=HTML Files
|
||||
TextFiles=Text Files
|
|
@ -142,9 +142,7 @@ function ValidateNumberString(value, minValue, maxValue)
|
|||
|
||||
function ShowInputErrorMessage(message)
|
||||
{
|
||||
// This is NOT MODAL as of 7/16/99!
|
||||
|
||||
window.openDialog("chrome://editor/content/EdMessage.xul", "MsgDlg", "chrome", "", message, "Input Error");
|
||||
window.openDialog("chrome://editor/content/EdMessage.xul", "MsgDlg", "chrome,close,titlebar,modal", "", message, "Input Error");
|
||||
}
|
||||
|
||||
function TrimStringLeft(string)
|
||||
|
@ -414,10 +412,10 @@ function GetSelectionAsText()
|
|||
// from the advanced edit button which points to a non existant onAdvanced() function
|
||||
// Well now it exists -pete
|
||||
|
||||
function onAdvanced(){
|
||||
function onAdvancedEdit(){
|
||||
|
||||
|
||||
dump("\n\ncomming soon . . .\nthe \"onAdvanced\" function\n\n");
|
||||
dump("\n\ncomming soon . . .\nthe \"onAdvancedEdit\" function\n\n");
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EdDialogOverlay.dtd">
|
||||
|
||||
<overlay id="EdDialogOverlay"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<box id="advancedEditButton" align="vertical">
|
||||
<box align="horizontal" style="margin-top: 0.2em">
|
||||
<titledbutton class="hspaced" id="AdvancedEdit" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
|
||||
</box>
|
||||
<html:div><html:hr width="100%"/></html:div>
|
||||
</box>
|
||||
|
||||
</overlay>
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorHLineProperties.dtd">
|
||||
<!-- dialog containing a control requiring initial setup -->
|
||||
|
@ -45,12 +45,8 @@
|
|||
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
|
||||
|
||||
<xul:broadcaster id="args" value=""/>
|
||||
<xul:titledbutton class="spaced" id="AdvancedEdit" onclick="onAdvanced()" value="&AdvancedEditButton.label;"/>
|
||||
<div><hr width="100%"/></div>
|
||||
<xul:spring flex="100%"/>
|
||||
<xul:box>
|
||||
<xul:spring flex="100%"/>
|
||||
<xul:titledbutton class="spaced" id="OK" onclick="onOK()" value="&OKButton.label;"/>
|
||||
<xul:titledbutton class="spaced" id="Cancel" onclick="onCancel()" value="&CancelButton.label;"/>
|
||||
</xul:box>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
</xul:window>
|
||||
|
|
|
@ -139,11 +139,6 @@ function onSaveDefault()
|
|||
}
|
||||
}
|
||||
|
||||
function onAdvanced()
|
||||
{
|
||||
//TODO: Call the generic attribute editor ("extra HTML")
|
||||
}
|
||||
|
||||
function ValidateData(setAttributes)
|
||||
{
|
||||
// Height is always pixels
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorHLineProperties.dtd">
|
||||
|
||||
|
@ -93,16 +93,10 @@
|
|||
<xul:titledbutton class="spaced" id="SaveDefault" onclick="onSaveDefault()" value="&saveSettings.label;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<xul:titledbutton class="spaced" id="AdvancedEdit" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div><hr width="100%"/></div>
|
||||
|
||||
<xul:spring flex="100%"/>
|
||||
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
|
||||
<xul:popup id="PixelOrPercentMenu">
|
||||
|
|
|
@ -567,6 +567,11 @@ function onOK()
|
|||
// setDimensions()
|
||||
// sets height and width attributes to inserted image
|
||||
// Brian King - XML Workshop
|
||||
// TODO: THIS NEEDS TO BE MODIFIED TO USE LOCALIZED STRING BUNDLE,
|
||||
// e.g., this assumes "% of"
|
||||
// Use editorShell.GetString("name") to get a string and
|
||||
// define those strings in editor\ui\dialogs\content\editor.properties
|
||||
// Note that using localized strings will break assumption about location of "% of"
|
||||
|
||||
function setDimensions()
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorImageProperties.dtd">
|
||||
|
||||
|
@ -152,7 +152,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- ////////////////////// Advanced controls table ///////////////////////////////// -->
|
||||
<!-- ////////////////////// "More" controls table ///////////////////////////////// -->
|
||||
|
||||
<div id="MoreRow" style="visibility: inherit; display: block;">
|
||||
<table>
|
||||
|
@ -331,16 +331,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<button
|
||||
id = "AdvancedButton"
|
||||
class = "disabled"
|
||||
onclick = "onAdvanced()">
|
||||
|
||||
&AdvancedEditButton.label;
|
||||
</button>
|
||||
|
||||
</td>
|
||||
</td>
|
||||
<td align="right">
|
||||
|
||||
<!-- IMAGE ALIGNMENT -->
|
||||
|
@ -495,8 +486,11 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- ////////////////////////// OK CANCEL Box /////////////////////////////// -->
|
||||
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorInsertSource.dtd">
|
||||
|
||||
|
@ -53,6 +53,6 @@
|
|||
</xul:box>
|
||||
|
||||
<xul:spring flex="100%"/>
|
||||
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
</xul:window>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorInsertTable.dtd">
|
||||
|
||||
|
@ -90,16 +90,11 @@
|
|||
<label for="border"> &pixelsPopup.value; </label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td cellspan="3">
|
||||
<xul:titledbutton class="spaced" id="AdvancedEdit" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div><hr width="100%"/></div>
|
||||
|
||||
<xul:spring flex="100%"/>
|
||||
|
||||
<xul:spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
|
||||
<xul:popup id="PixelOrPercentMenu">
|
||||
|
|
|
@ -115,8 +115,7 @@ function initDialog()
|
|||
if (parent) {
|
||||
anchorElement = parent;
|
||||
insertNew = false;
|
||||
// GET THIS FROM STRING BUNDLE
|
||||
linkCaption.data = "Link image:"
|
||||
linkCaption.data = editorShell.GetString("LinkImage");
|
||||
// Link source string is the source URL of image
|
||||
// TODO: THIS STILL DOESN'T HANDLE MULTIPLE SELECTED IMAGES!
|
||||
linkMessage.data = imageElement.getAttribute("src");;
|
||||
|
@ -187,6 +186,7 @@ function RemoveLink()
|
|||
|
||||
function onOK()
|
||||
{
|
||||
dump("***** Clicked OK in link props dialog\n");
|
||||
// TODO: VALIDATE FIELDS BEFORE COMMITING CHANGES
|
||||
|
||||
href = TrimString(hrefInput.value);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorLinkProperties.dtd">
|
||||
|
||||
|
@ -66,8 +66,9 @@
|
|||
</xul:box>
|
||||
</xul:box>
|
||||
</fieldset>
|
||||
<xul:titledbutton class="hspaced" id="AdvancedEdit" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
|
||||
</xul:box>
|
||||
<xul:spring class="bigspacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
</xul:window>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EdNamedAnchorProperties.dtd">
|
||||
|
||||
|
@ -51,14 +51,10 @@
|
|||
<input type="text" id="nameInput" size="30" maxlength="255" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<xul:titledbutton class="spaced" id="MoreAttributes" onclick="onMoreAttributes()" value="&moreButton.label;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div><hr width="100%"/></div>
|
||||
<xul:spring flex="100%"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
|
||||
</xul:window>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
var misspelledWord;
|
||||
var spellChecker;
|
||||
var allowSelectWord = true;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
|
@ -99,7 +100,9 @@ function CheckWord()
|
|||
FillSuggestedList();
|
||||
} else {
|
||||
ClearList(dialog.suggestedList);
|
||||
AppendStringToList(dialog.suggestedList, "(correct spelling)");
|
||||
AppendStringToList(dialog.suggestedList, editorShell.GetString("CorrectSpelling"));
|
||||
// Suppress being able to select the message text
|
||||
allowSelectWord = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +110,8 @@ function CheckWord()
|
|||
function SelectSuggestedWord()
|
||||
{
|
||||
dump("SpellCheck: SelectSuggestedWord\n");
|
||||
dialog.wordInput.value = dialog.suggestedList.options[dialog.suggestedList.selectedIndex].value;
|
||||
if (allowSelectWord)
|
||||
dialog.wordInput.value = dialog.suggestedList.options[dialog.suggestedList.selectedIndex].value;
|
||||
}
|
||||
|
||||
function Ignore()
|
||||
|
@ -155,7 +159,7 @@ function AddToDictionary()
|
|||
|
||||
function EditDictionary()
|
||||
{
|
||||
window.openDialog("chrome://editor/content/EdDictionary.xul", "Dictionary", "chrome", "", misspelledWord);
|
||||
window.openDialog("chrome://editor/content/EdDictionary.xul", "Dictionary", "chrome,close,titlebar,modal", "", misspelledWord);
|
||||
}
|
||||
|
||||
function SelectLanguage()
|
||||
|
@ -193,5 +197,12 @@ function FillSuggestedList(firstWord)
|
|||
AppendStringToList(list, word);
|
||||
}
|
||||
} while (word != "");
|
||||
if (list.length == 0) {
|
||||
// No suggestions - show a message but don't let user select it
|
||||
AppendStringToList(list, editorShell.GetString("NoSuggestedWords"));
|
||||
allowSelectWord = false;
|
||||
} else {
|
||||
allowSelectWord = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorTableProperties.dtd">
|
||||
|
||||
|
@ -53,9 +53,10 @@
|
|||
<tabpanel flex="100%" >
|
||||
<!-- table tab -->
|
||||
<box align="vertical">
|
||||
<titledbutton value="TABLE PANEL"/>
|
||||
<titledbutton value="TABLE PANEL"/>
|
||||
<html:div> WORK IN PROGRESS: This is the TABLE Tab </html:div>
|
||||
<titledbutton class="spaced" id="AdvancedEditTable" onclick="onAdvanced()" value="&AdvancedEditButton.label;"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
</box>
|
||||
<!-- end of table tab -->
|
||||
|
||||
|
@ -63,13 +64,13 @@
|
|||
<box align="vertical">
|
||||
<titledbutton value="CELL PANEL"/>
|
||||
<html:div> WORK IN PROGRESS: This is the CELL Tab </html:div>
|
||||
<titledbutton class="spaced" id="AdvancedEditCell" onclick="onAdvanced()" value="&AdvancedEditButton.label;"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
</box>
|
||||
<!-- end of cell tab -->
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
|
||||
<spring flex="100%"/>
|
||||
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="advancedEditButton"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
|
|
@ -43,3 +43,4 @@ EdInsSrc.xul
|
|||
EdInsSrc.js
|
||||
EdMessage.xul
|
||||
EdMessage.js
|
||||
EdDialogOverlay.xul
|
||||
|
|
|
@ -48,6 +48,7 @@ EXPORT_RESOURCE_CONTENT = \
|
|||
$(srcdir)/EdTableProps.js \
|
||||
$(srcdir)/EdMessage.xul \
|
||||
$(srcdir)/EdMessage.js \
|
||||
$(srcdir)/EdDialogOverlay.xul \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
|
|
|
@ -41,6 +41,7 @@ install::
|
|||
$(MAKE_INSTALL) EdInsSrc.js $(DIST)\bin\chrome\editor\content\default
|
||||
$(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
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\chrome\editor\content\default\EdDialogCommon.js
|
||||
|
@ -64,3 +65,4 @@ clobber::
|
|||
rm -f $(DIST)\bin\chrome\editor\content\default\EdInsSrc.js
|
||||
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
|
||||
|
|
|
@ -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 AdvancedEditButton.label "Advanced Edit...">
|
|
@ -22,7 +22,4 @@
|
|||
|
||||
<!ENTITY windowTitle.label "Named Anchor Properties">
|
||||
<!ENTITY anchorNameEditField.label "Anchor Name:">
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY moreButton.label "Advanced Edit...">
|
||||
|
||||
|
|
|
@ -37,6 +37,3 @@
|
|||
|
||||
<!ENTITY threeDShading.label "3-D Shading">
|
||||
<!ENTITY saveSettings.label "Save Settings">
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
-->
|
||||
|
||||
<!-- These strings are generic to all or most of the editor's dialogs. -->
|
||||
<!-- They should be moved into a "common" file -->
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
|
||||
|
||||
<!-- This button is for the progressive disclosure of additional editing functionality -->
|
||||
<!-- THIS TEXT WILL CHANGE DYNAMICALLY, SO VALUES SHOULD BE IN Editor.properties STRING BUNDLE FILE -->
|
||||
<!ENTITY MoreButton.label "More">
|
||||
|
|
|
@ -25,5 +25,3 @@
|
|||
|
||||
<!ENTITY sourceFieldset.label "HTML Source">
|
||||
<!ENTITY sourceEditField.label "Enter HTML source to insert:">
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
|
|
|
@ -35,7 +35,3 @@
|
|||
|
||||
<!ENTITY pixelsPopup.value "pixels">
|
||||
<!ENTITY percentPopup.value "percent">
|
||||
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
-->
|
||||
|
||||
<!-- These strings are generic to all or most of the editor's dialogs. -->
|
||||
<!-- They should be moved into a "common" file -->
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
|
||||
|
||||
<!-- This button is for the progressive disclosure of additional editing functionality -->
|
||||
<!ENTITY MoreButton.label "More">
|
||||
|
|
|
@ -23,6 +23,3 @@
|
|||
<!ENTITY tableWindow.title "Table Properties">
|
||||
<!ENTITY tableTab.label "Table">
|
||||
<!ENTITY cellTab.label "Cells">
|
||||
<!ENTITY OKButton.label "OK">
|
||||
<!ENTITY CancelButton.label "Cancel">
|
||||
<!ENTITY AdvancedEditButton.label "Advanced Edit...">
|
||||
|
|
|
@ -31,3 +31,4 @@ EditorPersonalDictionary.dtd
|
|||
EditorSpellCheck.dtd
|
||||
EditorTableProperties.dtd
|
||||
EdNamedAnchorProperties.dtd
|
||||
EdDialogOverlay.dtd
|
||||
|
|
|
@ -27,16 +27,17 @@ include $(topsrcdir)/config/config.mk
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
EXPORT_RESOURCE_CONTENT = \
|
||||
$(srcdir)/EditorHLineProperties.dtd \
|
||||
$(srcdir)/EditorImageProperties.dtd \
|
||||
$(srcdir)/EditorInsertSource.dtd \
|
||||
$(srcdir)/EditorInsertTable.dtd \
|
||||
$(srcdir)/EditorLinkProperties.dtd \
|
||||
$(srcdir)/EditorPersonalDictionary.dtd \
|
||||
$(srcdir)/EditorSpellCheck.dtd \
|
||||
$(srcdir)/EditorTableProperties.dtd \
|
||||
$(srcdir)/EdNamedAnchorProperties.dtd \
|
||||
$(NULL)
|
||||
$(srcdir)/EditorHLineProperties.dtd \
|
||||
$(srcdir)/EditorImageProperties.dtd \
|
||||
$(srcdir)/EditorInsertSource.dtd \
|
||||
$(srcdir)/EditorInsertTable.dtd \
|
||||
$(srcdir)/EditorLinkProperties.dtd \
|
||||
$(srcdir)/EditorPersonalDictionary.dtd \
|
||||
$(srcdir)/EditorSpellCheck.dtd \
|
||||
$(srcdir)/EditorTableProperties.dtd \
|
||||
$(srcdir)/EdNamedAnchorProperties.dtd \
|
||||
$(srcdir)/EdDialogOverlay.dtd \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/editor/locale/en-US/
|
||||
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/editor/locale/en-US/
|
||||
|
|
|
@ -29,6 +29,7 @@ install::
|
|||
$(MAKE_INSTALL) EditorSpellCheck.dtd $(DIST)\bin\chrome\editor\locale\en-US
|
||||
$(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
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EditorHLineProperties.dtd
|
||||
|
@ -40,3 +41,4 @@ clobber::
|
|||
rm -f $(DIST)\bin\chrome\editor\locale\en-US\EditorSpellCheck.dtd
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче