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 __PLUCKERBOOKREADER_H__
21 #define __PLUCKERBOOKREADER_H__
26 #include <ZLEncodingConverter.h>
28 #include "../../bookmodel/BookReader.h"
29 #include "../EncodedTextReader.h"
31 class PluckerBookReader
: public BookReader
, public EncodedTextReader
{
34 PluckerBookReader(const std::string
&filePath
, BookModel
&model
, const std::string
&encoding
);
55 void readRecord(size_t recordSize
);
56 void processTextRecord(size_t size
, const std::vector
<int> &pars
);
57 void processTextParagraph(char *start
, char *end
);
58 void processTextFunction(char *ptr
);
59 void setFont(FontType font
, bool start
);
60 void changeFont(FontType font
);
62 void safeAddControl(FBTextKind kind
, bool start
);
63 void safeAddHyperlinkControl(const std::string
&id
);
64 void safeBeginParagraph();
65 void safeEndParagraph();
67 void processHeader(FontType font
, bool start
);
70 std::string myFilePath
;
71 shared_ptr
<ZLInputStream
> myStream
;
74 std::string myConvertedTextBuffer
;
75 bool myParagraphStarted
;
77 ZLTextForcedControlEntry
*myForcedEntry
;
78 std::vector
<std::pair
<FBTextKind
,bool> > myDelayedControls
;
79 std::vector
<std::string
> myDelayedHyperlinks
;
80 unsigned short myCompressionVersion
;
81 unsigned char myBytesToSkip
;
83 std::set
<std::pair
<int, int> > myReferencedParagraphs
;
84 std::map
<int, std::vector
<int> > myParagraphMap
;
85 std::vector
<int> *myParagraphVector
;
86 bool myParagraphStored
;
89 #endif /* __PLUCKERBOOKREADER_H__ */