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