Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / linguistic / source / convdicxml.hxx
blob9a2b3c776c37bd000b2a531aaeccd6435a68de4d
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 INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
23 #include <com/sun/star/util/XFlushable.hpp>
24 #include <com/sun/star/util/MeasureUnit.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
27 #include <comphelper/processfactory.hxx>
28 #include <xmloff/xmlexp.hxx>
29 #include <xmloff/xmlimp.hxx>
30 #include <cppuhelper/interfacecontainer.h>
31 #include <rtl/ustring.hxx>
32 #include <linguistic/misc.hxx>
33 #include "defs.hxx"
36 class ConvDic;
39 class ConvDicXMLExport : public SvXMLExport
41 ConvDic &rDic;
42 bool bSuccess;
44 public:
45 ConvDicXMLExport( ConvDic &rConvDic,
46 const OUString &rFileName,
47 css::uno::Reference< css::xml::sax::XDocumentHandler > const &rHandler) :
48 SvXMLExport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLExport", rFileName,
49 css::util::MeasureUnit::CM, rHandler ),
50 rDic ( rConvDic ),
51 bSuccess ( false )
55 // SvXMLExport
56 void ExportAutoStyles_() override {}
57 void ExportMasterStyles_() override {}
58 void ExportContent_() override;
59 ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override;
61 bool Export();
65 class ConvDicXMLImport : public SvXMLImport
67 ConvDic *pDic; // conversion dictionary to be used
68 // if != NULL: whole file will be read and
69 // all entries will be added to the dictionary
70 // if == NULL: no entries will be added
71 // but the language and conversion type will
72 // still be determined!
74 LanguageType nLanguage; // language of the dictionary
75 sal_Int16 nConversionType; // conversion type the dictionary is used for
77 public:
79 //!! see comment for pDic member
80 explicit ConvDicXMLImport( ConvDic *pConvDic ) :
81 SvXMLImport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLImport", SvXMLImportFlags::ALL ),
82 pDic ( pConvDic )
84 nLanguage = LANGUAGE_NONE;
85 nConversionType = -1;
88 virtual void SAL_CALL startDocument() override;
90 virtual SvXMLImportContext * CreateDocumentContext(
91 sal_uInt16 nPrefix, const OUString &rLocalName,
92 const css::uno::Reference < css::xml::sax::XAttributeList > &rxAttrList ) override;
94 ConvDic * GetDic() { return pDic; }
95 LanguageType GetLanguage() const { return nLanguage; }
96 sal_Int16 GetConversionType() const { return nConversionType; }
98 void SetLanguage( LanguageType nLang ) { nLanguage = nLang; }
99 void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */