115922 embedding work. no changes should be observed in current product this will only affect the embedded effort. This moves the command handler stuff from content xul to embedding/components/commandhandler. a=judd r=saari built on mac/windows/gmake with this we will be able to finish removing editorshell from the app and have a true embedded editor.akkana will pick this up after me and finish the embedding work.

This commit is contained in:
mjudge%netscape.com 2002-02-02 05:13:56 +00:00
Родитель 36c1ce1091
Коммит 726b5e82c1
60 изменённых файлов: 2185 добавлений и 113 удалений

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

@ -65,7 +65,6 @@
#include "nsIContentIterator.h"
#include "nsIContentSerializer.h"
#include "nsIController.h"
#include "nsIControllerCommand.h"
#include "nsIControllers.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMRange.h"
@ -354,7 +353,6 @@ MAKE_CTOR(CreateXULElementFactory, nsIElementFactory, NS_NewXUL
#ifdef MOZ_SVG
MAKE_CTOR(CreateSVGElementFactory, nsIElementFactory, NS_NewSVGElementFactory)
#endif
MAKE_CTOR(CreateControllerCommandManager, nsIControllerCommandManager, NS_NewControllerCommandManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentHTTPStartup)
MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSOMFactory)
@ -792,11 +790,6 @@ static const nsModuleComponentInfo gComponents[] = {
CreateSVGElementFactory },
#endif
{ "Controller Command Manager",
NS_CONTROLLERCOMMANDMANAGER_CID,
"@mozilla.org/content/controller-command-manager;1",
CreateControllerCommandManager },
{ "Content HTTP Startup Listener",
NS_CONTENTHTTPSTARTUP_CID,
NS_CONTENTHTTPSTARTUP_CONTRACTID,

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

@ -507,7 +507,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2635rsan635rae2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -3948,7 +3948,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2635rsan635rae2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>

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

@ -347,7 +347,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jysun5jyay2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -834,13 +834,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllers.idl</PATH>
@ -952,11 +945,6 @@
<PATH>nsIController.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllers.idl</PATH>
@ -1288,7 +1276,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jysun5jyay2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1775,13 +1763,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllers.idl</PATH>
@ -1893,11 +1874,6 @@
<PATH>nsIController.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllers.idl</PATH>
@ -2015,12 +1991,6 @@
<PATH>nsIController.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

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

@ -1,3 +1,2 @@
nsIController.idl
nsIControllerCommand.idl
nsIControllers.idl

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

@ -31,7 +31,6 @@ MODULE = xuldoc
XPIDLSRCS = \
nsIController.idl \
nsIControllers.idl \
nsIControllerCommand.idl \
$(NULL)
EXPORTS = \

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

@ -28,7 +28,6 @@ DEPTH=..\..\..\..
XPIDLSRCS = \
.\nsIController.idl \
.\nsIControllers.idl \
.\nsIControllerCommand.idl \
$(NULL)
EXPORTS = \

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

@ -47,3 +47,49 @@ interface nsIController : nsISupports {
void onEvent(in DOMString eventName);
};
/*
Enhanced controller interface that allows for passing of parameters
to commands.
*/
interface nsICommandParams;
[scriptable, uuid(EBE55080-C8A9-11D5-A73C-DD620D6E04BC)]
interface nsICommandController : nsISupports
{
void getCommandState( in nsICommandParams aCommandParams);
void doCommand(in nsICommandParams aCommandParams);
};
/*
An API for registering commands in groups, to allow for
updating via nsIDOMWindowInternal::UpdateCommands.
*/
interface nsISimpleEnumerator;
[scriptable, uuid(9F82C404-1C7B-11D5-A73C-ECA43CA836FC)]
interface nsIControllerCommandGroup : nsISupports
{
void addCommandToGroup(in DOMString aCommand, in DOMString aGroup);
void removeCommandFromGroup(in DOMString aCommand, in DOMString aGroup);
boolean isCommandInGroup(in DOMString aCommand, in DOMString aGroup);
/*
We should expose some methods that allow for enumeration.
*/
nsISimpleEnumerator getGroupsEnumerator();
nsISimpleEnumerator getEnumeratorForGroup(in DOMString aGroup);
};

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

@ -55,10 +55,10 @@ REQUIRES = xpcom \
webshell \
webbrwsr \
unicharutil \
commandhandler \
$(NULL)
CPPSRCS = \
nsControllerCommandManager.cpp \
nsElementMap.cpp \
nsXULCommandDispatcher.cpp \
nsXULContentSink.cpp \

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

@ -49,12 +49,12 @@ REQUIRES = xpcom \
webshell \
webBrowser_core \
unicharutil \
commandhandler \
$(NULL)
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
CPP_OBJS= \
.\$(OBJDIR)\nsControllerCommandManager.obj \
.\$(OBJDIR)\nsElementMap.obj \
.\$(OBJDIR)\nsXULCommandDispatcher.obj \
.\$(OBJDIR)\nsXULContentSink.obj \

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

@ -39,7 +39,7 @@
#ifndef nsControllerCommandManager_h_
#define nsControllerCommandManager_h_
#include "nsIControllerCommandManager.h"
#include "nsIControllerCommand.h"
#include "nsWeakReference.h"
#include "nsHashtable.h"

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

@ -34,3 +34,4 @@ nsIContentViewer.idl
nsIContentViewerEdit.idl
nsIContentViewerFile.idl
nsIURIFixup.idl
nsIEditorDocShell.idl

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

@ -58,6 +58,9 @@ REQUIRES = xpcom \
xuldoc \
find \
nkcache \
composer \
commandhandler \
editor \
$(NULL)
XPIDLSRCS = \
@ -77,12 +80,14 @@ XPIDLSRCS = \
nsIContentViewerEdit.idl \
nsIContentViewerFile.idl \
nsIURIFixup.idl \
nsIEditorDocShell.idl \
$(NULL)
CPPSRCS = \
nsDocShell.cpp \
nsWebShell.cpp \
nsDocShellLoadInfo.cpp \
nsDocShellEditorData.cpp \
nsDocShellEnumerator.cpp \
nsDSURIContentListener.cpp \
nsDefaultURIFixup.cpp \

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

@ -50,6 +50,9 @@ REQUIRES = xpcom \
content \
gfx \
history \
composer \
commandhandler \
editor \
$(NULL)
LIBRARY_NAME=basedocshell_s
@ -71,10 +74,12 @@ XPIDLSRCS= \
.\nsITextScroll.idl \
.\nsIWebNavigation.idl \
.\nsIURIFixup.idl \
.\nsIEditorDocShell.idl \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsDocShell.obj \
.\$(OBJDIR)\nsDocShellEditorData.obj \
.\$(OBJDIR)\nsWebShell.obj \
.\$(OBJDIR)\nsDocShellEnumerator.obj \
.\$(OBJDIR)\nsDocShellLoadInfo.obj \

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

@ -78,6 +78,9 @@
#include "nsIPrincipal.h"
#include "nsIHistoryEntry.h"
// Editor-related
#include "nsIEditingSession.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMDocument.h"
#include "nsICachingChannel.h"
@ -265,6 +268,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIContentViewerContainer)
NS_INTERFACE_MAP_ENTRY(nsIEditorDocShell)
NS_INTERFACE_MAP_END_THREADSAFE
///*****************************************************************************
@ -363,6 +367,18 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
NS_ADDREF((nsISupports*)*aSink);
return NS_OK;
}
else if (aIID.Equals(NS_GET_IID(nsIEditingSession)) && NS_SUCCEEDED(EnsureEditorData())) {
nsCOMPtr<nsIEditingSession> editingSession;
mEditorData->GetEditingSession(getter_AddRefs(editingSession));
if (editingSession)
{
*aSink = editingSession;
NS_ADDREF((nsISupports *)*aSink);
return NS_OK;
}
return NS_NOINTERFACE;
}
else {
return QueryInterface(aIID, aSink);
}
@ -5567,6 +5583,64 @@ nsDocShell::ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd)
return NS_OK;
}
//*****************************************************************************
// nsDocShell: nsIEditorDocShell
//*****************************************************************************
NS_IMETHODIMP nsDocShell::GetEditor(nsIEditor * *aEditor)
{
NS_ENSURE_ARG_POINTER(aEditor);
nsresult rv = EnsureEditorData();
if (NS_FAILED(rv)) return rv;
return mEditorData->GetEditor(aEditor);
}
NS_IMETHODIMP nsDocShell::SetEditor(nsIEditor * aEditor)
{
nsresult rv = EnsureEditorData();
if (NS_FAILED(rv)) return rv;
return mEditorData->SetEditor(aEditor);
}
NS_IMETHODIMP nsDocShell::GetEditable(PRBool *aEditable)
{
NS_ENSURE_ARG_POINTER(aEditable);
*aEditable = mEditorData && mEditorData->GetEditable();
return NS_OK;
}
NS_IMETHODIMP nsDocShell::GetHasEditingSession(PRBool *aHasEditingSession)
{
NS_ENSURE_ARG_POINTER(aHasEditingSession);
if (mEditorData)
{
nsCOMPtr<nsIEditingSession> editingSession;
mEditorData->GetEditingSession(getter_AddRefs(editingSession));
*aHasEditingSession = (editingSession.get() != nsnull);
}
else
{
*aHasEditingSession = PR_FALSE;
}
return NS_OK;
}
NS_IMETHODIMP nsDocShell::MakeEditable(PRBool inWaitForUriLoad)
{
nsresult rv = EnsureEditorData();
if (NS_FAILED(rv)) return rv;
return mEditorData->MakeEditable(inWaitForUriLoad);
}
NS_IMETHODIMP
nsDocShell::AddToGlobalHistory(nsIURI * aURI)
{
@ -5759,6 +5833,20 @@ nsDocShell::EnsureScriptEnvironment()
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::EnsureEditorData()
{
if (!mEditorData)
{
mEditorData = new nsDocShellEditorData(this);
if (!mEditorData) return NS_ERROR_OUT_OF_MEMORY;
}
return mEditorData ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsDocShell::EnsureFind()
{
nsresult rv;

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

@ -40,11 +40,13 @@
#include "nsIDocumentLoader.h"
#include "nsIURILoader.h"
#include "nsIEditorDocShell.h"
#include "nsWeakReference.h"
// Local Includes
#include "nsDSURIContentListener.h"
#include "nsDocShellEditorData.h"
// Helper Classes
#include "nsCOMPtr.h"
@ -149,6 +151,7 @@ class nsDocShell : public nsIDocShell,
public nsIScriptGlobalObjectOwner,
public nsIRefreshURI,
public nsIWebProgressListener,
public nsIEditorDocShell,
public nsSupportsWeakReference
{
friend class nsDSURIContentListener;
@ -173,6 +176,7 @@ public:
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIREFRESHURI
NS_DECL_NSICONTENTVIEWERCONTAINER
NS_DECL_NSIEDITORDOCSHELL
nsresult SetLoadCookie(nsISupports * aCookie);
nsresult GetLoadCookie(nsISupports ** aResult);
@ -239,6 +243,7 @@ protected:
NS_IMETHOD GetRootScrollableView(nsIScrollableView ** aOutScrollView);
NS_IMETHOD EnsureContentListener();
NS_IMETHOD EnsureScriptEnvironment();
NS_IMETHOD EnsureEditorData();
NS_IMETHOD EnsureFind();
static inline PRUint32
@ -339,6 +344,9 @@ protected:
PRBool mIsBeingDestroyed;
// Editor stuff
nsDocShellEditorData* mEditorData; // editor data, if any
// WEAK REFERENCES BELOW HERE.
// Note these are intentionally not addrefd. Doing so will create a cycle.
// For that reasons don't use nsCOMPtr.

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

@ -110,6 +110,7 @@ typedef unsigned long HMTX;
#include "nsILayoutHistoryState.h"
#include "nsTextFormatter.h"
#include "nsPIDOMWindow.h"
#include "nsPICommandUpdater.h"
#include "nsIController.h"
#include "nsIFocusController.h"
#include "nsGUIEvent.h"
@ -228,6 +229,27 @@ void nsWebShell::InitFrameData()
SetMarginHeight(-1);
}
nsresult
nsWebShell::EnsureCommandHandler()
{
if (!mCommandManager)
{
mCommandManager = do_CreateInstance("@mozilla.org/embedcomp/command-manager;1");
if (!mCommandManager) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsPICommandUpdater> commandUpdater = do_QueryInterface(mCommandManager);
if (!commandUpdater) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor *, this));
nsresult rv = commandUpdater->Init(domWindow);
NS_ASSERTION(NS_SUCCEEDED(rv), "Initting command manager failed");
}
return mCommandManager ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMPL_ADDREF_INHERITED(nsWebShell, nsDocShell)
NS_IMPL_RELEASE_INHERITED(nsWebShell, nsDocShell)
@ -274,6 +296,13 @@ nsWebShell::GetInterface(const nsIID &aIID, void** aInstancePtr)
NS_ERROR_FAILURE);
return NS_OK;
}
else if(aIID.Equals(NS_GET_IID(nsICommandManager)))
{
NS_ENSURE_SUCCESS(EnsureCommandHandler(), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(mCommandManager->QueryInterface(NS_GET_IID(nsICommandManager),
aInstancePtr), NS_ERROR_FAILURE);
return NS_OK;
}
if (!*aInstancePtr || NS_FAILED(rv))
return nsDocShell::GetInterface(aIID,aInstancePtr);

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

@ -28,6 +28,7 @@
#include "nsILinkHandler.h"
#include "nsIClipboardCommands.h"
#include "nsDocShell.h"
#include "nsICommandManager.h"
class nsIController;
struct PRThread;
@ -99,6 +100,7 @@ protected:
virtual nsresult GetControllerForCommand ( const nsAReadableString & inCommand, nsIController** outController );
virtual nsresult IsCommandEnabled ( const nsAReadableString & inCommand, PRBool* outEnabled );
virtual nsresult DoCommand ( const nsAReadableString & inCommand );
nsresult EnsureCommandHandler();
//
// Helper method that is called when a new document (including any
@ -122,6 +124,8 @@ protected:
const char* aCommand,
nsIStreamListener** aResult);
nsCOMPtr<nsICommandManager> mCommandManager;
#ifdef DEBUG
private:
// We're counting the number of |nsWebShells| to help find leaks

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

@ -48,6 +48,9 @@ REQUIRES = xpcom \
chardet \
appcomps \
find \
composer \
editor \
commandhandler \
$(NULL)
ifeq ($(OS_ARCH),WINNT)

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

@ -38,6 +38,9 @@ REQUIRES = xpcom \
find \
gfx \
history \
composer \
editor \
commandhandler \
$(NULL)
include <$(DEPTH)\config\config.mak>

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

@ -547,7 +547,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>263jzwcn63nthc2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1041,6 +1041,13 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsDocShellEditorData.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1108,6 +1115,11 @@
<PATH>nsDocShellEnumerator.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsDocShellEditorData.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -1604,7 +1616,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>263jzwcn63nthc2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -2098,6 +2110,13 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsDocShellEditorData.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -2165,6 +2184,11 @@
<PATH>nsDocShellEnumerator.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsDocShellEditorData.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -2218,6 +2242,12 @@
<PATH>nsDocShellModule.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>docshell.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsDocShellEditorData.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUP>
<GROUP><NAME>NS Libraries</NAME>
<GROUP><NAME>Optimized</NAME>

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

@ -307,7 +307,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>265jqwan65niha2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -815,6 +815,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditorDocShell.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -892,6 +899,11 @@
<PATH>nsIContentViewerFile.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditorDocShell.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -1148,7 +1160,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>265jqwan65niha2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1656,6 +1668,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditorDocShell.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1733,6 +1752,11 @@
<PATH>nsIContentViewerFile.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditorDocShell.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -1829,6 +1853,12 @@
<PATH>nsIContentViewer.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditorDocShell.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

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

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
DIRS = src public
# Enable Editor API Logging!
ENABLE_EDITOR_API_LOG=1

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

@ -21,7 +21,7 @@
DEPTH=..\..
DIRS= src
DIRS= src public
include <$(DEPTH)\config\rules.mak>

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

@ -58,6 +58,7 @@ REQUIRES = xpcom \
gfx2 \
webbrwsr \
unicharutil \
commandhandler \
$(NULL)
CPPSRCS = \
@ -68,6 +69,8 @@ CPPSRCS = \
nsComposerController.cpp \
nsComposerCommands.cpp \
nsComposerRegistration.cpp \
nsEditingSession.cpp \
nsComposerCommandsUpdater.cpp \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -27,10 +27,12 @@ MODULE_NAME=nsComposerModule
CPP_OBJS = \
.\$(OBJDIR)\nsEditorShell.obj \
.\$(OBJDIR)\nsEditingSession.obj \
.\$(OBJDIR)\nsEditorShellMouseListener.obj \
.\$(OBJDIR)\nsInterfaceState.obj \
.\$(OBJDIR)\nsComposerController.obj \
.\$(OBJDIR)\nsComposerCommands.obj \
.\$(OBJDIR)\nsComposerCommandsUpdater.obj \
.\$(OBJDIR)\nsComposerRegistration.obj \
.\$(OBJDIR)\nsEditorParserObserver.obj \
$(NULL)
@ -64,6 +66,7 @@ REQUIRES = xpcom \
gfx2 \
webBrowser_core \
unicharutil \
commandhandler \
$(NULL)
include <$(DEPTH)/config/config.mak>

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

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

@ -77,6 +77,7 @@ protected:
// are we in HTML edit mode (not source view or plain text editing)
PRBool EditingHTML(nsIEditorShell* inEditorShell);
PRBool EditingHTML(nsIEditor* inEditorShell);
};
@ -110,6 +111,12 @@ protected:
// add/remove the style
virtual nsresult ToggleState(nsIEditorShell *aEditorShell, const char* aTagName) = 0;
// get the current state (on or off) for this style or block format
virtual nsresult GetCurrentState(nsIEditor *aEditor, const char* aTagName, nsICommandParams *aParams) = 0;
// add/remove the style
virtual nsresult ToggleState(nsIEditor *aEditor, const char* aTagName) = 0;
protected:
const char* mTagName;
@ -135,6 +142,12 @@ protected:
// add/remove the style
virtual nsresult ToggleState(nsIEditorShell *aEditorShell, const char* aTagName);
// get the current state (on or off) for this style or block format
virtual nsresult GetCurrentState(nsIEditor *aEditor, const char* aTagName, nsICommandParams *aParams);
// add/remove the style
virtual nsresult ToggleState(nsIEditor *aEditor, const char* aTagName);
};
@ -151,6 +164,12 @@ protected:
// add/remove the style
virtual nsresult ToggleState(nsIEditorShell *aEditorShell, const char* aTagName);
// get the current state (on or off) for this style or block format
virtual nsresult GetCurrentState(nsIEditor *aEditor, const char* aTagName, nsICommandParams *aParams);
// add/remove the style
virtual nsresult ToggleState(nsIEditor *aEditor, const char* aTagName);
};
class nsListItemCommand : public nsBaseStateUpdatingCommand
@ -166,6 +185,12 @@ protected:
// add/remove the style
virtual nsresult ToggleState(nsIEditorShell *aEditorShell, const char* aTagName);
// get the current state (on or off) for this style or block format
virtual nsresult GetCurrentState(nsIEditor *aEditor, const char* aTagName, nsICommandParams *aParams);
// add/remove the style
virtual nsresult ToggleState(nsIEditor *aEditor, const char* aTagName);
};
// Base class for commands whose state consists of a string (e.g. para format)
@ -185,6 +210,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed) = 0;
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState) = 0;
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams) =0;
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState) = 0;
protected:
@ -203,6 +230,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};
class nsFontFaceStateCommand : public nsMultiStateCommand
@ -214,6 +243,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};
class nsHighlightColorStateCommand : public nsMultiStateCommand
@ -226,6 +257,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
NS_IMETHOD IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *_retval);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};
@ -238,6 +271,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};
class nsAlignCommand : public nsMultiStateCommand
@ -249,6 +284,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};
class nsBackgroundColorStateCommand : public nsMultiStateCommand
@ -260,6 +297,8 @@ protected:
virtual nsresult GetCurrentState(nsIEditorShell *aEditorShell, nsString& outStateString, PRBool& outMixed);
virtual nsresult SetState(nsIEditorShell *aEditorShell, nsString& newState);
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams);
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState);
};

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

@ -66,6 +66,7 @@ NS_IMPL_RELEASE(nsComposerController)
NS_INTERFACE_MAP_BEGIN(nsComposerController)
NS_INTERFACE_MAP_ENTRY(nsIController)
NS_INTERFACE_MAP_ENTRY(nsICommandController)
NS_INTERFACE_MAP_ENTRY(nsIEditorController)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEditorController)
@ -91,7 +92,7 @@ NS_IMETHODIMP nsComposerController::Init(nsISupports *aCommandRefCon)
mCommandRefCon = aCommandRefCon; // no addref
mCommandManager = do_CreateInstance("@mozilla.org/content/controller-command-manager;1", &rv);
mCommandManager = do_CreateInstance(NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// register the commands.
@ -255,7 +256,7 @@ nsresult nsComposerController::GetComposerCommandManager(nsIControllerCommandMan
if (!cmdManager)
{
nsresult rv;
cmdManager = do_CreateInstance("@mozilla.org/content/controller-command-manager;1", &rv);
cmdManager = do_CreateInstance(NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// register the commands. This just happens once per instance
@ -271,3 +272,27 @@ nsresult nsComposerController::GetComposerCommandManager(nsIControllerCommandMan
return NS_OK;
}
//GetCommandState
/*
cmd_bold,cmd_italic,cmd_underline ->state commands
state_start : true,false
state_end : true,false
state_all : true,false
state_mixed : true,false
*/
/* void getCommandState (in DOMString aCommandName, inout nsICommandParams aCommandParams); */
NS_IMETHODIMP nsComposerController::GetCommandState(nsICommandParams *aCommandParams)
{
if (!mCommandRefCon || !mCommandManager)
return NS_ERROR_NOT_INITIALIZED;
return mCommandManager->GetCommandState(aCommandParams,mCommandRefCon);
}
/* void doCommand (in DOMString aCommandName, in nsICommandParams aCommandParams); */
NS_IMETHODIMP nsComposerController::DoCommand(nsICommandParams *aCommandParams)
{
if (!mCommandRefCon || !mCommandManager)
return NS_ERROR_NOT_INITIALIZED;
return mCommandManager->DoCommandParams(aCommandParams,mCommandRefCon);
}

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

@ -48,12 +48,14 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIControllerCommand.h"
#include "nsIControllerCommandManager.h"
#include "nsWeakPtr.h"
// the editor controller is used for composer only (and other HTML compose
// areas). The refCon that gets passed to its commands is an nsIEditorShell.
class nsComposerController : public nsIController,
public nsICommandController,
public nsIEditorController,
public nsIInterfaceRequestor
{
@ -78,6 +80,9 @@ public:
// nsIInterfaceRequestor
NS_DECL_NSIINTERFACEREQUESTOR
//nsICommandController
NS_DECL_NSICOMMANDCONTROLLER
protected:
//if editor is null then look to mContent. this is for dual use of window and content

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

@ -39,6 +39,7 @@
#include "nsIGenericFactory.h"
#include "nsEditorShell.h" // for the CID
#include "nsEditingSession.h" // for the CID
#include "nsComposerController.h" // for the CID
////////////////////////////////////////////////////////////////////////
@ -48,6 +49,7 @@
//
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorShell)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditingSession)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsComposerController)
////////////////////////////////////////////////////////////////////////
@ -63,6 +65,8 @@ static const nsModuleComponentInfo components[] = {
"@mozilla.org/editor/editorshell;1", nsEditorShellConstructor, },
{ "Editor Shell Spell Checker", NS_EDITORSHELL_CID,
"@mozilla.org/editor/editorspellcheck;1", nsEditorShellConstructor, },
{ "Editing Session", NS_EDITINGSESSION_CID,
"@mozilla.org/editor/editingsession;1", nsEditingSessionConstructor, },
};
////////////////////////////////////////////////////////////////////////

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

@ -46,6 +46,7 @@ REQUIRES = xpcom \
xuldoc \
unicharutil \
webbrwsr \
commandhandler \
$(NULL)
# Internal header files, needed by other editor sublibs:

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

@ -40,6 +40,7 @@ REQUIRES = xpcom \
widget \
unicharutil \
webBrowser_core \
commandhandler \
$(NULL)
CPP_OBJS = \

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

@ -49,6 +49,10 @@
#include "nsEditorCommands.h"
#define COMMAND_NAME NS_ConvertASCIItoUCS2("cmd_name")
#define STATE_ENABLED NS_ConvertASCIItoUCS2("state_enabled")
nsBaseEditorCommand::nsBaseEditorCommand()
{
NS_INIT_REFCNT();
@ -85,6 +89,23 @@ nsUndoCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *aC
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsUndoCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsUndoCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsRedoCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -110,6 +131,23 @@ nsRedoCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *aC
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsRedoCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsRedoCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsCutCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -133,6 +171,24 @@ nsCutCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *aCo
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsCutCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsCutCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsCutOrDeleteCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -164,6 +220,23 @@ nsCutOrDeleteCommand::DoCommand(const nsAReadableString & aCommandName, nsISuppo
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsCutOrDeleteCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsCutOrDeleteCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsCopyCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -187,6 +260,23 @@ nsCopyCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *aC
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsCopyCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsCopyCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsCopyOrDeleteCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -218,6 +308,23 @@ nsCopyOrDeleteCommand::DoCommand(const nsAReadableString & aCommandName, nsISupp
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsCopyOrDeleteCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsCopyOrDeleteCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsPasteCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
@ -252,6 +359,25 @@ nsPasteCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *a
return rv;
}
NS_IMETHODIMP
nsPasteCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsPasteCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsDeleteCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
{
@ -313,6 +439,24 @@ nsDeleteCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *
return aEditor->DeleteSelection(deleteDir);
}
NS_IMETHODIMP
nsDeleteCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsDeleteCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsSelectAllCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
{
@ -335,6 +479,25 @@ nsSelectAllCommand::DoCommand(const nsAReadableString & aCommandName, nsISupport
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsSelectAllCommand::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsSelectAllCommand::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}
NS_IMETHODIMP
nsSelectionMoveCommands::IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *outCmdEnabled)
{
@ -446,3 +609,21 @@ nsSelectionMoveCommands::DoCommand(const nsAReadableString & aCommandName, nsISu
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsSelectionMoveCommands::DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
return DoCommand(tString,aCommandRefCon);
}
NS_IMETHODIMP
nsSelectionMoveCommands::GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon)
{
nsString tString;
aParams->GetStringValue(COMMAND_NAME,tString);
PRBool canUndo;
IsCommandEnabled(tString, aCommandRefCon, &canUndo);
return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
}

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

@ -67,6 +67,8 @@ class _cmd : public nsBaseEditorCommand \
public: \
NS_IMETHOD IsCommandEnabled(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon, PRBool *_retval); \
NS_IMETHOD DoCommand(const nsAReadableString & aCommandName, nsISupports *aCommandRefCon); \
NS_IMETHOD DoCommandParams(nsICommandParams *aParams, nsISupports *aCommandRefCon); \
NS_IMETHOD GetCommandState(nsICommandParams *aParams, nsISupports *aCommandRefCon); \
};

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

@ -224,7 +224,7 @@ nsresult nsEditorController::GetEditorCommandManager(nsIControllerCommandManager
if (!cmdManager)
{
nsresult rv;
cmdManager = do_CreateInstance("@mozilla.org/content/controller-command-manager;1", &rv);
cmdManager = do_CreateInstance(NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// register the commands. This just happens once per instance

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

@ -46,6 +46,7 @@
#include "nsIController.h"
#include "nsIEditorController.h"
#include "nsIControllerCommand.h"
#include "nsIControllerCommandManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"

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

@ -53,6 +53,7 @@ REQUIRES = xpcom \
htmlparser \
appshell \
xuldoc \
commandhandler \
$(NULL)
ifdef MOZ_PLAINTEXT_EDITOR_ONLY

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

@ -33,6 +33,7 @@ REQUIRES = string \
necko \
appshell \
content_xul \
commandhandler \
$(NULL)
include <$(DEPTH)/config/config.mak>

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

@ -85,6 +85,16 @@
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>::composer:public:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
</SETTING>
<SETTING><NAME>SystemSearchPaths</NAME>
<SETTING>
@ -307,7 +317,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>253zwcn56thc2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -808,6 +818,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditingSession.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -880,6 +897,11 @@
<PATH>nsIURIRefObject.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditingSession.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -914,6 +936,16 @@
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>::composer:public:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
</SETTING>
<SETTING><NAME>SystemSearchPaths</NAME>
<SETTING>
@ -1136,7 +1168,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>253zwcn56thc2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1637,6 +1669,13 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditingSession.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1709,6 +1748,11 @@
<PATH>nsIURIRefObject.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditingSession.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -1803,6 +1847,12 @@
<PATH>nsIURIRefObject.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>editor.xpt</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIEditingSession.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUPLIST>
</PROJECT>

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

@ -527,7 +527,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2643qwan646iha2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1035,6 +1035,20 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEditingSession.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsComposerCommandsUpdater.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1112,6 +1126,16 @@
<PATH>nsComposerRegistration.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEditingSession.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsComposerCommandsUpdater.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -1588,7 +1612,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2643qwan646iha2&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -2096,6 +2120,20 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEditingSession.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsComposerCommandsUpdater.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -2173,6 +2211,16 @@
<PATH>nsComposerRegistration.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEditingSession.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsComposerCommandsUpdater.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -2226,6 +2274,18 @@
<PATH>nsComposerRegistration.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>ComposerDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsEditingSession.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>ComposerDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsComposerCommandsUpdater.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUP>
<GROUP><NAME>Static Libs</NAME>
<FILEREF>

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

@ -517,7 +517,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jqwun5jqey2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -2048,7 +2048,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jqwun5jqey2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -3567,7 +3567,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jqwun5jqey2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -4942,7 +4942,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>25jqwun5jqey2&#217;&#177;&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -6155,7 +6155,7 @@
</GROUP>
<GROUP><NAME>Static Libs</NAME>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>UnicharUtilsStatic.o</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
@ -6170,31 +6170,31 @@
<GROUP><NAME>NS Libraries</NAME>
<GROUP><NAME>Optimized</NAME>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>NSStdLib.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>NSRuntime.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>NSPR20.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>xpcom.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>PlainTextEditor.shlb</TARGETNAME>
<TARGETNAME>HTMLEditor.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>JavaScript.shlb</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>

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

@ -24,6 +24,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = windowwatcher appstartup find ui jsconsole webbrowserpersist build
DIRS = windowwatcher appstartup find ui jsconsole webbrowserpersist commandhandler build
include $(topsrcdir)/config/rules.mk

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

@ -49,6 +49,8 @@ REQUIRES = js \
content \
uriloader \
necko \
commandhandler \
content_xul \
$(NULL)
CPPSRCS = nsModule.cpp
@ -59,6 +61,7 @@ SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)jsconsole_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)find_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)webbrowserpersist_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)commandhandler_s.$(LIB_SUFFIX) \
$(NULL)
LOCAL_INCLUDES = \
@ -67,6 +70,7 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../jsconsole/src \
-I$(srcdir)/../find/src \
-I$(srcdir)/../webbrowserpersist/src \
-I$(srcdir/../commandhandler/src \
$(NULL)
EXTRA_DSO_LDOPTS = \

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

@ -534,7 +534,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>264jrwaw64jreea&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1077,6 +1077,34 @@
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandGroup.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandParams.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsControllerCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1179,6 +1207,26 @@
<PATH>UnicharUtilsStaticDebug.o</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandGroup.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandParams.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsControllerCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -2205,6 +2253,34 @@
<FILEKIND>Unknown</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandGroup.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandParams.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsControllerCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -2307,6 +2383,26 @@
<PATH>UnicharUtilsStatic.o</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandGroup.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandParams.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsControllerCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -2340,6 +2436,30 @@
</FILEREF>
</GROUP>
<GROUP><NAME>CommandHandler</NAME>
<FILEREF>
<TARGETNAME>EmbedComponentsDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandGroup.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>EmbedComponentsDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>EmbedComponentsDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsCommandParams.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>EmbedComponentsDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsControllerCommandManager.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUP>
<GROUP><NAME>WindowWatcher</NAME>
<FILEREF>

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

@ -327,7 +327,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2653rsap653rae3&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -814,6 +814,34 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsICommandParams.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsPICommandUpdater.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommandManager.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -876,6 +904,26 @@
<PATH>nsCWebBrowserPersist.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsICommandParams.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsPICommandUpdater.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommandManager.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -1152,7 +1200,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>2653rsap653rae3&#192;&#209;&#147;(</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1639,6 +1687,34 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsICommandParams.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsPICommandUpdater.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommandManager.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1701,6 +1777,26 @@
<PATH>nsCWebBrowserPersist.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsICommandParams.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsPICommandUpdater.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommandManager.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -1783,6 +1879,30 @@
<PATH>nsPIWindowWatcher.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsICommandParams.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsPICommandUpdater.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommand.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIControllerCommandManager.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUPLIST>
</PROJECT>

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

@ -35,6 +35,8 @@ REQUIRES = js \
necko \
content \
uriloader \
commandhandler \
content_xul \
$(NULL)
include <$(DEPTH)\config\config.mak>
@ -54,6 +56,7 @@ SUB_LIBRARIES = \
$(DIST)\lib\appstartupnotifier_s.lib \
$(DIST)\lib\find_s.lib \
$(DIST)\lib\webbrowserpersist_s.lib \
$(DIST)\lib\commandhandler_s.lib \
$(NULL)
LLIBS = \
@ -69,6 +72,7 @@ INCS = $(INCS) \
-I$(DEPTH)\embedding\components\appstartup\src \
-I$(DEPTH)\embedding\components\find\src \
-I$(DEPTH)\embedding\components\webbrowserpersist\src \
-I$(DEPTH)\embedding\components\commandhandler\src \
$(NULL)
include <$(DEPTH)\config\rules.mak>

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

@ -44,6 +44,10 @@
#include "nsJSConsoleService.h"
#include "nsWebBrowserFind.h"
#include "nsWebBrowserPersist.h"
#include "nsCommandManager.h"
#include "nsControllerCommandManager.h"
#include "nsCommandParams.h"
#include "nsCommandGroup.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPromptService, Init)
@ -52,6 +56,10 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppStartupNotifier)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSConsoleService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserFind)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserPersist)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandManager)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCommandParams, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandGroup)
static const nsModuleComponentInfo gComponents[] = {
@ -61,7 +69,11 @@ static const nsModuleComponentInfo gComponents[] = {
{ "Window Watcher", NS_WINDOWWATCHER_CID, NS_WINDOWWATCHER_CONTRACTID, nsWindowWatcherConstructor },
{ "Find", NS_WEB_BROWSER_FIND_CID, NS_WEB_BROWSER_FIND_CONTRACTID, nsWebBrowserFindConstructor },
{ NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor },
{ "WebBrowserPersist Component", NS_WEBBROWSERPERSIST_CID, NS_WEBBROWSERPERSIST_CONTRACTID, nsWebBrowserPersistConstructor }
{ "WebBrowserPersist Component", NS_WEBBROWSERPERSIST_CID, NS_WEBBROWSERPERSIST_CONTRACTID, nsWebBrowserPersistConstructor },
{ "Controller Command Manager", NS_CONTROLLERCOMMANDMANAGER_CID, NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, nsControllerCommandManagerConstructor },
{ "Command Manager", NS_COMMAND_MANAGER_CID, NS_COMMAND_MANAGER_CONTRACTID, nsCommandManagerConstructor },
{ "Command Params", NS_COMMAND_PARAMS_CID, NS_COMMAND_PARAMS_CONTRACTID, nsCommandParamsConstructor },
{ "Command Group", NS_CONTROLLER_COMMAND_GROUP_CID, NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, nsControllerCommandGroupConstructor }
};
NS_IMPL_NSGETMODULE(embedcomponents, gComponents)

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

@ -1,3 +1,5 @@
nsICommandManager.idl
nsPICommandUpdater.idl
nsICommandParams.idl
nsIControllerCommand.idl
nsIControllerCommandManager.idl

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

@ -24,6 +24,7 @@ DIRS= \
windowwatcher \
appstartup \
find \
commandhandler \
jsconsole \
ui \
webbrowserpersist \

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

@ -76,6 +76,7 @@
#include "stdafx.h"
#include "MfcEmbed.h"
#include "BrowserFrm.h"
#include "BrowserImpl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -83,6 +84,13 @@
static char THIS_FILE[] = __FILE__;
#endif
//prototypes
nsresult GetStateCommandParams(nsICommandParams **aParams);
#define ABOUT_BLANK "about:blank"
/////////////////////////////////////////////////////////////////////////////
// CBrowserFrame
@ -95,6 +103,13 @@ BEGIN_MESSAGE_MAP(CBrowserFrame, CFrameWnd)
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_ACTIVATE()
ON_COMMAND(ID_NEW_EDITWINDOW, OnNewEditor)
ON_COMMAND(ID_BOLD, OnBold)
ON_UPDATE_COMMAND_UI(ID_BOLD, OnUpdateBold)
ON_COMMAND(ID_ITALICS, OnItalics)
ON_UPDATE_COMMAND_UI(ID_ITALICS, OnUpdateItalics)
ON_COMMAND(ID_UNDERLINE, OnUnderline)
ON_UPDATE_COMMAND_UI(ID_UNDERLINE, OnUpdateUnderline)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -115,6 +130,8 @@ CBrowserFrame::CBrowserFrame(PRUint32 chromeMask)
// will have menubar, toolbar, statusbar etc.
m_chromeMask = chromeMask;
mIsEditor = FALSE;
NS_ADDREF(&mToolBarObserver);//make sure no one releases this
}
CBrowserFrame::~CBrowserFrame()
@ -170,15 +187,21 @@ int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
// Load the Most Recently Used(MRU) Urls into the UrlBar
m_wndUrlBar.LoadMRUList();
UINT resID = IDR_MAINFRAME;
if (mIsEditor)
resID = IDR_EDITOR;
// Create the toolbar with Back, Fwd, Stop, etc. buttons..
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
!m_wndToolBar.LoadToolBar(resID))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
mToolBarObserver.SetFrame(this,ID_TOOLBAR_UPDATE,100); //update if 100 ticks goes by and no more changes
// Create a ReBar window to which the toolbar and UrlBar
// will be added
if (!m_wndReBar.Create(this))
@ -189,6 +212,7 @@ int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
//Add the ToolBar and UrlBar windows to the rebar
m_wndReBar.AddBar(&m_wndToolBar);
if (!mIsEditor)
m_wndReBar.AddBar(&m_wndUrlBar, "Enter URL:");
// Create the status bar with two panes - one pane for actual status
@ -391,3 +415,98 @@ void CMyStatusBar::OnLButtonDown(UINT nFlags, CPoint point)
CStatusBar::OnLButtonDown(nFlags, point);
}
void CBrowserFrame::OnNewEditor()
{
// TODO: Add your command handler code here
// TODO: Add your command handler code here
// TODO: Add your command handler code here
// TODO: Add your command handler code here
CMfcEmbedApp *pApp = (CMfcEmbedApp *)AfxGetApp();
CBrowserFrame *pEditorFrame = pApp->CreateNewBrowserFrame(nsIWebBrowserChrome::CHROME_ALL,
-1, -1, -1, -1,
PR_TRUE,PR_TRUE);
if (pEditorFrame)
{
CString tUrl;
m_wndUrlBar.GetEnteredURL(tUrl);
pEditorFrame->m_wndBrowserView.OpenURL(ABOUT_BLANK);
CBrowserImpl *impl = pEditorFrame->GetBrowserImpl();
if (impl)
{
((CEditorImpl *)impl)->AddEditorObservers(&mToolBarObserver);
((CEditorImpl *)impl)->MakeEditable();
}
}
}
/*
"bold"
state_all //setter and getter
state_begin //getter
state_end //getter
state_mixed //getter
*/
#define COMMAND_NAME NS_ConvertASCIItoUCS2("cmd_name")
#define STATE_ALL NS_ConvertASCIItoUCS2("state_all")
#define BOLD_COMMAND NS_ConvertASCIItoUCS2("cmd_bold")
void CBrowserFrame::OnBold()
{
// TODO: Add your command handler code here
nsresult rv;
nsCOMPtr<nsICommandParams> params = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
if (NS_FAILED(rv) || !params)
return;
params->SetBooleanValue(STATE_ALL,true);
params->SetStringValue(COMMAND_NAME,BOLD_COMMAND);
CEditorImpl *impl = (CEditorImpl *)GetBrowserImpl();
if (impl)
impl->DoCommand(params);
}
void CBrowserFrame::OnUpdateBold(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
nsresult rv;
nsCOMPtr<nsICommandParams> params = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
params->SetStringValue(COMMAND_NAME,BOLD_COMMAND);
CEditorImpl *impl = (CEditorImpl *)GetBrowserImpl();
if (impl)
{
rv = impl->GetCommandState(params);
if (NS_SUCCEEDED(rv))
{
//set tri state of button here if we need to
}
}
//just return true for now
pCmdUI->Enable();
}
void CBrowserFrame::OnItalics()
{
// TODO: Add your command handler code here
}
void CBrowserFrame::OnUpdateItalics(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}
void CBrowserFrame::OnUnderline()
{
// TODO: Add your command handler code here
}
void CBrowserFrame::OnUpdateUnderline(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
}

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

@ -51,6 +51,7 @@
#include "BrowserView.h"
#include "IBrowserFrameGlue.h"
#include "MostRecentUrls.h"
#include "CCommandObserver.h"
// A simple UrlBar class...
class CUrlBar : public CComboBoxEx
@ -191,6 +192,8 @@ protected:
public:
void SetupFrameChrome();
void SetEditable(BOOL isEditor){mIsEditor = isEditor;}
BOOL GetEditable(){return mIsEditor;}
// Overrides
// ClassWizard generated virtual function overrides
@ -215,8 +218,18 @@ protected:
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnClose();
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
afx_msg void OnNewEditor();
afx_msg void OnBold();
afx_msg void OnUpdateBold(CCmdUI* pCmdUI);
afx_msg void OnItalics();
afx_msg void OnUpdateItalics(CCmdUI* pCmdUI);
afx_msg void OnUnderline();
afx_msg void OnUpdateUnderline(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
BOOL mIsEditor;
CCommandObserver mToolBarObserver;
};
/////////////////////////////////////////////////////////////////////////////

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

@ -81,6 +81,12 @@
#endif
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocShell.h"
#include "nsISimpleEnumerator.h"
#include "nsIEditingSession.h"
#include "nsICommandManager.h"
#include "BrowserImpl.h"
CBrowserImpl::CBrowserImpl()
@ -381,3 +387,121 @@ NS_IMETHODIMP CBrowserImpl::SetVisibility(PRBool aVisibility)
return NS_OK;
}
//EDITORIMPL
NS_METHOD
CEditorImpl::MakeEditable()
{
nsresult rv;
nsCOMPtr<nsIDOMWindow> domWindow;
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
if (!domWindow)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject = do_QueryInterface(domWindow);
if (!scriptGlobalObject)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocShell> docShell;
rv = scriptGlobalObject->GetDocShell(getter_AddRefs(docShell));
if (NS_FAILED(rv))
return rv;
if (!docShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIEditingSession> editingSession = do_GetInterface(docShell);
if (!editingSession)
return NS_ERROR_FAILURE;
rv= editingSession->MakeWindowEditable(domWindow, PR_TRUE);
// this can fail for the root (if it's a frameset), but we still want
// to make children editable
nsCOMPtr<nsISimpleEnumerator> docShellEnumerator;
docShell->GetDocShellEnumerator( nsIDocShellTreeItem::typeContent,
nsIDocShell::ENUMERATE_FORWARDS,
getter_AddRefs(docShellEnumerator));
if (docShellEnumerator)
{
PRBool hasMore;
while (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMore)) && hasMore)
{
nsCOMPtr<nsISupports> curSupports;
rv = docShellEnumerator->GetNext(getter_AddRefs(curSupports));
if (NS_FAILED(rv)) break;
nsCOMPtr<nsIDocShell> curShell = do_QueryInterface(curSupports, &rv);
if (NS_FAILED(rv)) break;
nsCOMPtr<nsIDOMWindow> childWindow = do_GetInterface(curShell,&rv);
if (childWindow)
editingSession->MakeWindowEditable(childWindow, PR_FALSE);
}
}
return NS_OK;
}
//nsIObserver
NS_IMETHODIMP
CEditorImpl::AddEditorObservers(nsIObserver *aObserver)
{
nsCOMPtr<nsICommandManager> commandManager;
nsresult rv;
commandManager = do_GetInterface(mWebBrowser,&rv);
if (commandManager)
{
nsAutoString tString(NS_LITERAL_STRING("cmd_bold"));
rv = commandManager->AddCommandObserver(aObserver,tString);
tString = NS_LITERAL_STRING("cmd_italic");
rv = commandManager->AddCommandObserver(aObserver,tString);
tString = NS_LITERAL_STRING("cmd_underline");
rv = commandManager->AddCommandObserver(aObserver,tString);
}
return rv;
}
NS_IMETHODIMP
CEditorImpl::DoCommand(nsICommandParams *aCommandParams)
{
nsCOMPtr<nsICommandManager> commandManager;
nsresult rv = NS_ERROR_FAILURE;
commandManager = do_GetInterface(mWebBrowser,&rv);
if (commandManager)
{
rv = commandManager->DoCommand(aCommandParams);
}
return rv;
}
NS_IMETHODIMP
CEditorImpl::IsCommandEnabled(const nsAString &aCommand, PRBool *retval)
{
nsCOMPtr<nsICommandManager> commandManager;
nsresult rv = NS_ERROR_FAILURE;
commandManager = do_GetInterface(mWebBrowser,&rv);
if (commandManager)
{
rv = commandManager->IsCommandEnabled(aCommand,retval);
}
return rv;
}
NS_IMETHODIMP
CEditorImpl::GetCommandState(nsICommandParams *aCommandParams)
{
nsCOMPtr<nsICommandManager> commandManager;
nsresult rv = NS_ERROR_FAILURE;
commandManager = do_GetInterface(mWebBrowser,&rv);
if (commandManager)
{
rv = commandManager->GetCommandState(aCommandParams);
}
return rv;
}

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

