1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
39 class ConvDicXMLExport
: public SvXMLExport
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
),
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
;
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
79 //!! see comment for pDic member
80 explicit ConvDicXMLImport( ConvDic
*pConvDic
) :
81 SvXMLImport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLImport", SvXMLImportFlags::ALL
),
84 nLanguage
= LANGUAGE_NONE
;
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
; }
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */