xref: /aoo41x/main/sc/source/ui/inc/formula.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_FORMULA_HXX
25cdf0e10cSrcweir #define SC_FORMULA_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "anyrefdg.hxx"
28cdf0e10cSrcweir #include "global.hxx"		// ScAddress
29cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
30cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen
31cdf0e10cSrcweir #include <vcl/lstbox.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <vcl/group.hxx>
34cdf0e10cSrcweir #include <svtools/svmedit.hxx>
35cdf0e10cSrcweir #include <vcl/tabpage.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGS
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #define _SVSTDARR_STRINGS
40cdf0e10cSrcweir #include <svl/svstdarr.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include "compiler.hxx"
44cdf0e10cSrcweir #include "cell.hxx"
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include "formula/formula.hxx"
47cdf0e10cSrcweir #include "IAnyRefDialog.hxx"
48cdf0e10cSrcweir #include "anyrefdg.hxx"
49cdf0e10cSrcweir #include <formula/IFunctionDescription.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir class ScViewData;
52cdf0e10cSrcweir class ScDocument;
53cdf0e10cSrcweir class ScFuncDesc;
54cdf0e10cSrcweir class ScInputHandler;
55cdf0e10cSrcweir class ScDocShell;
56cdf0e10cSrcweir class SvLBoxEntry;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //============================================================================
59cdf0e10cSrcweir typedef ScTabViewShell* PtrTabViewShell;
60cdf0e10cSrcweir //============================================================================
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class ScFormulaDlg : public formula::FormulaDlg,
63cdf0e10cSrcweir                      public IAnyRefDialog,
64cdf0e10cSrcweir                      public formula::IFormulaEditorHelper
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     ScFormulaReferenceHelper m_aHelper;
67cdf0e10cSrcweir     ScFormulaCell*	pCell;
68cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser>          m_xParser;
69cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper>    m_xOpCodeMapper;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     static ScDocument*	pDoc;
72cdf0e10cSrcweir 	static ScAddress	aCursorPos;
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir 					ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
75cdf0e10cSrcweir                         Window* pParent, ScViewData* pViewData ,formula::IFunctionManager* _pFunctionMgr);
76cdf0e10cSrcweir 					~ScFormulaDlg();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     // IFormulaEditorHelper
79cdf0e10cSrcweir     virtual void notifyChange();
80cdf0e10cSrcweir     virtual void fill();
81cdf0e10cSrcweir     virtual bool calculateValue(const String& _sExpression,String& _rResult);
82cdf0e10cSrcweir     virtual void doClose(sal_Bool _bOk);
83cdf0e10cSrcweir     virtual void insertEntryToLRUList(const formula::IFunctionDescription*	pDesc);
84cdf0e10cSrcweir     virtual void showReference(const String& _sFormula);
85cdf0e10cSrcweir     virtual void dispatch(sal_Bool _bOK,sal_Bool _bMartixChecked);
86cdf0e10cSrcweir     virtual void setDispatcherLock( sal_Bool bLock );
87cdf0e10cSrcweir     virtual void setReferenceInput(const formula::FormEditData* _pData);
88cdf0e10cSrcweir     virtual void deleteFormData();
89cdf0e10cSrcweir     virtual void clear();
90cdf0e10cSrcweir     virtual void switchBack();
91cdf0e10cSrcweir     virtual formula::FormEditData* getFormEditData() const;
92cdf0e10cSrcweir     virtual void setCurrentFormula(const String& _sReplacement);
93cdf0e10cSrcweir     virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd);
94cdf0e10cSrcweir     virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const;
95cdf0e10cSrcweir     virtual String getCurrentFormula() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual formula::IFunctionManager* getFunctionManager();
98cdf0e10cSrcweir     virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
99cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
100cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
101cdf0e10cSrcweir     virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	virtual sal_Bool	Close();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     // sc::IAnyRefDialog
106cdf0e10cSrcweir     virtual void ShowReference(const String& _sRef);
107cdf0e10cSrcweir     virtual void HideReference( sal_Bool bDoneRefMode = sal_True );
108cdf0e10cSrcweir     virtual void SetReference( const ScRange& rRef, ScDocument* pD );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
111cdf0e10cSrcweir     virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
112cdf0e10cSrcweir     virtual void RefInputDone( sal_Bool bForced = sal_False );
113cdf0e10cSrcweir     virtual sal_Bool IsTableLocked() const;
114cdf0e10cSrcweir     virtual sal_Bool IsRefInputMode() const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual sal_Bool IsDocAllowed( SfxObjectShell* pDocSh ) const;
117cdf0e10cSrcweir     virtual void AddRefEntry();
118cdf0e10cSrcweir     virtual void SetActive();
119cdf0e10cSrcweir     virtual void ViewShellChanged( ScTabViewShell* pScViewShell );
120cdf0e10cSrcweir protected:
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
123cdf0e10cSrcweir 	sal_uLong		 FindFocusWin(Window *pWin);
124cdf0e10cSrcweir 	void		 SaveLRUEntry(const ScFuncDesc*	pFuncDesc);
125cdf0e10cSrcweir 	void		 HighlightFunctionParas(const String& aFormula);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     sal_Bool        IsInputHdl(ScInputHandler* pHdl);
128cdf0e10cSrcweir     ScInputHandler* GetNextInputHandler(ScDocShell* pDocShell,PtrTabViewShell* ppViewSh);
129cdf0e10cSrcweir };
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir #endif // SC_CRNRDLG_HXX
134cdf0e10cSrcweir 
135