sync master with lastest vba changes
[ooovba.git] / reportdesign / source / ui / inc / Formula.hxx
blob15fcdde7bf12b82c1e46a78f39cac6764aa2af47
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formula.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef RPTUI_FORMULA_HXX
32 #define RPTUI_FORMULA_HXX
34 #include <formula/formula.hxx>
35 #include <formula/IFunctionDescription.hxx>
36 #include <formula/IControlReferenceHandler.hxx>
37 #include <boost/shared_ptr.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/report/meta/XFormulaParser.hpp>
41 class SvLBoxEntry;
42 //============================================================================
43 namespace rptui
45 //============================================================================
46 class FunctionManager;
47 class OAddFieldWindow;
49 //============================================================================
50 class FormulaDialog : public formula::FormulaModalDialog,
51 public formula::IFormulaEditorHelper,
52 public formula::IControlReferenceHandler
54 ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager;
55 formula::FormEditData* m_pFormulaData;
56 OAddFieldWindow* m_pAddField;
57 ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet;
58 ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser;
59 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
60 formula::RefEdit* m_pEdit;
61 String m_sFormula;
62 xub_StrLen m_nStart;
63 xub_StrLen m_nEnd;
65 DECL_LINK( OnClickHdl, OAddFieldWindow*);
66 public:
67 FormulaDialog( Window* pParent
68 , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xServiceFactory
69 , const ::boost::shared_ptr< formula::IFunctionManager >& _pFunctionMgr
70 , const ::rtl::OUString& _sFormula
71 , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet);
72 virtual ~FormulaDialog();
74 // IFormulaEditorHelper
75 virtual void notifyChange();
76 virtual void fill();
77 virtual bool calculateValue(const String& _sExpression,String& _rResult);
78 virtual void doClose(BOOL _bOk);
79 virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc);
80 virtual void showReference(const String& _sFormula);
81 virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked);
82 virtual void setDispatcherLock( BOOL bLock );
83 virtual void setReferenceInput(const formula::FormEditData* _pData);
84 virtual void deleteFormData();
85 virtual void clear();
86 virtual void switchBack();
87 virtual formula::FormEditData* getFormEditData() const;
88 virtual void setCurrentFormula(const String& _sReplacement);
89 virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd);
90 virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const;
91 virtual String getCurrentFormula() const;
93 virtual formula::IFunctionManager* getFunctionManager();
94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
95 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
97 virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
99 // IControlReferenceHandler
100 virtual void ShowReference(const String& _sRef);
101 virtual void HideReference( BOOL bDoneRefMode = TRUE );
102 virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
103 virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
105 protected:
106 void HighlightFunctionParas(const String& aFormula);
109 // =============================================================================
110 } // rptui
111 // =============================================================================
113 #endif // RPTUI_FORMULA_HXX