LibreOffice Module sc (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_SC_SOURCE_UI_INC_FORMULA_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_FORMULA_HXX
22 
23 #include <memory>
24 #include "anyrefdg.hxx"
25 
26 #include <scmod.hxx>
27 #include <formula/formula.hxx>
28 #include "IAnyRefDialog.hxx"
29 
30 class ScViewData;
31 class ScDocument;
32 class ScFuncDesc;
33 class ScInputHandler;
34 class ScDocShell;
35 
36 class ScFormulaDlg final : public formula::FormulaDlg,
37  public IAnyRefDialog
38 {
40  css::uno::Reference< css::sheet::XFormulaParser> m_xParser;
41  css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
42 
46  mutable std::shared_ptr<ScCompiler> m_xCompiler;
47 
48 public:
50  weld::Window* pParent, const ScViewData& rViewData, const formula::IFunctionManager* _pFunctionMgr);
51  virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override;
52 
53  // IFormulaEditorHelper
54  virtual void notifyChange() override;
55  virtual void fill() override;
56  virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) override;
57  virtual std::shared_ptr<formula::FormulaCompiler> getCompiler() const override;
58  virtual std::unique_ptr<formula::FormulaCompiler> createCompiler( formula::FormulaTokenArray& rArray ) const override;
59  virtual void doClose(bool _bOk) override;
60  virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc) override;
61  virtual void showReference(const OUString& _sFormula) override;
62  virtual void dispatch(bool _bOK, bool _bMatrixChecked) override;
63  virtual void setDispatcherLock( bool bLock ) override;
64  virtual void deleteFormData() override;
65  virtual void clear() override;
66  virtual void switchBack() override;
67  virtual formula::FormEditData* getFormEditData() const override;
68  virtual void setCurrentFormula(const OUString& _sReplacement) override;
69  virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override;
70  virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const override;
71  virtual OUString getCurrentFormula() const override;
72 
73  virtual formula::IFunctionManager* getFunctionManager() override;
74  virtual ::std::unique_ptr<formula::FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) override;
75  virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const override;
76  virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const override;
77  virtual css::table::CellAddress getReferencePosition() const override;
78 
79  virtual void Close() override;
80 
81  // sc::IAnyRefDialog
82  virtual void ShowReference(const OUString& _sRef) override;
83  virtual void HideReference( bool bDoneRefMode = true ) override;
84  virtual void SetReference( const ScRange& rRef, ScDocument& rD ) override;
85 
86  virtual void ReleaseFocus( formula::RefEdit* pEdit ) override;
87  virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) override;
88  virtual void RefInputDone( bool bForced = false ) override;
89  virtual bool IsTableLocked() const override;
90  virtual bool IsRefInputMode() const override;
91 
92  virtual bool IsDocAllowed( SfxObjectShell* pDocSh ) const override;
93  virtual void AddRefEntry() override;
94  virtual void SetActive() override;
95  virtual void ViewShellChanged() override;
96 
97 private:
98  virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override;
99  static void SaveLRUEntry(const ScFuncDesc* pFuncDesc);
100 
101  static bool IsInputHdl(const ScInputHandler* pHdl);
102  static ScInputHandler* GetNextInputHandler(const ScDocShell* pDocShell, ScTabViewShell** ppViewSh);
103 };
104 
105 #endif // INCLUDED_SC_SOURCE_UI_INC_FORMULA_HXX
106 
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool IsInputHdl(const ScInputHandler *pHdl)
Definition: formula.cxx:250
virtual void switchBack() override
Definition: formula.cxx:595
virtual bool IsTableLocked() const override
Definition: formula.cxx:538
sal_uInt16 char char * pDesc
Definition: callform.cxx:57
virtual void clear() override
Definition: formula.cxx:582
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: formula.cxx:381
virtual bool calculateValue(const OUString &_sExpression, OUString &_rResult, bool bMatrixFormula) override
Definition: formula.cxx:298
virtual css::uno::Reference< css::sheet::XFormulaParser > getFormulaParser() const override
Definition: formula.cxx:672
virtual ::std::unique_ptr< formula::FormulaTokenArray > convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken > &_aTokenList) override
Definition: formula.cxx:686
virtual void SetReference(const ScRange &rRef, ScDocument &rD) override
Definition: formula.cxx:395
virtual void getSelection(sal_Int32 &_nStart, sal_Int32 &_nEnd) const override
Definition: formula.cxx:656
virtual void setCurrentFormula(const OUString &_sReplacement) override
Definition: formula.cxx:629
virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override
Definition: formula.cxx:651
virtual void AddRefEntry() override
Definition: formula.cxx:534
static ScInputHandler * GetNextInputHandler(const ScDocShell *pDocShell, ScTabViewShell **ppViewSh)
Definition: formula.cxx:268
virtual void SetActive() override
Definition: formula.cxx:490
virtual void setDispatcherLock(bool bLock) override
Definition: formula.cxx:573
ScFormulaDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const ScViewData &rViewData, const formula::IFunctionManager *_pFunctionMgr)
Definition: formula.cxx:59
virtual void notifyChange() override
Definition: formula.cxx:180
virtual css::table::CellAddress getReferencePosition() const override
Definition: formula.cxx:681
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: formula.cxx:549
ScAddress m_CursorPos
Definition: formula.hxx:44
virtual formula::FormEditData * getFormEditData() const override
Definition: formula.cxx:622
virtual bool IsRefInputMode() const override
Definition: formula.cxx:476
virtual void insertEntryToLRUList(const formula::IFunctionDescription *pDesc) override
Definition: formula.cxx:513
virtual void deleteFormData() override
Definition: formula.cxx:577
virtual void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton) override
Definition: formula.cxx:544
ScFormulaReferenceHelper m_aHelper
Definition: formula.hxx:39
ScTabViewShell * m_pViewShell
Definition: formula.hxx:45
virtual std::unique_ptr< formula::FormulaCompiler > createCompiler(formula::FormulaTokenArray &rArray) const override
Definition: formula.cxx:370
static void SaveLRUEntry(const ScFuncDesc *pFuncDesc)
Definition: formula.cxx:500
virtual void Close() override
Definition: formula.cxx:288
virtual void ViewShellChanged() override
Definition: formula.cxx:530
css::uno::Reference< css::sheet::XFormulaParser > m_xParser
Definition: formula.hxx:40
virtual formula::IFunctionManager * getFunctionManager() override
Definition: formula.cxx:668
std::shared_ptr< ScCompiler > m_xCompiler
Definition: formula.hxx:46
virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override
Definition: formula.cxx:234
virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper > getFormulaOpCodeMapper() const override
Definition: formula.cxx:676
virtual void doClose(bool _bOk) override
Definition: formula.cxx:509
virtual void ShowReference(const OUString &_sRef) override
Definition: formula.cxx:522
virtual OUString getCurrentFormula() const override
Definition: formula.cxx:661
ScDocument * m_pDoc
Definition: formula.hxx:43
virtual void HideReference(bool bDoneRefMode=true) override
Definition: formula.cxx:526
virtual void dispatch(bool _bOK, bool _bMatrixChecked) override
Definition: formula.cxx:554
virtual void showReference(const OUString &_sFormula) override
Definition: formula.cxx:518
virtual bool IsDocAllowed(SfxObjectShell *pDocSh) const override
Definition: formula.cxx:483
virtual std::shared_ptr< formula::FormulaCompiler > getCompiler() const override
Definition: formula.cxx:363
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
Definition: funcdesc.hxx:41
virtual void RefInputDone(bool bForced=false) override
Definition: formula.cxx:389
virtual void fill() override
Definition: formula.cxx:187
css::uno::Reference< css::sheet::XFormulaOpCodeMapper > m_xOpCodeMapper
Definition: formula.hxx:41