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/MeasureUnit.hpp>
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25 #include <com/sun/star/xml/sax/FastToken.hpp>
26 #include <comphelper/processfactory.hxx>
27 #include <xmloff/xmlexp.hxx>
28 #include <xmloff/xmlimp.hxx>
29 #include <xmloff/xmltoken.hxx>
30 #include <xmloff/xmlnamespace.hxx>
31 #include <rtl/ustring.hxx>
35 using namespace css::xml::sax
;
36 using namespace ::xmloff::token
;
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 enum ConvDicXMLToken
: sal_Int32
67 TEXT_CONVERSION_DICTIONARY
= FastToken::NAMESPACE
| XML_NAMESPACE_TCD
| XML_BLOCK_LIST
,
68 RIGHT_TEXT
= FastToken::NAMESPACE
| XML_NAMESPACE_TCD
| XML_RIGHT_TEXT
,
69 ENTRY
= FastToken::NAMESPACE
| XML_NAMESPACE_TCD
| XML_ENTRY
,
72 class ConvDicXMLImport
: public SvXMLImport
74 ConvDic
*pDic
; // conversion dictionary to be used
75 // if != NULL: whole file will be read and
76 // all entries will be added to the dictionary
77 // if == NULL: no entries will be added
78 // but the language and conversion type will
79 // still be determined!
81 LanguageType nLanguage
; // language of the dictionary
82 sal_Int16 nConversionType
; // conversion type the dictionary is used for
86 //!! see comment for pDic member
87 explicit ConvDicXMLImport( ConvDic
*pConvDic
);
89 ConvDic
* GetDic() { return pDic
; }
90 LanguageType
GetLanguage() const { return nLanguage
; }
91 sal_Int16
GetConversionType() const { return nConversionType
; }
93 void SetLanguage( LanguageType nLang
) { nLanguage
= nLang
; }
94 void SetConversionType( sal_Int16 nType
) { nConversionType
= nType
; }
97 virtual SvXMLImportContext
*CreateFastContext( sal_Int32 Element
,
98 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & xAttrList
) override
;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */