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#pragma once
21
22#include <memory>
23#include "anyrefdg.hxx"
24
25#include <scmod.hxx>
26#include <formula/formula.hxx>
27#include "IAnyRefDialog.hxx"
28
29class ScViewData;
30class ScDocument;
31class ScFuncDesc;
32class ScInputHandler;
33class ScDocShell;
34
35class ScFormulaDlg final : public formula::FormulaDlg,
36 public IAnyRefDialog
37{
39 css::uno::Reference< css::sheet::XFormulaParser> m_xParser;
40 css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
41
45 mutable std::shared_ptr<ScCompiler> m_xCompiler;
46
47public:
49 weld::Window* pParent, const ScViewData& rViewData, const formula::IFunctionManager* _pFunctionMgr);
50 virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override;
51
52 // IFormulaEditorHelper
53 virtual void notifyChange() override;
54 virtual void fill() override;
55 virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) override;
56 virtual std::shared_ptr<formula::FormulaCompiler> getCompiler() const override;
57 virtual std::unique_ptr<formula::FormulaCompiler> createCompiler( formula::FormulaTokenArray& rArray ) const override;
58 virtual void doClose(bool _bOk) override;
59 virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc) override;
60 virtual void showReference(const OUString& _sFormula) override;
61 virtual void dispatch(bool _bOK, bool _bMatrixChecked) override;
62 virtual void setDispatcherLock( bool bLock ) override;
63 virtual void deleteFormData() override;
64 virtual void clear() override;
65 virtual void switchBack() override;
66 virtual formula::FormEditData* getFormEditData() const override;
67 virtual void setCurrentFormula(const OUString& _sReplacement) override;
68 virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override;
69 virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const override;
70 virtual OUString getCurrentFormula() const override;
71
72 virtual formula::IFunctionManager* getFunctionManager() override;
73 virtual ::std::unique_ptr<formula::FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) override;
74 virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const override;
75 virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const override;
76 virtual css::table::CellAddress getReferencePosition() const override;
77
78 virtual void Close() override;
79
80 // sc::IAnyRefDialog
81 virtual void ShowReference(const OUString& _sRef) override;
82 virtual void HideReference( bool bDoneRefMode = true ) override;
83 virtual void SetReference( const ScRange& rRef, ScDocument& rD ) override;
84
85 virtual void ReleaseFocus( formula::RefEdit* pEdit ) override;
86 virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) override;
87 virtual void RefInputDone( bool bForced = false ) override;
88 virtual bool IsTableLocked() const override;
89 virtual bool IsRefInputMode() const override;
90
91 virtual bool IsDocAllowed( SfxObjectShell* pDocSh ) const override;
92 virtual void AddRefEntry() override;
93 virtual void SetActive() override;
94 virtual void ViewShellChanged() override;
95
96private:
97 virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override;
98 static void SaveLRUEntry(const ScFuncDesc* pFuncDesc);
99
100 static bool IsInputHdl(const ScInputHandler* pHdl);
101 static ScInputHandler* GetNextInputHandler(const ScDocShell* pDocShell, ScTabViewShell** ppViewSh);
102};
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void deleteFormData() override
Definition: formula.cxx:575
ScTabViewShell * m_pViewShell
Definition: formula.hxx:44
virtual void notifyChange() override
Definition: formula.cxx:179
virtual void setDispatcherLock(bool bLock) override
Definition: formula.cxx:571
ScFormulaDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const ScViewData &rViewData, const formula::IFunctionManager *_pFunctionMgr)
Definition: formula.cxx:59
virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper > getFormulaOpCodeMapper() const override
Definition: formula.cxx:674
virtual css::uno::Reference< css::sheet::XFormulaParser > getFormulaParser() const override
Definition: formula.cxx:670
virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override
Definition: formula.cxx:233
virtual formula::FormEditData * getFormEditData() const override
Definition: formula.cxx:620
virtual void HideReference(bool bDoneRefMode=true) override
Definition: formula.cxx:524
virtual void fill() override
Definition: formula.cxx:186
virtual std::shared_ptr< formula::FormulaCompiler > getCompiler() const override
Definition: formula.cxx:361
virtual void insertEntryToLRUList(const formula::IFunctionDescription *pDesc) override
Definition: formula.cxx:511
virtual bool calculateValue(const OUString &_sExpression, OUString &_rResult, bool bMatrixFormula) override
Definition: formula.cxx:297
virtual void switchBack() override
Definition: formula.cxx:593
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: formula.cxx:547
virtual formula::IFunctionManager * getFunctionManager() override
Definition: formula.cxx:666
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: formula.cxx:379
css::uno::Reference< css::sheet::XFormulaOpCodeMapper > m_xOpCodeMapper
Definition: formula.hxx:40
static void SaveLRUEntry(const ScFuncDesc *pFuncDesc)
Definition: formula.cxx:498
virtual void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton) override
Definition: formula.cxx:542
virtual void getSelection(sal_Int32 &_nStart, sal_Int32 &_nEnd) const override
Definition: formula.cxx:654
virtual void ShowReference(const OUString &_sRef) override
Definition: formula.cxx:520
virtual void SetReference(const ScRange &rRef, ScDocument &rD) override
Definition: formula.cxx:393
virtual OUString getCurrentFormula() const override
Definition: formula.cxx:659
virtual void Close() override
Definition: formula.cxx:287
virtual void ViewShellChanged() override
Definition: formula.cxx:528
virtual void setCurrentFormula(const OUString &_sReplacement) override
Definition: formula.cxx:627
virtual bool IsDocAllowed(SfxObjectShell *pDocSh) const override
Definition: formula.cxx:481
virtual void dispatch(bool _bOK, bool _bMatrixChecked) override
Definition: formula.cxx:552
ScAddress m_CursorPos
Definition: formula.hxx:43
virtual void showReference(const OUString &_sFormula) override
Definition: formula.cxx:516
virtual bool IsRefInputMode() const override
Definition: formula.cxx:474
virtual css::table::CellAddress getReferencePosition() const override
Definition: formula.cxx:679
ScDocument * m_pDoc
Definition: formula.hxx:42
css::uno::Reference< css::sheet::XFormulaParser > m_xParser
Definition: formula.hxx:39
virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override
Definition: formula.cxx:649
static ScInputHandler * GetNextInputHandler(const ScDocShell *pDocShell, ScTabViewShell **ppViewSh)
Definition: formula.cxx:267
ScFormulaReferenceHelper m_aHelper
Definition: formula.hxx:38
virtual ::std::unique_ptr< formula::FormulaTokenArray > convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken > &_aTokenList) override
Definition: formula.cxx:684
static bool IsInputHdl(const ScInputHandler *pHdl)
Definition: formula.cxx:249
virtual std::unique_ptr< formula::FormulaCompiler > createCompiler(formula::FormulaTokenArray &rArray) const override
Definition: formula.cxx:368
virtual void RefInputDone(bool bForced=false) override
Definition: formula.cxx:387
virtual void doClose(bool _bOk) override
Definition: formula.cxx:507
virtual void clear() override
Definition: formula.cxx:580
virtual void SetActive() override
Definition: formula.cxx:488
virtual void AddRefEntry() override
Definition: formula.cxx:532
virtual bool IsTableLocked() const override
Definition: formula.cxx:536
std::shared_ptr< ScCompiler > m_xCompiler
Definition: formula.hxx:45
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
Definition: funcdesc.hxx:41