bump product version to 4.1.6.2
[LibreOffice.git] / linguistic / source / convdicxml.hxx
blob512be697ea1f0a05273738e298b5fe1b2148940c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _LINGUISTIC_CONVDICXML_HXX_
21 #define _LINGUISTIC_CONVDICXML_HXX_
23 #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
24 #include <com/sun/star/util/XFlushable.hpp>
25 #include <com/sun/star/util/MeasureUnit.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
28 #include <comphelper/processfactory.hxx>
29 #include <xmloff/xmlexp.hxx>
30 #include <xmloff/xmlimp.hxx>
31 #include <cppuhelper/implbase3.hxx>
32 #include <cppuhelper/interfacecontainer.h>
33 #include <rtl/ustring.hxx>
34 #include "linguistic/misc.hxx"
35 #include "defs.hxx"
38 class ConvDic;
41 class ConvDicXMLExport : public SvXMLExport
43 ConvDic &rDic;
44 sal_Bool bSuccess;
46 public:
47 ConvDicXMLExport( ConvDic &rConvDic,
48 const OUString &rFileName,
49 com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler) :
50 SvXMLExport ( comphelper::getProcessComponentContext(), rFileName,
51 ::com::sun::star::util::MeasureUnit::CM, rHandler ),
52 rDic ( rConvDic ),
53 bSuccess ( sal_False )
56 virtual ~ConvDicXMLExport()
60 // XServiceInfo (override parent method)
61 OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
63 // SvXMLExport
64 void _ExportAutoStyles() {}
65 void _ExportMasterStyles() {}
66 void _ExportContent();
67 sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
69 sal_Bool Export();
73 class ConvDicXMLImport : public SvXMLImport
75 ConvDic *pDic; // conversion dictionary to be used
76 // if != NULL: whole file will be read and
77 // all entries will be added to the dictionary
78 // if == NULL: no entries will be added
79 // but the language and conversion type will
80 // still be determined!
82 sal_Int16 nLanguage; // language of the dictionary
83 sal_Int16 nConversionType; // conversion type the dictionary is used for
84 sal_Bool bSuccess;
86 public:
88 //!! see comment for pDic member
89 ConvDicXMLImport( ConvDic *pConvDic, const OUString /*&rFileName*/ ) :
90 SvXMLImport ( comphelper::getProcessComponentContext(), IMPORT_ALL ),
91 pDic ( pConvDic )
93 nLanguage = LANGUAGE_NONE;
94 nConversionType = -1;
95 bSuccess = sal_False;
98 virtual ~ConvDicXMLImport() throw ()
102 // XServiceInfo (override parent method)
103 OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
105 virtual void SAL_CALL startDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
106 virtual void SAL_CALL endDocument(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
108 virtual SvXMLImportContext * CreateContext(
109 sal_uInt16 nPrefix, const OUString &rLocalName,
110 const com::sun::star::uno::Reference < com::sun::star::xml::sax::XAttributeList > &rxAttrList );
112 ConvDic * GetDic() { return pDic; }
113 sal_Int16 GetLanguage() const { return nLanguage; }
114 sal_Int16 GetConversionType() const { return nConversionType; }
115 sal_Bool GetSuccess() const { return bSuccess; }
117 void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
118 void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */