File indexing completed on 2024-12-01 13:11:43

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2014 Inge Wallin <inge@lysator.liu.se>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 
0022 // Own
0023 #include "KoOdfHeaderFooterProperties.h"
0024 
0025 // Qt
0026 #include <QString>
0027 
0028 // odflib
0029 #include <KoXmlStreamReader.h>
0030 #include <KoXmlWriter.h>
0031 
0032 #include "Odf2Debug.h"
0033 
0034 
0035 // ----------------------------------------------------------------
0036 //                         private class
0037 
0038 
0039 class Q_DECL_HIDDEN KoOdfHeaderFooterProperties::Private
0040 {
0041 public:
0042     Private() {};
0043     ~Private() {};
0044 
0045     // NYI: Background Image
0046 };
0047 
0048 
0049 // ----------------------------------------------------------------
0050 
0051 
0052 KoOdfHeaderFooterProperties::KoOdfHeaderFooterProperties()
0053     : KoOdfStyleProperties()
0054     , d(new KoOdfHeaderFooterProperties::Private())
0055 {
0056 }
0057 
0058 KoOdfHeaderFooterProperties::~KoOdfHeaderFooterProperties()
0059 {
0060     delete d;
0061 }
0062 
0063 
0064 void KoOdfHeaderFooterProperties::clear()
0065 {
0066     KoOdfStyleProperties::clear();
0067 }
0068 
0069 
0070 bool KoOdfHeaderFooterProperties::readOdf(KoXmlStreamReader &reader)
0071 {
0072     bool retval = readAttributes(reader);
0073     if (!retval) {
0074         return false;
0075     }
0076 
0077     // Load child elements.  For header-footer-properties, these are:
0078     //  - style:background-image
0079     while (reader.readNextStartElement()) {
0080         QString child = reader.qualifiedName().toString();
0081 
0082         if (child == "style:background-image") {
0083             // FIXME: NYI
0084         }
0085 
0086         // Skip rest of each element including children that are not read yet (shouldn't be any).
0087         reader.skipCurrentElement();
0088     }
0089 
0090     return retval;
0091 }
0092 
0093 bool KoOdfHeaderFooterProperties::saveOdf(const QString &propertySet, KoXmlWriter *writer)
0094 {
0095     Q_UNUSED(propertySet);
0096 
0097     writer->startElement("style:header-footer-properties");
0098     saveAttributes(writer);
0099 
0100     // Save child elements of style:header-footer-properties
0101     // FIXME NYI: style:background-image
0102 
0103     writer->endElement(); // style:header-footer-properties
0104 
0105     return true;
0106 }