1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef RPTUI_FORMULA_HXX
21 #define RPTUI_FORMULA_HXX
23 #include <formula/formula.hxx>
24 #include <formula/IControlReferenceHandler.hxx>
25 #include <boost/shared_ptr.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/report/meta/XFormulaParser.hpp>
29 namespace com
{ namespace sun
{ namespace star
{ namespace lang
{
30 class XMultiServiceFactory
;
33 //============================================================================
36 //============================================================================
37 class OAddFieldWindow
;
39 //============================================================================
40 class FormulaDialog
: public formula::FormulaModalDialog
,
41 public formula::IControlReferenceHandler
43 ::boost::shared_ptr
< formula::IFunctionManager
> m_aFunctionManager
;
44 formula::FormEditData
* m_pFormulaData
;
45 OAddFieldWindow
* m_pAddField
;
46 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xRowSet
;
47 ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFormulaParser
> m_xParser
;
48 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaOpCodeMapper
> m_xOpCodeMapper
;
49 formula::RefEdit
* m_pEdit
;
54 DECL_LINK( OnClickHdl
, OAddFieldWindow
*);
56 FormulaDialog( Window
* pParent
57 , const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _xServiceFactory
58 , const ::boost::shared_ptr
< formula::IFunctionManager
>& _pFunctionMgr
59 , const OUString
& _sFormula
60 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xRowSet
);
61 virtual ~FormulaDialog();
63 // IFormulaEditorHelper
64 virtual void notifyChange();
66 virtual bool calculateValue(const String
& _sExpression
,String
& _rResult
);
67 virtual void doClose(sal_Bool _bOk
);
68 virtual void insertEntryToLRUList(const formula::IFunctionDescription
* pDesc
);
69 virtual void showReference(const String
& _sFormula
);
70 virtual void dispatch(sal_Bool _bOK
,sal_Bool _bMartixChecked
);
71 virtual void setDispatcherLock( sal_Bool bLock
);
72 virtual void setReferenceInput(const formula::FormEditData
* _pData
);
73 virtual void deleteFormData();
75 virtual void switchBack();
76 virtual formula::FormEditData
* getFormEditData() const;
77 virtual void setCurrentFormula(const String
& _sReplacement
);
78 virtual void setSelection(xub_StrLen _nStart
,xub_StrLen _nEnd
);
79 virtual void getSelection(xub_StrLen
& _nStart
,xub_StrLen
& _nEnd
) const;
80 virtual String
getCurrentFormula() const;
82 virtual formula::IFunctionManager
* getFunctionManager();
83 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaParser
> getFormulaParser() const;
84 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaOpCodeMapper
> getFormulaOpCodeMapper() const;
85 virtual ::com::sun::star::table::CellAddress
getReferencePosition() const;
87 virtual ::std::auto_ptr
<formula::FormulaTokenArray
> convertToTokenArray(const ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FormulaToken
>& _aTokenList
);
89 // IControlReferenceHandler
90 virtual void ShowReference(const String
& _sRef
);
91 virtual void HideReference( sal_Bool bDoneRefMode
= sal_True
);
92 virtual void ReleaseFocus( formula::RefEdit
* pEdit
, formula::RefButton
* pButton
= NULL
);
93 virtual void ToggleCollapsed( formula::RefEdit
* pEdit
, formula::RefButton
* pButton
= NULL
);
96 void HighlightFunctionParas(const String
& aFormula
);
99 // =============================================================================
101 // =============================================================================
103 #endif // RPTUI_FORMULA_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */