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 .
19 #include "formula/FormulaOpCodeMapperObj.hxx"
20 #include "formula/opcode.hxx"
21 #include <comphelper/sequence.hxx>
23 // =============================================================================
26 // =============================================================================
28 using namespace ::com::sun::star
;
30 // -----------------------------------------------------------------------------
31 // --------------------------------------------------------------------------------
32 sal_Bool SAL_CALL
FormulaOpCodeMapperObj::supportsService( const ::rtl::OUString
& _rServiceName
) throw(uno::RuntimeException
)
34 return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName
, sal_True
).getLength() != 0;
36 //------------------------------------------------------------------------
37 SAL_WNODEPRECATED_DECLARATIONS_PUSH
38 FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr
<FormulaCompiler
> _pCompiler
)
39 : m_pCompiler(_pCompiler
)
42 SAL_WNODEPRECATED_DECLARATIONS_POP
44 FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
49 ::sal_Int32 SAL_CALL
FormulaOpCodeMapperObj::getOpCodeExternal()
50 throw (::com::sun::star::uno::RuntimeException
)
56 ::sal_Int32 SAL_CALL
FormulaOpCodeMapperObj::getOpCodeUnknown()
57 throw (::com::sun::star::uno::RuntimeException
)
59 return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
63 ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FormulaToken
>
64 SAL_CALL
FormulaOpCodeMapperObj::getMappings(
65 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& rNames
,
67 throw ( ::com::sun::star::lang::IllegalArgumentException
,
68 ::com::sun::star::uno::RuntimeException
)
70 FormulaCompiler::OpCodeMapPtr xMap
= m_pCompiler
->GetOpCodeMap( nLanguage
);
72 throw lang::IllegalArgumentException();
73 return xMap
->createSequenceOfFormulaTokens( *m_pCompiler
,rNames
);
77 ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FormulaOpCodeMapEntry
>
78 SAL_CALL
FormulaOpCodeMapperObj::getAvailableMappings(
79 sal_Int32 nLanguage
, sal_Int32 nGroups
)
80 throw ( ::com::sun::star::lang::IllegalArgumentException
,
81 ::com::sun::star::uno::RuntimeException
)
83 FormulaCompiler::OpCodeMapPtr xMap
= m_pCompiler
->GetOpCodeMap( nLanguage
);
85 throw lang::IllegalArgumentException();
86 return xMap
->createSequenceOfAvailableMappings( *m_pCompiler
,nGroups
);
88 //--------------------------------------------------------------------------
89 ::rtl::OUString SAL_CALL
FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException
)
91 return getImplementationName_Static();
93 // -----------------------------------------------------------------------------
94 ::rtl::OUString SAL_CALL
FormulaOpCodeMapperObj::getImplementationName_Static()
96 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "simple.formula.FormulaOpCodeMapperObj" ) );
98 // --------------------------------------------------------------------------------
99 uno::Sequence
< ::rtl::OUString
> SAL_CALL
FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException
)
101 return getSupportedServiceNames_Static();
103 uno::Sequence
< rtl::OUString
> SAL_CALL
FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
105 uno::Sequence
< rtl::OUString
> aSeq( 1 );
106 aSeq
[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FormulaOpCodeMapper" ));
110 SAL_WNODEPRECATED_DECLARATIONS_PUSH
111 uno::Reference
< uno::XInterface
> SAL_CALL
FormulaOpCodeMapperObj::create(
112 uno::Reference
< uno::XComponentContext
> const & /*_xContext*/)
114 return static_cast<sheet::XFormulaOpCodeMapper
*>(new FormulaOpCodeMapperObj(::std::auto_ptr
<FormulaCompiler
>(new FormulaCompiler())));
116 SAL_WNODEPRECATED_DECLARATIONS_POP
118 // -----------------------------------------------------------------------------
120 // =============================================================================
122 // =============================================================================
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */