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

ie_imp_GOComponent.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  * Copyright (C) 2004 Martin Sevior <msevior@physics.unimelb.edu.au>
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 
00024 #ifndef IE_IMP_GOComponent_H
00025 #define IE_IMP_GOComponent_H
00026 
00027 #include <stdio.h>
00028 #include "ie_imp.h"
00029 #include "ut_mbtowc.h"
00030 #include "pd_Document.h"
00031 #include <glib.h>
00032 class  UT_ByteBuf;
00033 class  ImportStream;
00034 
00035 extern GSList *mime_types;
00036 
00037 // The importer/reader for Embedable Components.
00038 
00039 class IE_Imp_Component_Sniffer : public IE_ImpSniffer
00040 {
00041     friend class IE_Imp;
00042     friend class IE_Imp_Component;
00043 
00044 public:
00045     IE_Imp_Component_Sniffer();
00046     virtual ~IE_Imp_Component_Sniffer();
00047 
00048     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00049     virtual const IE_MimeConfidence * getMimeConfidence ();
00050     virtual UT_Confidence_t recognizeContents (const char * szBuf,
00051                                     UT_uint32 iNumbytes);
00052     const char * recognizeContentsType (const char * szBuf,
00053                                     UT_uint32 iNumbytes);
00054     virtual bool getDlgLabels (const char ** szDesc,
00055                                const char ** szSuffixList,
00056                                IEFileType * ft);
00057     virtual UT_Error constructImporter (PD_Document * pDocument,
00058                                         IE_Imp ** ppie);
00059 
00060 protected:
00061     enum UCS2_Endian { UE_BigEnd = -1, UE_NotUCS = 0, UE_LittleEnd };
00062 
00063     static bool _recognizeUTF8 (const char * szBuf,
00064                                 UT_uint32 iNumbytes);
00065     static UCS2_Endian _recognizeUCS2 (const char * szBuf,
00066                                        UT_uint32 iNumbytes,
00067                                        bool bDeep);
00068 };
00069 
00070 // The importer/reader for GNOME-Office charts.
00071 
00072 class IE_Imp_Component : public IE_Imp
00073 {
00074 public:
00075     IE_Imp_Component(PD_Document * pDocument, char *mime_type = NULL);
00076     virtual ~IE_Imp_Component();
00077 
00078     virtual bool        pasteFromBuffer(PD_DocumentRange * pDocRange,
00079                                         const unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
00080     const UT_ByteBufPtr &     getByteBuf(void) const {return m_pByteBuf;}
00081 
00082 protected:
00083     virtual UT_Error    _loadFile(GsfInput * input);
00084     UT_Error            _parseStream(ImportStream * pStream);
00085 
00086  private:
00087     UT_ByteBufPtr       m_pByteBuf;
00088     std::string         m_MimeType;
00089 };
00090 
00091 #endif /* IE_IMP_Component_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1