LCOV - code coverage report
Current view: directory - content/xslt/src/xslt - txMozillaXSLTProcessor.h (source / functions) Found Hit Coverage
Test: app.info Lines: 7 1 14.3 %
Date: 2012-06-02 Functions: 8 1 12.5 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is TransforMiiX XSLT processor code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2002
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Peter Van der Beken <peterv@propagandism.org>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef TRANSFRMX_TXMOZILLAXSLTPROCESSOR_H
      40                 : #define TRANSFRMX_TXMOZILLAXSLTPROCESSOR_H
      41                 : 
      42                 : #include "nsAutoPtr.h"
      43                 : #include "nsStubMutationObserver.h"
      44                 : #include "nsIDocumentTransformer.h"
      45                 : #include "nsIXSLTProcessor.h"
      46                 : #include "nsIXSLTProcessorPrivate.h"
      47                 : #include "txExpandedNameMap.h"
      48                 : #include "txNamespaceMap.h"
      49                 : #include "nsIJSNativeInitializer.h"
      50                 : #include "nsCycleCollectionParticipant.h"
      51                 : 
      52                 : class nsIDOMNode;
      53                 : class nsIPrincipal;
      54                 : class nsIURI;
      55                 : class nsIXMLContentSink;
      56                 : class txStylesheet;
      57                 : class txResultRecycler;
      58                 : class txIGlobalParameter;
      59                 : 
      60                 : /* bacd8ad0-552f-11d3-a9f7-000064657374 */
      61                 : #define TRANSFORMIIX_XSLT_PROCESSOR_CID   \
      62                 : { 0xbacd8ad0, 0x552f, 0x11d3, {0xa9, 0xf7, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }
      63                 : 
      64                 : #define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID \
      65                 : "@mozilla.org/document-transformer;1?type=xslt"
      66                 : 
      67                 : #define XSLT_MSGS_URL  "chrome://global/locale/xslt/xslt.properties"
      68                 : 
      69                 : /**
      70                 :  * txMozillaXSLTProcessor is a front-end to the XSLT Processor.
      71                 :  */
      72                 : class txMozillaXSLTProcessor : public nsIXSLTProcessor,
      73                 :                                public nsIXSLTProcessorPrivate,
      74                 :                                public nsIDocumentTransformer,
      75                 :                                public nsStubMutationObserver,
      76                 :                                public nsIJSNativeInitializer
      77                 : {
      78                 : public:
      79                 :     /**
      80                 :      * Creates a new txMozillaXSLTProcessor
      81                 :      */
      82                 :     txMozillaXSLTProcessor();
      83                 : 
      84                 :     /**
      85                 :      * Default destructor for txMozillaXSLTProcessor
      86                 :      */
      87                 :     ~txMozillaXSLTProcessor();
      88                 : 
      89                 :     // nsISupports interface
      90               0 :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      91            1464 :     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(txMozillaXSLTProcessor,
      92                 :                                              nsIXSLTProcessor)
      93                 : 
      94                 :     // nsIXSLTProcessor interface
      95                 :     NS_DECL_NSIXSLTPROCESSOR
      96                 : 
      97                 :     // nsIXSLTProcessorPrivate interface
      98                 :     NS_DECL_NSIXSLTPROCESSORPRIVATE
      99                 : 
     100                 :     // nsIDocumentTransformer interface
     101                 :     NS_IMETHOD Init(nsIPrincipal* aPrincipal);
     102                 :     NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver);
     103                 :     NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsILoadGroup* aLoadGroup);
     104                 :     NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource);
     105               0 :     NS_IMETHOD CancelLoads() {return NS_OK;}
     106                 :     NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
     107                 :                                      const nsString& aNamespace);
     108                 :     NS_IMETHOD AddXSLTParam(const nsString& aName,
     109                 :                             const nsString& aNamespace,
     110                 :                             const nsString& aSelect,
     111                 :                             const nsString& aValue,
     112                 :                             nsIDOMNode* aContext);
     113                 : 
     114                 :     // nsIMutationObserver interface
     115                 :     NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
     116                 :     NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
     117                 :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
     118                 :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
     119                 :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
     120                 :     NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
     121                 : 
     122                 :     nsresult setStylesheet(txStylesheet* aStylesheet);
     123                 :     void reportError(nsresult aResult, const PRUnichar *aErrorText,
     124                 :                      const PRUnichar *aSourceText);
     125                 : 
     126               0 :     nsIDOMNode *GetSourceContentModel()
     127                 :     {
     128               0 :         return mSource;
     129                 :     }
     130                 : 
     131                 :     nsresult TransformToDoc(nsIDOMDocument **aResult);
     132                 : 
     133               0 :     bool IsLoadDisabled()
     134                 :     {
     135               0 :         return (mFlags & DISABLE_ALL_LOADS) != 0;
     136                 :     }
     137                 : 
     138                 :     // nsIJSNativeInitializer
     139                 :     NS_IMETHODIMP Initialize(nsISupports* aOwner, JSContext *cx, JSObject *obj,
     140                 :                              PRUint32 argc, jsval *argv);
     141                 : 
     142                 :     static nsresult Startup();
     143                 :     static void Shutdown();
     144                 : 
     145                 : private:
     146                 :     nsresult DoTransform();
     147                 :     void notifyError();
     148                 :     nsresult ensureStylesheet();
     149                 : 
     150                 :     nsRefPtr<txStylesheet> mStylesheet;
     151                 :     nsIDocument* mStylesheetDocument; // weak
     152                 :     nsCOMPtr<nsIContent> mEmbeddedStylesheetRoot;
     153                 : 
     154                 :     nsCOMPtr<nsIDOMNode> mSource;
     155                 :     nsresult mTransformResult;
     156                 :     nsresult mCompileResult;
     157                 :     nsString mErrorText, mSourceText;
     158                 :     nsCOMPtr<nsIPrincipal> mPrincipal;
     159                 :     nsCOMPtr<nsITransformObserver> mObserver;
     160                 :     txOwningExpandedNameMap<txIGlobalParameter> mVariables;
     161                 :     txNamespaceMap mParamNamespaceMap;
     162                 :     nsRefPtr<txResultRecycler> mRecycler;
     163                 : 
     164                 :     PRUint32 mFlags;
     165                 : };
     166                 : 
     167                 : extern nsresult TX_LoadSheet(nsIURI* aUri, txMozillaXSLTProcessor* aProcessor,
     168                 :                              nsILoadGroup* aLoadGroup,
     169                 :                              nsIPrincipal* aCallerPrincipal);
     170                 : 
     171                 : extern nsresult TX_CompileStylesheet(nsINode* aNode,
     172                 :                                      txMozillaXSLTProcessor* aProcessor,
     173                 :                                      nsIPrincipal* aCallerPrincipal,
     174                 :                                      txStylesheet** aStylesheet);
     175                 : 
     176                 : #endif

Generated by: LCOV version 1.7