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
20 #ifndef __RTFBOOKREADER_H__
21 #define __RTFBOOKREADER_H__
25 #include "RtfReader.h"
26 #include "../../bookmodel/BookReader.h"
32 class RtfBookReader
: public RtfReader
{
35 RtfBookReader(BookModel
&model
, const std::string
&encoding
);
38 bool readDocument(const std::string
&fileName
);
40 bool characterDataHandler(std::string
&str
);
43 void setEncoding(int code
);
45 void switchDestination(DestinationType destination
, bool on
);
46 void addCharData(const char *data
, size_t len
, bool convert
);
47 void insertImage(const std::string
&mimeType
, const std::string
&fileName
, size_t startOffset
, size_t size
);
49 void setFontProperty(FontProperty property
);
53 BookReader myBookReader
;
55 std::string myOutputBuffer
;
60 struct RtfBookReaderState
{
65 RtfBookReaderState myCurrentState
;
66 std::stack
<RtfBookReaderState
> myStateStack
;
69 inline RtfBookReader::~RtfBookReader() {}
71 #endif /* __RTFBOOKREADER_H__ */