File indexing completed on 2024-05-12 16:36:42

0001 /* This file is part of the KDE project
0002  *  Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
0003  *  Contact: Amit Aggarwal <amitcs06@gmail.com>
0004  *            <amit.5.aggarwal@nokia.com>
0005  *  Copyright (C) 2010 Thorsten Zachmann <t.zachmann@zagge.de>
0006  *
0007  *  This library is free software; you can redistribute it and/or
0008  *  modify it under the terms of the GNU Library General Public
0009  *  License as published by the Free Software Foundation; either
0010  *  version 2 of the License, or (at your option) any later version.
0011  *
0012  *  This library is distributed in the hope that it will be useful,
0013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  *  Library General Public License for more details.
0016  *
0017  *  You should have received a copy of the GNU Library General Public License
0018  *  along with this library; see the file COPYING.LIB.  If not, write to
0019  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  *  Boston, MA 02110-1301, USA.
0021  */
0022 
0023 #ifndef KPRDECLARATIONS_H
0024 #define KPRDECLARATIONS_H
0025 
0026 #include <QString>
0027 #include <QHash>
0028 #include <QVariant>
0029 
0030 class KoXmlElement;
0031 class KoPALoadingContext;
0032 class KoPASavingContext;
0033 
0034 class KPrDeclarations
0035 {
0036 public:
0037     /**
0038      * Presentation declaration type
0039      */
0040     enum Type {
0041         Footer,
0042         Header,
0043         DateTime
0044     };
0045 
0046     /**
0047      * Constructor
0048      */
0049     KPrDeclarations();
0050 
0051     /**
0052      * Destructor
0053      */
0054     ~KPrDeclarations();
0055 
0056     /**
0057      * loadOdfDeclaration
0058      * @param body KoXmlElement & body
0059      * @param context KoPALoadingContext
0060      * @return bool value
0061      */
0062     bool loadOdf(const KoXmlElement &body, KoPALoadingContext &context);
0063 
0064     /**
0065      * Save presentation:declaration entries
0066      */
0067     bool saveOdf(KoPASavingContext &paContext) const;
0068 
0069     /**
0070      * Similar to findStyle but for decls only.
0071      * \note Searches in content.xml added declaration!
0072      */
0073     const QString declaration(Type type, const QString &key);
0074 
0075 private:
0076     QHash<Type, QHash<QString /*key*/, QVariant /*data*/> > m_declarations;
0077 };
0078 
0079 #endif /* KPRDECLARATIONS_H */