lib

KoDocumentInfo.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
3 Copyright (C) 2004 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KO_DOCUMENT_INFO_H
22#define KO_DOCUMENT_INFO_H
23
24#include <tqobject.h>
25#include <tqmap.h>
26#include <tdeconfig.h>
27#include <koffice_export.h>
28
29class TQString;
30class TQStringList;
31class TQDomDocument;
32class TQDomElement;
33class TQDomNode;
34class TQDateTime;
35class KoStore;
36class KoDocumentInfoPage;
37class KoXmlWriter;
38
39class KOFFICECORE_EXPORT KoDocumentInfo : public TQObject
40{
41 TQ_OBJECT
42
43public:
44 KoDocumentInfo( TQObject* parent = 0, const char* name = 0 );
45 virtual ~KoDocumentInfo();
46
47 bool load( const TQDomDocument& doc );
48 bool loadOasis( const TQDomDocument& metaDoc );
49
50 TQDomDocument save();
51 bool saveOasis( KoStore* store );
52
57 TQString title() const;
58 TQString creator() const;
59
60 KoDocumentInfoPage* page( const TQString& name ) const;
61 TQStringList pages() const;
62 void documentInfochanged() { emit sigDocumentInfoModifed();}
63 signals:
64 void sigDocumentInfoModifed();
65};
66
67class KOFFICECORE_EXPORT KoDocumentInfoPage : public TQObject
68{
69public:
70 KoDocumentInfoPage( TQObject *parent, const char* name );
71
72 virtual bool load( const TQDomElement& e ) = 0;
73 virtual TQDomElement save( TQDomDocument& doc ) = 0;
74 virtual bool loadOasis( const TQDomNode& metaDoc ) = 0;
75 virtual bool saveOasis( KoXmlWriter &xmlWriter ) = 0;
76};
77
78class KOFFICECORE_EXPORT KoDocumentInfoAuthor : public KoDocumentInfoPage
79{
80 TQ_OBJECT
81
82public:
83 KoDocumentInfoAuthor( KoDocumentInfo* info );
84 ~KoDocumentInfoAuthor();
85
86 virtual bool load( const TQDomElement& e );
87 virtual TQDomElement save( TQDomDocument& doc );
88 virtual bool loadOasis( const TQDomNode& metaDoc );
89 virtual bool saveOasis( KoXmlWriter &xmlWriter );
90
91 TQString fullName() const;
92 TQString initial() const;
93 TQString title() const;
94 TQString company() const;
95 TQString email() const;
96 TQString telephoneHome() const;
97 TQString telephoneWork() const;
98 TQString fax() const;
99 TQString country() const;
100 TQString postalCode() const;
101 TQString city() const;
102 TQString street() const;
103 TQString position() const;
104
105 void setFullName( const TQString& n );
106 void setTitle( const TQString& n );
107 void setCompany( const TQString& n );
108 void setEmail( const TQString& n );
109 void setTelephoneHome( const TQString& n );
110 void setTelephoneWork( const TQString& n );
111 void setFax( const TQString& n );
112 void setCountry( const TQString& n );
113 void setPostalCode( const TQString& n );
114 void setCity( const TQString& n );
115 void setStreet( const TQString& n );
116 void setInitial( const TQString& n );
117 void setPosition( const TQString& n );
118 void initParameters();
119
120private:
121 TQString m_fullName;
122 TQString m_title;
123 TQString m_company;
124 TQString m_email;
125 TQString m_telephoneHome;
126 TQString m_telephoneWork;
127 TQString m_fax;
128 TQString m_country;
129 TQString m_postalCode;
130 TQString m_city;
131 TQString m_street;
132 TQString m_initial;
133 TQString m_position;
134 TDEConfig *m_emailCfg;
135};
136
137class KOFFICECORE_EXPORT KoDocumentInfoAbout : public KoDocumentInfoPage
138{
139 TQ_OBJECT
140
141public:
142 KoDocumentInfoAbout( KoDocumentInfo* info );
143
144 virtual bool load( const TQDomElement& e );
145 virtual TQDomElement save( TQDomDocument& doc );
146 virtual bool loadOasis( const TQDomNode& metaDoc );
147 virtual bool saveOasis( KoXmlWriter &xmlWriter );
148
149 TQString title() const;
150 TQString abstract() const;
151 TQString subject() const;
152 TQString keywords() const;
153 TQString initialCreator() const;
154 TQString editingCycles() const;
155 TQString creationDate() const;
156 TQString modificationDate() const;
157
158 void setKeywords( const TQString &n );
159 void setSubject( const TQString& n );
160
161 void setTitle( const TQString& n );
162 void setAbstract( const TQString& n );
163 void saveParameters();
164
165public slots:
166 void resetMetaData();
167
168private:
169 KoDocumentInfo* m_docInfo;
170 TQString m_title;
171 TQString m_abstract;
172 TQString m_keywords;
173 TQString m_subject;
174 TQString m_initialCreator;
175 TQDateTime m_creationDate;
176 TQDateTime m_modificationDate;
177 int m_editingCycles;
178 bool m_firstSave;
179};
180
181class KOFFICECORE_EXPORT KoDocumentInfoUserMetadata : public KoDocumentInfoPage
182{
183 TQ_OBJECT
184
185public:
186 KoDocumentInfoUserMetadata( KoDocumentInfo* info );
187
188 virtual bool load( const TQDomElement& e );
189 virtual TQDomElement save( TQDomDocument& doc );
190 virtual bool loadOasis( const TQDomNode& metaDoc );
191 virtual bool saveOasis( KoXmlWriter &xmlWriter );
192
193 TQMap<TQString, TQString>* metadataList() { return &m_metaList; }
194
195private:
196 TQMap<TQString, TQString> m_metaList;
197 TQStringList m_reserved;
198};
199
200#endif
Saves and loads KOffice documents using various backends.
Definition KoStore.h:40
A class for writing out XML (to any TQIODevice), with a special attention on performance.
Definition KoXmlWriter.h:37
TDEAction * save(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)