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_FORMULA_FORMULA_HXX
21 #define INCLUDED_FORMULA_FORMULA_HXX
26 #include <formula/formuladllapi.h>
27 #include <formula/IFunctionDescription.hxx>
28 #include <o3tl/deleter.hxx>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
31 #include <sfx2/basedlgs.hxx>
32 #include <tools/gen.hxx>
42 #define STRUCT_FOLDER 2
43 #define STRUCT_ERROR 3
45 enum class FormulaDlgMode
{ Formula
, Edit
};
48 class FormulaDlg_Impl
;
49 class IControlReferenceHandler
;
55 class FORMULA_DLLPUBLIC FormulaModalDialog
56 : public weld::GenericDialogController
, public formula::IFormulaEditorHelper
58 friend class FormulaDlg_Impl
;
60 FormulaModalDialog(weld::Window
* pParent
, IFunctionManager
const * _pFunctionMgr
,
61 IControlReferenceHandler
* _pDlg
);
62 virtual ~FormulaModalDialog() override
;
65 std::unique_ptr
<FormulaDlg_Impl
, o3tl::default_delete
<FormulaDlg_Impl
>> m_pImpl
;
69 ::std::pair
<RefButton
*,RefEdit
*> RefInputStartBefore( RefEdit
* pEdit
, RefButton
* pButton
);
70 void RefInputStartAfter();
71 void RefInputDoneAfter();
73 void SetMeText(const OUString
& _sText
);
75 void CheckMatrix(OUString
& aFormula
/*IN/OUT*/);
76 void Update(const OUString
& _sExp
);
78 void StoreFormEditData(FormEditData
* pData
);
81 class FORMULA_DLLPUBLIC FormulaDlg
:
82 public SfxModelessDialogController
, public IFormulaEditorHelper
84 friend class FormulaDlg_Impl
;
86 FormulaDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
,
87 weld::Window
* pParent
,
88 IFunctionManager
const * _pFunctionMgr
,
89 IControlReferenceHandler
* _pDlg
);
90 virtual ~FormulaDlg() override
;
92 std::unique_ptr
<FormulaDlg_Impl
, o3tl::default_delete
<FormulaDlg_Impl
>> m_pImpl
;
99 ::std::pair
<RefButton
*,RefEdit
*> RefInputStartBefore( RefEdit
* pEdit
, RefButton
* pButton
);
100 void RefInputStartAfter();
101 void RefInputDoneAfter( bool bForced
);
103 void SetMeText(const OUString
& _sText
);
104 FormulaDlgMode
SetMeText(const OUString
& _sText
, sal_Int32 PrivStart
, sal_Int32 PrivEnd
, bool bMatrix
, bool _bSelect
, bool _bUpdate
);
106 bool CheckMatrix(OUString
& aFormula
/*IN/OUT*/);
107 OUString
GetMeText() const;
108 void Update(const OUString
& _sExp
);
110 const IFunctionDescription
* getCurrentFunctionDescription() const;
111 bool UpdateParaWin(Selection
& _rSelection
);
112 void UpdateParaWin(const Selection
& _rSelection
, const OUString
& _sRefStr
);
113 RefEdit
* GetActiveEdit();
114 void SetEdSelection();
116 void StoreFormEditData(FormEditData
* pData
);
118 const FormulaHelper
& GetFormulaHelper() const;
123 #endif // INCLUDED_FORMULA_FORMULA_HXX
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */