1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_TOKENUNO_HXX 25cdf0e10cSrcweir #define SC_TOKENUNO_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 30cdf0e10cSrcweir #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp> 31cdf0e10cSrcweir #include <com/sun/star/sheet/FormulaToken.hpp> 32cdf0e10cSrcweir #include <com/sun/star/sheet/XFormulaParser.hpp> 33cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 34cdf0e10cSrcweir #include <svl/lstner.hxx> 35cdf0e10cSrcweir #include <formula/FormulaOpCodeMapperObj.hxx> 36cdf0e10cSrcweir #include "address.hxx" 37cdf0e10cSrcweir #include "compiler.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir class ScTokenArray; 40cdf0e10cSrcweir class ScDocShell; 41cdf0e10cSrcweir 42cdf0e10cSrcweir // ============================================================================ 43cdf0e10cSrcweir 44cdf0e10cSrcweir class ScTokenConversion 45cdf0e10cSrcweir { 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir static bool ConvertToTokenArray( 48cdf0e10cSrcweir ScDocument& rDoc, 49cdf0e10cSrcweir ScTokenArray& rTokenArray, 50cdf0e10cSrcweir const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence ); 51cdf0e10cSrcweir static bool ConvertToTokenSequence( 52cdf0e10cSrcweir ScDocument& rDoc, 53cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence, 54cdf0e10cSrcweir const ScTokenArray& rTokenArray ); 55cdf0e10cSrcweir }; 56cdf0e10cSrcweir 57cdf0e10cSrcweir // ============================================================================ 58cdf0e10cSrcweir 59cdf0e10cSrcweir class ScFormulaParserObj : public ::cppu::WeakImplHelper3< 60cdf0e10cSrcweir ::com::sun::star::sheet::XFormulaParser, 61cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet, 62cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo >, 63cdf0e10cSrcweir public SfxListener 64cdf0e10cSrcweir { 65cdf0e10cSrcweir private: 66cdf0e10cSrcweir ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::FormulaOpCodeMapEntry > maOpCodeMapping; 67cdf0e10cSrcweir ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; 68cdf0e10cSrcweir ScCompiler::OpCodeMapPtr mxOpCodeMap; 69cdf0e10cSrcweir ScDocShell* mpDocShell; 70cdf0e10cSrcweir sal_Int16 mnConv; 71cdf0e10cSrcweir bool mbEnglish; 72cdf0e10cSrcweir bool mbIgnoreSpaces; 73cdf0e10cSrcweir bool mbCompileFAP; 74cdf0e10cSrcweir 75cdf0e10cSrcweir void SetCompilerFlags( ScCompiler& rCompiler ) const; 76cdf0e10cSrcweir 77cdf0e10cSrcweir public: 78cdf0e10cSrcweir ScFormulaParserObj(ScDocShell* pDocSh); 79cdf0e10cSrcweir virtual ~ScFormulaParserObj(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir // XFormulaParser 84cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL parseFormula( 85cdf0e10cSrcweir const ::rtl::OUString& aFormula, 86cdf0e10cSrcweir const ::com::sun::star::table::CellAddress& rReferencePos ) 87cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 88cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL printFormula( const ::com::sun::star::uno::Sequence< 89cdf0e10cSrcweir ::com::sun::star::sheet::FormulaToken >& aTokens, 90cdf0e10cSrcweir const ::com::sun::star::table::CellAddress& rReferencePos ) 91cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir // XPropertySet 94cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > 95cdf0e10cSrcweir SAL_CALL getPropertySetInfo() 96cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, 98cdf0e10cSrcweir const ::com::sun::star::uno::Any& aValue ) 99cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 100cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 101cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 102cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 103cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 105cdf0e10cSrcweir const ::rtl::OUString& PropertyName ) 106cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 107cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 108cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, 110cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 111cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& xListener ) 112cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 113cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 114cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, 116cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 117cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& aListener ) 118cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 119cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 120cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, 122cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 123cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& aListener ) 124cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 125cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 126cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, 128cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 129cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& aListener ) 130cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 131cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 132cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 133cdf0e10cSrcweir 134cdf0e10cSrcweir // XServiceInfo 135cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 136cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 138cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 139cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 140cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir }; 142cdf0e10cSrcweir 143cdf0e10cSrcweir // ============================================================================ 144cdf0e10cSrcweir 145cdf0e10cSrcweir class ScFormulaOpCodeMapperObj : public formula::FormulaOpCodeMapperObj 146cdf0e10cSrcweir { 147cdf0e10cSrcweir public: 148cdf0e10cSrcweir ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler); 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir 151cdf0e10cSrcweir // ============================================================================ 152cdf0e10cSrcweir 153cdf0e10cSrcweir #endif 154cdf0e10cSrcweir 155