LibreOffice Module reportdesign (master)  1
Formula.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
22 
23 #include <formula/formula.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/report/meta/XFormulaParser.hpp>
27 #include <memory>
28 
29 namespace com::sun::star::lang {
30  class XMultiServiceFactory;
31 }
32 
33 namespace svl {
34 
35 class SharedStringPool;
36 
37 }
38 
39 namespace rptui
40 {
41 
42 class OAddFieldWindow;
43 
44 
47 {
48  std::shared_ptr<formula::IFunctionManager> m_aFunctionManager;
49  std::unique_ptr<formula::FormEditData> m_xFormulaData;
50  std::shared_ptr<OAddFieldWindow> m_xAddField;
51  css::uno::Reference < css::beans::XPropertySet > m_xRowSet;
52  css::uno::Reference< css::report::meta::XFormulaParser> m_xParser;
53  css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
55  OUString m_sFormula;
56  sal_Int32 m_nStart;
57  sal_Int32 m_nEnd;
58 
60 
61  DECL_LINK( OnClickHdl, OAddFieldWindow&, void );
62 public:
63  FormulaDialog( weld::Window* pParent
64  , const css::uno::Reference< css::lang::XMultiServiceFactory>& _xServiceFactory
65  , const std::shared_ptr< formula::IFunctionManager >& _pFunctionMgr
66  , const OUString& _sFormula
67  , const css::uno::Reference < css::beans::XPropertySet >& _xRowSet
68  , svl::SharedStringPool& rStrPool );
69 
70  virtual ~FormulaDialog() override;
71 
72  // IFormulaEditorHelper
73  virtual void notifyChange() override;
74  virtual void fill() override;
75  virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) override;
76  virtual std::shared_ptr<formula::FormulaCompiler> getCompiler() const override;
77  virtual std::unique_ptr<formula::FormulaCompiler> createCompiler( formula::FormulaTokenArray& rArray ) const override;
78  virtual void doClose(bool _bOk) override;
79  virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc) override;
80  virtual void showReference(const OUString& _sFormula) override;
81  virtual void dispatch(bool _bOK, bool _bMatrixChecked) override;
82  virtual void setDispatcherLock( bool bLock ) override;
83  virtual void deleteFormData() override;
84  virtual void clear() override;
85  virtual void switchBack() override;
86  virtual formula::FormEditData* getFormEditData() const override;
87  virtual void setCurrentFormula(const OUString& _sReplacement) override;
88  virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override;
89  virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const override;
90  virtual OUString getCurrentFormula() const override;
91 
93  virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const override;
94  virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const override;
95  virtual css::table::CellAddress getReferencePosition() const override;
96 
97  virtual ::std::unique_ptr<formula::FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) override;
98 
99  // IControlReferenceHandler
100  virtual void ShowReference(const OUString& _sRef) override;
101  virtual void HideReference( bool bDoneRefMode = true ) override;
102  virtual void ReleaseFocus( formula::RefEdit* pEdit ) override;
103  virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) override;
104 };
105 
106 
107 } // rptui
108 
109 
110 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
111 
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void HideReference(bool bDoneRefMode=true) override
Definition: Formula.cxx:191
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: Formula.cxx:195
virtual formula::FormEditData * getFormEditData() const override
Definition: Formula.cxx:146
std::shared_ptr< OAddFieldWindow > m_xAddField
Definition: Formula.hxx:50
virtual OUString getCurrentFormula() const override
Definition: Formula.cxx:178
sal_uInt16 char char * pDesc
virtual void getSelection(sal_Int32 &_nStart, sal_Int32 &_nEnd) const override
Definition: Formula.cxx:173
virtual void clear() override
Definition: Formula.cxx:140
virtual formula::IFunctionManager * getFunctionManager() override
Definition: Formula.cxx:182
virtual void setCurrentFormula(const OUString &_sReplacement) override
Definition: Formula.cxx:150
virtual std::unique_ptr< formula::FormulaCompiler > createCompiler(formula::FormulaTokenArray &rArray) const override
Definition: Formula.cxx:115
formula::RefEdit * m_pEdit
Definition: Formula.hxx:54
svl::SharedStringPool & mrStringPool
Definition: Formula.hxx:59
FormulaDialog(weld::Window *pParent, const css::uno::Reference< css::lang::XMultiServiceFactory > &_xServiceFactory, const std::shared_ptr< formula::IFunctionManager > &_pFunctionMgr, const OUString &_sFormula, const css::uno::Reference< css::beans::XPropertySet > &_xRowSet, svl::SharedStringPool &rStrPool)
Definition: Formula.cxx:44
virtual ::std::unique_ptr< formula::FormulaTokenArray > convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken > &_aTokenList) override
Definition: Formula.cxx:265
virtual void ShowReference(const OUString &_sRef) override
Definition: Formula.cxx:187
css::uno::Reference< css::sheet::XFormulaOpCodeMapper > m_xOpCodeMapper
Definition: Formula.hxx:53
virtual void fill() override
Definition: Formula.cxx:77
css::uno::Reference< css::beans::XPropertySet > m_xRowSet
Definition: Formula.hxx:51
virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper > getFormulaOpCodeMapper() const override
Definition: Formula.cxx:255
virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override
Definition: Formula.cxx:160
virtual css::table::CellAddress getReferencePosition() const override
Definition: Formula.cxx:260
virtual void deleteFormData() override
Definition: Formula.cxx:137
OUString m_sFormula
Definition: Formula.hxx:55
css::uno::Reference< css::report::meta::XFormulaParser > m_xParser
Definition: Formula.hxx:52
virtual css::uno::Reference< css::sheet::XFormulaParser > getFormulaParser() const override
Definition: Formula.cxx:250
sal_Int32 m_nEnd
Definition: Formula.hxx:57
virtual void switchBack() override
Definition: Formula.cxx:143
virtual void setDispatcherLock(bool bLock) override
Definition: Formula.cxx:134
std::unique_ptr< formula::FormEditData > m_xFormulaData
Definition: Formula.hxx:49
virtual void showReference(const OUString &_sFormula) override
Definition: Formula.cxx:128
DECL_LINK(OnClickHdl, OAddFieldWindow &, void)
virtual std::shared_ptr< formula::FormulaCompiler > getCompiler() const override
Definition: Formula.cxx:110
virtual void doClose(bool _bOk) override
Definition: Formula.cxx:120
virtual void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton) override
Definition: Formula.cxx:199
virtual void notifyChange() override
Definition: Formula.cxx:73
virtual void insertEntryToLRUList(const formula::IFunctionDescription *pDesc) override
Definition: Formula.cxx:125
virtual ~FormulaDialog() override
Definition: Formula.cxx:85
sal_Int32 m_nStart
Definition: Formula.hxx:56
virtual void dispatch(bool _bOK, bool _bMatrixChecked) override
Definition: Formula.cxx:131
virtual bool calculateValue(const OUString &_sExpression, OUString &_rResult, bool bMatrixFormula) override
Definition: Formula.cxx:104
std::shared_ptr< formula::IFunctionManager > m_aFunctionManager
Definition: Formula.hxx:48