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

OXMLi_PackageManager.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_PACKAGEMANAGER_H_
00024 #define _OXMLI_PACKAGEMANAGER_H_
00025 
00026 // Internal includes
00027 #include <OXMLi_StreamListener.h>
00028 #include <OXML_Types.h>
00029 #include <OXML_Section.h>
00030 
00031 // AbiWord includes
00032 #include <ut_types.h>
00033 
00034 // External includes
00035 #include <string>
00036 #include <map>
00037 #include <glib.h>
00038 #include <gsf/gsf-input.h>
00039 #include <gsf/gsf-infile.h>
00040 
00041 /* \class OXMLi_PackageManager
00042  * \brief This class wraps around the Open Package libgsf functions.
00043  * OXMLi_PackageManager provides a more convenient interface to the Open Package
00044  * libgsf functions.  It assumes that the package is a valid Word 2007 file.
00045  * This class follows the Singleton design pattern.
00046 */
00047 class OXMLi_PackageManager
00048 {
00049 public:
00051     static OXMLi_PackageManager* getNewInstance();
00053     static OXMLi_PackageManager* getInstance();
00055     static void destroyInstance();
00056 
00057     void setContainer( GsfInfile* pPkg );
00058     inline GsfInfile* getContainer() { return m_pPkg; }
00059 
00061 
00063     UT_Error parseDocumentStream();
00064 
00066 
00069     UT_Error parseDocumentHdrFtr( const char * id );
00070 
00072 
00074     UT_Error parseDocumentStyles();
00075 
00077 
00079     UT_Error parseDocumentTheme();
00080 
00082 
00084     UT_Error parseDocumentSettings();
00085 
00087 
00089     UT_Error parseDocumentNumbering();
00090 
00092 
00094     UT_Error parseDocumentFootnotes();
00095 
00097 
00099     UT_Error parseDocumentEndnotes();
00100 
00101     UT_ConstByteBufPtr parseImageStream(const char * id);
00102     std::string getPartName(const char * id);
00103 
00104 private:
00105     OXMLi_PackageManager();
00106     virtual ~OXMLi_PackageManager();
00107 
00108     GsfInput * getChildById( GsfInput * parent, const char * id );
00109     GsfInput * getChildByType( GsfInput * parent, OXML_PartType type );
00110     UT_Error parseChildById( GsfInput * parent, const char * id, OXMLi_StreamListener * pListener );
00111     UT_Error parseChildByType( GsfInput * parent, OXML_PartType type, OXMLi_StreamListener * pListener );
00112 
00113     const char * _getFullType( OXML_PartType type );
00114     GsfInput * _getDocumentStream();
00115     UT_Error _parseStream( GsfInput * stream, OXMLi_StreamListener * pListener );
00116 
00117     static OXMLi_PackageManager * s_pInst;
00118 
00119     GsfInfile* m_pPkg;
00120     GsfInput* m_pDocPart;
00121     std::map<std::string, bool> m_parsedParts;
00122 };
00123 
00124 #endif //_OXMLI_PACKAGEMANAGER_H_
00125 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1