Update ooo320-m1
[ooovba.git] / linguistic / source / convdicxml.hxx
blobab1deee005fef41b9ee6b99792d443f9d5e52550
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: convdicxml.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGUISTIC_CONVDICXML_HXX_
32 #define _LINGUISTIC_CONVDICXML_HXX_
34 #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
35 #include <com/sun/star/util/XFlushable.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
38 #include <xmloff/xmlexp.hxx>
39 #include <xmloff/xmlimp.hxx>
40 #include <cppuhelper/implbase3.hxx>
41 #include <cppuhelper/interfacecontainer.h>
42 #include <tools/string.hxx>
43 #include <rtl/ustring.hxx>
44 #include "misc.hxx"
45 #include "defs.hxx"
48 class ConvDic;
50 ///////////////////////////////////////////////////////////////////////////
52 class ConvDicXMLExport : public SvXMLExport
54 ConvDic &rDic;
55 sal_Bool bSuccess;
57 protected:
58 //void ExportNodes(const SmNode *pIn, int nLevel);
60 public:
61 ConvDicXMLExport( ConvDic &rConvDic,
62 const rtl::OUString &rFileName,
63 com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler) :
64 SvXMLExport ( utl::getProcessServiceFactory(), rFileName, rHandler ),
65 rDic ( rConvDic ),
66 bSuccess ( sal_False )
69 virtual ~ConvDicXMLExport()
73 // XServiceInfo (override parent method)
74 ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
76 // SvXMLExport
77 void _ExportAutoStyles() {}
78 void _ExportMasterStyles() {}
79 void _ExportContent();
80 sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
82 sal_Bool Export( SfxMedium &rMedium );
86 class ConvDicXMLImport : public SvXMLImport
88 ConvDic *pDic; // conversion dictionary to be used
89 // if != NULL: whole file will be read and
90 // all entries will be added to the dictionary
91 // if == NULL: no entries will be added
92 // but the language and conversion type will
93 // still be determined!
95 INT16 nLanguage; // language of the dictionary
96 sal_Int16 nConversionType; // conversion type the dictionary is used for
97 sal_Bool bSuccess;
99 public:
101 //!! see comment for pDic member
102 ConvDicXMLImport( ConvDic *pConvDic, const rtl::OUString /*&rFileName*/ ) :
103 SvXMLImport ( utl::getProcessServiceFactory(), IMPORT_ALL ),
104 pDic ( pConvDic )
106 nLanguage = LANGUAGE_NONE;
107 nConversionType = -1;
108 bSuccess = sal_False;
111 virtual ~ConvDicXMLImport() throw ()
115 // XServiceInfo (override parent method)
116 ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
118 virtual void SAL_CALL startDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
119 virtual void SAL_CALL endDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
121 virtual SvXMLImportContext * CreateContext(
122 sal_uInt16 nPrefix, const rtl::OUString &rLocalName,
123 const com::sun::star::uno::Reference < com::sun::star::xml::sax::XAttributeList > &rxAttrList );
125 ConvDic * GetDic() { return pDic; }
126 INT16 GetLanguage() const { return nLanguage; }
127 sal_Int16 GetConversionType() const { return nConversionType; }
128 sal_Bool GetSuccess() const { return bSuccess; }
130 void SetLanguage( INT16 nLang ) { nLanguage = nLang; }
131 void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
134 ///////////////////////////////////////////////////////////////////////////
136 #endif