LibreOffice Module sc (master)  1
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
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 .
18  */
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
37 {
39  css::uno::Reference< css::sheet::XFormulaParser> m_xParser;
40  css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
45  mutable std::shared_ptr<ScCompiler> m_xCompiler;
47 public:
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);
102 };
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool IsInputHdl(const ScInputHandler *pHdl)
Definition: formula.cxx:250
virtual void switchBack() override
Definition: formula.cxx:594
virtual bool IsTableLocked() const override
Definition: formula.cxx:537
sal_uInt16 char char * pDesc
Definition: callform.cxx:57
virtual void clear() override
Definition: formula.cxx:581
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: formula.cxx:380
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:671
virtual ::std::unique_ptr< formula::FormulaTokenArray > convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken > &_aTokenList) override
Definition: formula.cxx:685
virtual void SetReference(const ScRange &rRef, ScDocument &rD) override
Definition: formula.cxx:394
virtual void getSelection(sal_Int32 &_nStart, sal_Int32 &_nEnd) const override
Definition: formula.cxx:655
virtual void setCurrentFormula(const OUString &_sReplacement) override
Definition: formula.cxx:628
virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override
Definition: formula.cxx:650
virtual void AddRefEntry() override
Definition: formula.cxx:533
static ScInputHandler * GetNextInputHandler(const ScDocShell *pDocShell, ScTabViewShell **ppViewSh)
Definition: formula.cxx:268
virtual void SetActive() override
Definition: formula.cxx:489
virtual void setDispatcherLock(bool bLock) override
Definition: formula.cxx:572
ScFormulaDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const ScViewData &rViewData, const formula::IFunctionManager *_pFunctionMgr)
Definition: formula.cxx:60
virtual void notifyChange() override
Definition: formula.cxx:180
virtual css::table::CellAddress getReferencePosition() const override
Definition: formula.cxx:680
virtual void ReleaseFocus(formula::RefEdit *pEdit) override
Definition: formula.cxx:548
ScAddress m_CursorPos
Definition: formula.hxx:43
virtual formula::FormEditData * getFormEditData() const override
Definition: formula.cxx:621
virtual bool IsRefInputMode() const override
Definition: formula.cxx:475
virtual void insertEntryToLRUList(const formula::IFunctionDescription *pDesc) override
Definition: formula.cxx:512
virtual void deleteFormData() override
Definition: formula.cxx:576
virtual void ToggleCollapsed(formula::RefEdit *pEdit, formula::RefButton *pButton) override
Definition: formula.cxx:543
ScFormulaReferenceHelper m_aHelper
Definition: formula.hxx:38
ScTabViewShell * m_pViewShell
Definition: formula.hxx:44
virtual std::unique_ptr< formula::FormulaCompiler > createCompiler(formula::FormulaTokenArray &rArray) const override
Definition: formula.cxx:369
#define static
Definition: arraysum.hxx:27
static void SaveLRUEntry(const ScFuncDesc *pFuncDesc)
Definition: formula.cxx:499
virtual void Close() override
Definition: formula.cxx:288
virtual void ViewShellChanged() override
Definition: formula.cxx:529
css::uno::Reference< css::sheet::XFormulaParser > m_xParser
Definition: formula.hxx:39
virtual formula::IFunctionManager * getFunctionManager() override
Definition: formula.cxx:667
std::shared_ptr< ScCompiler > m_xCompiler
Definition: formula.hxx:45
virtual ~ScFormulaDlg() COVERITY_NOEXCEPT_FALSE override
Definition: formula.cxx:234
virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper > getFormulaOpCodeMapper() const override
Definition: formula.cxx:675
virtual void doClose(bool _bOk) override
Definition: formula.cxx:508
virtual void ShowReference(const OUString &_sRef) override
Definition: formula.cxx:521
virtual OUString getCurrentFormula() const override
Definition: formula.cxx:660
ScDocument * m_pDoc
Definition: formula.hxx:42
virtual void HideReference(bool bDoneRefMode=true) override
Definition: formula.cxx:525
virtual void dispatch(bool _bOK, bool _bMatrixChecked) override
Definition: formula.cxx:553
virtual void showReference(const OUString &_sFormula) override
Definition: formula.cxx:517
virtual bool IsDocAllowed(SfxObjectShell *pDocSh) const override
Definition: formula.cxx:482
virtual std::shared_ptr< formula::FormulaCompiler > getCompiler() const override
Definition: formula.cxx:362
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
Definition: funcdesc.hxx:40
virtual void RefInputDone(bool bForced=false) override
Definition: formula.cxx:388
virtual void fill() override
Definition: formula.cxx:187
css::uno::Reference< css::sheet::XFormulaOpCodeMapper > m_xOpCodeMapper
Definition: formula.hxx:40