This commit is contained in:
sfraser%netscape.com 1999-06-21 22:39:37 +00:00
Родитель 448d250679
Коммит ee744a53cc
18 изменённых файлов: 0 добавлений и 7477 удалений

Просмотреть файл

@ -1,90 +0,0 @@
interface EditorAppCore : BaseAppCore
{
/* IID: { 0x9afff72b, 0xca9a, 0x11d2, \
{0x96, 0xc9, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56}} */
readonly attribute DOMString contentsAsText;
readonly attribute DOMString contentsAsHTML;
readonly attribute Document editorDocument;
readonly attribute Selection editorSelection;
readonly attribute DOMString ParagraphFormat;
attribute int wrapColumn;
void EditorAppCore();
void setEditorType(in DOMString editorType);
void setTextProperty(in DOMString prop, in DOMString attr, in DOMString value);
void removeTextProperty(in DOMString prop, in DOMString attr);
void getTextProperty(in DOMString prop, in DOMString attr, in DOMString value, out DOMString firstHas, out DOMString anyHas, out DOMString allHas);
void setBodyAttribute(in DOMString attr, in DOMString value);
void setBackgroundColor(in DOMString color);
DOMString getLocalFileURL(in Window parent, in DOMString filterType);
void setParagraphFormat(in DOMString value);
void loadUrl(in DOMString url);
void newWindow();
void open();
void save();
void saveAs();
void closeWindow();
void print();
void exit();
void undo();
void redo();
void cut();
void copy();
void paste();
void pasteAsQuotation();
void pasteAsCitedQuotation(in DOMString cite);
void insertAsQuotation(in DOMString quotedText);
void insertAsCitedQuotation(in DOMString quotedText, in DOMString cite);
void selectAll();
void find();
void findNext();
void beginBatchChanges();
void endBatchChanges();
void insertText(in DOMString textToInsert);
void insertLink();
void insertImage();
void insertList(in DOMString listType);
void indent(in DOMString indent);
void align(in DOMString align);
Element getSelectedElement(in DOMString tagName);
Element createElementWithDefaults(in DOMString tagName);
Element insertElement(in Element element, in boolean deleteSelection);
void insertLinkAroundSelection(in Element anchorElement);
void selectElement(in Element element);
void setCaretAfterElement(in Element element);
void setToolbarWindow(in Window win);
void setContentWindow(in Window win);
void setWebShellWindow(in Window win);
DOMString startSpellChecking();
DOMString getNextMisspelledWord();
DOMString getSuggestedWord();
boolean checkCurrentWord(in DOMString suggestedWord);
void replaceWord(in DOMString misspelledWord, in DOMString replaceWord, in boolean allOccurrences);
void ignoreWordAllOccurrences(in DOMString word);
void addWordToDictionary(in DOMString word);
void removeWordFromDictionary(in DOMString word);
DOMString getPersonalDictionaryWord();
void closeSpellChecking();
void runUnitTests();
};

Просмотреть файл

@ -1,13 +0,0 @@
interface ToolbarCore : BaseAppCore
{
/* IID: { 0xbf4ae23e, 0xba9b, 0x11d2, \
{0x96, 0xc4, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56}} */
void ToolbarCore();
void SetWindow(in Window win);
void SetStatus(in wstring msg);
};

Просмотреть файл

@ -1,3 +0,0 @@
/* stub interface for compatibility with XPIDL */
interface nsIDOMEditorAppCore {};

Просмотреть файл

@ -1,305 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMEditorAppCore_h__
#define nsIDOMEditorAppCore_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMBaseAppCore.h"
class nsIDOMElement;
class nsIDOMDocument;
class nsIDOMSelection;
class nsIDOMWindow;
#define NS_IDOMEDITORAPPCORE_IID \
{ 0x9afff72b, 0xca9a, 0x11d2, \
{0x96, 0xc9, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56}}
class nsIDOMEditorAppCore : public nsIDOMBaseAppCore {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMEDITORAPPCORE_IID; return iid; }
NS_IMETHOD GetContentsAsText(nsString& aContentsAsText)=0;
NS_IMETHOD GetContentsAsHTML(nsString& aContentsAsHTML)=0;
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument)=0;
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection)=0;
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat)=0;
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn)=0;
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn)=0;
NS_IMETHOD SetEditorType(const nsString& aEditorType)=0;
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue)=0;
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr)=0;
NS_IMETHOD GetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue, nsString& aFirstHas, nsString& aAnyHas, nsString& aAllHas)=0;
NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue)=0;
NS_IMETHOD SetBackgroundColor(const nsString& aColor)=0;
NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn)=0;
NS_IMETHOD SetParagraphFormat(const nsString& aValue)=0;
NS_IMETHOD LoadUrl(const nsString& aUrl)=0;
NS_IMETHOD NewWindow()=0;
NS_IMETHOD Open()=0;
NS_IMETHOD Save()=0;
NS_IMETHOD SaveAs()=0;
NS_IMETHOD CloseWindow()=0;
NS_IMETHOD Print()=0;
NS_IMETHOD Exit()=0;
NS_IMETHOD Undo()=0;
NS_IMETHOD Redo()=0;
NS_IMETHOD Cut()=0;
NS_IMETHOD Copy()=0;
NS_IMETHOD Paste()=0;
NS_IMETHOD PasteAsQuotation()=0;
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCite)=0;
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText)=0;
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCite)=0;
NS_IMETHOD SelectAll()=0;
NS_IMETHOD Find()=0;
NS_IMETHOD FindNext()=0;
NS_IMETHOD BeginBatchChanges()=0;
NS_IMETHOD EndBatchChanges()=0;
NS_IMETHOD InsertText(const nsString& aTextToInsert)=0;
NS_IMETHOD InsertLink()=0;
NS_IMETHOD InsertImage()=0;
NS_IMETHOD InsertList(const nsString& aListType)=0;
NS_IMETHOD Indent(const nsString& aIndent)=0;
NS_IMETHOD Align(const nsString& aAlign)=0;
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn)=0;
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn)=0;
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn)=0;
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)=0;
NS_IMETHOD SelectElement(nsIDOMElement* aElement)=0;
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement)=0;
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin)=0;
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin)=0;
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin)=0;
NS_IMETHOD StartSpellChecking(nsString& aReturn)=0;
NS_IMETHOD GetNextMisspelledWord(nsString& aReturn)=0;
NS_IMETHOD GetSuggestedWord(nsString& aReturn)=0;
NS_IMETHOD CheckCurrentWord(const nsString& aSuggestedWord, PRBool* aReturn)=0;
NS_IMETHOD ReplaceWord(const nsString& aMisspelledWord, const nsString& aReplaceWord, PRBool aAllOccurrences)=0;
NS_IMETHOD IgnoreWordAllOccurrences(const nsString& aWord)=0;
NS_IMETHOD AddWordToDictionary(const nsString& aWord)=0;
NS_IMETHOD RemoveWordFromDictionary(const nsString& aWord)=0;
NS_IMETHOD GetPersonalDictionaryWord(nsString& aReturn)=0;
NS_IMETHOD CloseSpellChecking()=0;
NS_IMETHOD RunUnitTests()=0;
};
#define NS_DECL_IDOMEDITORAPPCORE \
NS_IMETHOD GetContentsAsText(nsString& aContentsAsText); \
NS_IMETHOD GetContentsAsHTML(nsString& aContentsAsHTML); \
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument); \
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection); \
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat); \
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn); \
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn); \
NS_IMETHOD SetEditorType(const nsString& aEditorType); \
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue); \
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr); \
NS_IMETHOD GetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue, nsString& aFirstHas, nsString& aAnyHas, nsString& aAllHas); \
NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue); \
NS_IMETHOD SetBackgroundColor(const nsString& aColor); \
NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn); \
NS_IMETHOD SetParagraphFormat(const nsString& aValue); \
NS_IMETHOD LoadUrl(const nsString& aUrl); \
NS_IMETHOD NewWindow(); \
NS_IMETHOD Open(); \
NS_IMETHOD Save(); \
NS_IMETHOD SaveAs(); \
NS_IMETHOD CloseWindow(); \
NS_IMETHOD Print(); \
NS_IMETHOD Exit(); \
NS_IMETHOD Undo(); \
NS_IMETHOD Redo(); \
NS_IMETHOD Cut(); \
NS_IMETHOD Copy(); \
NS_IMETHOD Paste(); \
NS_IMETHOD PasteAsQuotation(); \
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCite); \
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText); \
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCite); \
NS_IMETHOD SelectAll(); \
NS_IMETHOD Find(); \
NS_IMETHOD FindNext(); \
NS_IMETHOD BeginBatchChanges(); \
NS_IMETHOD EndBatchChanges(); \
NS_IMETHOD InsertText(const nsString& aTextToInsert); \
NS_IMETHOD InsertLink(); \
NS_IMETHOD InsertImage(); \
NS_IMETHOD InsertList(const nsString& aListType); \
NS_IMETHOD Indent(const nsString& aIndent); \
NS_IMETHOD Align(const nsString& aAlign); \
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn); \
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn); \
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn); \
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement); \
NS_IMETHOD SelectElement(nsIDOMElement* aElement); \
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement); \
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin); \
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin); \
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin); \
NS_IMETHOD StartSpellChecking(nsString& aReturn); \
NS_IMETHOD GetNextMisspelledWord(nsString& aReturn); \
NS_IMETHOD GetSuggestedWord(nsString& aReturn); \
NS_IMETHOD CheckCurrentWord(const nsString& aSuggestedWord, PRBool* aReturn); \
NS_IMETHOD ReplaceWord(const nsString& aMisspelledWord, const nsString& aReplaceWord, PRBool aAllOccurrences); \
NS_IMETHOD IgnoreWordAllOccurrences(const nsString& aWord); \
NS_IMETHOD AddWordToDictionary(const nsString& aWord); \
NS_IMETHOD RemoveWordFromDictionary(const nsString& aWord); \
NS_IMETHOD GetPersonalDictionaryWord(nsString& aReturn); \
NS_IMETHOD CloseSpellChecking(); \
NS_IMETHOD RunUnitTests(); \
#define NS_FORWARD_IDOMEDITORAPPCORE(_to) \
NS_IMETHOD GetContentsAsText(nsString& aContentsAsText) { return _to GetContentsAsText(aContentsAsText); } \
NS_IMETHOD GetContentsAsHTML(nsString& aContentsAsHTML) { return _to GetContentsAsHTML(aContentsAsHTML); } \
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument) { return _to GetEditorDocument(aEditorDocument); } \
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection) { return _to GetEditorSelection(aEditorSelection); } \
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat) { return _to GetParagraphFormat(aParagraphFormat); } \
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn) { return _to GetWrapColumn(aWrapColumn); } \
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn) { return _to SetWrapColumn(aWrapColumn); } \
NS_IMETHOD SetEditorType(const nsString& aEditorType) { return _to SetEditorType(aEditorType); } \
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue) { return _to SetTextProperty(aProp, aAttr, aValue); } \
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr) { return _to RemoveTextProperty(aProp, aAttr); } \
NS_IMETHOD GetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue, nsString& aFirstHas, nsString& aAnyHas, nsString& aAllHas) { return _to GetTextProperty(aProp, aAttr, aValue, aFirstHas, aAnyHas, aAllHas); } \
NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue) { return _to SetBodyAttribute(aAttr, aValue); } \
NS_IMETHOD SetBackgroundColor(const nsString& aColor) { return _to SetBackgroundColor(aColor); } \
NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn) { return _to GetLocalFileURL(aParent, aFilterType, aReturn); } \
NS_IMETHOD SetParagraphFormat(const nsString& aValue) { return _to SetParagraphFormat(aValue); } \
NS_IMETHOD LoadUrl(const nsString& aUrl) { return _to LoadUrl(aUrl); } \
NS_IMETHOD NewWindow() { return _to NewWindow(); } \
NS_IMETHOD Open() { return _to Open(); } \
NS_IMETHOD Save() { return _to Save(); } \
NS_IMETHOD SaveAs() { return _to SaveAs(); } \
NS_IMETHOD CloseWindow() { return _to CloseWindow(); } \
NS_IMETHOD Print() { return _to Print(); } \
NS_IMETHOD Exit() { return _to Exit(); } \
NS_IMETHOD Undo() { return _to Undo(); } \
NS_IMETHOD Redo() { return _to Redo(); } \
NS_IMETHOD Cut() { return _to Cut(); } \
NS_IMETHOD Copy() { return _to Copy(); } \
NS_IMETHOD Paste() { return _to Paste(); } \
NS_IMETHOD PasteAsQuotation() { return _to PasteAsQuotation(); } \
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCite) { return _to PasteAsCitedQuotation(aCite); } \
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText) { return _to InsertAsQuotation(aQuotedText); } \
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCite) { return _to InsertAsCitedQuotation(aQuotedText, aCite); } \
NS_IMETHOD SelectAll() { return _to SelectAll(); } \
NS_IMETHOD Find() { return _to Find(); } \
NS_IMETHOD FindNext() { return _to FindNext(); } \
NS_IMETHOD BeginBatchChanges() { return _to BeginBatchChanges(); } \
NS_IMETHOD EndBatchChanges() { return _to EndBatchChanges(); } \
NS_IMETHOD InsertText(const nsString& aTextToInsert) { return _to InsertText(aTextToInsert); } \
NS_IMETHOD InsertLink() { return _to InsertLink(); } \
NS_IMETHOD InsertImage() { return _to InsertImage(); } \
NS_IMETHOD InsertList(const nsString& aListType) { return _to InsertList(aListType); } \
NS_IMETHOD Indent(const nsString& aIndent) { return _to Indent(aIndent); } \
NS_IMETHOD Align(const nsString& aAlign) { return _to Align(aAlign); } \
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn) { return _to GetSelectedElement(aTagName, aReturn); } \
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn) { return _to CreateElementWithDefaults(aTagName, aReturn); } \
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn) { return _to InsertElement(aElement, aDeleteSelection, aReturn); } \
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement) { return _to InsertLinkAroundSelection(aAnchorElement); } \
NS_IMETHOD SelectElement(nsIDOMElement* aElement) { return _to SelectElement(aElement); } \
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement) { return _to SetCaretAfterElement(aElement); } \
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin) { return _to SetToolbarWindow(aWin); } \
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin) { return _to SetContentWindow(aWin); } \
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin) { return _to SetWebShellWindow(aWin); } \
NS_IMETHOD StartSpellChecking(nsString& aReturn) { return _to StartSpellChecking(aReturn); } \
NS_IMETHOD GetNextMisspelledWord(nsString& aReturn) { return _to GetNextMisspelledWord(aReturn); } \
NS_IMETHOD GetSuggestedWord(nsString& aReturn) { return _to GetSuggestedWord(aReturn); } \
NS_IMETHOD CheckCurrentWord(const nsString& aSuggestedWord, PRBool* aReturn) { return _to CheckCurrentWord(aSuggestedWord, aReturn); } \
NS_IMETHOD ReplaceWord(const nsString& aMisspelledWord, const nsString& aReplaceWord, PRBool aAllOccurrences) { return _to ReplaceWord(aMisspelledWord, aReplaceWord, aAllOccurrences); } \
NS_IMETHOD IgnoreWordAllOccurrences(const nsString& aWord) { return _to IgnoreWordAllOccurrences(aWord); } \
NS_IMETHOD AddWordToDictionary(const nsString& aWord) { return _to AddWordToDictionary(aWord); } \
NS_IMETHOD RemoveWordFromDictionary(const nsString& aWord) { return _to RemoveWordFromDictionary(aWord); } \
NS_IMETHOD GetPersonalDictionaryWord(nsString& aReturn) { return _to GetPersonalDictionaryWord(aReturn); } \
NS_IMETHOD CloseSpellChecking() { return _to CloseSpellChecking(); } \
NS_IMETHOD RunUnitTests() { return _to RunUnitTests(); } \
extern "C" NS_DOM nsresult NS_InitEditorAppCoreClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptEditorAppCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMEditorAppCore_h__

Просмотреть файл

@ -1,59 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMToolbarCore_h__
#define nsIDOMToolbarCore_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMBaseAppCore.h"
class nsIDOMWindow;
#define NS_IDOMTOOLBARCORE_IID \
{ 0xbf4ae23e, 0xba9b, 0x11d2, \
{0x96, 0xc4, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56}}
class nsIDOMToolbarCore : public nsIDOMBaseAppCore {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMTOOLBARCORE_IID; return iid; }
NS_IMETHOD SetWindow(nsIDOMWindow* aWin)=0;
NS_IMETHOD SetStatus(const nsString& aMsg)=0;
};
#define NS_DECL_IDOMTOOLBARCORE \
NS_IMETHOD SetWindow(nsIDOMWindow* aWin); \
NS_IMETHOD SetStatus(const nsString& aMsg); \
#define NS_FORWARD_IDOMTOOLBARCORE(_to) \
NS_IMETHOD SetWindow(nsIDOMWindow* aWin) { return _to##SetWindow(aWin); } \
NS_IMETHOD SetStatus(const nsString& aMsg) { return _to##SetStatus(aMsg); } \
extern nsresult NS_InitToolbarCoreClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptToolbarCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMToolbarCore_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,224 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsEditorAppCore_h___
#define nsEditorAppCore_h___
//#include "nsAppCores.h"
#include "nscore.h"
#include "nsString.h"
#include "nsISupports.h"
#include "nsIDOMEditorAppCore.h"
#include "nsIDocumentLoaderObserver.h"
#include "nsBaseAppCore.h"
#include "nsINetSupport.h"
#include "nsIStreamObserver.h"
#include "nsVoidArray.h"
#include "nsTextServicesCID.h"
#include "nsISpellChecker.h"
class nsIBrowserWindow;
class nsIWebShell;
class nsIScriptContext;
class nsIDOMWindow;
class nsIURL;
class nsIWebShellWindow;
class nsIPresShell;
class nsIHTMLEditor;
class nsITextEditor;
class nsIOutputStream;
//#define TEXT_EDITOR 1
////////////////////////////////////////////////////////////////////////////////
// nsEditorAppCore:
////////////////////////////////////////////////////////////////////////////////
class nsEditorAppCore : public nsBaseAppCore,
public nsIDOMEditorAppCore,
public nsIDocumentLoaderObserver
{
public:
nsEditorAppCore();
virtual ~nsEditorAppCore();
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD Init(const nsString& aId);
NS_IMETHOD GetId(nsString& aId) { return nsBaseAppCore::GetId(aId); }
NS_IMETHOD SetDocumentCharset(const nsString& aCharset) { return nsBaseAppCore::SetDocumentCharset(aCharset); }
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument);
NS_IMETHOD GetSelectedElement(const nsString& aTagName, nsIDOMElement** aReturn);
NS_IMETHOD CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement** aReturn);
// XXX aReturn in InsertElement is always forced to zero, should be removed
NS_IMETHOD InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection, nsIDOMElement** aReturn);
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
NS_IMETHOD SelectElement(nsIDOMElement* aElement);
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
NS_IMETHOD SetEditorType(const nsString& aEditorType);
NS_IMETHOD SetTextProperty(const nsString& aProp,
const nsString& aAttr,
const nsString& aValue);
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr);
NS_IMETHOD GetTextProperty(const nsString& aProp,
const nsString& aAttr,
const nsString& aValue,
nsString& aFirstHas,
nsString& aAnyHas,
nsString& aAllHas);
NS_IMETHOD SetBackgroundColor(const nsString& aColor);
NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue);
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat);
NS_IMETHOD SetParagraphFormat(const nsString& aParagraphFormat);
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn);
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn);
NS_IMETHOD GetContentsAsText(nsString& aContentsAsText);
NS_IMETHOD GetContentsAsHTML(nsString& aContentsAsHTML);
// can't use overloading in interfaces
NS_IMETHOD GetContentsAsTextStream(nsIOutputStream* aContentsAsText);
NS_IMETHOD GetContentsAsHTMLStream(nsIOutputStream* aContentsAsHTML);
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection);
NS_IMETHOD NewWindow();
NS_IMETHOD Open();
NS_IMETHOD Save();
NS_IMETHOD SaveAs();
NS_IMETHOD CloseWindow();
NS_IMETHOD PrintPreview();
NS_IMETHOD Print();
NS_IMETHOD Exit();
NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn);
NS_IMETHOD Undo();
NS_IMETHOD Redo();
NS_IMETHOD Back();
NS_IMETHOD Forward();
NS_IMETHOD LoadUrl(const nsString& aUrl);
NS_IMETHOD SetToolbarWindow(nsIDOMWindow* aWin);
NS_IMETHOD SetContentWindow(nsIDOMWindow* aWin);
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin);
NS_IMETHOD SetDisableCallback(const nsString& aScript);
NS_IMETHOD SetEnableCallback(const nsString& aScript);
// NS_IMETHOD OutputText(nsString);
NS_IMETHOD Cut();
NS_IMETHOD Copy();
NS_IMETHOD Paste();
NS_IMETHOD PasteAsQuotation();
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCiteString);
NS_IMETHOD SelectAll();
NS_IMETHOD InsertAsQuotation(const nsString& aquotedText);
NS_IMETHOD InsertAsCitedQuotation(const nsString& aquotedText,
const nsString& aCiteString);
NS_IMETHOD InsertText(const nsString& textToInsert);
NS_IMETHOD Find();
NS_IMETHOD FindNext();
// These next two will be replaced with the SetElementProperties
NS_IMETHOD InsertLink();
NS_IMETHOD InsertImage();
NS_IMETHOD InsertList(const nsString& aListType);
NS_IMETHOD Indent(const nsString& aIndent);
NS_IMETHOD Align(const nsString& aAlign);
NS_IMETHOD StartSpellChecking(nsString& aFirstMisspelledWord);
NS_IMETHOD GetNextMisspelledWord(nsString& aNextMisspelledWord);
NS_IMETHOD GetSuggestedWord(nsString& aSuggestedWord);
NS_IMETHOD CheckCurrentWord(const nsString& aSuggestedWord, PRBool* aIsMisspelled);
NS_IMETHOD ReplaceWord(const nsString& aMisspelledWord, const nsString& aReplaceWord, PRBool aAllOccurrences);
NS_IMETHOD IgnoreWordAllOccurrences(const nsString& aWord);
NS_IMETHOD AddWordToDictionary(const nsString& aWord);
NS_IMETHOD RemoveWordFromDictionary(const nsString& aWord);
NS_IMETHOD GetPersonalDictionaryWord(nsString& aSuggestedWord);
NS_IMETHOD CloseSpellChecking();
NS_IMETHOD BeginBatchChanges();
NS_IMETHOD EndBatchChanges();
NS_IMETHOD RunUnitTests();
// nsIDocumentLoaderObserver
NS_IMETHOD OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURL* aURL, const char* aCommand);
NS_IMETHOD OnEndDocumentLoad(nsIDocumentLoader* loader, nsIURL *aUrl, PRInt32 aStatus,
nsIDocumentLoaderObserver * aObserver);
NS_IMETHOD OnStartURLLoad(nsIDocumentLoader* loader, nsIURL* aURL, const char* aContentType,
nsIContentViewer* aViewer);
NS_IMETHOD OnProgressURLLoad(nsIDocumentLoader* loader, nsIURL* aURL, PRUint32 aProgress,
PRUint32 aProgressMax);
NS_IMETHOD OnStatusURLLoad(nsIDocumentLoader* loader, nsIURL* aURL, nsString& aMsg);
NS_IMETHOD OnEndURLLoad(nsIDocumentLoader* loader, nsIURL* aURL, PRInt32 aStatus);
NS_IMETHOD HandleUnknownContentType(nsIDocumentLoader* loader,
nsIURL *aURL,
const char *aContentType,
const char *aCommand );
protected:
nsCOMPtr<nsISpellChecker> mSpellChecker;
nsStringArray mSuggestedWordList;
PRInt32 mSuggestedWordIndex;
NS_IMETHOD DeleteSuggestedWordList();
typedef enum {
ePlainTextEditorType = 1,
eHTMLTextEditorType = 2
} EEditorType;
nsIPresShell* GetPresShellFor(nsIWebShell* aWebShell);
NS_IMETHOD DoEditorMode(nsIWebShell *aWebShell);
NS_IMETHOD ExecuteScript(nsIScriptContext * aContext, const nsString& aScript);
NS_IMETHOD InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
NS_IMETHOD RemoveOneProperty(const nsString& aProp, const nsString& aAttr);
void SetButtonImage(nsIDOMNode * aParentNode, PRInt32 aBtnNum, const nsString &aResName);
NS_IMETHOD CreateWindowWithURL(const char* urlStr);
NS_IMETHOD PrepareDocumentForEditing();
NS_IMETHOD DoFind(PRBool aFindNext);
nsString mEnableScript;
nsString mDisableScript;
nsIScriptContext *mToolbarScriptContext;
nsIScriptContext *mContentScriptContext;
nsIDOMWindow *mToolbarWindow; // weak reference
nsIDOMWindow *mContentWindow; // weak reference
nsIWebShellWindow *mWebShellWin; // weak reference
nsIWebShell *mWebShell; // weak reference
nsIWebShell *mContentAreaWebShell; // weak reference
EEditorType mEditorType;
nsString mEditorTypeString; // string which describes which editor type will be instantiated (lowercased)
nsCOMPtr<nsISupports> mEditor; // this can be either an HTML or plain text (or other?) editor
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
};
#endif // nsEditorAppCore_h___

Просмотреть файл

@ -1,117 +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 "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.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsAppCores.h"
#include "nsEditorAppCoreFactory.h"
#include "nsEditorAppCore.h"
#include "pratom.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
/////////////////////////////////////////////////////////////////////////
// nsEditorAppCoreFactory
/////////////////////////////////////////////////////////////////////////
nsEditorAppCoreFactory::nsEditorAppCoreFactory(void)
{
mRefCnt=0;
IncInstanceCount();
}
nsEditorAppCoreFactory::~nsEditorAppCoreFactory(void)
{
DecInstanceCount();
}
NS_IMETHODIMP
nsEditorAppCoreFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
{
if (aInstancePtr == NULL)
{
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kISupportsIID) )
{
*aInstancePtr = (void*) this;
}
else if ( aIID.Equals(kIFactoryIID) )
{
*aInstancePtr = (void*) this;
}
if (aInstancePtr == NULL)
{
return NS_ERROR_NO_INTERFACE;
}
AddRef();
return NS_OK;
}
NS_IMPL_ADDREF(nsEditorAppCoreFactory)
NS_IMPL_RELEASE(nsEditorAppCoreFactory)
NS_IMETHODIMP
nsEditorAppCoreFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
if (aResult == NULL)
{
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
/* do I have to use iSupports? */
nsEditorAppCore *inst = new nsEditorAppCore();
if (inst == NULL)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = inst->QueryInterface(aIID, aResult);
if (result != NS_OK)
delete inst;
return result;
}
NS_IMETHODIMP
nsEditorAppCoreFactory::LockFactory(PRBool aLock)
{
if (aLock)
IncLockCount();
else
DecLockCount();
return NS_OK;
}

Просмотреть файл

@ -1,49 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsEditorAppCoreFactory_h___
#define nsEditorAppCoreFactory_h___
//#include "nscore.h"
//#include "nsString.h"
#include "nsIFactory.h"
#include "nsISupports.h"
////////////////////////////////////////////////////////////////////////////////
// nsEditorAppCoreFactory:
////////////////////////////////////////////////////////////////////////////////
class nsEditorAppCoreFactory : public nsIFactory
{
public:
nsEditorAppCoreFactory();
virtual ~nsEditorAppCoreFactory();
PRBool CanUnload(void);
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
};
#endif // nsEditorAppCoreFactory_h___

Просмотреть файл

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsEditorInterfaces_h__
#define nsEditorInterfaces_h__
#include "nsIDOMEvent.h"
#include "nsIDOMKeyListener.h"
#include "nsIDOMMouseListener.h"
//nsIDOMKeyListener interface
class nsEditorKeyListener : public nsIDOMKeyListener {
public:
nsEditorKeyListener();
virtual ~nsEditorKeyListener();
NS_DECL_ISUPPORTS
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
public:
virtual nsresult KeyDown(nsIDOMEvent* aKeyEvent);
virtual nsresult KeyUp(nsIDOMEvent* aKeyEvent);
virtual nsresult KeyPress(nsIDOMEvent* aKeyEvent);
private:
virtual nsresult GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar);
};
//nsIDOMMouseListener interface
class nsEditorMouseListener : public nsIDOMMouseListener {
public:
nsEditorMouseListener();
virtual ~nsEditorMouseListener();
NS_DECL_ISUPPORTS
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
public:
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent);
};
extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult);
extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult);
#endif //nsEditorInterfaces_h__

Просмотреть файл

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsEditorMode.h"
#include "nsString.h"
#include "nsIDOMDocument.h"
#include "nsIHTMLEditor.h"
#include "nsEditorCID.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
static nsIHTMLEditor *gEditor;
static NS_DEFINE_IID(kIHTMLEditorIID, NS_IHTMLEDITOR_IID);
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID); // Still needed to register factory
//Don't think we these - switched to using HTMLEditor
//static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID);
#ifdef XP_PC
#define EDITOR_DLL "ender.dll"
#else
#ifdef XP_MAC
#define EDITOR_DLL "ENDER_DLL"
#else // XP_UNIX
#define EDITOR_DLL "libender"MOZ_DLL_SUFFIX
#endif
#endif
nsIHTMLEditor * GetEditor()
{
return gEditor;
}
nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShell)
{
nsresult result = NS_OK;
static needsInit=PR_TRUE;
if (gEditor)
gEditor=nsnull;
NS_ASSERTION(nsnull!=aDOMDocument, "null document");
NS_ASSERTION(nsnull!=aPresShell, "null presentation shell");
if ((nsnull==aDOMDocument) || (nsnull==aPresShell))
return NS_ERROR_NULL_POINTER;
/*
nsISupports *isup = nsnull;
result = nsServiceManager::GetService(kHTMLEditorCID,
kIHTMLEditorIID, &isup);
*/
result = nsComponentManager::CreateInstance(kHTMLEditorCID,
nsnull,
kIHTMLEditorIID, (void **)&gEditor);
if (NS_FAILED(result))
return result;
if (!gEditor) {
return NS_ERROR_OUT_OF_MEMORY;
}
return gEditor->Init(aDOMDocument, aPresShell);
}

Просмотреть файл

@ -1,31 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsEditorMode_h__
#define nsEditorMode_h__
#include "nsError.h"
class nsIDOMDocument;
class nsIPresShell;
class nsIHTMLEditor;
extern nsresult NS_InitEditorMode(nsIDOMDocument * aDOMDocument, nsIPresShell* aPresShell);
extern nsIHTMLEditor * GetEditor();
#endif //nsEditorMode_h__

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,396 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMToolbarCore.h"
#include "nsIDOMWindow.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsIComponentManager.h"
#include "nsDOMCID.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIToolbarCoreIID, NS_IDOMTOOLBARCORE_IID);
static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID);
NS_DEF_PTR(nsIDOMToolbarCore);
NS_DEF_PTR(nsIDOMWindow);
/***********************************************************************/
//
// ToolbarCore Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetToolbarCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMToolbarCore *a = (nsIDOMToolbarCore*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// ToolbarCore Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetToolbarCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMToolbarCore *a = (nsIDOMToolbarCore*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// ToolbarCore finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeToolbarCore(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// ToolbarCore enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateToolbarCore(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// ToolbarCore resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveToolbarCore(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
//
// Native method SetWindow
//
PR_STATIC_CALLBACK(JSBool)
ToolbarCoreSetWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMToolbarCore *nativeThis = (nsIDOMToolbarCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMWindowPtr b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0,
kIWindowIID,
"Window",
cx,
argv[0])) {
return JS_FALSE;
}
if (NS_OK != nativeThis->SetWindow(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function SetWindow requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method SetStatus
//
PR_STATIC_CALLBACK(JSBool)
ToolbarCoreSetStatus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMToolbarCore *nativeThis = (nsIDOMToolbarCore*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (NS_OK != nativeThis->SetStatus(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function SetStatus requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for ToolbarCore
//
JSClass ToolbarCoreClass = {
"ToolbarCore",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetToolbarCoreProperty,
SetToolbarCoreProperty,
EnumerateToolbarCore,
ResolveToolbarCore,
JS_ConvertStub,
FinalizeToolbarCore
};
//
// ToolbarCore class properties
//
static JSPropertySpec ToolbarCoreProperties[] =
{
{0}
};
//
// ToolbarCore class methods
//
static JSFunctionSpec ToolbarCoreMethods[] =
{
{"SetWindow", ToolbarCoreSetWindow, 1},
{"SetStatus", ToolbarCoreSetStatus, 1},
{0}
};
//
// ToolbarCore constructor
//
PR_STATIC_CALLBACK(JSBool)
ToolbarCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsresult result;
nsIID classID;
nsIScriptContext* context = (nsIScriptContext*)JS_GetContextPrivate(cx);
nsIScriptNameSpaceManager* manager;
nsIDOMToolbarCore *nativeThis;
nsIScriptObjectOwner *owner = nsnull;
static NS_DEFINE_IID(kIDOMToolbarCoreIID, NS_IDOMTOOLBARCORE_IID);
result = context->GetNameSpaceManager(&manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = manager->LookupName("ToolbarCore", PR_TRUE, classID);
NS_RELEASE(manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = nsComponentManager::CreateInstance(classID,
nsnull,
kIDOMToolbarCoreIID,
(void **)&nativeThis);
if (NS_OK != result) {
return JS_FALSE;
}
// XXX We should be calling Init() on the instance
result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner);
if (NS_OK != result) {
NS_RELEASE(nativeThis);
return JS_FALSE;
}
owner->SetScriptObject((void *)obj);
JS_SetPrivate(cx, obj, nativeThis);
NS_RELEASE(owner);
return JS_TRUE;
}
//
// ToolbarCore class initialization
//
nsresult NS_InitToolbarCoreClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "ToolbarCore", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitBaseAppCoreClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&ToolbarCoreClass, // JSClass
ToolbarCore, // JSNative ctor
0, // ctor args
ToolbarCoreProperties, // proto props
ToolbarCoreMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new ToolbarCore JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptToolbarCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptToolbarCore");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMToolbarCore *aToolbarCore;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitToolbarCoreClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIToolbarCoreIID, (void **)&aToolbarCore);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &ToolbarCoreClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aToolbarCore);
}
else {
NS_RELEASE(aToolbarCore);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -1,178 +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 "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.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsToolbarCore.h"
#include "nsIBrowserWindow.h"
#include "nsIComponentManager.h"
#include "nsAppCores.h"
#include "nsAppCoresCIDs.h"
#include "nsAppCoresManager.h"
#include "nsCOMPtr.h"
#include "nsIWebShell.h"
#include "nsIWebShellWindow.h"
#include "nsIScriptContext.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIDOMWindow.h"
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDOMCharacterData.h"
// Globals
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIToolbarCoreIID, NS_IDOMTOOLBARCORE_IID);
static NS_DEFINE_IID(kIDOMDocumentIID, nsIDOMDocument::GetIID());
static NS_DEFINE_IID(kIDocumentIID, nsIDocument::GetIID());
static NS_DEFINE_IID(kIDOMCharacterDataIID, nsIDOMCharacterData::GetIID());
static NS_DEFINE_IID(kToolbarCoreCID, NS_TOOLBARCORE_CID);
/////////////////////////////////////////////////////////////////////////
// nsToolbarCore
/////////////////////////////////////////////////////////////////////////
nsToolbarCore::nsToolbarCore()
{
printf("Created nsToolbarCore\n");
mWindow = nsnull;
mStatusText = nsnull;
IncInstanceCount();
NS_INIT_REFCNT();
}
nsToolbarCore::~nsToolbarCore()
{
NS_IF_RELEASE(mWindow);
NS_IF_RELEASE(mStatusText);
DecInstanceCount();
}
NS_IMPL_ADDREF(nsToolbarCore)
NS_IMPL_RELEASE(nsToolbarCore)
NS_IMETHODIMP
nsToolbarCore::QueryInterface(REFNSIID aIID,void** aInstancePtr)
{
if (aInstancePtr == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kIToolbarCoreIID) ) {
*aInstancePtr = (void*) ((nsIDOMToolbarCore*)this);
AddRef();
return NS_OK;
}
return nsBaseAppCore::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
nsToolbarCore::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
nsresult res = NS_OK;
if (nsnull == mScriptObject)
{
res = NS_NewScriptToolbarCore(aContext,
(nsISupports *)(nsIDOMToolbarCore*)this,
nsnull,
&mScriptObject);
}
*aScriptObject = mScriptObject;
return res;
}
NS_IMETHODIMP
nsToolbarCore::Init(const nsString& aId)
{
nsBaseAppCore::Init(aId);
nsAppCoresManager* sdm = new nsAppCoresManager();
sdm->Add((nsIDOMBaseAppCore *)(nsBaseAppCore *)this);
delete sdm;
return NS_OK;
}
NS_IMETHODIMP
nsToolbarCore::SetStatus(const nsString& aMsg)
{
/* if (nsnull == mStatusText) {
nsIDOMDocument * domDoc;
mWindow->GetDocument(&domDoc);
if (!domDoc)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> parent(GetParentNodeFromDOMDoc(domDoc));
if (!parent)
return NS_ERROR_FAILURE;
PRInt32 count = 0;
nsCOMPtr<nsIDOMNode> statusNode(FindNamedDOMNode(nsAutoString("#text"), parent, count, 7));
if (!statusNode)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCharacterData> charData(statusNode);
if (!charData)
return NS_ERROR_FAILURE;
mStatusText = charData;
mStatusText->SetData(nsAutoString("Ready.....")); // <<====== EVIL HARD-CODED STRING.
NS_RELEASE(domDoc);
}
mStatusText->SetData(aMsg); */
return NS_OK;
}
NS_IMETHODIMP
nsToolbarCore::SetWebShellWindow(nsIDOMWindow* aWin)
{
mWindow = aWin;
NS_ADDREF(aWin);
return NS_OK;
}
NS_IMETHODIMP
nsToolbarCore::SetWindow(nsIDOMWindow* aWin)
{
mWindow = aWin;
NS_ADDREF(aWin);
return NS_OK;
}

Просмотреть файл

@ -1,67 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsToolbarCorePrivate_h___
#define nsToolbarCorePrivate_h___
//#include "nsAppCores.h"
#include "nscore.h"
#include "nsString.h"
#include "nsISupports.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMToolbarCore.h"
#include "nsBaseAppCore.h"
class nsIBrowserWindow;
class nsIWebShell;
class nsIScriptContext;
class nsIDOMWindow;
class nsIDOMDocument;
class nsIDOMCharacterData;
////////////////////////////////////////////////////////////////////////////////
// nsToolbarCore:
////////////////////////////////////////////////////////////////////////////////
class nsToolbarCore : public nsBaseAppCore,
public nsIDOMToolbarCore
{
public:
nsToolbarCore();
virtual ~nsToolbarCore();
NS_DECL_ISUPPORTS
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD Init(const nsString& aId);
NS_IMETHOD GetId(nsString& aId) { return nsBaseAppCore::GetId(aId); }
NS_IMETHOD SetDocumentCharset(const nsString& aCharset) { return nsBaseAppCore::SetDocumentCharset(aCharset); }
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
NS_IMETHOD SetWebShellWindow(nsIDOMWindow* aWin);
NS_IMETHOD SetStatus(const nsString& aMsg);
private:
nsIDOMWindow *mWindow;
nsIDOMCharacterData *mStatusText;
};
#endif // nsToolbarCore_h___

Просмотреть файл

@ -1,116 +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 "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.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsAppCores.h"
#include "nsToolbarCoreFactory.h"
#include "nsToolbarCore.h"
#include "pratom.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
/////////////////////////////////////////////////////////////////////////
// nsToolbarCoreFactory
/////////////////////////////////////////////////////////////////////////
nsToolbarCoreFactory::nsToolbarCoreFactory(void)
{
mRefCnt=0;
IncInstanceCount();
}
nsToolbarCoreFactory::~nsToolbarCoreFactory(void)
{
DecInstanceCount();
}
NS_IMETHODIMP
nsToolbarCoreFactory::QueryInterface(REFNSIID aIID,void** aInstancePtr)
{
if (aInstancePtr == NULL)
{
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aInstancePtr = NULL;
if ( aIID.Equals(kISupportsIID) )
{
*aInstancePtr = (void*) this;
}
else if ( aIID.Equals(kIFactoryIID) )
{
*aInstancePtr = (void*) this;
}
if (aInstancePtr == NULL)
{
return NS_ERROR_NO_INTERFACE;
}
AddRef();
return NS_OK;
}
NS_IMPL_ADDREF(nsToolbarCoreFactory)
NS_IMPL_RELEASE(nsToolbarCoreFactory)
NS_IMETHODIMP
nsToolbarCoreFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
if (aResult == NULL)
{
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
/* do I have to use iSupports? */
nsToolbarCore *inst = new nsToolbarCore();
if (inst == NULL)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = inst->QueryInterface(aIID, aResult);
if (result != NS_OK)
delete inst;
return result;
}
NS_IMETHODIMP
nsToolbarCoreFactory::LockFactory(PRBool aLock)
{
if (aLock)
IncLockCount();
else
DecLockCount();
return NS_OK;
}

Просмотреть файл

@ -1,47 +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://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsToolbarCoreFactory_h___
#define nsToolbarCoreFactory_h___
#include "nsIFactory.h"
#include "nsISupports.h"
////////////////////////////////////////////////////////////////////////////////
// nsToolbarCoreFactory:
////////////////////////////////////////////////////////////////////////////////
class nsToolbarCoreFactory : public nsIFactory
{
public:
nsToolbarCoreFactory();
virtual ~nsToolbarCoreFactory();
PRBool CanUnload(void);
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstance(nsISupports *aOuter,
REFNSIID aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
};
#endif // nsToolbarCoreFactory_h___