1/*
2 * This file is part of the XSL implementation.
3 *
4 * Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB.  If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#include "config.h"
23#include "XSLStyleSheet.h"
24
25#if ENABLE(XSLT)
26
27#include "DOMWindow.h"
28#include "Document.h"
29#include "Node.h"
30#include "NotImplemented.h"
31#include "XSLImportRule.h"
32#include "XSLTProcessor.h"
33
34namespace WebCore {
35
36XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL,  bool embedded)
37    : m_ownerNode(parentNode)
38    , m_originalURL(originalURL)
39    , m_finalURL(finalURL)
40    , m_isDisabled(false)
41    , m_embedded(embedded)
42{
43}
44
45XSLStyleSheet::~XSLStyleSheet()
46{
47    for (unsigned i = 0; i < m_children.size(); ++i) {
48        ASSERT(m_children.at(i)->parentStyleSheet() == this);
49        m_children.at(i)->setParentStyleSheet(0);
50    }
51}
52
53bool XSLStyleSheet::isLoading() const
54{
55    notImplemented();
56    return false;
57}
58
59void XSLStyleSheet::checkLoaded()
60{
61    if (ownerNode())
62        ownerNode()->sheetLoaded();
63}
64
65void XSLStyleSheet::clearDocuments()
66{
67    notImplemented();
68}
69
70CachedResourceLoader* XSLStyleSheet::cachedResourceLoader()
71{
72    Document* document = ownerDocument();
73    if (!document)
74        return 0;
75    return document->cachedResourceLoader();
76}
77
78bool XSLStyleSheet::parseString(const String& string)
79{
80    // FIXME: Fix QXmlQuery so that it allows compiling the stylesheet before setting the document
81    // to be transformed. This way we could not only check if the stylesheet is correct before using it
82    // but also turn XSLStyleSheet::sheetString() into XSLStyleSheet::query() that returns a QXmlQuery.
83
84    m_sheetString = string;
85    return !m_sheetString.isEmpty();
86}
87
88void XSLStyleSheet::loadChildSheets()
89{
90    notImplemented();
91}
92
93void XSLStyleSheet::loadChildSheet(const String&)
94{
95    notImplemented();
96}
97
98Document* XSLStyleSheet::ownerDocument()
99{
100    Node* node = ownerNode();
101    return node ? node->document() : 0;
102}
103
104void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet*)
105{
106    notImplemented();
107}
108
109void XSLStyleSheet::markAsProcessed()
110{
111    notImplemented();
112}
113
114} // namespace WebCore
115
116#endif // ENABLE(XSLT)
117