XSLStyleSheetQt.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #include "config.h"
  22. #include "XSLStyleSheet.h"
  23. #if ENABLE(XSLT)
  24. #include "DOMWindow.h"
  25. #include "Document.h"
  26. #include "Node.h"
  27. #include "NotImplemented.h"
  28. #include "XSLImportRule.h"
  29. #include "XSLTProcessor.h"
  30. namespace WebCore {
  31. XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)
  32. : m_ownerNode(parentNode)
  33. , m_originalURL(originalURL)
  34. , m_finalURL(finalURL)
  35. , m_isDisabled(false)
  36. , m_embedded(embedded)
  37. {
  38. }
  39. XSLStyleSheet::~XSLStyleSheet()
  40. {
  41. for (unsigned i = 0; i < m_children.size(); ++i) {
  42. ASSERT(m_children.at(i)->parentStyleSheet() == this);
  43. m_children.at(i)->setParentStyleSheet(0);
  44. }
  45. }
  46. bool XSLStyleSheet::isLoading() const
  47. {
  48. notImplemented();
  49. return false;
  50. }
  51. void XSLStyleSheet::checkLoaded()
  52. {
  53. if (ownerNode())
  54. ownerNode()->sheetLoaded();
  55. }
  56. void XSLStyleSheet::clearDocuments()
  57. {
  58. notImplemented();
  59. }
  60. CachedResourceLoader* XSLStyleSheet::cachedResourceLoader()
  61. {
  62. Document* document = ownerDocument();
  63. if (!document)
  64. return 0;
  65. return document->cachedResourceLoader();
  66. }
  67. bool XSLStyleSheet::parseString(const String& string)
  68. {
  69. // FIXME: Fix QXmlQuery so that it allows compiling the stylesheet before setting the document
  70. // to be transformed. This way we could not only check if the stylesheet is correct before using it
  71. // but also turn XSLStyleSheet::sheetString() into XSLStyleSheet::query() that returns a QXmlQuery.
  72. m_sheetString = string;
  73. return !m_sheetString.isEmpty();
  74. }
  75. void XSLStyleSheet::loadChildSheets()
  76. {
  77. notImplemented();
  78. }
  79. void XSLStyleSheet::loadChildSheet(const String&)
  80. {
  81. notImplemented();
  82. }
  83. Document* XSLStyleSheet::ownerDocument()
  84. {
  85. Node* node = ownerNode();
  86. return node ? node->document() : 0;
  87. }
  88. void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet*)
  89. {
  90. notImplemented();
  91. }
  92. void XSLStyleSheet::markAsProcessed()
  93. {
  94. notImplemented();
  95. }
  96. } // namespace WebCore
  97. #endif // ENABLE(XSLT)