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

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2013 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 "KoOdfGraphicProperties.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 KoOdfGraphicProperties::Private
0040 {
0041 public:
0042     Private() {};
0043     ~Private() {};
0044 
0045     // NYI: Background Image
0046     // NYI: Columns
0047     // NYI: List Style
0048 };
0049 
0050 
0051 // ----------------------------------------------------------------
0052 
0053 
0054 KoOdfGraphicProperties::KoOdfGraphicProperties()
0055     : KoOdfStyleProperties()
0056     , d(new KoOdfGraphicProperties::Private())
0057 {
0058 }
0059 
0060 KoOdfGraphicProperties::~KoOdfGraphicProperties()
0061 {
0062     delete d;
0063 }
0064 
0065 
0066 void KoOdfGraphicProperties::clear()
0067 {
0068     KoOdfStyleProperties::clear();
0069 }
0070 
0071 
0072 bool KoOdfGraphicProperties::readOdf(KoXmlStreamReader &reader)
0073 {
0074     bool retval = readAttributes(reader);
0075     if (!retval) {
0076         return false;
0077     }
0078 
0079     // Load child elements.  For graphic-properties, these are:
0080     //  - style:background-image
0081     //  - style:columns
0082     //  - text:list-style
0083     while (reader.readNextStartElement()) {
0084         QString child = reader.qualifiedName().toString();
0085 
0086         if (child == "style:background-image") {
0087             // FIXME: NYI
0088         }
0089         else if (child == "style:columns") {
0090             // FIXME: NYI
0091         }
0092         else if (child == "text:list-style") {
0093             // FIXME: NYI
0094         }
0095 
0096         // Skip rest of each element including children that are not read yet (shouldn't be any).
0097         reader.skipCurrentElement();
0098     }
0099 
0100     return retval;
0101 }
0102 
0103 bool KoOdfGraphicProperties::saveOdf(const QString &propertySet, KoXmlWriter *writer)
0104 {
0105     Q_UNUSED(propertySet);
0106 
0107     writer->startElement("style:graphic-properties");
0108     saveAttributes(writer);
0109 
0110     // Save child elements of style:graphic-properties
0111     // FIXME NYI: style:background-image
0112     // FIXME NYI: style:columns
0113     // FIXME NYI: text:list-style
0114 
0115     writer->endElement(); // style:graphic-properties
0116 
0117     return true;
0118 }