Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _LINGUISTIC_CONVDICXML_HXX_
30 : : #define _LINGUISTIC_CONVDICXML_HXX_
31 : :
32 : : #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
33 : : #include <com/sun/star/util/XFlushable.hpp>
34 : : #include <com/sun/star/util/MeasureUnit.hpp>
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
37 : : #include <comphelper/processfactory.hxx>
38 : : #include <xmloff/xmlexp.hxx>
39 : : #include <xmloff/xmlimp.hxx>
40 : : #include <cppuhelper/implbase3.hxx>
41 : : #include <cppuhelper/interfacecontainer.h>
42 : : #include <rtl/ustring.hxx>
43 : : #include "linguistic/misc.hxx"
44 : : #include "defs.hxx"
45 : :
46 : :
47 : : class ConvDic;
48 : :
49 : :
50 : : class ConvDicXMLExport : public SvXMLExport
51 : : {
52 : : ConvDic &rDic;
53 : : sal_Bool bSuccess;
54 : :
55 : : public:
56 : 0 : ConvDicXMLExport( ConvDic &rConvDic,
57 : : const rtl::OUString &rFileName,
58 : : com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler) :
59 : : SvXMLExport ( comphelper::getProcessServiceFactory(), rFileName,
60 : : ::com::sun::star::util::MeasureUnit::CM, rHandler ),
61 : : rDic ( rConvDic ),
62 [ # # ]: 0 : bSuccess ( sal_False )
63 : : {
64 : 0 : }
65 : 0 : virtual ~ConvDicXMLExport()
66 : 0 : {
67 [ # # ]: 0 : }
68 : :
69 : : // XServiceInfo (override parent method)
70 : : ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
71 : :
72 : : // SvXMLExport
73 : 0 : void _ExportAutoStyles() {}
74 : 0 : void _ExportMasterStyles() {}
75 : : void _ExportContent();
76 : : sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
77 : :
78 : : sal_Bool Export();
79 : : };
80 : :
81 : :
82 : : class ConvDicXMLImport : public SvXMLImport
83 : : {
84 : : ConvDic *pDic; // conversion dictionary to be used
85 : : // if != NULL: whole file will be read and
86 : : // all entries will be added to the dictionary
87 : : // if == NULL: no entries will be added
88 : : // but the language and conversion type will
89 : : // still be determined!
90 : :
91 : : sal_Int16 nLanguage; // language of the dictionary
92 : : sal_Int16 nConversionType; // conversion type the dictionary is used for
93 : : sal_Bool bSuccess;
94 : :
95 : : public:
96 : :
97 : : //!! see comment for pDic member
98 : 0 : ConvDicXMLImport( ConvDic *pConvDic, const rtl::OUString /*&rFileName*/ ) :
99 : : SvXMLImport ( comphelper::getProcessServiceFactory(), IMPORT_ALL ),
100 : 0 : pDic ( pConvDic )
101 : : {
102 : 0 : nLanguage = LANGUAGE_NONE;
103 : 0 : nConversionType = -1;
104 : 0 : bSuccess = sal_False;
105 : 0 : }
106 : :
107 : 0 : virtual ~ConvDicXMLImport() throw ()
108 : 0 : {
109 [ # # ]: 0 : }
110 : :
111 : : // XServiceInfo (override parent method)
112 : : ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
113 : :
114 : : virtual void SAL_CALL startDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
115 : : virtual void SAL_CALL endDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
116 : :
117 : : virtual SvXMLImportContext * CreateContext(
118 : : sal_uInt16 nPrefix, const rtl::OUString &rLocalName,
119 : : const com::sun::star::uno::Reference < com::sun::star::xml::sax::XAttributeList > &rxAttrList );
120 : :
121 : 0 : ConvDic * GetDic() { return pDic; }
122 : 0 : sal_Int16 GetLanguage() const { return nLanguage; }
123 : 0 : sal_Int16 GetConversionType() const { return nConversionType; }
124 : : sal_Bool GetSuccess() const { return bSuccess; }
125 : :
126 : 0 : void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
127 : 0 : void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
128 : : };
129 : :
130 : :
131 : : #endif
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|