@ -42,6 +42,7 @@
#include "IBrowserFrameGlue.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsICommandParams.h"
class CBrowserImpl : public nsIInterfaceRequestor,
public nsIWebBrowserChrome,
@ -72,4 +73,16 @@ protected:
nsCOMPtr<nsIWebBrowser> mWebBrowser;
};
class CEditorImpl : public CBrowserImpl
{
public:
CEditorImpl(){};
virtual ~CEditorImpl(){};
NS_METHOD MakeEditable();
NS_METHOD AddEditorObservers(nsIObserver *aObserver);
NS_METHOD DoCommand(nsICommandParams *aCommandParams);
NS_METHOD IsCommandEnabled(const nsAString &aCommand, PRBool *retval);
NS_METHOD GetCommandState(nsICommandParams *aCommandParams);
};
#endif //_BROWSERIMPL_H

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

@ -47,6 +47,8 @@ REQUIRES = \
windowwatcher \
layout \
webbrowserpersist \
composer \
command_handler \
$(NULL)
CPPSRCS = \
@ -57,6 +59,7 @@ CPPSRCS = \
BrowserImpl.cpp \
BrowserImplWebPrgrsLstnr.cpp \
BrowserImplCtxMenuLstnr.cpp \
CCommandObserver.cpp \
Dialogs.cpp \
ProfileMgr.cpp \
ProfilesDlg.cpp \

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

