tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / formula.hxx
blob02ee866c1bc97e866cf0a6130d111003e5c03040
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 #pragma once
22 #include <memory>
23 #include "anyrefdg.hxx"
25 #include <scmod.hxx>
26 #include <formula/formula.hxx>
27 #include "IAnyRefDialog.hxx"
29 class ScViewData;
30 class ScDocument;
31 class ScFuncDesc;
32 class ScInputHandler;
33 class ScDocShell;
35 class ScFormulaDlg final : public formula::FormulaDlg,
36 public IAnyRefDialog
38 ScFormulaReferenceHelper m_aHelper;
39 css::uno::Reference< css::sheet::XFormulaParser> m_xParser;
40 css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
42 ScDocument* m_pDoc;
43 ScAddress m_CursorPos;
44 ScTabViewShell* m_pViewShell;
45 mutable std::shared_ptr<ScCompiler> m_xCompiler;
47 public:
48 ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
49 weld::Window* pParent, const ScViewData& rViewData, const formula::IFunctionManager* _pFunctionMgr);
50 virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override;
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;
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;
78 virtual void Close() override;
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;
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;
91 virtual bool IsDocAllowed( SfxObjectShell* pDocSh ) const override;
92 virtual void AddRefEntry() override;
93 virtual void SetActive() override;
94 virtual void ViewShellChanged() override;
96 private:
97 virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override;
98 static void SaveLRUEntry(const ScFuncDesc* pFuncDesc);
100 static bool IsInputHdl(const ScInputHandler* pHdl);
101 static ScInputHandler* GetNextInputHandler(const ScDocShell* pDocShell, ScTabViewShell** ppViewSh);
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */