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

       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) 2001
      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_MOZILLA_XML_OUTPUT_H
      40                 : #define TRANSFRMX_MOZILLA_XML_OUTPUT_H
      41                 : 
      42                 : #include "txXMLEventHandler.h"
      43                 : #include "nsAutoPtr.h"
      44                 : #include "nsIScriptLoaderObserver.h"
      45                 : #include "txOutputFormat.h"
      46                 : #include "nsCOMArray.h"
      47                 : #include "nsICSSLoaderObserver.h"
      48                 : #include "txStack.h"
      49                 : 
      50                 : class nsIContent;
      51                 : class nsIDOMDocument;
      52                 : class nsIAtom;
      53                 : class nsIDOMDocumentFragment;
      54                 : class nsIDOMElement;
      55                 : class nsIStyleSheet;
      56                 : class nsIDOMNode;
      57                 : class nsITransformObserver;
      58                 : class nsNodeInfoManager;
      59                 : class nsIDocument;
      60                 : class nsINode;
      61                 : 
      62                 : class txTransformNotifier : public nsIScriptLoaderObserver,
      63                 :                             public nsICSSLoaderObserver
      64               0 : {
      65                 : public:
      66                 :     txTransformNotifier();
      67                 : 
      68                 :     NS_DECL_ISUPPORTS
      69                 :     NS_DECL_NSISCRIPTLOADEROBSERVER
      70                 :     
      71                 :     // nsICSSLoaderObserver
      72                 :     NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet,
      73                 :                                 bool aWasAlternate,
      74                 :                                 nsresult aStatus);
      75                 : 
      76                 :     void Init(nsITransformObserver* aObserver);
      77                 :     nsresult AddScriptElement(nsIScriptElement* aElement);
      78                 :     void AddPendingStylesheet();
      79                 :     void OnTransformEnd(nsresult aResult = NS_OK);
      80                 :     void OnTransformStart();
      81                 :     nsresult SetOutputDocument(nsIDocument* aDocument);
      82                 : 
      83                 : private:
      84                 :     void SignalTransformEnd(nsresult aResult = NS_OK);
      85                 : 
      86                 :     nsCOMPtr<nsIDocument> mDocument;
      87                 :     nsCOMPtr<nsITransformObserver> mObserver;
      88                 :     nsCOMArray<nsIScriptElement> mScriptElements;
      89                 :     PRUint32 mPendingStylesheetCount;
      90                 :     bool mInTransform;
      91                 : };
      92                 : 
      93                 : class txMozillaXMLOutput : public txAOutputXMLEventHandler
      94                 : {
      95                 : public:
      96                 :     txMozillaXMLOutput(txOutputFormat* aFormat,
      97                 :                        nsITransformObserver* aObserver);
      98                 :     txMozillaXMLOutput(txOutputFormat* aFormat,
      99                 :                        nsIDOMDocumentFragment* aFragment,
     100                 :                        bool aNoFixup);
     101                 :     ~txMozillaXMLOutput();
     102                 : 
     103                 :     TX_DECL_TXAXMLEVENTHANDLER
     104                 :     TX_DECL_TXAOUTPUTXMLEVENTHANDLER
     105                 : 
     106                 :     nsresult closePrevious(bool aFlushText);
     107                 : 
     108                 :     nsresult createResultDocument(const nsSubstring& aName, PRInt32 aNsID,
     109                 :                                   nsIDOMDocument* aSourceDocument);
     110                 : 
     111                 : private:
     112                 :     nsresult createTxWrapper();
     113                 :     nsresult startHTMLElement(nsIContent* aElement, bool aXHTML);
     114                 :     nsresult endHTMLElement(nsIContent* aElement);
     115                 :     void processHTTPEquiv(nsIAtom* aHeader, const nsString& aValue);
     116                 :     nsresult createHTMLElement(nsIAtom* aName,
     117                 :                                nsIContent** aResult);
     118                 : 
     119                 :     nsresult attributeInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
     120                 :                                PRInt32 aNsID, const nsString& aValue);
     121                 :     nsresult startElementInternal(nsIAtom* aPrefix, nsIAtom* aLocalName,
     122                 :                                   PRInt32 aNsID);
     123                 : 
     124                 :     nsCOMPtr<nsIDocument> mDocument;
     125                 :     nsCOMPtr<nsINode> mCurrentNode;     // This is updated once an element is
     126                 :                                         // 'closed' (i.e. once we're done
     127                 :                                         // adding attributes to it).
     128                 :                                         // until then the opened element is
     129                 :                                         // kept in mOpenedElement
     130                 :     nsCOMPtr<nsIContent> mOpenedElement;
     131                 :     nsRefPtr<nsNodeInfoManager> mNodeInfoManager;
     132                 : 
     133                 :     nsCOMArray<nsINode> mCurrentNodeStack;
     134                 : 
     135                 :     nsCOMPtr<nsIContent> mNonAddedNode;
     136                 : 
     137                 :     nsRefPtr<txTransformNotifier> mNotifier;
     138                 : 
     139                 :     PRUint32 mTreeDepth, mBadChildLevel;
     140                 :     nsCString mRefreshString;
     141                 : 
     142                 :     txStack mTableStateStack;
     143                 :     enum TableState {
     144                 :         NORMAL,      // An element needing no special treatment
     145                 :         TABLE,       // A HTML table element
     146                 :         ADDED_TBODY  // An inserted tbody not coming from the stylesheet
     147                 :     };
     148                 :     TableState mTableState;
     149                 : 
     150                 :     nsAutoString mText;
     151                 : 
     152                 :     txOutputFormat mOutputFormat;
     153                 : 
     154                 :     bool mCreatingNewDocument;
     155                 : 
     156                 :     bool mOpenedElementIsHTML;
     157                 : 
     158                 :     // Set to true when we know there's a root content in our document.
     159                 :     bool mRootContentCreated;
     160                 : 
     161                 :     bool mNoFixup;
     162                 : 
     163                 :     enum txAction { eCloseElement = 1, eFlushText = 2 };
     164                 : };
     165                 : 
     166                 : #endif

Generated by: LCOV version 1.7