LibreOffice Module linguistic (master) 1
convdicxml.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
21#define INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
22
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>
27#include <xmloff/xmlexp.hxx>
28#include <xmloff/xmlimp.hxx>
29#include <xmloff/xmltoken.hxx>
31#include <rtl/ustring.hxx>
32
33
34class ConvDic;
35using namespace css::xml::sax;
36using namespace ::xmloff::token;
37
38
40{
43
44public:
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 )
52 {
53 }
54
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;
60
61 bool Export();
62};
63
64
65enum ConvDicXMLToken : sal_Int32
66{
68 RIGHT_TEXT = FastToken::NAMESPACE | XML_NAMESPACE_TCD | XML_RIGHT_TEXT,
69 ENTRY = FastToken::NAMESPACE | XML_NAMESPACE_TCD | XML_ENTRY,
70};
71
72class ConvDicXMLImport : public SvXMLImport
73{
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!
80
81 LanguageType nLanguage; // language of the dictionary
82 sal_Int16 nConversionType; // conversion type the dictionary is used for
83
84public:
85
87 explicit ConvDicXMLImport( ConvDic *pConvDic );
88
89 ConvDic * GetDic() { return pDic; }
91 sal_Int16 GetConversionType() const { return nConversionType; }
92
93 void SetLanguage( LanguageType nLang ) { nLanguage = nLang; }
94 void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
95
96private:
97 virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element,
98 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
99};
100
101
102#endif
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass=::xmloff::token::XML_TOKEN_INVALID) override
Definition: convdicxml.cxx:257
void ExportAutoStyles_() override
Definition: convdicxml.hxx:56
void ExportContent_() override
Definition: convdicxml.cxx:288
void ExportMasterStyles_() override
Definition: convdicxml.hxx:57
ConvDic & rDic
Definition: convdicxml.hxx:41
ConvDicXMLExport(ConvDic &rConvDic, const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler > const &rHandler)
Definition: convdicxml.hxx:45
void SetConversionType(sal_Int16 nType)
Definition: convdicxml.hxx:94
ConvDic * pDic
Definition: convdicxml.hxx:74
LanguageType nLanguage
Definition: convdicxml.hxx:81
sal_Int16 GetConversionType() const
Definition: convdicxml.hxx:91
ConvDic * GetDic()
Definition: convdicxml.hxx:89
sal_Int16 nConversionType
Definition: convdicxml.hxx:82
ConvDicXMLImport(ConvDic *pConvDic)
! see comment for pDic member
Definition: convdicxml.cxx:326
void SetLanguage(LanguageType nLang)
Definition: convdicxml.hxx:93
LanguageType GetLanguage() const
Definition: convdicxml.hxx:90
virtual SvXMLImportContext * CreateFastContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: convdicxml.cxx:333
ConvDicXMLToken
Definition: convdicxml.hxx:66
@ RIGHT_TEXT
Definition: convdicxml.hxx:68
@ TEXT_CONVERSION_DICTIONARY
Definition: convdicxml.hxx:67
@ ENTRY
Definition: convdicxml.hxx:69
Reference< XComponentContext > getProcessComponentContext()
XML_RIGHT_TEXT
XML_ENTRY
XML_BLOCK_LIST
QPRO_FUNC_TYPE nType
constexpr sal_uInt16 XML_NAMESPACE_TCD