1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include "anyrefdg.hxx"
26 #include <formula/formula.hxx>
27 #include "IAnyRefDialog.hxx"
35 class ScFormulaDlg final
: public formula::FormulaDlg
,
38 ScFormulaReferenceHelper m_aHelper
;
39 css::uno::Reference
< css::sheet::XFormulaParser
> m_xParser
;
40 css::uno::Reference
< css::sheet::XFormulaOpCodeMapper
> m_xOpCodeMapper
;
43 ScAddress m_CursorPos
;
44 ScTabViewShell
* m_pViewShell
;
45 mutable std::shared_ptr
<ScCompiler
> m_xCompiler
;
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
;
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
;
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: */