Use o3tl::convert in Math
[LibreOffice.git] / reportdesign / source / ui / inc / Formula.hxx
blob8ec93075b5b02e4b8271d107e953714dc1d01171
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
23 #include <formula/formula.hxx>
24 #include <formula/IControlReferenceHandler.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/report/meta/XFormulaParser.hpp>
27 #include <memory>
29 namespace com::sun::star::lang {
30 class XMultiServiceFactory;
33 namespace svl {
35 class SharedStringPool;
39 namespace rptui
42 class OAddFieldWindow;
45 class FormulaDialog : public formula::FormulaModalDialog,
46 public formula::IControlReferenceHandler
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;
54 formula::RefEdit* m_pEdit;
55 OUString m_sFormula;
56 sal_Int32 m_nStart;
57 sal_Int32 m_nEnd;
59 svl::SharedStringPool& mrStringPool;
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 );
70 virtual ~FormulaDialog() override;
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;
92 virtual formula::IFunctionManager* getFunctionManager() override;
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;
97 virtual ::std::unique_ptr<formula::FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) override;
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;
107 } // rptui
110 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */