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