| 1 | // Copyright (C) 2025 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QSVGCSSHANDLER_P_H |
| 5 | #define QSVGCSSHANDLER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtSvg/private/qtsvgglobal_p.h> |
| 19 | #include <QtSvg/private/qsvgcssanimation_p.h> |
| 20 | #include <QtCore/qstringview.h> |
| 21 | #include <QtGui/private/qcssparser_p.h> |
| 22 | #include <QtCore/qxmlstream.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QSvgStyleSelector; |
| 27 | class QSvgNode; |
| 28 | class QSvgCssHandler { |
| 29 | public: |
| 30 | QSvgCssHandler(); |
| 31 | ~QSvgCssHandler(); |
| 32 | |
| 33 | QSvgCssAnimation *createAnimation(QStringView name); |
| 34 | void collectAnimations(const QCss::StyleSheet &sheet); |
| 35 | |
| 36 | void parseStyleSheet(const QStringView str); |
| 37 | void parseCSStoXMLAttrs(const QList<QCss::Declaration> &declarations, QXmlStreamAttributes &attributes) const; |
| 38 | void parseCSStoXMLAttrs(const QString &css, QXmlStreamAttributes &attributes) const; |
| 39 | |
| 40 | void styleLookup(QSvgNode *node, QXmlStreamAttributes &attributes) const; |
| 41 | |
| 42 | private: |
| 43 | QHash<QString, QCss::AnimationRule> m_animations; |
| 44 | QSvgStyleSelector *m_selector = nullptr; |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | QT_END_NAMESPACE |
| 49 | |
| 50 | #endif // QSVGCSSHANDLER_P_H |
| 51 | |