Line data Source code
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 : #include "formula/FormulaOpCodeMapperObj.hxx"
20 : #include "formula/opcode.hxx"
21 : #include <comphelper/sequence.hxx>
22 : #include <cppuhelper/supportsservice.hxx>
23 :
24 : namespace formula
25 : {
26 : using namespace ::com::sun::star;
27 :
28 0 : sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
29 : {
30 0 : return cppu::supportsService(this, _rServiceName);
31 : }
32 :
33 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
34 60 : FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler)
35 60 : : m_pCompiler(_pCompiler)
36 : {
37 60 : }
38 : SAL_WNODEPRECATED_DECLARATIONS_POP
39 :
40 61 : FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
41 : {
42 61 : }
43 :
44 58 : ::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
45 : throw (::com::sun::star::uno::RuntimeException, std::exception)
46 : {
47 58 : return ocExternal;
48 : }
49 :
50 :
51 58 : ::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown()
52 : throw (::com::sun::star::uno::RuntimeException, std::exception)
53 : {
54 58 : return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
55 : }
56 :
57 :
58 : ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
59 0 : SAL_CALL FormulaOpCodeMapperObj::getMappings(
60 : const ::com::sun::star::uno::Sequence< OUString >& rNames,
61 : sal_Int32 nLanguage )
62 : throw ( ::com::sun::star::lang::IllegalArgumentException,
63 : ::com::sun::star::uno::RuntimeException, std::exception)
64 : {
65 0 : FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
66 0 : if (!xMap)
67 0 : throw lang::IllegalArgumentException();
68 0 : return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames);
69 : }
70 :
71 :
72 : ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
73 348 : SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
74 : sal_Int32 nLanguage, sal_Int32 nGroups )
75 : throw ( ::com::sun::star::lang::IllegalArgumentException,
76 : ::com::sun::star::uno::RuntimeException, std::exception)
77 : {
78 348 : FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
79 348 : if (!xMap)
80 0 : throw lang::IllegalArgumentException();
81 348 : return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups);
82 : }
83 :
84 0 : OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException, std::exception)
85 : {
86 0 : return getImplementationName_Static();
87 : }
88 :
89 1 : OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static()
90 : {
91 1 : return OUString( "simple.formula.FormulaOpCodeMapperObj" );
92 : }
93 :
94 0 : uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
95 : {
96 0 : return getSupportedServiceNames_Static();
97 : }
98 1 : uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
99 : {
100 1 : uno::Sequence< OUString > aSeq( 1 );
101 1 : aSeq[0] = "com.sun.star.sheet.FormulaOpCodeMapper";
102 1 : return aSeq;
103 : }
104 :
105 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
106 1 : uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create(
107 : uno::Reference< uno::XComponentContext > const & /*_xContext*/)
108 : {
109 1 : return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler>(new FormulaCompiler())));
110 : }
111 : SAL_WNODEPRECATED_DECLARATIONS_POP
112 :
113 :
114 :
115 :
116 : } // formula
117 :
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|