mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
just broke the mac build. I will tell jfrancis!
This commit is contained in:
parent
2356d797d9
commit
63135b6376
@ -29,6 +29,7 @@ LIBRARY_NAME = ender
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
editorInterfaces.cpp \
|
||||
nsEditFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
MODULE = editor
|
||||
|
@ -22,6 +22,103 @@
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsEditFactory.h"
|
||||
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
||||
//monitor for the editor
|
||||
|
||||
|
||||
|
||||
PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at the same time for the FIRST time, we are screwed
|
||||
{
|
||||
static PRMonitor *ns_editlock = nsnull;
|
||||
if (nsnull == ns_editlock)
|
||||
{
|
||||
ns_editlock = (PRMonitor *)1; //how long will the next line take? lets cut down on the chance of reentrancy
|
||||
ns_editlock = PR_NewMonitor();
|
||||
}
|
||||
else if ((PRMonitor *)1 == ns_editlock)
|
||||
return getEditorMonitor();
|
||||
return ns_editlock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
we must be good providers of factories ect. this is where to put ALL editor exports
|
||||
*/
|
||||
//BEGIN EXPORTS
|
||||
// dont ask!
|
||||
#ifdef MAC_STATIC
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_LAYOUT_DLL(const nsCID &aClass,
|
||||
nsIFactory **aFactory)
|
||||
#elif defined(MAC_SHARED)
|
||||
#pragma export on
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory
|
||||
**aFactory)
|
||||
#pragma export off
|
||||
// for non-mac platforms:
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory
|
||||
**aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = nsnull;
|
||||
|
||||
if (aClass.Equals(kIEditFactoryIID)) {
|
||||
return getEditFactory(aFactory);
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
{
|
||||
return PR_FALSE; //I have no idea. I am copying code here
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kIEditFactoryIID, path,
|
||||
PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
|
||||
|
||||
//END EXPORTS
|
||||
|
||||
|
||||
//class implementations are in order they are declared in editor.h
|
||||
|
||||
@ -32,21 +129,13 @@ nsEditor::nsEditor()
|
||||
}
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
|
||||
|
||||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
//the autopointers will clear themselves up.
|
||||
//but we need to also remove the listeners or we have a leak
|
||||
COM_auto_ptr<nsIDOMEventReceiver> erP;
|
||||
nsresult t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, func_AddRefs(erP));
|
||||
nsresult t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, getter_AddRefs(erP));
|
||||
if (NS_SUCCEEDED( t_result ))
|
||||
{
|
||||
erP->RemoveEventListener(mKeyListenerP, kIDOMKeyListenerIID);
|
||||
@ -73,8 +162,6 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
@ -106,13 +193,13 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
|
||||
mDomInterfaceP = aDomInterface;
|
||||
|
||||
nsresult t_result = NS_NewEditorKeyListener(func_AddRefs(mKeyListenerP), this);
|
||||
nsresult t_result = NS_NewEditorKeyListener(getter_AddRefs(mKeyListenerP), this);
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
NS_NOTREACHED("Init Failed");
|
||||
return t_result;
|
||||
}
|
||||
t_result = NS_NewEditorMouseListener(func_AddRefs(mMouseListenerP), this);
|
||||
t_result = NS_NewEditorMouseListener(getter_AddRefs(mMouseListenerP), this);
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
mKeyListenerP = 0; //dont keep the key listener if the mouse listener fails.
|
||||
@ -120,7 +207,7 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
return t_result;
|
||||
}
|
||||
COM_auto_ptr<nsIDOMEventReceiver> erP;
|
||||
t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, func_AddRefs(erP));
|
||||
t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, getter_AddRefs(erP));
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
mKeyListenerP = 0;
|
||||
@ -134,10 +221,11 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
/*
|
||||
now to handle selection
|
||||
*/
|
||||
/*
|
||||
COM_auto_ptr<nsIDocument> document;
|
||||
if (NS_SUCCEEDED(t_result = mDomInterfaceP->QueryInterface(kIDocumentIID, func_AddRefs(document))))
|
||||
if (NS_SUCCEEDED(t_result = mDomInterfaceP->QueryInterface(kIDocumentIID, getter_AddRefs(document))))
|
||||
{
|
||||
if (!NS_SUCCEEDED(t_result = document->GetSelection(*func_AddRefs(mSelectionP))))
|
||||
if (!NS_SUCCEEDED(t_result = document->GetSelection(*getter_AddRefs(mSelectionP))))
|
||||
{
|
||||
NS_NOTREACHED("query interface");
|
||||
return t_result;
|
||||
@ -148,7 +236,7 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
NS_NOTREACHED("query interface");
|
||||
return t_result;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -184,6 +272,8 @@ nsEditor::Commit(PRBool aCtrlKey)
|
||||
{
|
||||
if (aCtrlKey)
|
||||
{
|
||||
// nsSelectionRange range;
|
||||
//mSelectionP->GetRange(&range);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -229,9 +319,9 @@ nsEditor::AppendText(nsString *aStr)
|
||||
COM_auto_ptr<nsIDOMText> text;
|
||||
if (!aStr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (NS_SUCCEEDED(GetCurrentNode(func_AddRefs(currentNode))) &&
|
||||
NS_SUCCEEDED(GetFirstTextNode(currentNode,func_AddRefs(textNode))) &&
|
||||
NS_SUCCEEDED(textNode->QueryInterface(kIDOMTextIID, func_AddRefs(text)))) {
|
||||
if (NS_SUCCEEDED(GetCurrentNode(getter_AddRefs(currentNode))) &&
|
||||
NS_SUCCEEDED(GetFirstTextNode(currentNode,getter_AddRefs(textNode))) &&
|
||||
NS_SUCCEEDED(textNode->QueryInterface(kIDOMTextIID, getter_AddRefs(text)))) {
|
||||
text->AppendData(*aStr);
|
||||
}
|
||||
|
||||
@ -248,7 +338,7 @@ nsEditor::GetCurrentNode(nsIDOMNode ** aNode)
|
||||
/* If no node set, get first text node */
|
||||
COM_auto_ptr<nsIDOMElement> docNode;
|
||||
|
||||
if (NS_SUCCEEDED(mDomInterfaceP->GetDocumentElement(func_AddRefs(docNode))))
|
||||
if (NS_SUCCEEDED(mDomInterfaceP->GetDocumentElement(getter_AddRefs(docNode))))
|
||||
{
|
||||
return docNode->QueryInterface(kIDOMNodeIID,(void **) aNode);
|
||||
}
|
||||
@ -279,14 +369,14 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
|
||||
COM_auto_ptr<nsIDOMNode> node1;
|
||||
COM_auto_ptr<nsIDOMNode> node2;
|
||||
|
||||
if (!NS_SUCCEEDED(aNode->GetFirstChild(func_AddRefs(node1))))
|
||||
if (!NS_SUCCEEDED(aNode->GetFirstChild(getter_AddRefs(node1))))
|
||||
{
|
||||
NS_NOTREACHED("GetFirstTextNode Failed");
|
||||
}
|
||||
while(!answer && node1)
|
||||
{
|
||||
GetFirstTextNode(node1, func_AddRefs(answer));
|
||||
node1->GetNextSibling(func_AddRefs(node2));
|
||||
GetFirstTextNode(node1, getter_AddRefs(answer));
|
||||
node1->GetNextSibling(getter_AddRefs(node2));
|
||||
node1 = node2;
|
||||
}
|
||||
}
|
||||
@ -309,30 +399,3 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
|
||||
|
||||
|
||||
|
||||
//BEGIN FACTORY METHODS
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
NS_InitEditor(nsIEditor ** aInstancePtrResult, nsIDOMDocument *aDomDoc)
|
||||
{
|
||||
if (!aInstancePtrResult || !aDomDoc)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsEditor* editor = new nsEditor();
|
||||
if (NULL == editor) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult result = editor->Init(aDomDoc);
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
|
||||
return editor->QueryInterface(kIEditorIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//END FACTORY METHODS
|
||||
|
@ -20,7 +20,12 @@
|
||||
#include "nsIContextLoader.h"
|
||||
#include "COM_auto_ptr.h"
|
||||
#include "editorInterfaces.h"
|
||||
#include "nsISelection.h"
|
||||
//#include "nsISelection.h"
|
||||
|
||||
|
||||
//This is the monitor for the editor.
|
||||
PRMonitor *getEditorMonitor();
|
||||
|
||||
|
||||
/** implementation of an editor object. it will be the controler/focal point
|
||||
* for the main editor services. i.e. the GUIControler, publishing, transaction
|
||||
@ -33,7 +38,7 @@ private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
COM_auto_ptr<nsIDOMEventListener> mKeyListenerP;
|
||||
COM_auto_ptr<nsIDOMEventListener> mMouseListenerP;
|
||||
COM_auto_ptr<nsISelection> mSelectionP;
|
||||
// COM_auto_ptr<nsISelection> mSelectionP;
|
||||
public:
|
||||
/** The default constructor. This should suffice. the setting of the interfaces is done
|
||||
* after the construction of the editor class.
|
||||
|
@ -220,7 +220,7 @@ nsresult
|
||||
nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
COM_auto_ptr<nsIDOMNode> target;
|
||||
if (NS_OK == aMouseEvent->GetTarget(func_AddRefs(target))) {
|
||||
if (NS_OK == aMouseEvent->GetTarget(getter_AddRefs(target))) {
|
||||
// nsSetCurrentNode(aTarget);
|
||||
}
|
||||
//Should not be error. Need a new way to do return values
|
||||
|
@ -22,11 +22,13 @@ LIBRARY_NAME=ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
editorInterfaces.cpp \
|
||||
editorInterfaces.cpp \
|
||||
nsEditFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\editor.obj \
|
||||
.\$(OBJDIR)\nsEditFactory.obj \
|
||||
.\$(OBJDIR)\editorInterfaces.obj \
|
||||
$(NULL)
|
||||
|
||||
|
135
editor/base/nsEditFactory.cpp
Normal file
135
editor/base/nsEditFactory.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nsEditFactory.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "editor.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID);
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
getEditFactory(nsIFactory **aFactory)
|
||||
{
|
||||
static COM_auto_ptr<nsIFactory> g_pNSIFactory;
|
||||
PR_EnterMonitor(getEditorMonitor());
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
if (!g_pNSIFactory)
|
||||
{
|
||||
nsEditFactory *factory = new nsEditFactory(getter_AddRefs(g_pNSIFactory));
|
||||
*aFactory = g_pNSIFactory;
|
||||
}
|
||||
else
|
||||
result = g_pNSIFactory->QueryInterface(kIFactoryIID, (void **)aFactory);
|
||||
PR_ExitMonitor(getEditorMonitor());
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
NS_NOTREACHED("!nsEditor");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIFactoryIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditFactory)
|
||||
NS_IMPL_RELEASE(nsEditFactory)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsEditor *editor = NULL;
|
||||
*aResult = NULL;
|
||||
|
||||
if (aOuter && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
editor = new nsEditor();
|
||||
if (editor->QueryInterface(aIID,
|
||||
(void**)aResult) != NS_OK) {
|
||||
// then we're trying get a interface other than nsISupports and
|
||||
// nsIEditor
|
||||
delete editor;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsEditFactory:
|
||||
|
||||
nsEditFactory::nsEditFactory(nsIFactory **aFactory)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
nsresult err = NS_OK;
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
if (aFactory)
|
||||
{
|
||||
err = this->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
//this is to be sure we have at least one
|
||||
//reference to the factory
|
||||
if ( (err == NS_OK) && (*aFactory != NULL) )
|
||||
{
|
||||
nsRepository::RegisterFactory(kIEditFactoryIID, *aFactory,
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsEditFactory::~nsEditFactory()
|
||||
{
|
||||
nsRepository::UnregisterFactory(kIEditFactoryIID, (nsIFactory *)this); //we are out of ref counts anyway
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
63
editor/base/nsEditFactory.h
Normal file
63
editor/base/nsEditFactory.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- 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 nsIEditFactory_h___
|
||||
#define nsIEditFactory_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
class nsEditor;
|
||||
|
||||
/*
|
||||
EditFactory that can make an editor
|
||||
*/
|
||||
|
||||
/**
|
||||
* This supplies the neccessary entrance to the edit module. it will return any
|
||||
* instantiations that we need.
|
||||
*/
|
||||
class nsEditFactory;
|
||||
|
||||
nsresult getEditFactory(nsIFactory **);
|
||||
|
||||
class nsEditFactory : public nsIFactory {
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports and AggregatedQueryInterface:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_IMETHOD
|
||||
CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
LockFactory(PRBool aLock);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsEditFactory:
|
||||
|
||||
virtual ~nsEditFactory(void);
|
||||
private:
|
||||
nsEditFactory(nsIFactory **aFactory); //will fill the aFactory with the result from queryinterface
|
||||
friend nsresult getEditFactory(nsIFactory **);
|
||||
};
|
||||
|
||||
#endif //nsIEditFactory_h___
|
@ -29,6 +29,7 @@ LIBRARY_NAME = ender
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
editorInterfaces.cpp \
|
||||
nsEditFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
MODULE = editor
|
||||
|
@ -22,6 +22,103 @@
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsEditFactory.h"
|
||||
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
||||
//monitor for the editor
|
||||
|
||||
|
||||
|
||||
PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at the same time for the FIRST time, we are screwed
|
||||
{
|
||||
static PRMonitor *ns_editlock = nsnull;
|
||||
if (nsnull == ns_editlock)
|
||||
{
|
||||
ns_editlock = (PRMonitor *)1; //how long will the next line take? lets cut down on the chance of reentrancy
|
||||
ns_editlock = PR_NewMonitor();
|
||||
}
|
||||
else if ((PRMonitor *)1 == ns_editlock)
|
||||
return getEditorMonitor();
|
||||
return ns_editlock;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
we must be good providers of factories ect. this is where to put ALL editor exports
|
||||
*/
|
||||
//BEGIN EXPORTS
|
||||
// dont ask!
|
||||
#ifdef MAC_STATIC
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_LAYOUT_DLL(const nsCID &aClass,
|
||||
nsIFactory **aFactory)
|
||||
#elif defined(MAC_SHARED)
|
||||
#pragma export on
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory
|
||||
**aFactory)
|
||||
#pragma export off
|
||||
// for non-mac platforms:
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory
|
||||
**aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = nsnull;
|
||||
|
||||
if (aClass.Equals(kIEditFactoryIID)) {
|
||||
return getEditFactory(aFactory);
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
{
|
||||
return PR_FALSE; //I have no idea. I am copying code here
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kIEditFactoryIID, path,
|
||||
PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
|
||||
|
||||
//END EXPORTS
|
||||
|
||||
|
||||
//class implementations are in order they are declared in editor.h
|
||||
|
||||
@ -32,21 +129,13 @@ nsEditor::nsEditor()
|
||||
}
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
|
||||
|
||||
|
||||
nsEditor::~nsEditor()
|
||||
{
|
||||
//the autopointers will clear themselves up.
|
||||
//but we need to also remove the listeners or we have a leak
|
||||
COM_auto_ptr<nsIDOMEventReceiver> erP;
|
||||
nsresult t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, func_AddRefs(erP));
|
||||
nsresult t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, getter_AddRefs(erP));
|
||||
if (NS_SUCCEEDED( t_result ))
|
||||
{
|
||||
erP->RemoveEventListener(mKeyListenerP, kIDOMKeyListenerIID);
|
||||
@ -73,8 +162,6 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
@ -106,13 +193,13 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
|
||||
mDomInterfaceP = aDomInterface;
|
||||
|
||||
nsresult t_result = NS_NewEditorKeyListener(func_AddRefs(mKeyListenerP), this);
|
||||
nsresult t_result = NS_NewEditorKeyListener(getter_AddRefs(mKeyListenerP), this);
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
NS_NOTREACHED("Init Failed");
|
||||
return t_result;
|
||||
}
|
||||
t_result = NS_NewEditorMouseListener(func_AddRefs(mMouseListenerP), this);
|
||||
t_result = NS_NewEditorMouseListener(getter_AddRefs(mMouseListenerP), this);
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
mKeyListenerP = 0; //dont keep the key listener if the mouse listener fails.
|
||||
@ -120,7 +207,7 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
return t_result;
|
||||
}
|
||||
COM_auto_ptr<nsIDOMEventReceiver> erP;
|
||||
t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, func_AddRefs(erP));
|
||||
t_result = mDomInterfaceP->QueryInterface(kIDOMEventReceiverIID, getter_AddRefs(erP));
|
||||
if (NS_OK != t_result)
|
||||
{
|
||||
mKeyListenerP = 0;
|
||||
@ -134,10 +221,11 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
/*
|
||||
now to handle selection
|
||||
*/
|
||||
/*
|
||||
COM_auto_ptr<nsIDocument> document;
|
||||
if (NS_SUCCEEDED(t_result = mDomInterfaceP->QueryInterface(kIDocumentIID, func_AddRefs(document))))
|
||||
if (NS_SUCCEEDED(t_result = mDomInterfaceP->QueryInterface(kIDocumentIID, getter_AddRefs(document))))
|
||||
{
|
||||
if (!NS_SUCCEEDED(t_result = document->GetSelection(*func_AddRefs(mSelectionP))))
|
||||
if (!NS_SUCCEEDED(t_result = document->GetSelection(*getter_AddRefs(mSelectionP))))
|
||||
{
|
||||
NS_NOTREACHED("query interface");
|
||||
return t_result;
|
||||
@ -148,7 +236,7 @@ nsEditor::Init(nsIDOMDocument *aDomInterface)
|
||||
NS_NOTREACHED("query interface");
|
||||
return t_result;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -184,6 +272,8 @@ nsEditor::Commit(PRBool aCtrlKey)
|
||||
{
|
||||
if (aCtrlKey)
|
||||
{
|
||||
// nsSelectionRange range;
|
||||
//mSelectionP->GetRange(&range);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -229,9 +319,9 @@ nsEditor::AppendText(nsString *aStr)
|
||||
COM_auto_ptr<nsIDOMText> text;
|
||||
if (!aStr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (NS_SUCCEEDED(GetCurrentNode(func_AddRefs(currentNode))) &&
|
||||
NS_SUCCEEDED(GetFirstTextNode(currentNode,func_AddRefs(textNode))) &&
|
||||
NS_SUCCEEDED(textNode->QueryInterface(kIDOMTextIID, func_AddRefs(text)))) {
|
||||
if (NS_SUCCEEDED(GetCurrentNode(getter_AddRefs(currentNode))) &&
|
||||
NS_SUCCEEDED(GetFirstTextNode(currentNode,getter_AddRefs(textNode))) &&
|
||||
NS_SUCCEEDED(textNode->QueryInterface(kIDOMTextIID, getter_AddRefs(text)))) {
|
||||
text->AppendData(*aStr);
|
||||
}
|
||||
|
||||
@ -248,7 +338,7 @@ nsEditor::GetCurrentNode(nsIDOMNode ** aNode)
|
||||
/* If no node set, get first text node */
|
||||
COM_auto_ptr<nsIDOMElement> docNode;
|
||||
|
||||
if (NS_SUCCEEDED(mDomInterfaceP->GetDocumentElement(func_AddRefs(docNode))))
|
||||
if (NS_SUCCEEDED(mDomInterfaceP->GetDocumentElement(getter_AddRefs(docNode))))
|
||||
{
|
||||
return docNode->QueryInterface(kIDOMNodeIID,(void **) aNode);
|
||||
}
|
||||
@ -279,14 +369,14 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
|
||||
COM_auto_ptr<nsIDOMNode> node1;
|
||||
COM_auto_ptr<nsIDOMNode> node2;
|
||||
|
||||
if (!NS_SUCCEEDED(aNode->GetFirstChild(func_AddRefs(node1))))
|
||||
if (!NS_SUCCEEDED(aNode->GetFirstChild(getter_AddRefs(node1))))
|
||||
{
|
||||
NS_NOTREACHED("GetFirstTextNode Failed");
|
||||
}
|
||||
while(!answer && node1)
|
||||
{
|
||||
GetFirstTextNode(node1, func_AddRefs(answer));
|
||||
node1->GetNextSibling(func_AddRefs(node2));
|
||||
GetFirstTextNode(node1, getter_AddRefs(answer));
|
||||
node1->GetNextSibling(getter_AddRefs(node2));
|
||||
node1 = node2;
|
||||
}
|
||||
}
|
||||
@ -309,30 +399,3 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
|
||||
|
||||
|
||||
|
||||
//BEGIN FACTORY METHODS
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
NS_InitEditor(nsIEditor ** aInstancePtrResult, nsIDOMDocument *aDomDoc)
|
||||
{
|
||||
if (!aInstancePtrResult || !aDomDoc)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsEditor* editor = new nsEditor();
|
||||
if (NULL == editor) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult result = editor->Init(aDomDoc);
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
|
||||
return editor->QueryInterface(kIEditorIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//END FACTORY METHODS
|
||||
|
@ -20,7 +20,12 @@
|
||||
#include "nsIContextLoader.h"
|
||||
#include "COM_auto_ptr.h"
|
||||
#include "editorInterfaces.h"
|
||||
#include "nsISelection.h"
|
||||
//#include "nsISelection.h"
|
||||
|
||||
|
||||
//This is the monitor for the editor.
|
||||
PRMonitor *getEditorMonitor();
|
||||
|
||||
|
||||
/** implementation of an editor object. it will be the controler/focal point
|
||||
* for the main editor services. i.e. the GUIControler, publishing, transaction
|
||||
@ -33,7 +38,7 @@ private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
COM_auto_ptr<nsIDOMEventListener> mKeyListenerP;
|
||||
COM_auto_ptr<nsIDOMEventListener> mMouseListenerP;
|
||||
COM_auto_ptr<nsISelection> mSelectionP;
|
||||
// COM_auto_ptr<nsISelection> mSelectionP;
|
||||
public:
|
||||
/** The default constructor. This should suffice. the setting of the interfaces is done
|
||||
* after the construction of the editor class.
|
||||
|
@ -220,7 +220,7 @@ nsresult
|
||||
nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
COM_auto_ptr<nsIDOMNode> target;
|
||||
if (NS_OK == aMouseEvent->GetTarget(func_AddRefs(target))) {
|
||||
if (NS_OK == aMouseEvent->GetTarget(getter_AddRefs(target))) {
|
||||
// nsSetCurrentNode(aTarget);
|
||||
}
|
||||
//Should not be error. Need a new way to do return values
|
||||
|
@ -22,11 +22,13 @@ LIBRARY_NAME=ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
editorInterfaces.cpp \
|
||||
editorInterfaces.cpp \
|
||||
nsEditFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\editor.obj \
|
||||
.\$(OBJDIR)\nsEditFactory.obj \
|
||||
.\$(OBJDIR)\editorInterfaces.obj \
|
||||
$(NULL)
|
||||
|
||||
|
135
editor/core/nsEditFactory.cpp
Normal file
135
editor/core/nsEditFactory.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nsEditFactory.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "editor.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID);
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
getEditFactory(nsIFactory **aFactory)
|
||||
{
|
||||
static COM_auto_ptr<nsIFactory> g_pNSIFactory;
|
||||
PR_EnterMonitor(getEditorMonitor());
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
if (!g_pNSIFactory)
|
||||
{
|
||||
nsEditFactory *factory = new nsEditFactory(getter_AddRefs(g_pNSIFactory));
|
||||
*aFactory = g_pNSIFactory;
|
||||
}
|
||||
else
|
||||
result = g_pNSIFactory->QueryInterface(kIFactoryIID, (void **)aFactory);
|
||||
PR_ExitMonitor(getEditorMonitor());
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
NS_NOTREACHED("!nsEditor");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIFactoryIID) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditFactory)
|
||||
NS_IMPL_RELEASE(nsEditFactory)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsEditor *editor = NULL;
|
||||
*aResult = NULL;
|
||||
|
||||
if (aOuter && !aIID.Equals(kISupportsIID))
|
||||
return NS_NOINTERFACE; // XXX right error?
|
||||
editor = new nsEditor();
|
||||
if (editor->QueryInterface(aIID,
|
||||
(void**)aResult) != NS_OK) {
|
||||
// then we're trying get a interface other than nsISupports and
|
||||
// nsIEditor
|
||||
delete editor;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsEditFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsEditFactory:
|
||||
|
||||
nsEditFactory::nsEditFactory(nsIFactory **aFactory)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
nsresult err = NS_OK;
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
if (aFactory)
|
||||
{
|
||||
err = this->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
//this is to be sure we have at least one
|
||||
//reference to the factory
|
||||
if ( (err == NS_OK) && (*aFactory != NULL) )
|
||||
{
|
||||
nsRepository::RegisterFactory(kIEditFactoryIID, *aFactory,
|
||||
PR_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsEditFactory::~nsEditFactory()
|
||||
{
|
||||
nsRepository::UnregisterFactory(kIEditFactoryIID, (nsIFactory *)this); //we are out of ref counts anyway
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
63
editor/core/nsEditFactory.h
Normal file
63
editor/core/nsEditFactory.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- 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 nsIEditFactory_h___
|
||||
#define nsIEditFactory_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
class nsEditor;
|
||||
|
||||
/*
|
||||
EditFactory that can make an editor
|
||||
*/
|
||||
|
||||
/**
|
||||
* This supplies the neccessary entrance to the edit module. it will return any
|
||||
* instantiations that we need.
|
||||
*/
|
||||
class nsEditFactory;
|
||||
|
||||
nsresult getEditFactory(nsIFactory **);
|
||||
|
||||
class nsEditFactory : public nsIFactory {
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsISupports and AggregatedQueryInterface:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsIFactory:
|
||||
|
||||
NS_IMETHOD
|
||||
CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
LockFactory(PRBool aLock);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// from nsEditFactory:
|
||||
|
||||
virtual ~nsEditFactory(void);
|
||||
private:
|
||||
nsEditFactory(nsIFactory **aFactory); //will fill the aFactory with the result from queryinterface
|
||||
friend nsresult getEditFactory(nsIFactory **);
|
||||
};
|
||||
|
||||
#endif //nsIEditFactory_h___
|
Loading…
x
Reference in New Issue
Block a user