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 .
21 #include <sal/config.h>
25 #include <formula/FormulaCompiler.hxx>
26 #include <formula/FormulaOpCodeMapperObj.hxx>
27 #include <formula/opcode.hxx>
28 #include <cppuhelper/supportsservice.hxx>
29 #include <com/sun/star/lang/IllegalArgumentException.hpp>
33 using namespace ::com::sun::star
;
35 sal_Bool SAL_CALL
FormulaOpCodeMapperObj::supportsService( const OUString
& _rServiceName
)
37 return cppu::supportsService(this, _rServiceName
);
40 FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::unique_ptr
<FormulaCompiler
> && _pCompiler
)
41 : m_pCompiler(std::move(_pCompiler
))
45 FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
49 ::sal_Int32 SAL_CALL
FormulaOpCodeMapperObj::getOpCodeExternal()
55 ::sal_Int32 SAL_CALL
FormulaOpCodeMapperObj::getOpCodeUnknown()
57 return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
61 css::uno::Sequence
< css::sheet::FormulaToken
>
62 SAL_CALL
FormulaOpCodeMapperObj::getMappings(
63 const css::uno::Sequence
< OUString
>& rNames
,
66 FormulaCompiler::OpCodeMapPtr xMap
= m_pCompiler
->GetOpCodeMap( nLanguage
);
68 throw lang::IllegalArgumentException();
69 return xMap
->createSequenceOfFormulaTokens( *m_pCompiler
,rNames
);
73 css::uno::Sequence
< css::sheet::FormulaOpCodeMapEntry
>
74 SAL_CALL
FormulaOpCodeMapperObj::getAvailableMappings(
75 sal_Int32 nLanguage
, sal_Int32 nGroups
)
77 FormulaCompiler::OpCodeMapPtr xMap
= m_pCompiler
->GetOpCodeMap( nLanguage
);
79 throw lang::IllegalArgumentException();
80 return xMap
->createSequenceOfAvailableMappings( *m_pCompiler
,nGroups
);
83 OUString SAL_CALL
FormulaOpCodeMapperObj::getImplementationName( )
85 return u
"simple.formula.FormulaOpCodeMapperObj"_ustr
;
88 uno::Sequence
< OUString
> SAL_CALL
FormulaOpCodeMapperObj::getSupportedServiceNames( )
90 return { u
"com.sun.star.sheet.FormulaOpCodeMapper"_ustr
};
95 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
96 simple_formula_FormulaOpCodeMapperObj(
97 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const& )
100 new formula::FormulaOpCodeMapperObj(std::make_unique
<formula::FormulaCompiler
>()));
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */