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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_FORMULA_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_FORMULA_HXX
23 #include "anyrefdg.hxx"
25 #include <svtools/stdctrl.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <vcl/group.hxx>
28 #include <svtools/svmedit.hxx>
29 #include <vcl/tabpage.hxx>
31 #include "compiler.hxx"
33 #include <formula/formula.hxx>
34 #include "IAnyRefDialog.hxx"
43 typedef ScTabViewShell
* PtrTabViewShell
;
45 class ScFormulaDlg
: public formula::FormulaDlg
,
48 ScFormulaReferenceHelper m_aHelper
;
49 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaParser
> m_xParser
;
50 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaOpCodeMapper
> m_xOpCodeMapper
;
52 static ScDocument
* pDoc
;
53 static ScAddress aCursorPos
;
55 ScFormulaDlg( SfxBindings
* pB
, SfxChildWindow
* pCW
,
56 vcl::Window
* pParent
, ScViewData
* pViewData
,formula::IFunctionManager
* _pFunctionMgr
);
57 virtual ~ScFormulaDlg();
58 virtual void dispose() SAL_OVERRIDE
;
60 // IFormulaEditorHelper
61 virtual void notifyChange() SAL_OVERRIDE
;
62 virtual void fill() SAL_OVERRIDE
;
63 virtual bool calculateValue(const OUString
& _sExpression
, OUString
& _rResult
) SAL_OVERRIDE
;
64 virtual void doClose(bool _bOk
) SAL_OVERRIDE
;
65 virtual void insertEntryToLRUList(const formula::IFunctionDescription
* pDesc
) SAL_OVERRIDE
;
66 virtual void showReference(const OUString
& _sFormula
) SAL_OVERRIDE
;
67 virtual void dispatch(bool _bOK
, bool _bMatrixChecked
) SAL_OVERRIDE
;
68 virtual void setDispatcherLock( bool bLock
) SAL_OVERRIDE
;
69 virtual void setReferenceInput(const formula::FormEditData
* _pData
) SAL_OVERRIDE
;
70 virtual void deleteFormData() SAL_OVERRIDE
;
71 virtual void clear() SAL_OVERRIDE
;
72 virtual void switchBack() SAL_OVERRIDE
;
73 virtual formula::FormEditData
* getFormEditData() const SAL_OVERRIDE
;
74 virtual void setCurrentFormula(const OUString
& _sReplacement
) SAL_OVERRIDE
;
75 virtual void setSelection(sal_Int32 _nStart
, sal_Int32 _nEnd
) SAL_OVERRIDE
;
76 virtual void getSelection(sal_Int32
& _nStart
, sal_Int32
& _nEnd
) const SAL_OVERRIDE
;
77 virtual OUString
getCurrentFormula() const SAL_OVERRIDE
;
79 virtual formula::IFunctionManager
* getFunctionManager() SAL_OVERRIDE
;
80 virtual ::std::unique_ptr
<formula::FormulaTokenArray
> convertToTokenArray(const ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FormulaToken
>& _aTokenList
) SAL_OVERRIDE
;
81 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaParser
> getFormulaParser() const SAL_OVERRIDE
;
82 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XFormulaOpCodeMapper
> getFormulaOpCodeMapper() const SAL_OVERRIDE
;
83 virtual ::com::sun::star::table::CellAddress
getReferencePosition() const SAL_OVERRIDE
;
85 virtual bool Close() SAL_OVERRIDE
;
88 virtual void ShowReference(const OUString
& _sRef
) SAL_OVERRIDE
;
89 virtual void HideReference( bool bDoneRefMode
= true ) SAL_OVERRIDE
;
90 virtual void SetReference( const ScRange
& rRef
, ScDocument
* pD
) SAL_OVERRIDE
;
92 virtual void ReleaseFocus( formula::RefEdit
* pEdit
, formula::RefButton
* pButton
= NULL
) SAL_OVERRIDE
;
93 virtual void ToggleCollapsed( formula::RefEdit
* pEdit
, formula::RefButton
* pButton
= NULL
) SAL_OVERRIDE
;
94 virtual void RefInputDone( bool bForced
= false ) SAL_OVERRIDE
;
95 virtual bool IsTableLocked() const SAL_OVERRIDE
;
96 virtual bool IsRefInputMode() const SAL_OVERRIDE
;
98 virtual bool IsDocAllowed( SfxObjectShell
* pDocSh
) const SAL_OVERRIDE
;
99 virtual void AddRefEntry() SAL_OVERRIDE
;
100 virtual void SetActive() SAL_OVERRIDE
;
101 virtual void ViewShellChanged() SAL_OVERRIDE
;
104 virtual void RefInputStart( formula::RefEdit
* pEdit
, formula::RefButton
* pButton
= NULL
) SAL_OVERRIDE
;
105 static void SaveLRUEntry(const ScFuncDesc
* pFuncDesc
);
107 static bool IsInputHdl(ScInputHandler
* pHdl
);
108 static ScInputHandler
* GetNextInputHandler(ScDocShell
* pDocShell
,PtrTabViewShell
* ppViewSh
);
111 #endif // INCLUDED_SC_SOURCE_UI_INC_FORMULA_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */