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 #ifndef FORMULA_CONTROL_HELPER_HXX_INCLUDED 28 #define FORMULA_CONTROL_HELPER_HXX_INCLUDED 29 30 #include "formula/funcutl.hxx" 31 #include <svtools/svmedit.hxx> 32 namespace formula 33 { 34 35 //============================================================================ 36 // class ValWnd 37 class ValWnd : public Window 38 { 39 public: 40 ValWnd( Window* pParent, const ResId& rId ); 41 42 void SetValue( const String& rStrVal ); 43 44 protected: 45 virtual void Paint( const Rectangle& rRect ); 46 47 private: 48 String aStrValue; 49 Rectangle aRectOut; 50 }; 51 52 //============================================================================ 53 // class EditBox 54 class EditBox : public Control 55 { 56 private: 57 58 MultiLineEdit* pMEdit; 59 Link aSelChangedLink; 60 Selection aOldSel; 61 sal_Bool bMouseFlag; 62 DECL_LINK( ChangedHdl, EditBox* ); 63 64 protected: 65 66 virtual long PreNotify( NotifyEvent& rNEvt ); 67 virtual void SelectionChanged(); 68 virtual void Resize(); 69 virtual void GetFocus(); 70 71 72 public: 73 EditBox( Window* pParent, 74 WinBits nWinStyle = WB_LEFT | WB_BORDER ); 75 EditBox( Window* pParent, const ResId& rResId ); 76 77 virtual ~EditBox(); 78 79 MultiLineEdit* GetEdit() {return pMEdit;} 80 81 void SetSelChangedHdl( const Link& rLink ) { aSelChangedLink = rLink; } 82 const Link& GetSelChangedHdl() const { return aSelChangedLink; } 83 84 void UpdateOldSel(); 85 }; 86 87 //============================================================================ 88 // class ArgEdit 89 90 class ArgEdit : public RefEdit 91 { 92 public: 93 ArgEdit( Window* pParent, const ResId& rResId ); 94 95 void Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit, 96 ScrollBar& rArgSlider, sal_uInt16 nArgCount ); 97 98 protected: 99 virtual void KeyInput( const KeyEvent& rKEvt ); 100 101 private: 102 ArgEdit* pEdPrev; 103 ArgEdit* pEdNext; 104 ScrollBar* pSlider; 105 sal_uInt16 nArgs; 106 }; 107 108 109 //============================================================================ 110 // class ArgInput 111 112 class ArgInput 113 { 114 private: 115 116 Link aFxClickLink; 117 Link aRefClickLink; 118 Link aFxFocusLink; 119 Link aRefFocusLink; 120 Link aEdFocusLink; 121 Link aEdModifyLink; 122 123 FixedText* pFtArg; 124 ImageButton* pBtnFx; 125 ArgEdit* pEdArg; 126 RefButton* pRefBtn; 127 128 DECL_LINK( FxBtnClickHdl, ImageButton* ); 129 DECL_LINK( RefBtnClickHdl,RefButton* ); 130 DECL_LINK( FxBtnFocusHdl, ImageButton* ); 131 DECL_LINK( RefBtnFocusHdl,RefButton* ); 132 DECL_LINK( EdFocusHdl, ArgEdit* ); 133 DECL_LINK( EdModifyHdl,ArgEdit* ); 134 135 protected: 136 137 virtual void FxClick(); 138 virtual void RefClick(); 139 virtual void FxFocus(); 140 virtual void RefFocus(); 141 virtual void EdFocus(); 142 virtual void EdModify(); 143 144 public: 145 146 ArgInput(); 147 148 void InitArgInput ( FixedText* pftArg, 149 ImageButton* pbtnFx, 150 ArgEdit* pedArg, 151 RefButton* prefBtn); 152 153 void SetArgName(const String &aArg); 154 String GetArgName(); 155 void SetArgNameFont(const Font&); 156 157 void SetArgVal(const String &aVal); 158 String GetArgVal(); 159 160 void SetArgSelection (const Selection& rSel ); 161 void ReplaceSelOfArg (const String& rStr ); 162 163 Selection GetArgSelection(); 164 165 166 ArgEdit* GetArgEdPtr() {return pEdArg;} 167 168 169 void SetFxClickHdl( const Link& rLink ) { aFxClickLink = rLink; } 170 const Link& GetFxClickHdl() const { return aFxClickLink; } 171 172 void SetRefClickHdl( const Link& rLink ) { aRefClickLink = rLink; } 173 const Link& GetRefClickHdl() const { return aRefClickLink; } 174 175 void SetFxFocusHdl( const Link& rLink ) { aFxFocusLink = rLink; } 176 const Link& GetFxFocusHdl() const { return aFxFocusLink; } 177 178 void SetRefFocusHdl( const Link& rLink ) { aRefFocusLink = rLink; } 179 const Link& GetRefFocusHdl() const { return aRefFocusLink; } 180 181 void SetEdFocusHdl( const Link& rLink ) { aEdFocusLink = rLink; } 182 const Link& GetEdFocusHdl() const { return aEdFocusLink; } 183 184 void SetEdModifyHdl( const Link& rLink ) { aEdModifyLink = rLink; } 185 const Link& GetEdModifyHdl() const { return aEdModifyLink; } 186 187 void Hide(); 188 void Show(); 189 190 }; 191 192 } 193 #endif // FORMULA_FORMULA_HELPER_HXX_INCLUDED 194