1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef FORMULA_FUNCPAGE_HXX 29 #define FORMULA_FUNCPAGE_HXX 30 31 #include <svtools/stdctrl.hxx> 32 #include <vcl/lstbox.hxx> 33 #include <vcl/group.hxx> 34 #include <svtools/svmedit.hxx> 35 #include <vcl/tabpage.hxx> 36 37 #include <vcl/tabctrl.hxx> 38 #include <vcl/button.hxx> 39 #include <svtools/svtreebx.hxx> 40 41 #include <boost/shared_ptr.hpp> 42 #include <vector> 43 #include "ModuleHelper.hxx" 44 //============================================================================ 45 namespace formula 46 { 47 48 class IFunctionDescription; 49 class IFunctionManager; 50 class IFunctionCategory; 51 52 //============================================================================ 53 class FormulaListBox : public ListBox 54 { 55 protected: 56 57 virtual void KeyInput( const KeyEvent& rKEvt ); 58 virtual long PreNotify( NotifyEvent& rNEvt ); 59 60 public: 61 FormulaListBox( Window* pParent, WinBits nWinStyle = WB_BORDER ); 62 63 FormulaListBox( Window* pParent, const ResId& rResId ); 64 65 }; 66 67 68 69 typedef const IFunctionDescription* TFunctionDesc; 70 //============================================================================ 71 class FuncPage : public TabPage 72 { 73 private: 74 OModuleClient m_aModuleClient; 75 Link aDoubleClickLink; 76 Link aSelectionLink; 77 FixedText aFtCategory; 78 ListBox aLbCategory; 79 FixedText aFtFunction; 80 FormulaListBox aLbFunction; 81 const IFunctionManager* 82 m_pFunctionManager; 83 84 ::std::vector< TFunctionDesc > aLRUList; 85 rtl::OString m_aHelpId; 86 87 88 void impl_addFunctions(const IFunctionCategory* _pCategory); 89 DECL_LINK( SelHdl, ListBox* ); 90 DECL_LINK( DblClkHdl, ListBox* ); 91 92 protected: 93 94 void UpdateFunctionList(); 95 void InitLRUList(); 96 97 98 public: 99 100 FuncPage( Window* pParent,const IFunctionManager* _pFunctionManager); 101 102 void SetCategory(sal_uInt16 nCat); 103 void SetFunction(sal_uInt16 nFunc); 104 void SetFocus(); 105 sal_uInt16 GetCategory(); 106 sal_uInt16 GetFunction(); 107 sal_uInt16 GetFunctionEntryCount(); 108 109 sal_uInt16 GetFuncPos(const IFunctionDescription* _pDesc); 110 const IFunctionDescription* GetFuncDesc( sal_uInt16 nPos ) const; 111 String GetSelFunctionName() const; 112 113 void SetDoubleClickHdl( const Link& rLink ) { aDoubleClickLink = rLink; } 114 const Link& GetDoubleClickHdl() const { return aDoubleClickLink; } 115 116 void SetSelectHdl( const Link& rLink ) { aSelectionLink = rLink; } 117 const Link& GetSelectHdl() const { return aSelectionLink; } 118 119 }; 120 121 } // formula 122 #endif 123 124