1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*- 2 // vi:set ts=4 sts=4 sw=4 noet : 3 // 4 // Copyright 2010-2020 wkhtmltopdf authors 5 // 6 // This file is part of wkhtmltopdf. 7 // 8 // wkhtmltopdf is free software: you can redistribute it and/or modify 9 // it under the terms of the GNU Lesser General Public License as published by 10 // the Free Software Foundation, either version 3 of the License, or 11 // (at your option) any later version. 12 // 13 // wkhtmltopdf is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 // GNU General Public License for more details. 17 // 18 // You should have received a copy of the GNU Lesser General Public License 19 // along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>. 20 21 #ifndef __OUTLINE_P_HH__ 22 #define __OUTLINE_P_HH__ 23 24 #include "outline.hh" 25 #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ 26 #include "dllbegin.inc" 27 namespace wkhtmltopdf { 28 29 class DLL_LOCAL OutlineItem { 30 public: 31 QList<OutlineItem *> children; 32 OutlineItem * parent; 33 uint page; 34 uint document; 35 QString value; 36 QWebElement element; 37 QString anchor; 38 QString tocAnchor; 39 bool display; 40 bool forwardLinks; 41 bool backLinks; 42 void fillAnchors(const OutlineItem * other, 43 int & anchorCounter, 44 QVector<QPair<QWebElement, QString> > & local, 45 QHash<QString, QWebElement> & anchors); 46 bool differentFrom(const OutlineItem * other) const; 47 OutlineItem(); 48 ~OutlineItem(); 49 }; 50 51 class DLL_LOCAL OutlinePrivate { 52 public: 53 const settings::PdfGlobal & settings; 54 QList<OutlineItem *> documentOutlines; 55 QList<int> documentPages; 56 QList<int> prefixSum; 57 int pageCount; 58 int anchorCounter; 59 60 QList< QList< OutlineItem *> > hfCache; 61 62 OutlinePrivate(const settings::PdfGlobal & settings); 63 ~OutlinePrivate(); 64 void buildPrefixSum(); 65 void fillChildAnchors(OutlineItem * item, QHash<QString, QWebElement> & anchors); 66 void outlineChildren(OutlineItem * item, QPrinter * printer, int level); 67 void buildHFCache(OutlineItem * i, int level); 68 void dumpChildren(QTextStream & stream, const QList<OutlineItem *> & items, int level) const; 69 }; 70 71 #include "dllend.inc" 72 } 73 #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ 74 #endif //__OUTLINE_P_HH__ 75