2 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #include <ZLStringUtil.h>
24 #include <ZLInputStream.h>
26 #include "RtfPlugin.h"
27 #include "RtfDescriptionReader.h"
28 #include "RtfBookReader.h"
29 #include "../../description/BookDescription.h"
31 bool RtfPlugin::providesMetaInfo() const {
35 bool RtfPlugin::acceptsFile(const ZLFile
&file
) const {
36 const std::string
&extension
= file
.extension();
37 return (extension
== "rtf");
40 bool RtfPlugin::readDescription(const std::string
&path
, BookDescription
&description
) const {
42 shared_ptr
<ZLInputStream
> stream
= file
.inputStream();
44 if (stream
.isNull()) {
48 detectEncodingAndLanguage(description
, *stream
);
50 if (!RtfDescriptionReader(description
).readDocument(path
)) {
57 bool RtfPlugin::readModel(const BookDescription
&description
, BookModel
&model
) const {
58 return RtfBookReader(model
, description
.encoding()).readDocument(description
.fileName());
61 const std::string
&RtfPlugin::iconName() const {
62 static const std::string ICON_NAME
= "rtf";
66 FormatInfoPage
*RtfPlugin::createInfoPage(ZLOptionsDialog
&, const std::string
&) {