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 :
20 : #ifndef INCLUDED_SC_INC_TOKENUNO_HXX
21 : #define INCLUDED_SC_INC_TOKENUNO_HXX
22 :
23 : #include <com/sun/star/uno/Sequence.hxx>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
27 : #include <com/sun/star/sheet/FormulaToken.hpp>
28 : #include <com/sun/star/sheet/XFormulaParser.hpp>
29 : #include <cppuhelper/implbase3.hxx>
30 : #include <svl/lstner.hxx>
31 : #include <formula/FormulaOpCodeMapperObj.hxx>
32 : #include "address.hxx"
33 : #include "compiler.hxx"
34 :
35 : class ScTokenArray;
36 : class ScDocShell;
37 :
38 : class ScTokenConversion
39 : {
40 : public:
41 : static SC_DLLPUBLIC bool ConvertToTokenArray(
42 : ScDocument& rDoc,
43 : ScTokenArray& rTokenArray,
44 : const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence );
45 : static SC_DLLPUBLIC bool ConvertToTokenSequence(
46 : const ScDocument& rDoc,
47 : com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence,
48 : const ScTokenArray& rTokenArray );
49 : };
50 :
51 : class ScFormulaParserObj : public ::cppu::WeakImplHelper3<
52 : ::com::sun::star::sheet::XFormulaParser,
53 : ::com::sun::star::beans::XPropertySet,
54 : ::com::sun::star::lang::XServiceInfo >,
55 : public SfxListener
56 : {
57 : private:
58 : ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::FormulaOpCodeMapEntry > maOpCodeMapping;
59 : ::com::sun::star::uno::Sequence<com::sun::star::sheet::ExternalLinkInfo> maExternalLinks;
60 : ScCompiler::OpCodeMapPtr mxOpCodeMap;
61 : ScDocShell* mpDocShell;
62 : sal_Int16 mnConv;
63 : bool mbEnglish;
64 : bool mbIgnoreSpaces;
65 : bool mbCompileFAP;
66 :
67 : void SetCompilerFlags( ScCompiler& rCompiler ) const;
68 :
69 : public:
70 : ScFormulaParserObj(ScDocShell* pDocSh);
71 : virtual ~ScFormulaParserObj();
72 :
73 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
74 :
75 : // XFormulaParser
76 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL parseFormula(
77 : const OUString& aFormula,
78 : const ::com::sun::star::table::CellAddress& rReferencePos )
79 : throw (::com::sun::star::uno::RuntimeException,
80 : std::exception) SAL_OVERRIDE;
81 : virtual OUString SAL_CALL printFormula( const ::com::sun::star::uno::Sequence<
82 : ::com::sun::star::sheet::FormulaToken >& aTokens,
83 : const ::com::sun::star::table::CellAddress& rReferencePos )
84 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
86 : // XPropertySet
87 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
88 : SAL_CALL getPropertySetInfo()
89 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
91 : const ::com::sun::star::uno::Any& aValue )
92 : throw(::com::sun::star::beans::UnknownPropertyException,
93 : ::com::sun::star::beans::PropertyVetoException,
94 : ::com::sun::star::lang::IllegalArgumentException,
95 : ::com::sun::star::lang::WrappedTargetException,
96 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
98 : const OUString& PropertyName )
99 : throw(::com::sun::star::beans::UnknownPropertyException,
100 : ::com::sun::star::lang::WrappedTargetException,
101 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
103 : const ::com::sun::star::uno::Reference<
104 : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
105 : throw(::com::sun::star::beans::UnknownPropertyException,
106 : ::com::sun::star::lang::WrappedTargetException,
107 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
109 : const ::com::sun::star::uno::Reference<
110 : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
111 : throw(::com::sun::star::beans::UnknownPropertyException,
112 : ::com::sun::star::lang::WrappedTargetException,
113 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
115 : const ::com::sun::star::uno::Reference<
116 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
117 : throw(::com::sun::star::beans::UnknownPropertyException,
118 : ::com::sun::star::lang::WrappedTargetException,
119 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
121 : const ::com::sun::star::uno::Reference<
122 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
123 : throw(::com::sun::star::beans::UnknownPropertyException,
124 : ::com::sun::star::lang::WrappedTargetException,
125 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 :
127 : // XServiceInfo
128 : virtual OUString SAL_CALL getImplementationName()
129 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
131 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
133 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : };
135 :
136 940 : class ScFormulaOpCodeMapperObj : public formula::FormulaOpCodeMapperObj
137 : {
138 : public:
139 : ScFormulaOpCodeMapperObj(::std::unique_ptr<formula::FormulaCompiler> && _pCompiler);
140 : };
141 :
142 : #endif
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|