From b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 18 Apr 2013 18:26:28 +0200 Subject: execute move of global headers see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a --- formula/inc/formula/ExternalReferenceHelper.hxx | 41 --- formula/inc/formula/FormulaCompiler.hxx | 388 -------------------- formula/inc/formula/FormulaOpCodeMapperObj.hxx | 84 ----- formula/inc/formula/IControlReferenceHandler.hxx | 42 --- formula/inc/formula/IFunctionDescription.hxx | 170 --------- formula/inc/formula/compiler.hrc | 423 ---------------------- formula/inc/formula/errorcodes.hxx | 119 ------- formula/inc/formula/formdata.hxx | 83 ----- formula/inc/formula/formula.hxx | 142 -------- formula/inc/formula/formuladllapi.h | 34 -- formula/inc/formula/formulahelper.hxx | 80 ----- formula/inc/formula/funcutl.hxx | 109 ------ formula/inc/formula/grammar.hxx | 242 ------------- formula/inc/formula/omoduleclient.hxx | 43 --- formula/inc/formula/opcode.hxx | 420 ---------------------- formula/inc/formula/token.hxx | 428 ----------------------- formula/inc/formula/tokenarray.hxx | 287 --------------- 17 files changed, 3135 deletions(-) delete mode 100644 formula/inc/formula/ExternalReferenceHelper.hxx delete mode 100644 formula/inc/formula/FormulaCompiler.hxx delete mode 100644 formula/inc/formula/FormulaOpCodeMapperObj.hxx delete mode 100644 formula/inc/formula/IControlReferenceHandler.hxx delete mode 100644 formula/inc/formula/IFunctionDescription.hxx delete mode 100644 formula/inc/formula/compiler.hrc delete mode 100644 formula/inc/formula/errorcodes.hxx delete mode 100644 formula/inc/formula/formdata.hxx delete mode 100644 formula/inc/formula/formula.hxx delete mode 100644 formula/inc/formula/formuladllapi.h delete mode 100644 formula/inc/formula/formulahelper.hxx delete mode 100644 formula/inc/formula/funcutl.hxx delete mode 100644 formula/inc/formula/grammar.hxx delete mode 100644 formula/inc/formula/omoduleclient.hxx delete mode 100644 formula/inc/formula/opcode.hxx delete mode 100644 formula/inc/formula/token.hxx delete mode 100644 formula/inc/formula/tokenarray.hxx (limited to 'formula/inc') diff --git a/formula/inc/formula/ExternalReferenceHelper.hxx b/formula/inc/formula/ExternalReferenceHelper.hxx deleted file mode 100644 index cd9b3b5b69c6..000000000000 --- a/formula/inc/formula/ExternalReferenceHelper.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_EXTERNALREFERENCEHELPER_HXX -#define FORMULA_EXTERNALREFERENCEHELPER_HXX - -#include -#include "formula/formuladllapi.h" - -namespace formula -{ - class FORMULA_DLLPUBLIC SAL_NO_VTABLE ExternalReferenceHelper - { - public: - virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const = 0; - - protected: - ~ExternalReferenceHelper() {} - }; -// ============================================================================= -} // formula -// ============================================================================= -#endif //FORMULA_EXTERNALREFERENCEHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx deleted file mode 100644 index b53bb2df4316..000000000000 --- a/formula/inc/formula/FormulaCompiler.hxx +++ /dev/null @@ -1,388 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_COMPILER_HXX_INCLUDED -#define FORMULA_COMPILER_HXX_INCLUDED - -#include "formula/formuladllapi.h" -#include -#include -#include - -#include -#include - -#include - -#include "formula/opcode.hxx" -#include "formula/grammar.hxx" -#include "formula/token.hxx" -#include "formula/ExternalReferenceHelper.hxx" - - -#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */ -#define MAXCODE 512 /* maximum number of tokens in formula */ - - -namespace com { namespace sun { namespace star { - namespace sheet { - struct FormulaOpCodeMapEntry; - struct FormulaToken; - } -}}} - - -namespace formula -{ - class FormulaTokenArray; - -struct FormulaArrayStack -{ - FormulaArrayStack* pNext; - FormulaTokenArray* pArr; - bool bTemp; -}; - - -struct FORMULA_DLLPUBLIC StringHashCode -{ - size_t operator()( const String& rStr ) const - { - return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() ); - } -}; - -typedef ::boost::unordered_map< String, OpCode, StringHashCode, ::std::equal_to< String > > OpCodeHashMap; -typedef ::boost::unordered_map< String, String, StringHashCode, ::std::equal_to< String > > ExternalHashMap; - -class FORMULA_DLLPUBLIC FormulaCompiler -{ -public: - FormulaCompiler(); - FormulaCompiler(FormulaTokenArray& _rArr); - virtual ~FormulaCompiler(); - - // SUNWS8 needs a forward declared friend, otherwise members of the outer - // class are not accessible. - class OpCodeMap; - friend class FormulaCompiler::OpCodeMap; - - /** Mappings from strings to OpCodes and vice versa. */ - class FORMULA_DLLPUBLIC OpCodeMap - { - OpCodeHashMap * mpHashMap; /// Hash map of symbols, String -> OpCode - String * mpTable; /// Array of symbols, OpCode -> String, offset==OpCode - ExternalHashMap * mpExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String - ExternalHashMap * mpReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String - FormulaGrammar::Grammar meGrammar; /// Grammar, language and reference convention - sal_uInt16 mnSymbols; /// Count of OpCode symbols - bool mbCore : 1; /// If mapping was setup by core, not filters - bool mbEnglish : 1; /// If English symbols and external names - - OpCodeMap(); // prevent usage - OpCodeMap( const OpCodeMap& ); // prevent usage - OpCodeMap& operator=( const OpCodeMap& ); // prevent usage - - public: - - OpCodeMap(sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar ) : - mpHashMap( new OpCodeHashMap( nSymbols)), - mpTable( new String[ nSymbols ]), - mpExternalHashMap( new ExternalHashMap), - mpReverseExternalHashMap( new ExternalHashMap), - meGrammar( eGrammar), - mnSymbols( nSymbols), - mbCore( bCore) - { - mbEnglish = FormulaGrammar::isEnglish( meGrammar); - } - virtual ~OpCodeMap(); - - void copyFrom( const OpCodeMap& r ); - - /// Get the symbol String -> OpCode hash map for finds. - inline const OpCodeHashMap* getHashMap() const { return mpHashMap; } - - /// Get the symbol String -> AddIn String hash map for finds. - inline const ExternalHashMap* getExternalHashMap() const { return mpExternalHashMap; } - - /// Get the AddIn String -> symbol String hash map for finds. - inline const ExternalHashMap* getReverseExternalHashMap() const { return mpReverseExternalHashMap; } - - /// Get the symbol string matching an OpCode. - inline const String& getSymbol( const OpCode eOp ) const - { - DBG_ASSERT( sal_uInt16(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range"); - if (sal_uInt16(eOp) < mnSymbols) - return mpTable[ eOp ]; - static String s_sEmpty; - return s_sEmpty; - } - - /// Get the grammar. - inline FormulaGrammar::Grammar getGrammar() const { return meGrammar; } - - /// Get the symbol count. - inline sal_uInt16 getSymbolCount() const { return mnSymbols; } - - /** Are these English symbols, as opposed to native language (which may - be English as well)? */ - inline bool isEnglish() const { return mbEnglish; } - - /// Is it an internal core mapping, or setup by filters? - inline bool isCore() const { return mbCore; } - - /// Is it an ODF 1.1 compatibility mapping? - inline bool isPODF() const { return FormulaGrammar::isPODF( meGrammar); } - - /// Is it an ODFF / ODF 1.2 mapping? - inline bool isODFF() const { return FormulaGrammar::isODFF( meGrammar); } - - /// Does it have external symbol/name mappings? - inline bool hasExternals() const { return !mpExternalHashMap->empty(); } - - /// Put entry of symbol String and OpCode pair. - void putOpCode( const String & rStr, const OpCode eOp ); - - /// Put entry of symbol String and AddIn international String pair. - void putExternal( const String & rSymbol, const String & rAddIn ); - - /** Put entry of symbol String and AddIn international String pair, - failing silently if rAddIn name already exists. */ - void putExternalSoftly( const String & rSymbol, const String & rAddIn ); - - /// Core implementation of XFormulaOpCodeMapper::getMappings() - ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > - createSequenceOfFormulaTokens(const FormulaCompiler& _rCompiler, - const ::com::sun::star::uno::Sequence< OUString >& rNames ) const; - - /// Core implementation of XFormulaOpCodeMapper::getAvailableMappings() - ::com::sun::star::uno::Sequence< - ::com::sun::star::sheet::FormulaOpCodeMapEntry > - createSequenceOfAvailableMappings( const FormulaCompiler& _rCompiler,const sal_Int32 nGroup ) const; - - /** The value used in createSequenceOfAvailableMappings() and thus in - XFormulaOpCodeMapper::getMappings() for an unknown symbol. */ - static sal_Int32 getOpCodeUnknown(); - }; - -public: - typedef ::boost::shared_ptr< const OpCodeMap > OpCodeMapPtr; - typedef ::boost::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr; - - /** Get OpCodeMap for formula language. - @param nLanguage - One of ::com::sun::star::sheet::FormulaLanguage constants. - @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned. - */ - OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage ) const; - - /** Create an internal symbol map from API mapping. - @param bEnglish - Use English number parser / formatter instead of native. - */ - OpCodeMapPtr CreateOpCodeMap( - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::FormulaOpCodeMapEntry > & rMapping, - bool bEnglish ); - - /** Get current OpCodeMap in effect. */ - inline OpCodeMapPtr GetCurrentOpCodeMap() const { return mxSymbols; } - - /** Get OpCode for English symbol. - Used in XFunctionAccess to create token array. - @param rName - Symbol to lookup. MUST be upper case. - */ - OpCode GetEnglishOpCode( const String& rName ) const; - - sal_uInt16 GetErrorConstant( const String& rName ) const; - - void SetCompileForFAP( bool bVal ) - { bCompileForFAP = bVal; bIgnoreErrors = bVal; } - - static bool IsOpCodeVolatile( OpCode eOp ); - - static bool DeQuote( String& rStr ); - - - static const String& GetNativeSymbol( OpCode eOp ); - static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix - - short GetNumFormatType() const { return nNumFmt; } - bool CompileTokenArray(); - - void CreateStringFromTokenArray( String& rFormula ); - void CreateStringFromTokenArray( OUStringBuffer& rBuffer ); - FormulaToken* CreateStringFromToken( String& rFormula, FormulaToken* pToken, - bool bAllowArrAdvance = false ); - FormulaToken* CreateStringFromToken( OUStringBuffer& rBuffer, FormulaToken* pToken, - bool bAllowArrAdvance = false ); - - void AppendBoolean( OUStringBuffer& rBuffer, bool bVal ); - void AppendDouble( OUStringBuffer& rBuffer, double fVal ); - void AppendString( OUStringBuffer& rBuffer, const String & rStr ); - - /** Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar, - including an address reference convention. */ - inline FormulaGrammar::Grammar GetGrammar() const { return meGrammar; } - - static void UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep ); - static void ResetNativeSymbols(); - static void SetNativeSymbols( const OpCodeMapPtr& xMap ); -protected: - virtual String FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const; - virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const; - virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, FormulaGrammar::Grammar _eGrammar ) const; - virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const; - virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const; - - virtual void SetError(sal_uInt16 nError); - virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef ); - virtual bool HandleExternalReference(const FormulaToken& _aToken); - virtual bool HandleRange(); - virtual bool HandleSingleRef(); - virtual bool HandleDbData(); - - virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP); - virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromMatrix(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* pTokenP); - virtual void LocalizeString( String& rName ); // modify rName - input: exact name - - void AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError ); - - bool GetToken(); - OpCode NextToken(); - void PutCode( FormulaTokenRef& ); - void Factor(); - void RangeLine(); - void UnionLine(); - void IntersectionLine(); - void UnaryLine(); - void PostOpLine(); - void PowLine(); - void MulDivLine(); - void AddSubLine(); - void ConcatLine(); - void CompareLine(); - void NotLine(); - OpCode Expression(); - void PopTokenArray(); - void PushTokenArray( FormulaTokenArray*, bool = false ); - - bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 ); - - String aCorrectedFormula; // autocorrected Formula - String aCorrectedSymbol; // autocorrected Symbol - - OpCodeMapPtr mxSymbols; // which symbols are used - - FormulaTokenRef mpToken; // current token - FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method) - FormulaTokenArray* pArr; - ExternalReferenceHelper* pExternalRef; - - FormulaToken** pCode; - FormulaArrayStack* pStack; - - OpCode eLastOp; - short nRecursion; // GetToken() recursions - short nNumFmt; // set during CompileTokenArray() - sal_uInt16 pc; // program counter - - FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention. - - bool bAutoCorrect; // whether to apply AutoCorrection - bool bCorrected; // AutoCorrection was applied - bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot - // will not be resolved - bool bIgnoreErrors; // on AutoCorrect and CompileForFAP - // ignore errors and create RPN nevertheless - bool glSubTotal; // if code contains one or more subtotal functions -private: - void InitSymbolsNative() const; /// only SymbolsNative, on first document creation - void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later - void InitSymbolsPODF() const; /// only SymbolsPODF, on demand - void InitSymbolsODFF() const; /// only SymbolsODFF, on demand - void InitSymbolsEnglishXL() const; /// only SymbolsEnglishXL, on demand - - void loadSymbols(sal_uInt16 _nSymbols,FormulaGrammar::Grammar _eGrammar,NonConstOpCodeMapPtr& _xMap) const; - - static inline void ForceArrayOperator( FormulaTokenRef& rCurr, const FormulaTokenRef& rPrev ) - { - if ( rPrev && rPrev->HasForceArray() && - rCurr->GetType() == svByte && rCurr->GetOpCode() != ocPush - && !rCurr->HasForceArray() ) - rCurr->SetForceArray( true); - } - - // SUNWS7 needs a forward declared friend, otherwise members of the outer - // class are not accessible. - class CurrentFactor; - friend class FormulaCompiler::CurrentFactor; - class CurrentFactor - { - FormulaTokenRef pPrevFac; - FormulaCompiler* pCompiler; - // not implemented - CurrentFactor( const CurrentFactor& ); - CurrentFactor& operator=( const CurrentFactor& ); - public: - explicit CurrentFactor( FormulaCompiler* pComp ) - : pPrevFac( pComp->pCurrentFactorToken ) - , pCompiler( pComp ) - {} - ~CurrentFactor() - { pCompiler->pCurrentFactorToken = pPrevFac; } - // yes, this operator= may modify the RValue - void operator=( FormulaTokenRef& r ) - { - ForceArrayOperator( r, pPrevFac); - pCompiler->pCurrentFactorToken = r; - } - void operator=( FormulaToken* p ) - { - FormulaTokenRef xTemp( p ); - *this = xTemp; - } - operator FormulaTokenRef&() - { return pCompiler->pCurrentFactorToken; } - FormulaToken* operator->() - { return pCompiler->pCurrentFactorToken.operator->(); } - operator FormulaToken*() - { return operator->(); } - }; - - - mutable NonConstOpCodeMapPtr mxSymbolsODFF; // ODFF symbols - mutable NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols - mutable NonConstOpCodeMapPtr mxSymbolsNative; // native symbols - mutable NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols - mutable NonConstOpCodeMapPtr mxSymbolsEnglishXL; // English Excel symbols (for VBA formula parsing) -}; -// ============================================================================= -} // formula -// ============================================================================= - -#endif // FORMULA_COMPILER_HXX_INCLUDED - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/FormulaOpCodeMapperObj.hxx b/formula/inc/formula/FormulaOpCodeMapperObj.hxx deleted file mode 100644 index 07945ca27101..000000000000 --- a/formula/inc/formula/FormulaOpCodeMapperObj.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED -#define FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED - -#include "formula/formuladllapi.h" -#include -#include -#include -#include -#include -#include "formula/FormulaCompiler.hxx" - - -namespace formula -{ - -class FORMULA_DLLPUBLIC FormulaOpCodeMapperObj : public ::cppu::WeakImplHelper2< - ::com::sun::star::sheet::XFormulaOpCodeMapper, - ::com::sun::star::lang::XServiceInfo > -{ - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr m_pCompiler; - SAL_WNODEPRECATED_DECLARATIONS_POP -public: - static OUString getImplementationName_Static(); - static ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_Static(); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext); - -protected: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - FormulaOpCodeMapperObj(::std::auto_ptr _pCompiler); - SAL_WNODEPRECATED_DECLARATIONS_POP - virtual ~FormulaOpCodeMapperObj(); - -private: - // XFormulaOpCodeMapper - // Attributes - virtual ::sal_Int32 SAL_CALL getOpCodeExternal() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getOpCodeUnknown() throw (::com::sun::star::uno::RuntimeException); - // Methods - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getMappings( - const ::com::sun::star::uno::Sequence< OUString >& rNames, - sal_Int32 nLanguage ) - throw ( ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > SAL_CALL getAvailableMappings( - sal_Int32 nLanguage, sal_Int32 nGroups ) - throw ( ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); - -}; -// ============================================================================= -} // formula -// ============================================================================= - -#endif // FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/IControlReferenceHandler.hxx b/formula/inc/formula/IControlReferenceHandler.hxx deleted file mode 100644 index bee4bac3953e..000000000000 --- a/formula/inc/formula/IControlReferenceHandler.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED -#define FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED - -#include "formula/formuladllapi.h" - -namespace formula -{ - class RefEdit; - class RefButton; - class FORMULA_DLLPUBLIC SAL_NO_VTABLE IControlReferenceHandler - { - public: - virtual void ShowReference(const String& _sRef) = 0; - virtual void HideReference( sal_Bool bDoneRefMode = sal_True ) = 0; - virtual void ReleaseFocus( RefEdit* pEdit, RefButton* pButton = NULL ) = 0; - virtual void ToggleCollapsed( RefEdit* pEdit, RefButton* pButton = NULL ) = 0; - - protected: - ~IControlReferenceHandler() {} - }; -} // formula -#endif // FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx deleted file mode 100644 index 1747c2f2ddce..000000000000 --- a/formula/inc/formula/IFunctionDescription.hxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDE_FUNCTION_DESCRIPTION -#define INCLUDE_FUNCTION_DESCRIPTION - -#include -#include -#include "formula/formuladllapi.h" -#include -#include -#include -#include - -class SvTreeListEntry; - -namespace formula -{ - class IFunctionCategory; - class IFunctionDescription; - class FormEditData; - class FormulaTokenArray; - - class SAL_NO_VTABLE IFunctionManager - { - public: - IFunctionManager(){} - enum EToken - { - eOk, - eClose, - eSep, - eArrayOpen, - eArrayClose - }; - virtual sal_uInt32 getCount() const = 0; - virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0; - virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0; - virtual const IFunctionDescription* getFunctionByName(const OUString& _sFunctionName) const = 0; - - virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0; - - protected: - ~IFunctionManager() {} - }; - - class SAL_NO_VTABLE IFunctionCategory - { - public: - IFunctionCategory(){} - virtual const IFunctionManager* getFunctionManager() const = 0; - virtual sal_uInt32 getCount() const = 0; - virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0; - virtual sal_uInt32 getNumber() const = 0; - virtual OUString getName() const = 0; - - protected: - ~IFunctionCategory() {} - }; - - class SAL_NO_VTABLE IFunctionDescription - { - public: - IFunctionDescription(){} - virtual OUString getFunctionName() const = 0; - virtual const IFunctionCategory* getCategory() const = 0; - virtual OUString getDescription() const = 0; - // GetSuppressedArgCount - virtual xub_StrLen getSuppressedArgumentCount() const = 0; - // GetFormulaString - virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0; - // GetVisibleArgMapping - virtual void fillVisibleArgumentMapping(::std::vector& _rArguments) const = 0; - virtual void initArgumentInfo() const = 0; - virtual OUString getSignature() const = 0; - virtual OString getHelpId() const = 0; - - // parameter - virtual sal_uInt32 getParameterCount() const = 0; - virtual OUString getParameterName(sal_uInt32 _nPos) const = 0; - virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0; - virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0; - - protected: - ~IFunctionDescription() {} - }; - - class SAL_NO_VTABLE IFormulaToken - { - public: - virtual bool isFunction() const = 0; - virtual sal_uInt32 getArgumentCount() const = 0; - - protected: - ~IFormulaToken() {} - }; - - class SAL_NO_VTABLE IStructHelper - { - public: - IStructHelper(){} - virtual SvTreeListEntry* InsertEntry(const XubString& rText, SvTreeListEntry* pParent, - sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0; - - virtual String GetEntryText(SvTreeListEntry* pEntry) const = 0; - virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0; - - protected: - ~IStructHelper() {} - }; - - class SAL_NO_VTABLE IFormulaEditorHelper - { - public: - IFormulaEditorHelper(){} - virtual void notifyChange() = 0; - virtual void fill() = 0; - - virtual String getCurrentFormula() const = 0; - virtual void setCurrentFormula(const String& _sReplacement) = 0; - - virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const = 0; - virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd) = 0; - - virtual FormEditData* getFormEditData() const = 0; - virtual bool calculateValue(const String& _sExpression,String& _rResult) = 0; - - virtual void switchBack() = 0; - - virtual void clear() = 0; - virtual void deleteFormData() = 0; - virtual void setReferenceInput(const FormEditData* _pData) = 0; - - virtual IFunctionManager* getFunctionManager() = 0; - virtual ::std::auto_ptr convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0; - virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0; - - virtual void setDispatcherLock( sal_Bool bLock ) = 0; - virtual void dispatch(sal_Bool _bOK,sal_Bool _bMartixChecked) = 0; - virtual void doClose(sal_Bool _bOk) = 0; - virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0; - virtual void showReference(const String& _sFormula) = 0; - - protected: - ~IFormulaEditorHelper() {} - }; - -} -#endif //INCLUDE_FUNCTION_DESCRIPTION - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/compiler.hrc b/formula/inc/formula/compiler.hrc deleted file mode 100644 index 053947c2a796..000000000000 --- a/formula/inc/formula/compiler.hrc +++ /dev/null @@ -1,423 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_COMPILER_HRC -#define FORMULA_COMPILER_HRC - -/* Central definition of OpCodes for spreadsheet functions */ - -/*** Special commands ***/ -#define SC_OPCODE_PUSH 0 /* internal commands */ -#define SC_OPCODE_CALL 1 -#define SC_OPCODE_STOP 2 -#define SC_OPCODE_EXTERNAL 3 -#define SC_OPCODE_NAME 4 -#define SC_OPCODE_EXTERNAL_REF 5 -#define SC_OPCODE_IF 6 /* jump commands */ -#define SC_OPCODE_IF_ERROR 7 -#define SC_OPCODE_IF_NA 8 -#define SC_OPCODE_CHOSE 9 -#define SC_OPCODE_OPEN 10 /* parentheses and separators */ -#define SC_OPCODE_CLOSE 11 -#define SC_OPCODE_SEP 12 -#define SC_OPCODE_MISSING 13 /* special OpCodes */ -#define SC_OPCODE_BAD 14 -#define SC_OPCODE_STRINGXML 15 -#define SC_OPCODE_SPACES 16 -#define SC_OPCODE_MAT_REF 17 -#define SC_OPCODE_DB_AREA 18 /* additional access operators */ -#define SC_OPCODE_MACRO 19 -#define SC_OPCODE_COL_ROW_NAME 20 -#define SC_OPCODE_COL_ROW_NAME_AUTO 21 -#define SC_OPCODE_PERCENT_SIGN 22 /* operator _follows_ value */ -#define SC_OPCODE_ARRAY_OPEN 23 -#define SC_OPCODE_ARRAY_CLOSE 24 -#define SC_OPCODE_ARRAY_ROW_SEP 25 -#define SC_OPCODE_ARRAY_COL_SEP 26 /* some convs use sep != col_sep */ -#define SC_OPCODE_STOP_DIV 27 -#define SC_OPCODE_SKIP 28 /* used to skip raw tokens during string compilation */ - -/*** error constants #... ***/ -#define SC_OPCODE_START_ERRORS 30 -#define SC_OPCODE_ERROR_NULL 30 -#define SC_OPCODE_ERROR_DIVZERO 31 -#define SC_OPCODE_ERROR_VALUE 32 -#define SC_OPCODE_ERROR_REF 33 -#define SC_OPCODE_ERROR_NAME 34 -#define SC_OPCODE_ERROR_NUM 35 -#define SC_OPCODE_ERROR_NA 36 -#define SC_OPCODE_STOP_ERRORS 37 - -/*** Binary operators ***/ -#define SC_OPCODE_START_BIN_OP 40 -#define SC_OPCODE_ADD 40 -#define SC_OPCODE_SUB 41 -#define SC_OPCODE_MUL 42 -#define SC_OPCODE_DIV 43 -#define SC_OPCODE_AMPERSAND 44 -#define SC_OPCODE_POW 45 -#define SC_OPCODE_EQUAL 46 -#define SC_OPCODE_NOT_EQUAL 47 -#define SC_OPCODE_LESS 48 -#define SC_OPCODE_GREATER 49 -#define SC_OPCODE_LESS_EQUAL 50 -#define SC_OPCODE_GREATER_EQUAL 51 -#define SC_OPCODE_AND 52 -#define SC_OPCODE_OR 53 -#define SC_OPCODE_INTERSECT 54 -#define SC_OPCODE_UNION 55 -#define SC_OPCODE_RANGE 56 -#define SC_OPCODE_STOP_BIN_OP 57 - -/* NOTE: binary and unary operators must be in sequence for compiler! */ - -/*** Unary operators ***/ -#define SC_OPCODE_START_UN_OP 60 -#define SC_OPCODE_NOT 60 -#define SC_OPCODE_NEG 61 -#define SC_OPCODE_NEG_SUB 62 -#define SC_OPCODE_STOP_UN_OP 63 - -#define SC_OPCODE_START_FUNCTION 65 - -/*** Functions without parameters ***/ -#define SC_OPCODE_START_NO_PAR 65 -#define SC_OPCODE_PI 65 -#define SC_OPCODE_RANDOM 66 -#define SC_OPCODE_TRUE 67 -#define SC_OPCODE_FALSE 68 -#define SC_OPCODE_GET_ACT_DATE 69 -#define SC_OPCODE_GET_ACT_TIME 70 -#define SC_OPCODE_NO_VALUE 71 -#define SC_OPCODE_CURRENT 72 -#define SC_OPCODE_STOP_NO_PAR 73 - -/*** Functions with one parameter ***/ -#define SC_OPCODE_START_1_PAR 80 -#define SC_OPCODE_DEG 80 /* trigonometric */ -#define SC_OPCODE_RAD 81 -#define SC_OPCODE_SIN 82 -#define SC_OPCODE_COS 83 -#define SC_OPCODE_TAN 84 -#define SC_OPCODE_COT 85 -#define SC_OPCODE_ARC_SIN 86 -#define SC_OPCODE_ARC_COS 87 -#define SC_OPCODE_ARC_TAN 88 -#define SC_OPCODE_ARC_COT 89 -#define SC_OPCODE_SIN_HYP 90 -#define SC_OPCODE_COS_HYP 91 -#define SC_OPCODE_TAN_HYP 92 -#define SC_OPCODE_COT_HYP 93 -#define SC_OPCODE_ARC_SIN_HYP 94 /* transcendent */ -#define SC_OPCODE_ARC_COS_HYP 95 -#define SC_OPCODE_ARC_TAN_HYP 96 -#define SC_OPCODE_ARC_COT_HYP 97 -#define SC_OPCODE_COSECANT 98 -#define SC_OPCODE_SECANT 99 -#define SC_OPCODE_COSECANT_HYP 100 -#define SC_OPCODE_SECANT_HYP 101 -#define SC_OPCODE_EXP 102 -#define SC_OPCODE_LN 103 -#define SC_OPCODE_SQRT 104 -#define SC_OPCODE_FACT 105 -#define SC_OPCODE_GET_YEAR 106 /* date and time */ -#define SC_OPCODE_GET_MONTH 107 -#define SC_OPCODE_GET_DAY 108 -#define SC_OPCODE_GET_HOUR 109 -#define SC_OPCODE_GET_MIN 110 -#define SC_OPCODE_GET_SEC 111 -#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */ -#define SC_OPCODE_ABS 113 -#define SC_OPCODE_INT 114 -#define SC_OPCODE_PHI 115 -#define SC_OPCODE_GAUSS 116 -#define SC_OPCODE_IS_EMPTY 117 /* obtain type */ -#define SC_OPCODE_IS_STRING 118 -#define SC_OPCODE_IS_NON_STRING 119 -#define SC_OPCODE_IS_LOGICAL 120 -#define SC_OPCODE_TYPE 121 -#define SC_OPCODE_IS_REF 122 -#define SC_OPCODE_IS_VALUE 123 -#define SC_OPCODE_IS_FORMULA 124 -#define SC_OPCODE_IS_NV 125 -#define SC_OPCODE_IS_ERR 126 -#define SC_OPCODE_IS_ERROR 127 -#define SC_OPCODE_IS_EVEN 128 -#define SC_OPCODE_IS_ODD 129 -#define SC_OPCODE_N 130 -#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */ -#define SC_OPCODE_GET_TIME_VALUE 132 -#define SC_OPCODE_CODE 133 -#define SC_OPCODE_TRIM 134 -#define SC_OPCODE_UPPER 135 -#define SC_OPCODE_PROPPER 136 -#define SC_OPCODE_LOWER 137 -#define SC_OPCODE_LEN 138 -#define SC_OPCODE_T 139 /* miscellaneous, part 21 */ -#define SC_OPCODE_VALUE 140 -#define SC_OPCODE_CLEAN 141 -#define SC_OPCODE_CHAR 142 -#define SC_OPCODE_LOG10 143 -#define SC_OPCODE_EVEN 144 -#define SC_OPCODE_ODD 145 -#define SC_OPCODE_STD_NORM_DIST 146 -#define SC_OPCODE_FISHER 147 -#define SC_OPCODE_FISHER_INV 148 -#define SC_OPCODE_S_NORM_INV 149 -#define SC_OPCODE_GAMMA_LN 150 -#define SC_OPCODE_ERROR_TYPE 151 -#define SC_OPCODE_ERR_CELL 152 -#define SC_OPCODE_FORMULA 153 -#define SC_OPCODE_ARABIC 154 -#define SC_OPCODE_INFO 155 -#define SC_OPCODE_BAHTTEXT 156 -#define SC_OPCODE_JIS 157 -#define SC_OPCODE_ASC 158 -#define SC_OPCODE_UNICODE 159 -#define SC_OPCODE_UNICHAR 160 -#define SC_OPCODE_GAMMA 161 -#define SC_OPCODE_STOP_1_PAR 162 - -/*** Functions with more than one parameters ***/ -#define SC_OPCODE_START_2_PAR 201 -#define SC_OPCODE_ARC_TAN_2 201 -#define SC_OPCODE_CEIL 202 -#define SC_OPCODE_FLOOR 203 -#define SC_OPCODE_ROUND 204 -#define SC_OPCODE_ROUND_UP 205 -#define SC_OPCODE_ROUND_DOWN 206 -#define SC_OPCODE_TRUNC 207 -#define SC_OPCODE_LOG 208 -#define SC_OPCODE_POWER 209 -#define SC_OPCODE_GGT 210 -#define SC_OPCODE_KGV 211 -#define SC_OPCODE_MOD 212 -#define SC_OPCODE_SUM_PRODUCT 213 -#define SC_OPCODE_SUM_SQ 214 -#define SC_OPCODE_SUM_X2MY2 215 -#define SC_OPCODE_SUM_X2DY2 216 -#define SC_OPCODE_SUM_XMY2 217 -#define SC_OPCODE_GET_DATE 218 -#define SC_OPCODE_GET_TIME 219 -#define SC_OPCODE_GET_DIFF_DATE 220 -#define SC_OPCODE_GET_DIFF_DATE_360 221 -#define SC_OPCODE_MIN 222 -#define SC_OPCODE_MAX 223 -#define SC_OPCODE_SUM 224 -#define SC_OPCODE_PRODUCT 225 -#define SC_OPCODE_AVERAGE 226 -#define SC_OPCODE_COUNT 227 -#define SC_OPCODE_COUNT_2 228 -#define SC_OPCODE_NBW 229 -#define SC_OPCODE_IKV 230 -#define SC_OPCODE_VAR 231 -#define SC_OPCODE_VAR_P 232 -#define SC_OPCODE_ST_DEV 233 -#define SC_OPCODE_ST_DEV_P 234 -#define SC_OPCODE_B 235 -#define SC_OPCODE_NORM_DIST 236 -#define SC_OPCODE_EXP_DIST 237 -#define SC_OPCODE_BINOM_DIST 238 -#define SC_OPCODE_POISSON_DIST 239 -#define SC_OPCODE_KOMBIN 240 -#define SC_OPCODE_KOMBIN_2 241 -#define SC_OPCODE_VARIATIONEN 242 -#define SC_OPCODE_VARIATIONEN_2 243 -#define SC_OPCODE_BW 244 -#define SC_OPCODE_DIA 245 -#define SC_OPCODE_GDA 246 -#define SC_OPCODE_GDA_2 247 -#define SC_OPCODE_VBD 248 -#define SC_OPCODE_LAUFZ 249 -#define SC_OPCODE_LIA 250 -#define SC_OPCODE_RMZ 251 -#define SC_OPCODE_COLUMNS 252 -#define SC_OPCODE_ROWS 253 -#define SC_OPCODE_COLUMN 254 -#define SC_OPCODE_ROW 255 -#define SC_OPCODE_ZGZ 256 -#define SC_OPCODE_ZW 257 -#define SC_OPCODE_ZZR 258 -#define SC_OPCODE_ZINS 259 -#define SC_OPCODE_ZINS_Z 260 -#define SC_OPCODE_KAPZ 261 -#define SC_OPCODE_KUM_ZINS_Z 262 -#define SC_OPCODE_KUM_KAP_Z 263 -#define SC_OPCODE_EFFEKTIV 264 -#define SC_OPCODE_NOMINAL 265 -#define SC_OPCODE_SUB_TOTAL 266 -#define SC_OPCODE_DB_SUM 267 /* database functions */ -#define SC_OPCODE_DB_COUNT 268 -#define SC_OPCODE_DB_COUNT_2 269 -#define SC_OPCODE_DB_AVERAGE 270 -#define SC_OPCODE_DB_GET 271 -#define SC_OPCODE_DB_MAX 272 -#define SC_OPCODE_DB_MIN 273 -#define SC_OPCODE_DB_PRODUCT 274 -#define SC_OPCODE_DB_STD_DEV 275 -#define SC_OPCODE_DB_STD_DEV_P 276 -#define SC_OPCODE_DB_VAR 277 -#define SC_OPCODE_DB_VAR_P 278 -#define SC_OPCODE_INDIRECT 279 /* management functions */ -#define SC_OPCODE_ADDRESS 280 -#define SC_OPCODE_MATCH 281 -#define SC_OPCODE_COUNT_EMPTY_CELLS 282 -#define SC_OPCODE_COUNT_IF 283 -#define SC_OPCODE_SUM_IF 284 -#define SC_OPCODE_LOOKUP 285 -#define SC_OPCODE_V_LOOKUP 286 -#define SC_OPCODE_H_LOOKUP 287 -#define SC_OPCODE_MULTI_AREA 288 -#define SC_OPCODE_OFFSET 289 -#define SC_OPCODE_INDEX 290 -#define SC_OPCODE_AREAS 291 -#define SC_OPCODE_CURRENCY 292 /* string functions */ -#define SC_OPCODE_REPLACE 293 -#define SC_OPCODE_FIXED 294 -#define SC_OPCODE_FIND 295 -#define SC_OPCODE_EXACT 296 -#define SC_OPCODE_LEFT 297 -#define SC_OPCODE_RIGHT 298 -#define SC_OPCODE_SEARCH 299 -#define SC_OPCODE_MID 300 -#define SC_OPCODE_TEXT 301 -#define SC_OPCODE_SUBSTITUTE 302 -#define SC_OPCODE_REPT 303 -#define SC_OPCODE_CONCAT 304 -#define SC_OPCODE_MAT_VALUE 305 /* matrix functions */ -#define SC_OPCODE_MAT_DET 306 -#define SC_OPCODE_MAT_INV 307 -#define SC_OPCODE_MAT_MULT 308 -#define SC_OPCODE_MAT_TRANS 309 -#define SC_OPCODE_MATRIX_UNIT 310 -#define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */ -#define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */ -#define SC_OPCODE_LOG_NORM_DIST 313 -#define SC_OPCODE_T_DIST 314 -#define SC_OPCODE_F_DIST 315 -#define SC_OPCODE_CHI_DIST 316 -#define SC_OPCODE_WEIBULL 317 -#define SC_OPCODE_NEG_BINOM_VERT 318 -#define SC_OPCODE_KRIT_BINOM 319 -#define SC_OPCODE_KURT 320 -#define SC_OPCODE_HAR_MEAN 321 -#define SC_OPCODE_GEO_MEAN 322 -#define SC_OPCODE_STANDARD 323 -#define SC_OPCODE_AVE_DEV 324 -#define SC_OPCODE_SCHIEFE 325 -#define SC_OPCODE_DEV_SQ 326 -#define SC_OPCODE_MEDIAN 327 -#define SC_OPCODE_MODAL_VALUE 328 -#define SC_OPCODE_Z_TEST 329 -#define SC_OPCODE_T_TEST 330 -#define SC_OPCODE_RANK 331 -#define SC_OPCODE_PERCENTILE 332 -#define SC_OPCODE_PERCENT_RANK 333 -#define SC_OPCODE_LARGE 334 -#define SC_OPCODE_SMALL 335 -#define SC_OPCODE_FREQUENCY 336 -#define SC_OPCODE_QUARTILE 337 -#define SC_OPCODE_NORM_INV 338 -#define SC_OPCODE_CONFIDENCE 339 -#define SC_OPCODE_F_TEST 340 -#define SC_OPCODE_TRIM_MEAN 341 -#define SC_OPCODE_PROB 342 -#define SC_OPCODE_CORREL 343 -#define SC_OPCODE_COVAR 344 -#define SC_OPCODE_PEARSON 345 -#define SC_OPCODE_RSQ 346 -#define SC_OPCODE_STEYX 347 -#define SC_OPCODE_SLOPE 348 -#define SC_OPCODE_INTERCEPT 349 -#define SC_OPCODE_TREND 350 -#define SC_OPCODE_GROWTH 351 -#define SC_OPCODE_RGP 352 -#define SC_OPCODE_RKP 353 -#define SC_OPCODE_FORECAST 354 -#define SC_OPCODE_CHI_INV 355 -#define SC_OPCODE_GAMMA_DIST 356 -#define SC_OPCODE_GAMMA_INV 357 -#define SC_OPCODE_T_INV 358 -#define SC_OPCODE_F_INV 359 -#define SC_OPCODE_CHI_TEST 360 -#define SC_OPCODE_LOG_INV 361 -#define SC_OPCODE_TABLE_OP 362 -#define SC_OPCODE_BETA_DIST 363 -#define SC_OPCODE_BETA_INV 364 -#define SC_OPCODE_WEEK 365 /* miscellaneous */ -#define SC_OPCODE_GET_DAY_OF_WEEK 366 -#define SC_OPCODE_NO_NAME 367 -#define SC_OPCODE_STYLE 368 -#define SC_OPCODE_DDE 369 -#define SC_OPCODE_BASE 370 -#define SC_OPCODE_TABLE 371 -#define SC_OPCODE_TABLES 372 -#define SC_OPCODE_MIN_A 373 -#define SC_OPCODE_MAX_A 374 -#define SC_OPCODE_AVERAGE_A 375 -#define SC_OPCODE_ST_DEV_A 376 -#define SC_OPCODE_ST_DEV_P_A 377 -#define SC_OPCODE_VAR_A 378 -#define SC_OPCODE_VAR_P_A 379 -#define SC_OPCODE_EASTERSUNDAY 380 -#define SC_OPCODE_DECIMAL 381 -#define SC_OPCODE_CONVERT 382 -#define SC_OPCODE_ROMAN 383 -#define SC_OPCODE_MIRR 384 -#define SC_OPCODE_CELL 385 -#define SC_OPCODE_ISPMT 386 -#define SC_OPCODE_HYPERLINK 387 -#define SC_OPCODE_INDIRECT_XL 388 /* See also INDIRECT for OOO variant */ -#define SC_OPCODE_ADDRESS_XL 389 /* See also ADRESS for OOO variant */ -#define SC_OPCODE_GET_PIVOT_DATA 390 -#define SC_OPCODE_EUROCONVERT 391 -#define SC_OPCODE_NUMBERVALUE 392 -#define SC_OPCODE_CHISQ_DIST 393 -#define SC_OPCODE_CHISQ_INV 394 -#define SC_OPCODE_BITAND 395 -#define SC_OPCODE_BITOR 396 -#define SC_OPCODE_BITXOR 397 -#define SC_OPCODE_BITRSHIFT 398 -#define SC_OPCODE_BITLSHIFT 399 -#define SC_OPCODE_GET_DATEDIF 400 -#define SC_OPCODE_XOR 401 -#define SC_OPCODE_AVERAGE_IF 402 -#define SC_OPCODE_SUM_IFS 403 -#define SC_OPCODE_AVERAGE_IFS 404 -#define SC_OPCODE_COUNT_IFS 405 -#define SC_OPCODE_SKEWP 406 -#define SC_OPCODE_STOP_2_PAR 407 -#define SC_OPCODE_LAST_OPCODE_ID 406 /* last OpCode */ - -#define SC_OPCODE_STOP_FUNCTION 407 - -/*** Internal ***/ -#define SC_OPCODE_INTERNAL_BEGIN 9999 -#define SC_OPCODE_TTT 9999 -#define SC_OPCODE_INTERNAL_END 9999 - -/*** from here on ExtraData contained ***/ -#define SC_OPCODE_DATA_TOKEN_1 10000 - -#define SC_OPCODE_NONE 0xFFFF - - -#endif /* FORMULA_COMPILER_HRC */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/errorcodes.hxx b/formula/inc/formula/errorcodes.hxx deleted file mode 100644 index 1e145e04132b..000000000000 --- a/formula/inc/formula/errorcodes.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef SC_ERRORCODES_HXX -#define SC_ERRORCODES_HXX - -#include -#include - -namespace ScErrorCodes -{ - -const sal_uInt16 errIllegalChar = 501; -const sal_uInt16 errIllegalArgument = 502; -const sal_uInt16 errIllegalFPOperation = 503; // #NUM! -const sal_uInt16 errIllegalParameter = 504; -const sal_uInt16 errIllegalJump = 505; -const sal_uInt16 errSeparator = 506; -const sal_uInt16 errPair = 507; -const sal_uInt16 errPairExpected = 508; -const sal_uInt16 errOperatorExpected = 509; -const sal_uInt16 errVariableExpected = 510; -const sal_uInt16 errParameterExpected = 511; -const sal_uInt16 errCodeOverflow = 512; -const sal_uInt16 errStringOverflow = 513; -const sal_uInt16 errStackOverflow = 514; -const sal_uInt16 errUnknownState = 515; -const sal_uInt16 errUnknownVariable = 516; -const sal_uInt16 errUnknownOpCode = 517; -const sal_uInt16 errUnknownStackVariable = 518; -const sal_uInt16 errNoValue = 519; // #VALUE! -const sal_uInt16 errUnknownToken = 520; -const sal_uInt16 errNoCode = 521; // #NULL! -const sal_uInt16 errCircularReference = 522; -const sal_uInt16 errNoConvergence = 523; -const sal_uInt16 errNoRef = 524; // #REF! -const sal_uInt16 errNoName = 525; // #NAME? -const sal_uInt16 errDoubleRef = 526; -const sal_uInt16 errInterpOverflow = 527; -// Not displayed, temporary for TrackFormulas, -// Cell depends on another cell that has errCircularReference -const sal_uInt16 errTrackFromCircRef = 528; -// ScInterpreter internal: no numeric value but numeric queried. If this is -// set as mnStringNoValueError no error is generated but 0 returned. -const sal_uInt16 errCellNoValue = 529; -// Interpreter: needed AddIn not found -const sal_uInt16 errNoAddin = 530; -// Interpreter: needed Macro not found -const sal_uInt16 errNoMacro = 531; -// Interpreter: Division by zero -const sal_uInt16 errDivisionByZero = 532; // #DIV/0! -// Compiler: a non-simple (str,err,val) value was put in an array -const sal_uInt16 errNestedArray = 533; -// ScInterpreter internal: no numeric value but numeric queried. If this is -// temporarily (!) set as mnStringNoValueError, the error is generated and can -// be used to distinguish that condition from all other (inherited) errors. Do -// not use for anything else! Never push or inherit the error otherwise! -const sal_uInt16 errNotNumericString = 534; -// ScInterpreter internal: jump matrix already has a result at this position, -// do not overwrite in case of empty code path. -const sal_uInt16 errJumpMatHasResult = 535; - -// Interpreter: NA() not available condition, not a real error -const sal_uInt16 NOTAVAILABLE = 0x7fff; - - -/** Unconditionally construct a double value of NAN where the lower bits - represent an interpreter error code. */ -inline double CreateDoubleError( sal_uInt16 nErr ) -{ - union - { - double fVal; - sal_math_Double smVal; - }; - ::rtl::math::setNan( &fVal ); - smVal.nan_parts.fraction_lo = nErr; - return fVal; -} - - -/** Recreate the error code of a coded double error, if any. */ -inline sal_uInt16 GetDoubleErrorValue( double fVal ) -{ - if ( ::rtl::math::isFinite( fVal ) ) - return 0; - if ( ::rtl::math::isInf( fVal ) ) - return errIllegalFPOperation; // normal INF - sal_uInt32 nErr = reinterpret_cast< sal_math_Double * >( - &fVal)->nan_parts.fraction_lo; - if ( nErr & 0xffff0000 ) - return errNoValue; // just a normal NAN - return (sal_uInt16)(nErr & 0x0000ffff); // any other error -} - -} // namespace ScErrorCodes - -// yes, exceptionally we put a "using namespace" in a header file.. -using namespace ScErrorCodes; - -#endif // SC_ERRORCODES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/formdata.hxx b/formula/inc/formula/formdata.hxx deleted file mode 100644 index 595ddb63fc5a..000000000000 --- a/formula/inc/formula/formdata.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_FORMDATA_HXX -#define FORMULA_FORMDATA_HXX - -#include -#include -#include "formula/formuladllapi.h" - -//============================================================================ -namespace formula -{ -class FORMULA_DLLPUBLIC FormEditData -{ -public: - FormEditData(); - virtual ~FormEditData(); - - virtual void SaveValues(); - sal_Bool HasParent() const { return pParent != NULL; } - - inline sal_uInt16 GetMode() const { return nMode; } - inline xub_StrLen GetFStart() const { return nFStart; } - inline sal_uInt16 GetCatSel() const { return nCatSel; } - inline sal_uInt16 GetFuncSel() const { return nFuncSel; } - inline sal_uInt16 GetOffset() const { return nOffset; } - inline sal_uInt16 GetEdFocus() const { return nEdFocus; } - inline const String& GetUndoStr() const { return aUndoStr; } - inline sal_Bool GetMatrixFlag()const{ return bMatrix;} - inline OString GetUniqueId()const { return aUniqueId;} - inline const Selection& GetSelection()const { return aSelection;} - - inline void SetMode( sal_uInt16 nNew ) { nMode = nNew; } - inline void SetFStart( xub_StrLen nNew ) { nFStart = nNew; } - inline void SetCatSel( sal_uInt16 nNew ) { nCatSel = nNew; } - inline void SetFuncSel( sal_uInt16 nNew ) { nFuncSel = nNew; } - inline void SetOffset( sal_uInt16 nNew ) { nOffset = nNew; } - inline void SetEdFocus( sal_uInt16 nNew ) { nEdFocus = nNew; } - inline void SetUndoStr( const String& rNew ) { aUndoStr = rNew; } - inline void SetMatrixFlag(sal_Bool bNew) { bMatrix=bNew;} - inline void SetUniqueId(const OString nNew) { aUniqueId=nNew;} - inline void SetSelection(const Selection& aSel) { aSelection=aSel;} -protected: - void Reset(); - FormEditData( const FormEditData& ); - const FormEditData& operator=( const FormEditData& r ); - - FormEditData* pParent; // fuer Verschachtelung -private: - sal_uInt16 nMode; // enum ScFormulaDlgMode - xub_StrLen nFStart; - sal_uInt16 nCatSel; - sal_uInt16 nFuncSel; - sal_uInt16 nOffset; - sal_uInt16 nEdFocus; - String aUndoStr; - sal_Bool bMatrix; - OString aUniqueId; - Selection aSelection; -}; - - -} // formula -#endif // FORMULA_FORMDATA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/formula.hxx b/formula/inc/formula/formula.hxx deleted file mode 100644 index 5a55f5ca81d1..000000000000 --- a/formula/inc/formula/formula.hxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_FORMULA_HXX -#define FORMULA_FORMULA_HXX - -#include -#include -#include "formula/formuladllapi.h" -#include "formula/omoduleclient.hxx" -#include - -namespace formula -{ -//============================================================================ -#define STRUCT_END 1 -#define STRUCT_FOLDER 2 -#define STRUCT_ERROR 3 - -enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FORMDLG_EDIT }; - -//============================================================================ - -class FormulaDlg_Impl; -class IControlReferenceHandler; -class IFunctionDescription; -class IFunctionManager; -class FormulaHelper; -class RefEdit; -class RefButton; -class FormEditData; -//============================================================================ -class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper -{ - friend class FormulaDlg_Impl; -public: - FormulaModalDialog( Window* pParent - , bool _bSupportFunctionResult - , bool _bSupportResult - , bool _bSupportMatrix - ,IFunctionManager* _pFunctionMgr - ,IControlReferenceHandler* _pDlg = NULL ); - virtual ~FormulaModalDialog(); -private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr m_pImpl; - SAL_WNODEPRECATED_DECLARATIONS_POP - -protected: - - virtual long PreNotify( NotifyEvent& rNEvt ); - ::std::pair RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL ); - void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL ); - void RefInputDoneAfter( sal_Bool bForced = sal_False ); - void SetFocusWin(Window *pWin,const OString& nUniqueId); - - void SetMeText(const String& _sText); - void Update(); - sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/); - void Update(const String& _sExp); - - void StoreFormEditData(FormEditData* pData); -}; - -class FORMULA_DLLPUBLIC FormulaDlg: - private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper - // order of base classes is important, as OModuleClient controls the - // lifecycle of the ResMgr passed into SfxModelessDialog (via - // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in - // ~Resource, the ResMgr must outlive the Resource (from which - // SfxModelessDialog ultimately derives) -{ - friend class FormulaDlg_Impl; -public: - FormulaDlg( SfxBindings* pB - , SfxChildWindow* pCW - , Window* pParent - , bool _bSupportFunctionResult - , bool _bSupportResult - , bool _bSupportMatrix - , IFunctionManager* _pFunctionMgr - , IControlReferenceHandler* _pDlg = NULL ); - virtual ~FormulaDlg(); -private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr m_pImpl; - SAL_WNODEPRECATED_DECLARATIONS_POP - - DECL_LINK( UpdateFocusHdl, void*); -protected: - void disableOk(); - -protected: - - virtual long PreNotify( NotifyEvent& rNEvt ); - ::std::pair RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL ); - void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL ); - void RefInputDoneAfter( sal_Bool bForced = sal_False ); - void SetFocusWin(Window *pWin,const OString& nUniqueId); - void HighlightFunctionParas(const String& aFormula); - - void SetMeText(const String& _sText); - FormulaDlgMode SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate); - void Update(); - sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/); - String GetMeText() const; - void Update(const String& _sExp); - void CheckMatrix(); - void DoEnter(sal_Bool _bOk); - sal_Bool isUserMatrix() const; - const IFunctionDescription* getCurrentFunctionDescription() const; - sal_Bool UpdateParaWin(Selection& _rSelection); - void UpdateParaWin(const Selection& _rSelection,const String& _sRefStr); - RefEdit* GetActiveEdit(); - void SetEdSelection(); - - void StoreFormEditData(FormEditData* pData); - - const FormulaHelper& GetFormulaHelper() const; -}; - -} // formula - -#endif // FORMULA_FORMULA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/formuladllapi.h b/formula/inc/formula/formuladllapi.h deleted file mode 100644 index b2f4b06bd1a8..000000000000 --- a/formula/inc/formula/formuladllapi.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FORMULADLLAPI_H -#define INCLUDED_FORMULADLLAPI_H - -#include "sal/types.h" - -#if defined(FORMULA_DLLIMPLEMENTATION) -#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif -#define FORMULA_DLLPRIVATE SAL_DLLPRIVATE - -#endif /* INCLUDED_FORMULADLLAPI_H */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/formulahelper.hxx b/formula/inc/formula/formulahelper.hxx deleted file mode 100644 index 27c9b6683964..000000000000 --- a/formula/inc/formula/formulahelper.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_FORMULA_HELPER_HXX -#define FORMULA_FORMULA_HELPER_HXX - -#include "formula/IFunctionDescription.hxx" -#include -#include -#include -#include "formula/formuladllapi.h" - -class SvtSysLocale; -class CharClass; - -namespace formula -{ - class FORMULA_DLLPUBLIC FormulaHelper - { - ::std::auto_ptr m_pSysLocale; - const CharClass* m_pCharClass; - const IFunctionManager* m_pFunctionManager; - const sal_Unicode open; - const sal_Unicode close; - const sal_Unicode sep; - const sal_Unicode arrayOpen; - const sal_Unicode arrayClose; - public: - FormulaHelper(const IFunctionManager* _pFunctionManager); - - inline const CharClass* GetCharClass() const { return m_pCharClass; } - - sal_Bool GetNextFunc( const String& rFormula, - sal_Bool bBack, - xub_StrLen& rFStart, // Ein- und Ausgabe - xub_StrLen* pFEnd = NULL, - const IFunctionDescription** ppFDesc = NULL, - ::std::vector< OUString>* pArgs = NULL ) const; - - xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart, - sal_Bool bBack, String* pFuncName = NULL ) const; - - xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart ) const; - - xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart, - sal_uInt16 nArg ) const; - - void GetArgStrings ( ::std::vector< OUString >& _rArgs, - const String& rFormula, - xub_StrLen nFuncPos, - sal_uInt16 nArgs ) const; - - void FillArgStrings ( const String& rFormula, - xub_StrLen nFuncPos, - sal_uInt16 nArgs, - ::std::vector< OUString >& _rArgs ) const; - }; -// ============================================================================= -} // formula -// ============================================================================= - -#endif //FORMULA_FORMULA_HELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/funcutl.hxx b/formula/inc/formula/funcutl.hxx deleted file mode 100644 index 6676117cdf20..000000000000 --- a/formula/inc/formula/funcutl.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_FUNCUTL_HXX -#define FORMULA_FUNCUTL_HXX - -#include -#include -#include -#include "formula/formuladllapi.h" - -namespace formula { - -class IControlReferenceHandler; - -class FORMULA_DLLPUBLIC RefEdit : public Edit -{ -private: - Timer aTimer; - IControlReferenceHandler* pAnyRefDlg; // parent dialog - Window* pLabelWidget; - - DECL_LINK( UpdateHdl, void* ); - -protected: - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void GetFocus(); - virtual void LoseFocus(); - -public: - RefEdit( Window* _pParent,IControlReferenceHandler* pParent, - Window* pShrinkModeLabel, const ResId& rResId ); - RefEdit( Window* _pParent, Window* pShrinkModeLabel, - WinBits nStyle = WB_BORDER ); - virtual ~RefEdit(); - - void SetRefString( const XubString& rStr ); - - /** - * Flag reference valid or invalid, which in turn changes the visual - * appearance of the control accordingly. - */ - void SetRefValid(bool bValid); - - using Edit::SetText; - virtual void SetText( const XubString& rStr ); - virtual void Modify(); - - void StartUpdateData(); - - void SetReferences( IControlReferenceHandler* pDlg, Window *pLabelWidget ); - IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; } - Window* GetLabelWidgetForShrinkMode() { return pLabelWidget; } -}; - - -//============================================================================ - -class FORMULA_DLLPUBLIC RefButton : public ImageButton -{ -private: - Image aImgRefStart; /// Start reference input - Image aImgRefDone; /// Stop reference input - OUString aShrinkQuickHelp; - OUString aExpandQuickHelp; - IControlReferenceHandler* pAnyRefDlg; // parent dialog - RefEdit* pRefEdit; // zugeordnetes Edit-Control - -protected: - virtual void Click(); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void GetFocus(); - virtual void LoseFocus(); - -public: - RefButton(Window* _pParent, const ResId& rResId); - RefButton(Window* _pParent, WinBits nStyle = 0); - RefButton(Window* _pParent, const ResId& rResId, - RefEdit* pEdit, IControlReferenceHandler* pDlg); - - void SetReferences( IControlReferenceHandler* pDlg, - RefEdit* pEdit ); - - void SetStartImage(); - void SetEndImage(); - void DoRef() { Click(); } -}; - -} // formula - -#endif // FORMULA_FUNCUTL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/grammar.hxx b/formula/inc/formula/grammar.hxx deleted file mode 100644 index 584aff1ae57f..000000000000 --- a/formula/inc/formula/grammar.hxx +++ /dev/null @@ -1,242 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_GRAMMAR_HXX -#define FORMULA_GRAMMAR_HXX - -#include "com/sun/star/sheet/FormulaLanguage.hpp" -#include "formula/formuladllapi.h" -#include - -namespace formula -{ - -/** Grammars digested by ScCompiler. - */ -class FORMULA_DLLPUBLIC FormulaGrammar -{ -public: - enum AddressConvention{ - CONV_UNSPECIFIED = -1, /* useful when we want method to chose, must be first */ - - /* elements must be sequential and changes should be reflected in ScCompiler::pCharTables */ - CONV_OOO = 0, /* 'doc'#sheet.A1:sheet2.B2 */ - CONV_ODF, /* ['doc'#sheet.A1:sheet2.B2] */ - CONV_XL_A1, /* [doc]sheet:sheet2!A1:B2 */ - CONV_XL_R1C1, /* [doc]sheet:sheet2!R1C1:R2C2 */ - CONV_XL_OOX, /* [#]sheet:sheet2!A1:B2 */ - - CONV_LOTUS_A1, /* external? 3d? A1.B2 */ - - CONV_LAST /* for loops, must always be last */ - }; - - //! CONV_UNSPECIFIED is a negative value! - static const int kConventionOffset = - CONV_UNSPECIFIED + 1; - // Room for 32k hypothetical languages plus EXTERNAL. - static const int kConventionShift = 16; - // Room for 256 reference conventions. - static const int kEnglishBit = (1 << (kConventionShift + 8)); - // Mask off all non-language bits. - static const int kFlagMask = ~((~int(0)) << kConventionShift); - - /** Values encoding the formula language plus address reference convention - plus English parsing/formatting - */ - //! When adding new values adapt isSupported() below as well. - enum Grammar - { - /// Used only in ScCompiler ctor and in some XML import API context. - GRAM_UNSPECIFIED = -1, - /// ODFF with default ODF A1 bracketed references. - GRAM_ODFF = ::com::sun::star::sheet::FormulaLanguage::ODFF | - ((CONV_ODF + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// ODF 1.1 with default ODF A1 bracketed references. - GRAM_PODF = ::com::sun::star::sheet::FormulaLanguage::ODF_11 | - ((CONV_ODF + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// English with default A1 reference style. - GRAM_ENGLISH = ::com::sun::star::sheet::FormulaLanguage::ENGLISH | - ((CONV_OOO + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// Native with default A1 reference style. - GRAM_NATIVE = ::com::sun::star::sheet::FormulaLanguage::NATIVE | - ((CONV_OOO + - kConventionOffset) << kConventionShift), - /// ODFF with reference style as set in UI, may be A1 or R1C1. - GRAM_ODFF_UI = ::com::sun::star::sheet::FormulaLanguage::ODFF | - ((CONV_UNSPECIFIED + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// ODFF with A1 reference style, unbracketed. - GRAM_ODFF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODFF | - ((CONV_OOO + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// ODF 1.1 with reference style as set in UI, may be A1 or R1C1. - GRAM_PODF_UI = ::com::sun::star::sheet::FormulaLanguage::ODF_11 | - ((CONV_UNSPECIFIED + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// ODF 1.1 with A1 reference style, unbracketed. - GRAM_PODF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODF_11 | - ((CONV_OOO + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// Native with reference style as set in UI, may be A1 or R1C1. - GRAM_NATIVE_UI = ::com::sun::star::sheet::FormulaLanguage::NATIVE | - ((CONV_UNSPECIFIED + - kConventionOffset) << kConventionShift), - /// Native with ODF A1 bracketed references. Not very useful but supported. - GRAM_NATIVE_ODF = ::com::sun::star::sheet::FormulaLanguage::NATIVE | - ((CONV_ODF + - kConventionOffset) << kConventionShift), - /// Native with Excel A1 reference style. - GRAM_NATIVE_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE | - ((CONV_XL_A1 + - kConventionOffset) << kConventionShift), - /// Native with Excel R1C1 reference style. - GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE | - ((CONV_XL_R1C1 + - kConventionOffset) << kConventionShift), - /// English with Excel A1 reference style. - GRAM_ENGLISH_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH | - ((CONV_XL_A1 + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// English with Excel R1C1 reference style. - GRAM_ENGLISH_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH | - ((CONV_XL_R1C1 + - kConventionOffset) << kConventionShift) | - kEnglishBit, - /// Central definition of the default grammar to be used. - GRAM_DEFAULT = GRAM_NATIVE_UI, - - /// Central definition of the default storage grammar to be used. - GRAM_STORAGE_DEFAULT = GRAM_ODFF, - - /** OpCodeMap set by external filter and merged with reference - convention plus English bit on top. Plain value acts as - FormulaLanguage. */ - GRAM_EXTERNAL = (1 << (kConventionShift - 1)) - }; - - /// If English parsing/formatting is associated with a grammar. - static inline bool isEnglish( const Grammar eGrammar ) - { - return (eGrammar & kEnglishBit) != 0; - } - - /** Compatibility helper for old "bCompileEnglish, bCompileXML" API calls - to obtain the new grammar. */ - static Grammar mapAPItoGrammar( const bool bEnglish, const bool bXML ) - { - Grammar eGrammar; - if (bEnglish && bXML) - eGrammar = GRAM_PODF; - else if (bEnglish && !bXML) - eGrammar = GRAM_PODF_A1; - else if (!bEnglish && bXML) - eGrammar = GRAM_NATIVE_ODF; - else // (!bEnglish && !bXML) - eGrammar = GRAM_NATIVE; - return eGrammar; - } - - static bool isSupported( const Grammar eGrammar ) - { - switch (eGrammar) - { - case GRAM_ODFF : - case GRAM_PODF : - case GRAM_ENGLISH : - case GRAM_NATIVE : - case GRAM_ODFF_UI : - case GRAM_ODFF_A1 : - case GRAM_PODF_UI : - case GRAM_PODF_A1 : - case GRAM_NATIVE_UI : - case GRAM_NATIVE_ODF : - case GRAM_NATIVE_XL_A1 : - case GRAM_NATIVE_XL_R1C1 : - case GRAM_ENGLISH_XL_A1 : - case GRAM_ENGLISH_XL_R1C1: - return true; - default: - return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL; - } - } - - static inline sal_Int32 extractFormulaLanguage( const Grammar eGrammar ) - { - return eGrammar & kFlagMask; - } - - static inline AddressConvention extractRefConvention( const Grammar eGrammar ) - { - return static_cast( - ((eGrammar & ~kEnglishBit) >> kConventionShift) - - kConventionOffset); - } - - static inline Grammar setEnglishBit( const Grammar eGrammar, const bool bEnglish ) - { - if (bEnglish) - return static_cast( eGrammar | kEnglishBit); - else - return static_cast( eGrammar & ~kEnglishBit); - } - - static inline Grammar mergeToGrammar( const Grammar eGrammar, const AddressConvention eConv ) - { - bool bEnglish = isEnglish( eGrammar); - Grammar eGram = static_cast( - extractFormulaLanguage( eGrammar) | - ((eConv + kConventionOffset) << kConventionShift)); - eGram = setEnglishBit( eGram, bEnglish); - DBG_ASSERT( isSupported( eGram), "CompilerGrammarMap::mergeToGrammar: unsupported grammar"); - return eGram; - } - - /// If grammar is of ODF 1.1 - static inline bool isPODF( const Grammar eGrammar ) - { - return extractFormulaLanguage( eGrammar) == - ::com::sun::star::sheet::FormulaLanguage::ODF_11; - } - - /// If grammar is of ODFF - static inline bool isODFF( const Grammar eGrammar ) - { - return extractFormulaLanguage( eGrammar) == - ::com::sun::star::sheet::FormulaLanguage::ODFF; - } - -}; -// ============================================================================= -} // formula -// ============================================================================= - -#endif // FORMULA_GRAMMAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/omoduleclient.hxx b/formula/inc/formula/omoduleclient.hxx deleted file mode 100644 index 76fcee97fb57..000000000000 --- a/formula/inc/formula/omoduleclient.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FORMULA_MODULECLIENT_HXX -#define INCLUDED_FORMULA_MODULECLIENT_HXX - -#include "sal/config.h" - -#include "boost/noncopyable.hpp" -#include "formula/formuladllapi.h" - -namespace formula { - -/** Base class for objects which use any global module-specific resources. -*/ -class FORMULA_DLLPUBLIC OModuleClient: private boost::noncopyable -{ -public: - OModuleClient(); - ~OModuleClient(); -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/opcode.hxx b/formula/inc/formula/opcode.hxx deleted file mode 100644 index b94c066a624b..000000000000 --- a/formula/inc/formula/opcode.hxx +++ /dev/null @@ -1,420 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_OPCODE_HXX -#define FORMULA_OPCODE_HXX - -#include "formula/compiler.hrc" // OpCodes -#include - -enum OpCodeEnum -{ - // Special commands - ocPush = SC_OPCODE_PUSH, - ocCall = SC_OPCODE_CALL, - ocStop = SC_OPCODE_STOP, - ocExternal = SC_OPCODE_EXTERNAL, - ocName = SC_OPCODE_NAME, - ocExternalRef = SC_OPCODE_EXTERNAL_REF, - // Jump commands - ocIf = SC_OPCODE_IF, - ocIfError = SC_OPCODE_IF_ERROR, - ocIfNA = SC_OPCODE_IF_NA, - ocChose = SC_OPCODE_CHOSE, - // Parentheses and separators - ocOpen = SC_OPCODE_OPEN, - ocClose = SC_OPCODE_CLOSE, - ocSep = SC_OPCODE_SEP, - ocArrayOpen = SC_OPCODE_ARRAY_OPEN, - ocArrayClose = SC_OPCODE_ARRAY_CLOSE, - ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP, - ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP, - // Special OpCodes - ocMissing = SC_OPCODE_MISSING, - ocBad = SC_OPCODE_BAD, - ocStringXML = SC_OPCODE_STRINGXML, - ocSpaces = SC_OPCODE_SPACES, - ocMatRef = SC_OPCODE_MAT_REF, - ocSkip = SC_OPCODE_SKIP, - // Access commands - ocDBArea = SC_OPCODE_DB_AREA, - ocMacro = SC_OPCODE_MACRO, - ocColRowName = SC_OPCODE_COL_ROW_NAME, - ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO, - // Percent operator _follows_ value - ocPercentSign = SC_OPCODE_PERCENT_SIGN, - // Error constants - ocErrNull = SC_OPCODE_ERROR_NULL, - ocErrDivZero = SC_OPCODE_ERROR_DIVZERO, - ocErrValue = SC_OPCODE_ERROR_VALUE, - ocErrRef = SC_OPCODE_ERROR_REF, - ocErrName = SC_OPCODE_ERROR_NAME, - ocErrNum = SC_OPCODE_ERROR_NUM, - ocErrNA = SC_OPCODE_ERROR_NA, - // Binary operators - ocAdd = SC_OPCODE_ADD, - ocSub = SC_OPCODE_SUB, - ocMul = SC_OPCODE_MUL, - ocDiv = SC_OPCODE_DIV, - ocAmpersand = SC_OPCODE_AMPERSAND, - ocPow = SC_OPCODE_POW, - ocEqual = SC_OPCODE_EQUAL, - ocNotEqual = SC_OPCODE_NOT_EQUAL, - ocLess = SC_OPCODE_LESS, - ocGreater = SC_OPCODE_GREATER, - ocLessEqual = SC_OPCODE_LESS_EQUAL, - ocGreaterEqual = SC_OPCODE_GREATER_EQUAL, - ocAnd = SC_OPCODE_AND, - ocOr = SC_OPCODE_OR, - ocXor = SC_OPCODE_XOR, - ocIntersect = SC_OPCODE_INTERSECT, - ocUnion = SC_OPCODE_UNION, - ocRange = SC_OPCODE_RANGE, - // Unary operators - ocNot = SC_OPCODE_NOT, - ocNeg = SC_OPCODE_NEG, - ocNegSub = SC_OPCODE_NEG_SUB, - // Functions with no parameters - ocPi = SC_OPCODE_PI, - ocRandom = SC_OPCODE_RANDOM, - ocTrue = SC_OPCODE_TRUE, - ocFalse = SC_OPCODE_FALSE, - ocGetActDate = SC_OPCODE_GET_ACT_DATE, - ocGetActTime = SC_OPCODE_GET_ACT_TIME, - ocNotAvail = SC_OPCODE_NO_VALUE, - ocCurrent = SC_OPCODE_CURRENT, - // Functions with one parameter - ocDeg = SC_OPCODE_DEG, - ocRad = SC_OPCODE_RAD, - ocSin = SC_OPCODE_SIN, - ocCos = SC_OPCODE_COS, - ocTan = SC_OPCODE_TAN, - ocCot = SC_OPCODE_COT, - ocArcSin = SC_OPCODE_ARC_SIN, - ocArcCos = SC_OPCODE_ARC_COS, - ocArcTan = SC_OPCODE_ARC_TAN, - ocArcCot = SC_OPCODE_ARC_COT, - ocSinHyp = SC_OPCODE_SIN_HYP, - ocCosHyp = SC_OPCODE_COS_HYP, - ocTanHyp = SC_OPCODE_TAN_HYP, - ocCotHyp = SC_OPCODE_COT_HYP, - ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP, - ocArcCosHyp = SC_OPCODE_ARC_COS_HYP, - ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP, - ocArcCotHyp = SC_OPCODE_ARC_COT_HYP, - ocCosecant = SC_OPCODE_COSECANT, - ocSecant = SC_OPCODE_SECANT, - ocCosecantHyp = SC_OPCODE_COSECANT_HYP, - ocSecantHyp = SC_OPCODE_SECANT_HYP, - ocExp = SC_OPCODE_EXP, - ocLn = SC_OPCODE_LN, - ocSqrt = SC_OPCODE_SQRT, - ocFact = SC_OPCODE_FACT, - ocGetYear = SC_OPCODE_GET_YEAR, - ocGetMonth = SC_OPCODE_GET_MONTH, - ocGetDay = SC_OPCODE_GET_DAY, - ocGetHour = SC_OPCODE_GET_HOUR, - ocGetMin = SC_OPCODE_GET_MIN, - ocGetSec = SC_OPCODE_GET_SEC, - ocPlusMinus = SC_OPCODE_PLUS_MINUS, - ocAbs = SC_OPCODE_ABS, - ocInt = SC_OPCODE_INT, - ocPhi = SC_OPCODE_PHI, - ocGauss = SC_OPCODE_GAUSS, - ocIsEmpty = SC_OPCODE_IS_EMPTY, - ocIsString = SC_OPCODE_IS_STRING, - ocIsNonString = SC_OPCODE_IS_NON_STRING, - ocIsLogical = SC_OPCODE_IS_LOGICAL, - ocType = SC_OPCODE_TYPE, - ocCell = SC_OPCODE_CELL, - ocIsRef = SC_OPCODE_IS_REF, - ocIsValue = SC_OPCODE_IS_VALUE, - ocIsFormula = SC_OPCODE_IS_FORMULA, - ocIsNA = SC_OPCODE_IS_NV, - ocIsErr = SC_OPCODE_IS_ERR, - ocIsError = SC_OPCODE_IS_ERROR, - ocIsEven = SC_OPCODE_IS_EVEN, - ocIsOdd = SC_OPCODE_IS_ODD, - ocN = SC_OPCODE_N, - // String functions - ocGetDateValue = SC_OPCODE_GET_DATE_VALUE, - ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE, - ocCode = SC_OPCODE_CODE, - ocTrim = SC_OPCODE_TRIM, - ocUpper = SC_OPCODE_UPPER, - ocPropper = SC_OPCODE_PROPPER, - ocLower = SC_OPCODE_LOWER, - ocLen = SC_OPCODE_LEN, - ocT = SC_OPCODE_T, - ocValue = SC_OPCODE_VALUE, - ocClean = SC_OPCODE_CLEAN, - ocChar = SC_OPCODE_CHAR, - ocLog10 = SC_OPCODE_LOG10, - ocEven = SC_OPCODE_EVEN, - ocOdd = SC_OPCODE_ODD, - ocStdNormDist = SC_OPCODE_STD_NORM_DIST, - ocFisher = SC_OPCODE_FISHER, - ocFisherInv = SC_OPCODE_FISHER_INV, - ocSNormInv = SC_OPCODE_S_NORM_INV, - ocGammaLn = SC_OPCODE_GAMMA_LN, - ocGamma = SC_OPCODE_GAMMA, - ocErrorType = SC_OPCODE_ERROR_TYPE, - ocErrCell = SC_OPCODE_ERR_CELL, - ocFormula = SC_OPCODE_FORMULA, - ocArabic = SC_OPCODE_ARABIC, - ocInfo = SC_OPCODE_INFO, - ocBahtText = SC_OPCODE_BAHTTEXT, - ocJis = SC_OPCODE_JIS, - ocAsc = SC_OPCODE_ASC, - ocUnicode = SC_OPCODE_UNICODE, - ocUnichar = SC_OPCODE_UNICHAR, - // Functions with more than one parameters - ocArcTan2 = SC_OPCODE_ARC_TAN_2, - ocCeil = SC_OPCODE_CEIL, - ocFloor = SC_OPCODE_FLOOR, - ocRound = SC_OPCODE_ROUND, - ocRoundUp = SC_OPCODE_ROUND_UP, - ocRoundDown = SC_OPCODE_ROUND_DOWN, - ocTrunc = SC_OPCODE_TRUNC, - ocLog = SC_OPCODE_LOG, - ocPower = SC_OPCODE_POWER, - ocGCD = SC_OPCODE_GGT, - ocLCM = SC_OPCODE_KGV, - ocMod = SC_OPCODE_MOD, - ocSumProduct = SC_OPCODE_SUM_PRODUCT, - ocSumSQ = SC_OPCODE_SUM_SQ, - ocSumX2MY2 = SC_OPCODE_SUM_X2MY2, - ocSumX2DY2 = SC_OPCODE_SUM_X2DY2, - ocSumXMY2 = SC_OPCODE_SUM_XMY2, - ocGetDate = SC_OPCODE_GET_DATE, - ocGetTime = SC_OPCODE_GET_TIME, - ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE, - ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360, - ocGetDateDif = SC_OPCODE_GET_DATEDIF, - ocMin = SC_OPCODE_MIN, - ocMax = SC_OPCODE_MAX, - ocSum = SC_OPCODE_SUM, - ocProduct = SC_OPCODE_PRODUCT, - ocAverage = SC_OPCODE_AVERAGE, - ocCount = SC_OPCODE_COUNT, - ocCount2 = SC_OPCODE_COUNT_2, - ocNPV = SC_OPCODE_NBW, - ocIRR = SC_OPCODE_IKV, - ocMIRR = SC_OPCODE_MIRR, - ocISPMT = SC_OPCODE_ISPMT, - ocVar = SC_OPCODE_VAR, - ocVarP = SC_OPCODE_VAR_P, - ocStDev = SC_OPCODE_ST_DEV, - ocStDevP = SC_OPCODE_ST_DEV_P, - ocB = SC_OPCODE_B, - ocNormDist = SC_OPCODE_NORM_DIST, - ocExpDist = SC_OPCODE_EXP_DIST, - ocBinomDist = SC_OPCODE_BINOM_DIST, - ocPoissonDist = SC_OPCODE_POISSON_DIST, - ocKombin = SC_OPCODE_KOMBIN, - ocKombin2 = SC_OPCODE_KOMBIN_2, - ocVariationen = SC_OPCODE_VARIATIONEN, - ocVariationen2 = SC_OPCODE_VARIATIONEN_2, - ocBW = SC_OPCODE_BW, - ocDIA = SC_OPCODE_DIA, - ocGDA = SC_OPCODE_GDA, - ocGDA2 = SC_OPCODE_GDA_2, - ocVBD = SC_OPCODE_VBD, - ocLaufz = SC_OPCODE_LAUFZ, - ocLIA = SC_OPCODE_LIA, - ocRMZ = SC_OPCODE_RMZ, - ocColumns = SC_OPCODE_COLUMNS, - ocRows = SC_OPCODE_ROWS, - ocColumn = SC_OPCODE_COLUMN, - ocRow = SC_OPCODE_ROW, - ocZGZ = SC_OPCODE_ZGZ, - ocZW = SC_OPCODE_ZW, - ocZZR = SC_OPCODE_ZZR, - ocZins = SC_OPCODE_ZINS, - ocZinsZ = SC_OPCODE_ZINS_Z, - ocKapz = SC_OPCODE_KAPZ, - ocKumZinsZ = SC_OPCODE_KUM_ZINS_Z, - ocKumKapZ = SC_OPCODE_KUM_KAP_Z, - ocEffektiv = SC_OPCODE_EFFEKTIV, - ocNominal = SC_OPCODE_NOMINAL, - ocSubTotal = SC_OPCODE_SUB_TOTAL, - // Database functions - ocDBSum = SC_OPCODE_DB_SUM, - ocDBCount = SC_OPCODE_DB_COUNT, - ocDBCount2 = SC_OPCODE_DB_COUNT_2, - ocDBAverage = SC_OPCODE_DB_AVERAGE, - ocDBGet = SC_OPCODE_DB_GET, - ocDBMax = SC_OPCODE_DB_MAX, - ocDBMin = SC_OPCODE_DB_MIN, - ocDBProduct = SC_OPCODE_DB_PRODUCT, - ocDBStdDev = SC_OPCODE_DB_STD_DEV, - ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P, - ocDBVar = SC_OPCODE_DB_VAR, - ocDBVarP = SC_OPCODE_DB_VAR_P, - // Management functions - ocIndirect = SC_OPCODE_INDIRECT, - ocIndirectXL = SC_OPCODE_INDIRECT_XL, - ocAddress = SC_OPCODE_ADDRESS, - ocAddressXL = SC_OPCODE_ADDRESS_XL, - ocMatch = SC_OPCODE_MATCH, - ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS, - ocCountIf = SC_OPCODE_COUNT_IF, - ocSumIf = SC_OPCODE_SUM_IF, - ocAverageIf = SC_OPCODE_AVERAGE_IF, - ocSumIfs = SC_OPCODE_SUM_IFS, - ocAverageIfs = SC_OPCODE_AVERAGE_IFS, - ocCountIfs = SC_OPCODE_COUNT_IFS, - ocLookup = SC_OPCODE_LOOKUP, - ocVLookup = SC_OPCODE_V_LOOKUP, - ocHLookup = SC_OPCODE_H_LOOKUP, - ocMultiArea = SC_OPCODE_MULTI_AREA, - ocOffset = SC_OPCODE_OFFSET, - ocIndex = SC_OPCODE_INDEX, - ocAreas = SC_OPCODE_AREAS, - // String functions - ocCurrency = SC_OPCODE_CURRENCY, - ocReplace = SC_OPCODE_REPLACE, - ocFixed = SC_OPCODE_FIXED, - ocFind = SC_OPCODE_FIND, - ocExact = SC_OPCODE_EXACT, - ocLeft = SC_OPCODE_LEFT, - ocRight = SC_OPCODE_RIGHT, - ocSearch = SC_OPCODE_SEARCH, - ocMid = SC_OPCODE_MID, - ocText = SC_OPCODE_TEXT, - ocSubstitute = SC_OPCODE_SUBSTITUTE, - ocRept = SC_OPCODE_REPT, - ocConcat = SC_OPCODE_CONCAT, - ocNumberValue = SC_OPCODE_NUMBERVALUE, - // Matrix functions - ocMatValue = SC_OPCODE_MAT_VALUE, - ocMatDet = SC_OPCODE_MAT_DET, - ocMatInv = SC_OPCODE_MAT_INV, - ocMatMult = SC_OPCODE_MAT_MULT, - ocMatTrans = SC_OPCODE_MAT_TRANS, - ocMatrixUnit = SC_OPCODE_MATRIX_UNIT, - // BackSolver - ocBackSolver = SC_OPCODE_BACK_SOLVER, - // Statistical functions - ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST, - ocLogNormDist = SC_OPCODE_LOG_NORM_DIST, - ocTDist = SC_OPCODE_T_DIST, - ocFDist = SC_OPCODE_F_DIST, - ocChiDist = SC_OPCODE_CHI_DIST, - ocChiSqDist = SC_OPCODE_CHISQ_DIST, - ocChiSqInv = SC_OPCODE_CHISQ_INV, - ocWeibull = SC_OPCODE_WEIBULL, - ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT, - ocKritBinom = SC_OPCODE_KRIT_BINOM, - ocKurt = SC_OPCODE_KURT, - ocHarMean = SC_OPCODE_HAR_MEAN, - ocGeoMean = SC_OPCODE_GEO_MEAN, - ocStandard = SC_OPCODE_STANDARD, - ocAveDev = SC_OPCODE_AVE_DEV, - ocSchiefe = SC_OPCODE_SCHIEFE, - ocSkewp = SC_OPCODE_SKEWP, - ocDevSq = SC_OPCODE_DEV_SQ, - ocMedian = SC_OPCODE_MEDIAN, - ocModalValue = SC_OPCODE_MODAL_VALUE, - ocZTest = SC_OPCODE_Z_TEST, - ocTTest = SC_OPCODE_T_TEST, - ocRank = SC_OPCODE_RANK, - ocPercentile = SC_OPCODE_PERCENTILE, - ocPercentrank = SC_OPCODE_PERCENT_RANK, - ocLarge = SC_OPCODE_LARGE, - ocSmall = SC_OPCODE_SMALL, - ocFrequency = SC_OPCODE_FREQUENCY, - ocQuartile = SC_OPCODE_QUARTILE, - ocNormInv = SC_OPCODE_NORM_INV, - ocConfidence = SC_OPCODE_CONFIDENCE, - ocFTest = SC_OPCODE_F_TEST, - ocTrimMean = SC_OPCODE_TRIM_MEAN, - ocProb = SC_OPCODE_PROB, - ocCorrel = SC_OPCODE_CORREL, - ocCovar = SC_OPCODE_COVAR, - ocPearson = SC_OPCODE_PEARSON, - ocRSQ = SC_OPCODE_RSQ, - ocSTEYX = SC_OPCODE_STEYX, - ocSlope = SC_OPCODE_SLOPE, - ocIntercept = SC_OPCODE_INTERCEPT, - ocTrend = SC_OPCODE_TREND, - ocGrowth = SC_OPCODE_GROWTH, - ocRGP = SC_OPCODE_RGP, - ocRKP = SC_OPCODE_RKP, - ocForecast = SC_OPCODE_FORECAST, - ocChiInv = SC_OPCODE_CHI_INV, - ocGammaDist = SC_OPCODE_GAMMA_DIST, - ocGammaInv = SC_OPCODE_GAMMA_INV, - ocTInv = SC_OPCODE_T_INV, - ocFInv = SC_OPCODE_F_INV, - ocChiTest = SC_OPCODE_CHI_TEST, - ocLogInv = SC_OPCODE_LOG_INV, - ocTableOp = SC_OPCODE_TABLE_OP, - ocBetaDist = SC_OPCODE_BETA_DIST, - ocBetaInv = SC_OPCODE_BETA_INV, - // Bit functions - ocBitAnd = SC_OPCODE_BITAND, - ocBitOr = SC_OPCODE_BITOR, - ocBitXor = SC_OPCODE_BITXOR, - ocBitRshift = SC_OPCODE_BITRSHIFT, - ocBitLshift = SC_OPCODE_BITLSHIFT, - // miscellaneous - ocWeek = SC_OPCODE_WEEK, - ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK, - ocNoName = SC_OPCODE_NO_NAME, - ocStyle = SC_OPCODE_STYLE, - ocDde = SC_OPCODE_DDE, - ocBase = SC_OPCODE_BASE, - ocTable = SC_OPCODE_TABLE, - ocTables = SC_OPCODE_TABLES, - ocMinA = SC_OPCODE_MIN_A, - ocMaxA = SC_OPCODE_MAX_A, - ocAverageA = SC_OPCODE_AVERAGE_A, - ocStDevA = SC_OPCODE_ST_DEV_A, - ocStDevPA = SC_OPCODE_ST_DEV_P_A, - ocVarA = SC_OPCODE_VAR_A, - ocVarPA = SC_OPCODE_VAR_P_A, - ocEasterSunday = SC_OPCODE_EASTERSUNDAY, - ocDecimal = SC_OPCODE_DECIMAL, - ocConvert = SC_OPCODE_CONVERT, - ocRoman = SC_OPCODE_ROMAN, - ocHyperLink = SC_OPCODE_HYPERLINK, - ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA, - ocEuroConvert = SC_OPCODE_EUROCONVERT, - // internal stuff - ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN, - ocTTT = SC_OPCODE_TTT, - ocInternalEnd = SC_OPCODE_INTERNAL_END, - // from here on ExtraData - ocDataToken1 = SC_OPCODE_DATA_TOKEN_1, - // no OpCode - ocNone = SC_OPCODE_NONE -}; - -#ifndef DBG_UTIL -// save memory since compilers tend to int an enum -typedef sal_uInt16 OpCode; -#else -// have enum names in debugger -typedef OpCodeEnum OpCode; -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx deleted file mode 100644 index 3a174d7b9d4f..000000000000 --- a/formula/inc/formula/token.hxx +++ /dev/null @@ -1,428 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_TOKEN_HXX -#define FORMULA_TOKEN_HXX - -#include -#include -#include -#include "formula/opcode.hxx" -#include -#include "formula/IFunctionDescription.hxx" -#include "formula/formuladllapi.h" - -#include - -namespace formula -{ - -enum StackVarEnum -{ - svByte, - svDouble, - svString, - svSingleRef, - svDoubleRef, - svMatrix, - svIndex, - svJump, - svExternal, // Byte + String - svFAP, // FormulaAutoPilot only, ever exported - svJumpMatrix, // 2003-07-02 - svRefList, // ocUnion result - svEmptyCell, // Result is an empty cell, e.g. in LOOKUP() - - svMatrixCell, // Result is a matrix with bells and - // whistles as needed for _the_ matrix - // formula result. - - svHybridCell, // A temporary condition of a formula - // cell during import, having a double - // and/or string result and a formula - // string to be compiled. - - svHybridValueCell, // A temporary formula cell with an value - // and possibily a string representation - - svExternalSingleRef, - svExternalDoubleRef, - svExternalName, - svSubroutine, // A token with a subroutine token array. - svError, // error token - svMissing = 0x70, // 0 or "" - svSep, // separator, ocSep, ocOpen, ocClose - svUnknown // unknown StackType -}; - -#ifndef DBG_UTIL -// save memory since compilers tend to int an enum -typedef sal_uInt8 StackVar; -#else -// have enum names in debugger -typedef StackVarEnum StackVar; -#endif - - -class FormulaToken; -typedef ::boost::intrusive_ptr FormulaTokenRef; -typedef ::boost::intrusive_ptr FormulaConstTokenRef; - -class FormulaTokenArray; - -class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken -{ - OpCode eOp; - // not implemented, prevent usage - FormulaToken(); - FormulaToken& operator=( const FormulaToken& ); -protected: - - const StackVar eType; // type of data - mutable sal_uInt16 nRefCnt; // reference count - -public: - FormulaToken( StackVar eTypeP,OpCode e = ocPush ) : - eOp(e), eType( eTypeP ), nRefCnt(0) {} - FormulaToken( const FormulaToken& r ) : IFormulaToken(), - eOp(r.eOp), eType( r.eType ), nRefCnt(0) {} - - virtual ~FormulaToken(); - - inline void Delete() { delete this; } - inline StackVar GetType() const { return eType; } - bool IsFunction() const; // pure functions, no operators - bool IsExternalRef() const; - sal_uInt8 GetParamCount() const; - inline void IncRef() const { nRefCnt++; } - inline void DecRef() const - { - if (!--nRefCnt) - const_cast(this)->Delete(); - } - inline sal_uInt16 GetRef() const { return nRefCnt; } - inline OpCode GetOpCode() const { return eOp; } - - /** - Dummy methods to avoid switches and casts where possible, - the real token classes have to overload the appropriate method[s]. - The only methods valid anytime if not overloaded are: - - - GetByte() since this represents the count of parameters to a function - which of course is 0 on non-functions. FormulaByteToken and ScExternal do - overload it. - - - HasForceArray() since also this is only used for operators and - functions and is 0 for other tokens. - - Any other non-overloaded method pops up an assertion. - */ - - virtual sal_uInt8 GetByte() const; - virtual void SetByte( sal_uInt8 n ); - virtual bool HasForceArray() const; - virtual void SetForceArray( bool b ); - virtual double GetDouble() const; - virtual double& GetDoubleAsReference(); - virtual const String& GetString() const; - virtual sal_uInt16 GetIndex() const; - virtual void SetIndex( sal_uInt16 n ); - virtual bool IsGlobal() const; - virtual void SetGlobal( bool b ); - virtual short* GetJump() const; - virtual const String& GetExternal() const; - virtual FormulaToken* GetFAPOrigToken() const; - virtual sal_uInt16 GetError() const; - virtual void SetError( sal_uInt16 ); - - virtual FormulaToken* Clone() const { return new FormulaToken(*this); } - - virtual bool Is3DRef() const; // reference with 3D flag set - virtual bool TextEqual( const formula::FormulaToken& rToken ) const; - virtual bool operator==( const FormulaToken& rToken ) const; - - virtual bool isFunction() const - { - return IsFunction(); - } - - virtual sal_uInt32 getArgumentCount() const - { - return GetParamCount(); - } - - /** This is dirty and only the compiler should use it! */ - struct PrivateAccess { friend class FormulaCompiler; private: PrivateAccess() { } }; - inline void NewOpCode( OpCode e, const PrivateAccess& ) { eOp = e; } - - static size_t GetStrLenBytes( xub_StrLen nLen ) - { return nLen * sizeof(sal_Unicode); } - static size_t GetStrLenBytes( const String& rStr ) - { return GetStrLenBytes( rStr.Len() ); } -}; - -inline void intrusive_ptr_add_ref(const FormulaToken* p) -{ - p->IncRef(); -} - -inline void intrusive_ptr_release(const FormulaToken* p) -{ - p->DecRef(); -} - -class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken -{ -private: - sal_uInt8 nByte; - bool bHasForceArray; -protected: - FormulaByteToken( OpCode e, sal_uInt8 n, StackVar v, bool b ) : - FormulaToken( v,e ), nByte( n ), - bHasForceArray( b ) {} -public: - FormulaByteToken( OpCode e, sal_uInt8 n, bool b ) : - FormulaToken( svByte,e ), nByte( n ), - bHasForceArray( b ) {} - FormulaByteToken( OpCode e, sal_uInt8 n ) : - FormulaToken( svByte,e ), nByte( n ), - bHasForceArray( false ) {} - FormulaByteToken( OpCode e ) : - FormulaToken( svByte,e ), nByte( 0 ), - bHasForceArray( false ) {} - FormulaByteToken( const FormulaByteToken& r ) : - FormulaToken( r ), nByte( r.nByte ), - bHasForceArray( r.bHasForceArray ) {} - - virtual FormulaToken* Clone() const { return new FormulaByteToken(*this); } - virtual sal_uInt8 GetByte() const; - virtual void SetByte( sal_uInt8 n ); - virtual bool HasForceArray() const; - virtual void SetForceArray( bool b ); - virtual bool operator==( const FormulaToken& rToken ) const; - - DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaByteToken ) -}; - - -// A special token for the FormulaAutoPilot only. Keeps a reference pointer of -// the token of which it was created for comparison. -class FORMULA_DLLPUBLIC FormulaFAPToken : public FormulaByteToken -{ -private: - FormulaTokenRef pOrigToken; -public: - FormulaFAPToken( OpCode e, sal_uInt8 n, FormulaToken* p ) : - FormulaByteToken( e, n, svFAP, false ), - pOrigToken( p ) {} - FormulaFAPToken( const FormulaFAPToken& r ) : - FormulaByteToken( r ), pOrigToken( r.pOrigToken ) {} - - virtual FormulaToken* Clone() const { return new FormulaFAPToken(*this); } - virtual FormulaToken* GetFAPOrigToken() const; - virtual bool operator==( const FormulaToken& rToken ) const; -}; - -class FORMULA_DLLPUBLIC FormulaDoubleToken : public FormulaToken -{ -private: - double fDouble; -public: - FormulaDoubleToken( double f ) : - FormulaToken( svDouble ), fDouble( f ) {} - FormulaDoubleToken( const FormulaDoubleToken& r ) : - FormulaToken( r ), fDouble( r.fDouble ) {} - - virtual FormulaToken* Clone() const { return new FormulaDoubleToken(*this); } - virtual double GetDouble() const; - virtual double& GetDoubleAsReference(); - virtual bool operator==( const FormulaToken& rToken ) const; - - DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaDoubleToken ) -}; - - -class FORMULA_DLLPUBLIC FormulaStringToken : public FormulaToken -{ -private: - String aString; -public: - FormulaStringToken( const String& r ) : - FormulaToken( svString ), aString( r ) {} - FormulaStringToken( const FormulaStringToken& r ) : - FormulaToken( r ), aString( r.aString ) {} - - virtual FormulaToken* Clone() const { return new FormulaStringToken(*this); } - virtual const String& GetString() const; - virtual bool operator==( const FormulaToken& rToken ) const; - - DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken ) -}; - - -/** Identical to FormulaStringToken, but with explicit OpCode instead of implicit - ocPush, and an optional sal_uInt8 for ocBad tokens. */ -class FORMULA_DLLPUBLIC FormulaStringOpToken : public FormulaByteToken -{ -private: - String aString; -public: - FormulaStringOpToken( OpCode e, const String& r ) : - FormulaByteToken( e, 0, svString, false ), aString( r ) {} - FormulaStringOpToken( const FormulaStringOpToken& r ) : - FormulaByteToken( r ), aString( r.aString ) {} - - virtual FormulaToken* Clone() const { return new FormulaStringOpToken(*this); } - virtual const String& GetString() const; - virtual bool operator==( const FormulaToken& rToken ) const; -}; - -class FORMULA_DLLPUBLIC FormulaIndexToken : public FormulaToken -{ -private: - sal_uInt16 nIndex; - bool mbGlobal; -public: - FormulaIndexToken( OpCode e, sal_uInt16 n, bool bGlobal = true ) : - FormulaToken( svIndex, e ), nIndex( n ), mbGlobal( bGlobal ) {} - FormulaIndexToken( const FormulaIndexToken& r ) : - FormulaToken( r ), nIndex( r.nIndex ), mbGlobal( r.mbGlobal ) {} - - virtual FormulaToken* Clone() const { return new FormulaIndexToken(*this); } - virtual sal_uInt16 GetIndex() const; - virtual void SetIndex( sal_uInt16 n ); - virtual bool IsGlobal() const; - virtual void SetGlobal( bool b ); - virtual bool operator==( const FormulaToken& rToken ) const; -}; - - -class FORMULA_DLLPUBLIC FormulaExternalToken : public FormulaToken -{ -private: - String aExternal; - sal_uInt8 nByte; -public: - FormulaExternalToken( OpCode e, sal_uInt8 n, const String& r ) : - FormulaToken( svExternal, e ), aExternal( r ), - nByte( n ) {} - FormulaExternalToken( OpCode e, const String& r ) : - FormulaToken(svExternal, e ), aExternal( r ), - nByte( 0 ) {} - FormulaExternalToken( const FormulaExternalToken& r ) : - FormulaToken( r ), aExternal( r.aExternal ), - nByte( r.nByte ) {} - - virtual FormulaToken* Clone() const { return new FormulaExternalToken(*this); } - virtual const String& GetExternal() const; - virtual sal_uInt8 GetByte() const; - virtual void SetByte( sal_uInt8 n ); - virtual bool operator==( const FormulaToken& rToken ) const; -}; - - -class FORMULA_DLLPUBLIC FormulaMissingToken : public FormulaToken -{ -public: - FormulaMissingToken() : - FormulaToken( svMissing,ocMissing ) {} - FormulaMissingToken( const FormulaMissingToken& r ) : - FormulaToken( r ) {} - - virtual FormulaToken* Clone() const { return new FormulaMissingToken(*this); } - virtual double GetDouble() const; - virtual const String& GetString() const; - virtual bool operator==( const FormulaToken& rToken ) const; -}; - -class FORMULA_DLLPUBLIC FormulaJumpToken : public FormulaToken -{ -private: - short* pJump; -public: - FormulaJumpToken( OpCode e, short* p ) : - FormulaToken( formula::svJump , e) - { - pJump = new short[ p[0] + 1 ]; - memcpy( pJump, p, (p[0] + 1) * sizeof(short) ); - } - FormulaJumpToken( const FormulaJumpToken& r ) : - FormulaToken( r ) - { - pJump = new short[ r.pJump[0] + 1 ]; - memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) ); - } - virtual ~FormulaJumpToken(); - virtual short* GetJump() const; - virtual bool operator==( const formula::FormulaToken& rToken ) const; - virtual FormulaToken* Clone() const { return new FormulaJumpToken(*this); } -}; - - -class FORMULA_DLLPUBLIC FormulaSubroutineToken : public FormulaToken -{ -public: - /** Takes ownership of pArray and deletes it upon destruction! */ - FormulaSubroutineToken( const FormulaTokenArray* pArray ) : - FormulaToken( svSubroutine, ocCall ), mpArray( pArray) {} - FormulaSubroutineToken( const FormulaSubroutineToken& r ); - virtual ~FormulaSubroutineToken(); - virtual FormulaToken* Clone() const { return new FormulaSubroutineToken(*this); } - virtual bool operator==( const FormulaToken& rToken ) const; - -private: - const FormulaTokenArray* mpArray; -}; - - -class FORMULA_DLLPUBLIC FormulaUnknownToken : public FormulaToken -{ -public: - FormulaUnknownToken( OpCode e ) : - FormulaToken( svUnknown, e ) {} - FormulaUnknownToken( const FormulaUnknownToken& r ) : - FormulaToken( r ) {} - - virtual FormulaToken* Clone() const { return new FormulaUnknownToken(*this); } - virtual bool operator==( const FormulaToken& rToken ) const; -}; - - -class FORMULA_DLLPUBLIC FormulaErrorToken : public FormulaToken -{ - sal_uInt16 nError; -public: - FormulaErrorToken( sal_uInt16 nErr ) : - FormulaToken( svError ), nError( nErr) {} - FormulaErrorToken( const FormulaErrorToken& r ) : - FormulaToken( r ), nError( r.nError) {} - - virtual FormulaToken* Clone() const { return new FormulaErrorToken(*this); } - virtual sal_uInt16 GetError() const; - virtual void SetError( sal_uInt16 nErr ); - virtual bool operator==( const FormulaToken& rToken ) const; -}; - -// ============================================================================= -} // formula -// ============================================================================= - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx deleted file mode 100644 index 875b055a621a..000000000000 --- a/formula/inc/formula/tokenarray.hxx +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef FORMULA_TOKENARRAY_HXX -#define FORMULA_TOKENARRAY_HXX - -#include -#include "formula/token.hxx" -#include "formula/ExternalReferenceHelper.hxx" -#include -#include - -namespace formula -{ - -// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode... - -typedef sal_uInt8 ScRecalcMode; -// Only one of the exclusive bits can be set, -// handled by TokenArray SetRecalcMode... methods -#define RECALCMODE_NORMAL 0x01 // exclusive -#define RECALCMODE_ALWAYS 0x02 // exclusive, always -#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load -#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load -#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible -#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved -#define RECALCMODE_EMASK 0x0F // mask of exclusive bits -// If new bits are to be defined, AddRecalcMode has to be adjusted! - -class FormulaMissingContext; - -class FORMULA_DLLPUBLIC MissingConvention -{ - bool mbODFF; /// TRUE: ODFF, FALSE: PODF -public: - explicit MissingConvention( bool bODFF ) : mbODFF(bODFF) {} - // Implementation and usage only in token.cxx - inline bool isRewriteNeeded( OpCode eOp ) const; - inline bool isODFF() const { return mbODFF; } -}; - -class FORMULA_DLLPUBLIC FormulaTokenArray -{ - friend class FormulaCompiler; - friend class FormulaTokenIterator; - friend class FormulaMissingContext; - -protected: - FormulaToken** pCode; // Token code array - FormulaToken** pRPN; // RPN array - sal_uInt16 nLen; // Length of token array - sal_uInt16 nRPN; // Length of RPN array - sal_uInt16 nIndex; // Current step index - sal_uInt16 nError; // Error code - short nRefs; // Count of cell references - ScRecalcMode nMode; // Flags to indicate when to recalc this code - bool bHyperLink; // If HYPERLINK() occurs in the formula. - -protected: - void Assign( const FormulaTokenArray& ); - - /// Also used by the compiler. The token MUST had been allocated with new! - FormulaToken* Add( FormulaToken* ); - inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits ) - { nMode |= (nBits & ~RECALCMODE_EMASK); } - inline ScRecalcMode GetCombinedBitsRecalcMode() const - { return nMode & ~RECALCMODE_EMASK; } - /** Exclusive bits already set in nMode are - zero'ed, nBits may contain combined bits, but - only one exclusive bit may be set! */ - inline void SetMaskedRecalcMode( ScRecalcMode nBits ) - { nMode = GetCombinedBitsRecalcMode() | nBits; } - -public: - FormulaTokenArray(); - /// Assignment with references to FormulaToken entries (not copied!) - FormulaTokenArray( const FormulaTokenArray& ); - virtual ~FormulaTokenArray(); - FormulaTokenArray* Clone() const; /// True copy! - - void Clear(); - void DelRPN(); - FormulaToken* First() { nIndex = 0; return Next(); } - FormulaToken* Next(); - FormulaToken* FirstNoSpaces() { nIndex = 0; return NextNoSpaces(); } - FormulaToken* NextNoSpaces(); - FormulaToken* GetNextName(); - FormulaToken* GetNextReference(); - FormulaToken* GetNextReferenceRPN(); - FormulaToken* GetNextReferenceOrName(); - FormulaToken* GetNextColRowName(); - FormulaToken* GetNextOpCodeRPN( OpCode ); - /// Peek at nIdx-1 if not out of bounds, decrements nIdx if successful. Returns NULL if not. - FormulaToken* PeekPrev( sal_uInt16 & nIdx ); - FormulaToken* PeekNext(); - FormulaToken* PeekPrevNoSpaces(); /// Only after Reset/First/Next/Last/Prev! - FormulaToken* PeekNextNoSpaces(); /// Only after Reset/First/Next/Last/Prev! - FormulaToken* FirstRPN() { nIndex = 0; return NextRPN(); } - FormulaToken* NextRPN(); - FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); } - FormulaToken* PrevRPN(); - - bool HasExternalRef() const; - bool HasOpCode( OpCode ) const; - bool HasOpCodeRPN( OpCode ) const; - /// Token of type svIndex or opcode ocColRowName - bool HasNameOrColRowName() const; - - FormulaToken** GetArray() const { return pCode; } - FormulaToken** GetCode() const { return pRPN; } - sal_uInt16 GetLen() const { return nLen; } - sal_uInt16 GetCodeLen() const { return nRPN; } - void Reset() { nIndex = 0; } - sal_uInt16 GetCodeError() const { return nError; } - void SetCodeError( sal_uInt16 n ) { nError = n; } - short GetRefs() const { return nRefs; } - void IncrementRefs() { ++nRefs; } - void SetHyperLink( bool bVal ) { bHyperLink = bVal; } - bool IsHyperLink() const { return bHyperLink; } - - inline ScRecalcMode GetRecalcMode() const { return nMode; } - /** Bits aren't set directly but validated and - maybe handled according to priority if more - than one exclusive bit was set. */ - void AddRecalcMode( ScRecalcMode nBits ); - - inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; } - inline void SetExclusiveRecalcModeNormal() - { SetMaskedRecalcMode( RECALCMODE_NORMAL ); } - inline void SetExclusiveRecalcModeAlways() - { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); } - inline void SetExclusiveRecalcModeOnLoad() - { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); } - inline void SetExclusiveRecalcModeOnLoadOnce() - { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); } - inline void SetRecalcModeForced() - { nMode |= RECALCMODE_FORCED; } - inline void ClearRecalcModeForced() - { nMode &= ~RECALCMODE_FORCED; } - inline void SetRecalcModeOnRefMove() - { nMode |= RECALCMODE_ONREFMOVE; } - inline void ClearRecalcModeOnRefMove() - { nMode &= ~RECALCMODE_ONREFMOVE; } - inline bool IsRecalcModeNormal() const - { return (nMode & RECALCMODE_NORMAL) != 0; } - inline bool IsRecalcModeAlways() const - { return (nMode & RECALCMODE_ALWAYS) != 0; } - inline bool IsRecalcModeOnLoad() const - { return (nMode & RECALCMODE_ONLOAD) != 0; } - inline bool IsRecalcModeOnLoadOnce() const - { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; } - inline bool IsRecalcModeForced() const - { return (nMode & RECALCMODE_FORCED) != 0; } - inline bool IsRecalcModeOnRefMove() const - { return (nMode & RECALCMODE_ONREFMOVE) != 0; } - - /** Get OpCode of the most outer function */ - inline OpCode GetOuterFuncOpCode(); - - /** Operators +,-,*,/,^,&,=,<>,<,>,<=,>= - with DoubleRef in Formula? */ - bool HasMatrixDoubleRefOps(); - - virtual FormulaToken* AddOpCode(OpCode e); - - /** Adds the single token to array. - Derived classes must overload it when they want to support derived classes from FormulaToken. - @return true when an error occurs - */ - virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken, ExternalReferenceHelper* _pRef = NULL); - - /** fill the array with the tokens from the sequence. - It calls AddFormulaToken for each token in the list. - @param _aSequence the token to add - @return true when an error occurs - */ - bool Fill(const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& _aSequence, ExternalReferenceHelper* _pRef = NULL); - - /** - * Do some checking based on the individual tokens. For now, we use this - * only to check whether we can vectorize the token array. - */ - virtual void CheckToken( const FormulaToken& t ); - - FormulaToken* AddToken( const FormulaToken& ); - FormulaToken* AddString( const sal_Unicode* pStr ); - FormulaToken* AddString( const String& rStr ); - FormulaToken* AddDouble( double fVal ); - FormulaToken* AddExternal( const sal_Unicode* pStr ); - /** Xcl import may play dirty tricks with OpCode!=ocExternal. - Others don't use! */ - FormulaToken* AddExternal( const String& rStr, OpCode eOp = ocExternal ); - FormulaToken* AddBad( const String& rStr ); /// ocBad with String - FormulaToken* AddStringXML( const String& rStr ); /// ocStringXML with String, temporary during import - - virtual FormulaToken* MergeArray( ); - - /// Assignment with references to FormulaToken entries (not copied!) - FormulaTokenArray& operator=( const FormulaTokenArray& ); - - /** Determines if this formula needs any changes to convert it to something - previous versions of OOo could consume (Plain Old Formula). */ - bool NeedsPofRewrite(const MissingConvention & rConv); - - /** Rewrites to Plain Old Formula, substituting missing parameters. The - FormulaTokenArray* returned is new'ed. */ - FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv); - - /** Determines if this formula may be followed by a reference. */ - bool MayReferenceFollow(); -}; - -inline OpCode FormulaTokenArray::GetOuterFuncOpCode() -{ - if ( pRPN && nRPN ) - return pRPN[nRPN-1]->GetOpCode(); - return ocNone; -} - -struct ImpTokenIterator -{ - ImpTokenIterator* pNext; - const FormulaTokenArray* pArr; - short nPC; - short nStop; - - DECL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator ); -}; - -class FORMULA_DLLPUBLIC FormulaTokenIterator -{ - ImpTokenIterator* pCur; - -public: - FormulaTokenIterator( const FormulaTokenArray& ); - ~FormulaTokenIterator(); - void Reset(); - const FormulaToken* Next(); - const FormulaToken* PeekNextOperator(); - bool IsEndOfPath() const; /// if a jump or subroutine path is done - bool HasStacked() const { return pCur->pNext != 0; } - short GetPC() const { return pCur->nPC; } - - /** Jump or subroutine call. - Program counter values will be incremented before code is executed => - positions are to be passed with -1 offset. - @param nStart - Start on code at position nStart+1 (yes, pass with offset -1) - @param nNext - After subroutine continue with instruction at position nNext+1 - @param nStop - Stop before reaching code at position nStop. If not specified the - default is to either run the entire code, or to stop if an ocSep or - ocClose is encountered, which are only present in ocIf or ocChose - jumps. - */ - void Jump( short nStart, short nNext, short nStop = SHRT_MAX ); - void Push( const FormulaTokenArray* ); - void Pop(); - -private: - const FormulaToken* GetNonEndOfPathToken( short nIdx ) const; -}; -// ============================================================================= -} // formula -// ============================================================================= - - -#endif // FORMULA_TOKENARRAY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit