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 __BOOKMODEL_H__
21 #define __BOOKMODEL_H__
26 #include <ZLTextModel.h>
27 #include <ZLTextParagraph.h>
28 #include "../description/BookDescription.h"
32 class ContentsModel
: public ZLTextTreeModel
{
35 void setReference(const ZLTextTreeParagraph
*paragraph
, int reference
);
36 int reference(const ZLTextTreeParagraph
*paragraph
) const;
39 std::map
<const ZLTextTreeParagraph
*,int> myReferenceByParagraph
;
46 Label(shared_ptr
<ZLTextModel
> model
, int paragraphNumber
) : Model(model
), ParagraphNumber(paragraphNumber
) {}
48 const shared_ptr
<ZLTextModel
> Model
;
49 const int ParagraphNumber
;
53 BookModel(const BookDescriptionPtr description
);
56 const std::string
&fileName() const;
58 shared_ptr
<ZLTextModel
> bookTextModel() const;
59 shared_ptr
<ZLTextModel
> contentsModel() const;
61 const ZLImageMap
&imageMap() const;
62 Label
label(const std::string
&id
) const;
64 const BookDescriptionPtr
description() const;
67 const BookDescriptionPtr myDescription
;
68 shared_ptr
<ZLTextModel
> myBookTextModel
;
69 shared_ptr
<ZLTextModel
> myContentsModel
;
71 std::map
<std::string
,shared_ptr
<ZLTextModel
> > myFootnotes
;
72 std::map
<std::string
,Label
> myInternalHyperlinks
;
74 friend class BookReader
;
77 inline shared_ptr
<ZLTextModel
> BookModel::bookTextModel() const { return myBookTextModel
; }
78 inline shared_ptr
<ZLTextModel
> BookModel::contentsModel() const { return myContentsModel
; }
79 inline const ZLImageMap
&BookModel::imageMap() const { return myImages
; }
80 inline const BookDescriptionPtr
BookModel::description() const { return myDescription
; }
82 #endif /* __BOOKMODEL_H__ */