/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ /* AbiWord * Copyright (C) 2001-2002 Dom Lachowicz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include #include #include #include "ut_types.h" #include "ut_assert.h" #include "ut_debugmsg.h" #include "ut_string.h" #include "ie_imp_WML.h" #include "ie_impGraphic.h" #include "ie_types.h" #include "pd_Document.h" #include "ut_growbuf.h" #include "ut_path.h" #include "ut_string_class.h" #include "fg_GraphicRaster.h" /* * This file is meant to import WML documents. * WML is an XML derivate and is the standard markup * language for wireless communication devices such * as web-phones and other PDAs. * * The correspondence between WML and Word processing * documents isn't as good as say, HTML is, but everyone * gets a stiffie now when you mention the word "wireless" * in front of anything, so... */ /*****************************************************************/ /*****************************************************************/ IE_Imp_WML_Sniffer::IE_Imp_WML_Sniffer (const char * _name) : IE_ImpSniffer(_name) { // } // supported suffixes static IE_SuffixConfidence IE_Imp_WML_Sniffer__SuffixConfidence[] = { { "wml", UT_CONFIDENCE_PERFECT }, { "", UT_CONFIDENCE_ZILCH } }; const IE_SuffixConfidence * IE_Imp_WML_Sniffer::getSuffixConfidence () { return IE_Imp_WML_Sniffer__SuffixConfidence; } const IE_MimeConfidence * IE_Imp_WML_Sniffer::getMimeConfidence () { // mimetypes once getMimeConfidence is implemented (need to check correctness) // "text/vnd.wap.wml" return NULL; } UT_Confidence_t IE_Imp_WML_Sniffer::recognizeContents(const char * szBuf, UT_uint32 /*iNumbytes*/) { // TODO: scan the first few lines if(strstr(szBuf, "!DOCTYPE wml PUBLIC") == NULL) return UT_CONFIDENCE_ZILCH; return UT_CONFIDENCE_PERFECT; } UT_Error IE_Imp_WML_Sniffer::constructImporter(PD_Document * pDocument, IE_Imp ** ppie) { IE_Imp_WML * p = new IE_Imp_WML(pDocument); *ppie = p; return UT_OK; } bool IE_Imp_WML_Sniffer::getDlgLabels(const char ** pszDesc, const char ** pszSuffixList, IEFileType * ft) { *pszDesc = "WML (.wml)"; *pszSuffixList = "*.wml"; *ft = getFileType(); return true; } /*****************************************************************/ /*****************************************************************/ IE_Imp_WML::~IE_Imp_WML() { DELETEP(m_TableHelperStack); } IE_Imp_WML::IE_Imp_WML (PD_Document * pDocument) : IE_Imp_XML(pDocument,false), m_bOpenedBlock(false), m_bOpenedSection(false), m_iColumns(0), m_iImages(0), m_iOpenedColumns(0), m_TableHelperStack(new IE_Imp_TableHelperStack()) { } /*****************************************************************/ /*****************************************************************/ #define TT_OTHER 0 // anything else #define TT_DOCUMENT 1 // a document #define TT_SECTION 2 // card or section #define TT_BLOCK 3 // a paragraph

#define TT_IMAGE 4 // an image object #define TT_BREAK 5 // a forced line-break
#define TT_BOLD 6 // bold text #define TT_ITALIC 7 // italic text #define TT_UNDERLINE 8 // underlined text #define TT_STRONG 9 // strong(bold) text #define TT_EMPHASIS 10 // emphasis(bold) text #define TT_BIG 11 // big(superscript) text #define TT_SMALL 12 // small(subscript) text #define TT_TABLE 13 // #define TT_TABLE_ROW 14 // #define TT_TABLE_CELL 15 //
#define TT_ACCESS 16 // #define TT_HEAD 17 // #define TT_META 18 // #define TT_TEMPLATE 19 //