From e1d677c891d8d3c4f7240df65278fb42cf87c3b9 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Sat, 28 Aug 1999 07:37:23 +0000 Subject: [PATCH] Work in progress to integrate Keith Visco's XSL processor, Transformiix, into Gecko. All code is protected by #ifdef XSL and will not affect the build. git-svn-id: svn://10.0.0.236/trunk@44989 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/xsl/document/src/makefile.win | 9 +++- .../document/src/nsIDocumentTransformer.idl | 45 +++++++++++++++++++ .../xsl/document/src/nsTransformMediator.cpp | 5 +-- mozilla/layout/xsl/document/src/makefile.win | 9 +++- .../document/src/nsIDocumentTransformer.idl | 45 +++++++++++++++++++ .../xsl/document/src/nsTransformMediator.cpp | 5 +-- 6 files changed, 108 insertions(+), 10 deletions(-) create mode 100644 mozilla/content/xsl/document/src/nsIDocumentTransformer.idl create mode 100644 mozilla/layout/xsl/document/src/nsIDocumentTransformer.idl diff --git a/mozilla/content/xsl/document/src/makefile.win b/mozilla/content/xsl/document/src/makefile.win index fbfd54c3e6c..caf21707755 100644 --- a/mozilla/content/xsl/document/src/makefile.win +++ b/mozilla/content/xsl/document/src/makefile.win @@ -21,7 +21,13 @@ LIBRARY_NAME=raptorxsldoc_s MODULE=raptor REQUIRES=xpcom raptor pref -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN +DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN \ +!if defined(MOZ_XSL) +-DXSL +!endif + +XPIDLSRCS= .\nsIDocumentTransformer.idl \ + $(NULL) CPPSRCS= \ nsXSLContentSink.cpp \ @@ -34,7 +40,6 @@ CPP_OBJS= \ $(NULL) EXPORTS = \ - nsIDocumentTransformer.h \ nsITransformMediator.h \ $(NULL) diff --git a/mozilla/content/xsl/document/src/nsIDocumentTransformer.idl b/mozilla/content/xsl/document/src/nsIDocumentTransformer.idl new file mode 100644 index 00000000000..c2be2296052 --- /dev/null +++ b/mozilla/content/xsl/document/src/nsIDocumentTransformer.idl @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" + +interface nsIDOMElement; +interface nsIDOMDocument; +interface nsIObserver; + +/** + * This interface should be implemented by any object that wants to + * transform the content model of the current document before the + * document is displayed. One possible implementor of this interface + * is an XSL processor. + */ + +[scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)] +interface nsIDocumentTransformer : nsISupports +{ + void TransformDocument(in nsIDOMElement aSourceDOM, + in nsIDOMElement aStyleDOM, + in nsIDOMDocument aOutputDOC, + in nsIObserver aObserver); +}; + + +%{ C++ +extern nsresult +NS_NewDocumentTransformer(nsIDocumentTransformer** aDocTransformer); +%} \ No newline at end of file diff --git a/mozilla/content/xsl/document/src/nsTransformMediator.cpp b/mozilla/content/xsl/document/src/nsTransformMediator.cpp index 4b32a8954be..53ddb6f6e07 100644 --- a/mozilla/content/xsl/document/src/nsTransformMediator.cpp +++ b/mozilla/content/xsl/document/src/nsTransformMediator.cpp @@ -21,9 +21,8 @@ #include "nsIComponentManager.h" static NS_DEFINE_IID(kITransformMediatorIID, NS_ITRANSFORM_MEDIATOR_IID); -static NS_DEFINE_IID(kIDocumentTransformerIID, NS_IDOCUMENT_TRANSFORMER_IID); -const char* kTransformerProgIDPrefix = "component://netscape/document-converter?type="; +const char* kTransformerProgIDPrefix = "component://netscape/document-transformer?type="; nsresult NS_NewTransformMediator(nsITransformMediator** aResult, @@ -90,7 +89,7 @@ nsTransformMediator::Init(const nsString& aMimeType) if (NS_SUCCEEDED(rv)) { // Try to find a component that implements the nsIDocumentTransformer interface rv = nsComponentManager::CreateInstance(cid, nsnull, - kIDocumentTransformerIID, (void**) &mTransformer); + NS_GET_IID(nsIDocumentTransformer), (void**) &mTransformer); } delete [] progIDStr; } diff --git a/mozilla/layout/xsl/document/src/makefile.win b/mozilla/layout/xsl/document/src/makefile.win index fbfd54c3e6c..caf21707755 100644 --- a/mozilla/layout/xsl/document/src/makefile.win +++ b/mozilla/layout/xsl/document/src/makefile.win @@ -21,7 +21,13 @@ LIBRARY_NAME=raptorxsldoc_s MODULE=raptor REQUIRES=xpcom raptor pref -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN +DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN \ +!if defined(MOZ_XSL) +-DXSL +!endif + +XPIDLSRCS= .\nsIDocumentTransformer.idl \ + $(NULL) CPPSRCS= \ nsXSLContentSink.cpp \ @@ -34,7 +40,6 @@ CPP_OBJS= \ $(NULL) EXPORTS = \ - nsIDocumentTransformer.h \ nsITransformMediator.h \ $(NULL) diff --git a/mozilla/layout/xsl/document/src/nsIDocumentTransformer.idl b/mozilla/layout/xsl/document/src/nsIDocumentTransformer.idl new file mode 100644 index 00000000000..c2be2296052 --- /dev/null +++ b/mozilla/layout/xsl/document/src/nsIDocumentTransformer.idl @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" + +interface nsIDOMElement; +interface nsIDOMDocument; +interface nsIObserver; + +/** + * This interface should be implemented by any object that wants to + * transform the content model of the current document before the + * document is displayed. One possible implementor of this interface + * is an XSL processor. + */ + +[scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)] +interface nsIDocumentTransformer : nsISupports +{ + void TransformDocument(in nsIDOMElement aSourceDOM, + in nsIDOMElement aStyleDOM, + in nsIDOMDocument aOutputDOC, + in nsIObserver aObserver); +}; + + +%{ C++ +extern nsresult +NS_NewDocumentTransformer(nsIDocumentTransformer** aDocTransformer); +%} \ No newline at end of file diff --git a/mozilla/layout/xsl/document/src/nsTransformMediator.cpp b/mozilla/layout/xsl/document/src/nsTransformMediator.cpp index 4b32a8954be..53ddb6f6e07 100644 --- a/mozilla/layout/xsl/document/src/nsTransformMediator.cpp +++ b/mozilla/layout/xsl/document/src/nsTransformMediator.cpp @@ -21,9 +21,8 @@ #include "nsIComponentManager.h" static NS_DEFINE_IID(kITransformMediatorIID, NS_ITRANSFORM_MEDIATOR_IID); -static NS_DEFINE_IID(kIDocumentTransformerIID, NS_IDOCUMENT_TRANSFORMER_IID); -const char* kTransformerProgIDPrefix = "component://netscape/document-converter?type="; +const char* kTransformerProgIDPrefix = "component://netscape/document-transformer?type="; nsresult NS_NewTransformMediator(nsITransformMediator** aResult, @@ -90,7 +89,7 @@ nsTransformMediator::Init(const nsString& aMimeType) if (NS_SUCCEEDED(rv)) { // Try to find a component that implements the nsIDocumentTransformer interface rv = nsComponentManager::CreateInstance(cid, nsnull, - kIDocumentTransformerIID, (void**) &mTransformer); + NS_GET_IID(nsIDocumentTransformer), (void**) &mTransformer); } delete [] progIDStr; }