1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGLOADINGCONTEXT_H
#define SVGLOADINGCONTEXT_H
#include "flake_export.h"
#include <KoXmlReader.h>
class SvgGraphicsContext;
class SvgStyleParser;
class KoDocumentResourceManager;
class KoImageCollection;
class KoShape;
/// Contains data used for loading svg
class FLAKE_EXPORT SvgLoadingContext
{
public:
SvgLoadingContext(KoDocumentResourceManager *documentResourceManager);
~SvgLoadingContext();
/// Returns the current graphics context
SvgGraphicsContext *currentGC() const;
/// Pushes a new graphics context to the stack
SvgGraphicsContext *pushGraphicsContext(const KoXmlElement &element = KoXmlElement(), bool inherit = true);
/// Pops the current graphics context from the stack
void popGraphicsContext();
/// Sets the initial xml base dir, i.e. the directory the svg file is read from
void setInitialXmlBaseDir(const QString &baseDir);
/// Returns the current xml base dir
QString xmlBaseDir() const;
/// Constructs an absolute file path from the given href and current xml base directory
QString absoluteFilePath(const QString &href);
/// Returns the next z-index
int nextZIndex();
/// Returns the image collection used for managing images
KoImageCollection* imageCollection();
/// Registers a shape so it can be referenced later
void registerShape(const QString &id, KoShape *shape);
/// Returns shape with specified id
KoShape* shapeById(const QString &id);
/// Adds a definition for later use
void addDefinition(const KoXmlElement &element);
/// Returns the definition with the specified id
KoXmlElement definition(const QString &id) const;
/// Checks if a definition with the specified id exists
bool hasDefinition(const QString &id) const;
/// Adds a css style sheet
void addStyleSheet(const KoXmlElement &styleSheet);
/// Returns list of css styles matching to the specified element
QStringList matchingStyles(const KoXmlElement &element) const;
/// Returns a style parser to parse styles
SvgStyleParser &styleParser();
private:
class Private;
Private * const d;
};
#endif // SVGLOADINGCONTEXT_H
|