bump product version to 4.2.0.1
[LibreOffice.git] / include / formula / formula.hxx
bloba7ca1e34fb1c64069f9d6915d05ca2a0af5faca9
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 <sfx2/basedlgs.hxx>
24 #include <memory>
25 #include <formula/formuladllapi.h>
26 #include <formula/omoduleclient.hxx>
27 #include <formula/IFunctionDescription.hxx>
29 namespace formula
31 //============================================================================
32 #define STRUCT_END 1
33 #define STRUCT_FOLDER 2
34 #define STRUCT_ERROR 3
36 enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FORMDLG_EDIT };
38 //============================================================================
40 class FormulaDlg_Impl;
41 class IControlReferenceHandler;
42 class IFunctionDescription;
43 class IFunctionManager;
44 class FormulaHelper;
45 class RefEdit;
46 class RefButton;
47 class FormEditData;
48 //============================================================================
49 class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper
51 friend class FormulaDlg_Impl;
52 public:
53 FormulaModalDialog( Window* pParent
54 , bool _bSupportFunctionResult
55 , bool _bSupportResult
56 , bool _bSupportMatrix
57 ,IFunctionManager* _pFunctionMgr
58 ,IControlReferenceHandler* _pDlg = NULL );
59 virtual ~FormulaModalDialog();
60 private:
61 SAL_WNODEPRECATED_DECLARATIONS_PUSH
62 ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
63 SAL_WNODEPRECATED_DECLARATIONS_POP
65 protected:
67 virtual long PreNotify( NotifyEvent& rNEvt );
68 ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
69 void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
70 void RefInputDoneAfter( sal_Bool bForced = sal_False );
71 void SetFocusWin(Window *pWin,const OString& nUniqueId);
73 void SetMeText(const OUString& _sText);
74 void Update();
75 sal_Bool CheckMatrix(OUString& aFormula /*IN/OUT*/);
76 void Update(const OUString& _sExp);
78 void StoreFormEditData(FormEditData* pData);
81 class FORMULA_DLLPUBLIC FormulaDlg:
82 private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
83 // order of base classes is important, as OModuleClient controls the
84 // lifecycle of the ResMgr passed into SfxModelessDialog (via
85 // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
86 // ~Resource, the ResMgr must outlive the Resource (from which
87 // SfxModelessDialog ultimately derives)
89 friend class FormulaDlg_Impl;
90 public:
91 FormulaDlg( SfxBindings* pB
92 , SfxChildWindow* pCW
93 , Window* pParent
94 , bool _bSupportFunctionResult
95 , bool _bSupportResult
96 , bool _bSupportMatrix
97 , IFunctionManager* _pFunctionMgr
98 , IControlReferenceHandler* _pDlg = NULL );
99 virtual ~FormulaDlg();
100 private:
101 SAL_WNODEPRECATED_DECLARATIONS_PUSH
102 ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
103 SAL_WNODEPRECATED_DECLARATIONS_POP
105 DECL_LINK( UpdateFocusHdl, void*);
106 protected:
107 void disableOk();
109 protected:
111 virtual long PreNotify( NotifyEvent& rNEvt );
112 ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
113 void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
114 void RefInputDoneAfter( sal_Bool bForced = sal_False );
115 void SetFocusWin(Window *pWin,const OString& nUniqueId);
116 void HighlightFunctionParas(const OUString& aFormula);
118 void SetMeText(const OUString& _sText);
119 FormulaDlgMode SetMeText(const OUString& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd, sal_Bool bMatrix, sal_Bool _bSelect, sal_Bool _bUpdate);
120 void Update();
121 sal_Bool CheckMatrix(OUString& aFormula /*IN/OUT*/);
122 OUString GetMeText() const;
123 void Update(const OUString& _sExp);
124 void CheckMatrix();
125 void DoEnter(sal_Bool _bOk);
126 const IFunctionDescription* getCurrentFunctionDescription() const;
127 sal_Bool UpdateParaWin(Selection& _rSelection);
128 void UpdateParaWin(const Selection& _rSelection, const OUString& _sRefStr);
129 RefEdit* GetActiveEdit();
130 void SetEdSelection();
132 void StoreFormEditData(FormEditData* pData);
134 const FormulaHelper& GetFormulaHelper() const;
137 } // formula
139 #endif // INCLUDED_FORMULA_FORMULA_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */