build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / formula / formula.hxx
blobc0a12a3e0edd6d094d7c60d3b985601e35b4b4f5
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 #ifndef INCLUDED_FORMULA_FORMULA_HXX
21 #define INCLUDED_FORMULA_FORMULA_HXX
23 #include <memory>
24 #include <utility>
26 #include <formula/formuladllapi.h>
27 #include <formula/omoduleclient.hxx>
28 #include <formula/IFunctionDescription.hxx>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
31 #include <sfx2/basedlgs.hxx>
32 #include <tools/gen.hxx>
33 #include <tools/link.hxx>
34 #include <vcl/dialog.hxx>
36 class Idle;
37 class NotifyEvent;
38 class SfxBindings;
39 class SfxChildWindow;
41 namespace vcl {
42 class Window;
45 namespace formula
48 #define STRUCT_END 1
49 #define STRUCT_FOLDER 2
50 #define STRUCT_ERROR 3
52 enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FORMDLG_EDIT };
55 class FormulaDlg_Impl;
56 class IControlReferenceHandler;
57 class FormulaHelper;
58 class RefEdit;
59 class RefButton;
60 class FormEditData;
62 class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper
64 friend class FormulaDlg_Impl;
65 public:
66 FormulaModalDialog( vcl::Window* pParent
67 ,IFunctionManager* _pFunctionMgr
68 ,IControlReferenceHandler* _pDlg = nullptr );
69 virtual ~FormulaModalDialog() override;
70 virtual void dispose() override;
72 private:
73 ::std::unique_ptr<FormulaDlg_Impl> m_pImpl;
75 protected:
77 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
78 ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton );
79 void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton );
80 void RefInputDoneAfter();
82 void SetMeText(const OUString& _sText);
83 void Update();
84 void CheckMatrix(OUString& aFormula /*IN/OUT*/);
85 void Update(const OUString& _sExp);
87 void StoreFormEditData(FormEditData* pData);
90 class FORMULA_DLLPUBLIC FormulaDlg:
91 private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
92 // order of base classes is important, as OModuleClient controls the
93 // lifecycle of the ResMgr passed into SfxModelessDialog (via
94 // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
95 // ~Resource, the ResMgr must outlive the Resource (from which
96 // SfxModelessDialog ultimately derives)
98 friend class FormulaDlg_Impl;
99 public:
100 FormulaDlg( SfxBindings* pB
101 , SfxChildWindow* pCW
102 , vcl::Window* pParent
103 , IFunctionManager* _pFunctionMgr
104 , IControlReferenceHandler* _pDlg = nullptr );
105 virtual ~FormulaDlg() override;
106 virtual void dispose() override;
107 private:
108 ::std::unique_ptr<FormulaDlg_Impl> m_pImpl;
110 DECL_LINK( UpdateFocusHdl, Idle*, void );
111 protected:
112 void disableOk();
114 protected:
116 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
117 ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton );
118 void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton );
119 void RefInputDoneAfter( bool bForced );
121 void SetMeText(const OUString& _sText);
122 FormulaDlgMode SetMeText(const OUString& _sText, sal_Int32 PrivStart, sal_Int32 PrivEnd, bool bMatrix, bool _bSelect, bool _bUpdate);
123 void Update();
124 bool CheckMatrix(OUString& aFormula /*IN/OUT*/);
125 OUString GetMeText() const;
126 void Update(const OUString& _sExp);
127 void DoEnter();
128 const IFunctionDescription* getCurrentFunctionDescription() const;
129 bool UpdateParaWin(Selection& _rSelection);
130 void UpdateParaWin(const Selection& _rSelection, const OUString& _sRefStr);
131 RefEdit* GetActiveEdit();
132 void SetEdSelection();
134 void StoreFormEditData(FormEditData* pData);
136 const FormulaHelper& GetFormulaHelper() const;
139 } // formula
141 #endif // INCLUDED_FORMULA_FORMULA_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */