1 /* poppler-private.h: qt interface to poppler 2 * Copyright (C) 2005, Net Integration Technologies, Inc. 3 * Copyright (C) 2005-2008, 2010 Albert Astals Cid <aacid@kde.org> 4 * Copyright (C) 2006, Kristian Høgsberg <krh@bitplanet.net> 5 * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at> 6 * Copyright (C) 2007, Pino Toscano <pino@kde.org> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2, or (at your option) 11 * any later version. 12 * 13 * This program 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 General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 21 */ 22 23 #include <qdom.h> 24 25 #include <config.h> 26 #include <Object.h> 27 #include <PDFDoc.h> 28 #include <FontInfo.h> 29 #if defined(HAVE_SPLASH) 30 #include <SplashOutputDev.h> 31 #else 32 class SplashOutputDev; 33 #endif 34 35 namespace Poppler { 36 37 class Document; 38 class DocumentData; 39 class PageTransition; 40 41 QString unicodeToQString(Unicode* u, int len); 42 43 QString UnicodeParsedString(GooString *s1); 44 45 GooString *QStringToGooString(const QString &s); 46 47 class LinkDestinationData { 48 public: LinkDestinationData(LinkDest * l,GooString * nd,Poppler::DocumentData * pdfdoc)49 LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc) 50 { 51 } 52 53 LinkDest *ld; 54 GooString *namedDest; 55 Poppler::DocumentData *doc; 56 }; 57 58 class DocumentData { 59 public: DocumentData(GooString * filePath,GooString * password)60 DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {} 61 ~DocumentData()62 ~DocumentData() 63 { 64 #if defined(HAVE_SPLASH) 65 delete m_outputDev; 66 #endif 67 delete m_fontInfoScanner; 68 } 69 getOutputDev()70 SplashOutputDev *getOutputDev() 71 { 72 #if defined(HAVE_SPLASH) 73 if (!m_outputDev) 74 { 75 SplashColor white; 76 white[0] = 255; 77 white[1] = 255; 78 white[2] = 255; 79 m_outputDev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white); 80 m_outputDev->startDoc(doc.getXRef()); 81 } 82 #endif 83 return m_outputDev; 84 } 85 86 void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items ); 87 88 class PDFDoc doc; 89 bool locked; 90 FontInfoScanner *m_fontInfoScanner; 91 SplashOutputDev *m_outputDev; 92 }; 93 94 class PageData { 95 public: 96 const Document *doc; 97 int index; 98 PageTransition *transition; 99 ::Page *page; 100 }; 101 102 } 103