• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

OXMLi_ListenerState.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource
00004  *
00005  * Copyright (C) 2007 Philippe Milot <PhilMilot@gmail.com>
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef _OXMLI_LISTENERSTATE_H_
00024 #define _OXMLI_LISTENERSTATE_H_
00025 
00026 // Internal includes
00027 #include <OXMLi_Types.h>
00028 #include <OXMLi_StreamListener.h>
00029 
00030 // AbiWord includes
00031 #include <ut_types.h>
00032 
00033 // External includes
00034 #include <stack>
00035 #include <string>
00036 
00037 // Forward declarations
00038 class OXMLi_StreamListener;
00039 
00040 /* \class OXMLi_ListenerState
00041  * \brief Base class for all OXMLi_StreamListener states.
00042 */
00043 class OXMLi_ListenerState
00044 {
00045 public:
00046     OXMLi_ListenerState();
00047     virtual ~OXMLi_ListenerState();
00048 
00049     inline void setListener(OXMLi_StreamListener * pListener) { m_pListener = pListener; }
00050     inline OXMLi_StreamListener * getListener() { return m_pListener; }
00051 
00052     virtual void startElement (OXMLi_StartElementRequest * rqst) = 0;
00053     virtual void endElement (OXMLi_EndElementRequest * rqst) = 0;
00054     virtual void charData (OXMLi_CharDataRequest * rqst) = 0;
00055 
00056     bool nameMatches(const std::string& name, const char* ns, const char* tag);
00057     const gchar* attrMatches(const char* ns, const gchar* attr, std::map<std::string, std::string>* atts);
00058     bool contextMatches(const std::string& name, const char* ns, const char* tag);
00059 
00060 protected:
00061     bool _error_if_fail(bool val);
00062     UT_Error _flushTopLevel(OXMLi_ElementStack * stck, OXMLi_SectionStack * sect_stck);
00063     const gchar * _TwipsToPoints(const gchar * twips);
00064     const gchar * _TwipsToInches(const gchar * twips);
00065     const gchar * _EighthPointsToPoints(const gchar * eights);
00066     const gchar * _EmusToInches(const gchar * emus);
00067     void getFontLevelRange(const gchar * val, OXML_FontLevel& level, OXML_CharRange& range);
00068 
00069 private:
00070     //StreamListener backreference
00071     OXMLi_StreamListener * m_pListener;
00072 };
00073 #endif //_OXMLI_LISTENERSTATE_H_
00074 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1