1 /************************************************************************* 2 ** SpecialHandler.h ** 3 ** ** 4 ** This file is part of dvisvgm -- the DVI to SVG converter ** 5 ** Copyright (C) 2005-2015 Martin Gieseking <martin.gieseking@uos.de> ** 6 ** ** 7 ** This program is free software; you can redistribute it and/or ** 8 ** modify it under the terms of the GNU General Public License as ** 9 ** published by the Free Software Foundation; either version 3 of ** 10 ** the License, or (at your option) any later version. ** 11 ** ** 12 ** This program is distributed in the hope that it will be useful, but ** 13 ** WITHOUT ANY WARRANTY; without even the implied warranty of ** 14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 15 ** GNU General Public License for more details. ** 16 ** ** 17 ** You should have received a copy of the GNU General Public License ** 18 ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** 19 *************************************************************************/ 20 21 #ifndef DVISVGM_SPECIALHANDLER_H 22 #define DVISVGM_SPECIALHANDLER_H 23 24 #include <istream> 25 #include <list> 26 #include "MessageException.h" 27 28 29 struct SpecialActions; 30 class SpecialManager; 31 32 33 struct SpecialException : public MessageException 34 { SpecialExceptionSpecialException35 SpecialException (const std::string &msg) : MessageException(msg) {} 36 }; 37 38 39 struct DVIPreprocessingListener 40 { ~DVIPreprocessingListenerDVIPreprocessingListener41 virtual ~DVIPreprocessingListener () {} 42 virtual void dviPreprocessingFinished () =0; 43 }; 44 45 46 struct DVIEndPageListener 47 { ~DVIEndPageListenerDVIEndPageListener48 virtual ~DVIEndPageListener () {} 49 virtual void dviEndPage (unsigned pageno) =0; 50 }; 51 52 53 struct DVIPositionListener 54 { ~DVIPositionListenerDVIPositionListener55 virtual ~DVIPositionListener () {} 56 virtual void dviMovedTo (double x, double y) =0; 57 }; 58 59 60 struct SpecialHandler 61 { 62 friend class SpecialManager; 63 ~SpecialHandlerSpecialHandler64 virtual ~SpecialHandler () {} 65 virtual const char** prefixes () const=0; 66 virtual const char* info () const=0; 67 virtual const char* name () const=0; setDviScaleFactorSpecialHandler68 virtual void setDviScaleFactor (double dvi2bp) {} preprocessSpecialHandler69 virtual void preprocess (const char *prefix, std::istream &is, SpecialActions *actions) {} 70 virtual bool process (const char *prefix, std::istream &is, SpecialActions *actions)=0; 71 }; 72 73 74 #endif 75