update dev300-m58
[ooovba.git] / sc / source / ui / inc / formula.hxx
blob81d051771245104196f45d59d13c81751b97226b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formula.hxx,v $
10 * $Revision: 1.5.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_FORMULA_HXX
32 #define SC_FORMULA_HXX
34 #include "anyrefdg.hxx"
35 #include "global.hxx" // ScAddress
36 #include <svtools/stdctrl.hxx>
37 #ifndef _LSTBOX_HXX //autogen
38 #include <vcl/lstbox.hxx>
39 #endif
40 #include <vcl/group.hxx>
41 #include <svtools/svmedit.hxx>
42 #include <vcl/tabpage.hxx>
44 #ifndef _SVSTDARR_STRINGS
46 #define _SVSTDARR_STRINGS
47 #include <svtools/svstdarr.hxx>
49 #endif
50 #include "compiler.hxx"
51 #include "cell.hxx"
53 #include "formula/formula.hxx"
54 #include "IAnyRefDialog.hxx"
55 #include "anyrefdg.hxx"
56 #include <formula/IFunctionDescription.hxx>
58 class ScViewData;
59 class ScDocument;
60 class ScFuncDesc;
61 class ScInputHandler;
62 class ScDocShell;
63 class SvLBoxEntry;
65 //============================================================================
66 typedef ScTabViewShell* PtrTabViewShell;
67 //============================================================================
69 class ScFormulaDlg : public formula::FormulaDlg,
70 public IAnyRefDialog,
71 public formula::IFormulaEditorHelper
73 ScFormulaReferenceHelper m_aHelper;
74 ScFormulaCell* pCell;
75 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> m_xParser;
76 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
78 static ScDocument* pDoc;
79 static ScAddress aCursorPos;
80 public:
81 ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
82 Window* pParent, ScViewData* pViewData ,formula::IFunctionManager* _pFunctionMgr);
83 ~ScFormulaDlg();
85 // IFormulaEditorHelper
86 virtual void notifyChange();
87 virtual void fill();
88 virtual bool calculateValue(const String& _sExpression,String& _rResult);
89 virtual void doClose(BOOL _bOk);
90 virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc);
91 virtual void showReference(const String& _sFormula);
92 virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked);
93 virtual void setDispatcherLock( BOOL bLock );
94 virtual void setReferenceInput(const formula::FormEditData* _pData);
95 virtual void deleteFormData();
96 virtual void clear();
97 virtual void switchBack();
98 virtual formula::FormEditData* getFormEditData() const;
99 virtual void setCurrentFormula(const String& _sReplacement);
100 virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd);
101 virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const;
102 virtual String getCurrentFormula() const;
104 virtual formula::IFunctionManager* getFunctionManager();
105 virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
108 virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
110 virtual BOOL Close();
112 // sc::IAnyRefDialog
113 virtual void ShowReference(const String& _sRef);
114 virtual void HideReference( BOOL bDoneRefMode = TRUE );
115 virtual void SetReference( const ScRange& rRef, ScDocument* pD );
117 virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
118 virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
119 virtual void RefInputDone( BOOL bForced = FALSE );
120 virtual BOOL IsTableLocked() const;
121 virtual BOOL IsRefInputMode() const;
123 virtual BOOL IsDocAllowed( SfxObjectShell* pDocSh ) const;
124 virtual void AddRefEntry();
125 virtual void SetActive();
126 virtual void ViewShellChanged( ScTabViewShell* pScViewShell );
127 protected:
129 virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
130 ULONG FindFocusWin(Window *pWin);
131 void SaveLRUEntry(const ScFuncDesc* pFuncDesc);
132 void HighlightFunctionParas(const String& aFormula);
134 BOOL IsInputHdl(ScInputHandler* pHdl);
135 ScInputHandler* GetNextInputHandler(ScDocShell* pDocShell,PtrTabViewShell* ppViewSh);
140 #endif // SC_CRNRDLG_HXX