@ -330,8 +330,12 @@ BOOL CMfcEmbedApp::InitInstance()
CBrowserFrame* CMfcEmbedApp::CreateNewBrowserFrame(PRUint32 chromeMask,
PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool bIsEditor,
PRBool bShowWindow)
{
UINT resId = IDR_MAINFRAME;
if (bIsEditor)
resId = IDR_EDITOR;
// Setup a CRect with the requested window dimensions
CRect winSize(x, y, cx, cy);
@ -345,8 +349,9 @@ CBrowserFrame* CMfcEmbedApp::CreateNewBrowserFrame(PRUint32 chromeMask,
// Now, create the browser frame
CBrowserFrame* pFrame = new CBrowserFrame(chromeMask);
pFrame->SetEditable(bIsEditor);
if (!pFrame->Create(NULL, strTitle, WS_OVERLAPPEDWINDOW,
winSize, NULL, MAKEINTRESOURCE(IDR_MAINFRAME), 0L, NULL))
winSize, NULL, MAKEINTRESOURCE(resId), 0L, NULL))
{
return NULL;
}

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

@ -75,7 +75,7 @@ public:
CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL,
PRInt32 x = -1, PRInt32 y = -1,
PRInt32 cx = -1, PRInt32 cy = -1,
PRInt32 cx = -1, PRInt32 cy = -1,PRBool bIsEditor=PR_FALSE,
PRBool bShowWindow = PR_TRUE);
void RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame = TRUE);

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

@ -77,6 +77,7 @@ IDR_SECURITY_BROKEN ICON DISCARDABLE "res\\broken.ico"
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
IDR_EDITOR BITMAP MOVEABLE PURE "res\\mainfram.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@ -96,6 +97,13 @@ BEGIN
BUTTON ID_APP_ABOUT
END
IDR_EDITOR TOOLBAR DISCARDABLE 20, 18
BEGIN
BUTTON ID_BOLD
BUTTON ID_ITALICS
BUTTON ID_UNDERLINE
END
/////////////////////////////////////////////////////////////////////////////
//
@ -107,6 +115,7 @@ BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New Browser Window\tCtrl+N", ID_NEW_BROWSER
MENUITEM "&New Editor Window", ID_NEW_EDITWINDOW
MENUITEM SEPARATOR
MENUITEM "&Open File...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save Page As...\tCtrl+S", ID_FILE_SAVE_AS
@ -219,6 +228,41 @@ BEGIN
END
END
IDR_EDITOR MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "New &Browser Window\tCtrl+N", ID_NEW_BROWSER
MENUITEM SEPARATOR
MENUITEM "&Open File...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save Page As...\tCtrl+S", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "&Print...\tCtrl-P", ID_FILE_PRINT
MENUITEM SEPARATOR
MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT
MENUITEM "New &Editor Window", ID_NEW_EDITORWINDOW
END
POPUP "&Edit"
BEGIN
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
MENUITEM SEPARATOR
MENUITEM "Select &All", ID_EDIT_SELECT_ALL
MENUITEM "Select &None", ID_EDIT_SELECT_NONE
MENUITEM SEPARATOR
MENUITEM "&Find in This Page...\tCtrl+F", ID_EDIT_FIND
MENUITEM SEPARATOR
MENUITEM "Profiles...", ID_MANAGE_PROFILES
MENUITEM SEPARATOR
MENUITEM "Preferences...", ID_EDIT_PREFERENCES
END
POPUP "&Help"
BEGIN
MENUITEM "&About MfcEmbed...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
@ -525,6 +569,8 @@ BEGIN
IDS_ENCRYPTION_LOW_GRADE "Low-grade Encryption (%1% %2!d! bit)"
IDS_ENCRYPTION_NONE "Connection Not Encrypted"
IDS_SRCH_STR_NOT_FOUND "The text you entered was not found"
IDS_VIEW_FRAME_SOURCE "View Frame Source"
IDS_OPEN_FRAME_IN_NEW_WINDOW "Open Frame in New Window"
END
STRINGTABLE PRELOAD DISCARDABLE
@ -597,8 +643,6 @@ STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_PRINTPREVIEW "Print Preview"
ID_FILE_PRINTSETUP "Page Setup Dialog"
IDS_VIEW_FRAME_SOURCE "View Frame Source"
IDS_OPEN_FRAME_IN_NEW_WINDOW "Open Frame in New Window"
END
#endif // English (U.S.) resources

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

@ -39,6 +39,8 @@ REQUIRES = \
windowwatcher \
layout \
webbrowserpersist \
composer \
commandhandler \
$(NULL)
DIRS=components \
@ -61,6 +63,7 @@ OBJS = \
.\$(OBJDIR)\BrowserImpl.obj \
.\$(OBJDIR)\BrowserImplWebPrgrsLstnr.obj \
.\$(OBJDIR)\BrowserImplCtxMenuLstnr.obj \
.\$(OBJDIR)\CCommandObserver.obj \
.\$(OBJDIR)\Dialogs.obj \
.\$(OBJDIR)\ProfileMgr.obj \
.\$(OBJDIR)\ProfilesDlg.obj \

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

@ -230,6 +230,10 @@ SOURCE=.\res\broken.ico
# End Source File
# Begin Source File
SOURCE=.\res\mainfram.bmp
# End Source File
# Begin Source File
SOURCE=.\res\mfcembed.ico
# End Source File
# Begin Source File
@ -245,5 +249,49 @@ SOURCE=.\res\ssecur.ico
SOURCE=.\res\Toolbar.bmp
# End Source File
# End Group
# Begin Group "Interfaces"
# PROP Default_Filter "*.idl"
# Begin Source File
SOURCE=..\..\components\commandhandler\public\nsICommandManager.idl
# End Source File
# Begin Source File
SOURCE=..\..\components\commandhandler\public\nsICommandParams.idl
# End Source File
# Begin Source File
SOURCE=..\..\..\content\xul\document\public\nsIController.idl
# End Source File
# Begin Source File
SOURCE=..\..\components\commandhandler\public\nsIControllerCommand.idl
# End Source File
# Begin Source File
SOURCE=..\..\components\commandhandler\public\nsIControllerCommandManager.idl
# End Source File
# End Group
# Begin Group "implementations"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\components\commandhandler\src\nsCommandManager.cpp
# End Source File
# Begin Source File
SOURCE=..\..\components\commandhandler\src\nsCommandManager.h
# End Source File
# Begin Source File
SOURCE=..\..\..\editor\composer\src\nsComposerCommands.cpp
# End Source File
# Begin Source File
SOURCE=..\..\components\commandhandler\src\nsControllerCommandManager.cpp
# End Source File
# End Group
# End Target
# End Project

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

@ -3,8 +3,10 @@
// Used by mfcembed.rc
//
#define IDD_ABOUTBOX 100
#define ID_TOOLBAR_UPDATE 101
#define IDR_MAINFRAME 128
#define IDR_MOZEMBTYPE 129
#define IDR_EDITOR 129
#define IDR_CTXMENU_DOCUMENT 130
#define IDR_CTXMENU_LINK 131
#define IDR_CTXMENU_TEXT 132
@ -96,8 +98,13 @@
#define ID_EDIT_PREFERENCES 32788
#define ID_FILE_PRINTPREVIEW 32789
#define ID_FILE_PRINTSETUP 32790
#define ID_NEW_EDITORWINDOW 32790
#define ID_VIEW_FRAME_SOURCE 32791
#define ID_OPEN_FRAME_IN_NEW_WINDOW 32792
#define ID_BOLD 32793
#define ID_UNDERLINE 32794
#define ID_ITALICS 32795
#define ID_NEW_EDITWINDOW 32796
// Next default values for new objects
//
@ -105,8 +112,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 155
#define _APS_NEXT_COMMAND_VALUE 32793
#define _APS_NEXT_COMMAND_VALUE 32797
#define _APS_NEXT_CONTROL_VALUE 1042
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif