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_FUNCUTL_HXX 29 #define FORMULA_FUNCUTL_HXX 30 31 // #include <vcl/scrbar.hxx> 32 #include <vcl/fixed.hxx> 33 #include <vcl/button.hxx> 34 #include <vcl/edit.hxx> 35 #include "formula/formuladllapi.h" 36 37 38 namespace formula 39 { 40 class IControlReferenceHandler; 41 42 class FORMULA_DLLPUBLIC RefEdit : public Edit 43 { 44 private: 45 Timer aTimer; 46 IControlReferenceHandler* pAnyRefDlg; // parent dialog 47 sal_Bool bSilentFocus; // for SilentGrabFocus() 48 49 DECL_LINK( UpdateHdl, Timer* ); 50 51 protected: 52 virtual void KeyInput( const KeyEvent& rKEvt ); 53 virtual void GetFocus(); 54 virtual void LoseFocus(); 55 56 public: 57 RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ); 58 RefEdit( Window* pParent, const ResId& rResId ); 59 virtual ~RefEdit(); 60 61 void SetRefString( const XubString& rStr ); 62 using Edit::SetText; 63 virtual void SetText( const XubString& rStr ); 64 virtual void Modify(); 65 66 void StartUpdateData(); 67 68 void SilentGrabFocus(); // does not update any references 69 70 void SetRefDialog( IControlReferenceHandler* pDlg ); 71 inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; } 72 }; 73 74 75 //============================================================================ 76 77 class FORMULA_DLLPUBLIC RefButton : public ImageButton 78 { 79 private: 80 Image aImgRefStart; /// Start reference input 81 Image aImgRefStartHC; /// Start reference input (high contrast) 82 Image aImgRefDone; /// Stop reference input 83 Image aImgRefDoneHC; /// Stop reference input (high contrast) 84 IControlReferenceHandler* pAnyRefDlg; // parent dialog 85 RefEdit* pRefEdit; // zugeordnetes Edit-Control 86 87 protected: 88 virtual void Click(); 89 virtual void KeyInput( const KeyEvent& rKEvt ); 90 virtual void GetFocus(); 91 virtual void LoseFocus(); 92 93 public: 94 RefButton( Window* _pParent, const ResId& rResId); 95 RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit ,IControlReferenceHandler* pDlg); 96 97 void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit ); 98 99 void SetStartImage(); 100 void SetEndImage(); 101 inline void DoRef() { Click(); } 102 }; 103 104 } // formula 105 #endif // FORMULA_FUNCUTL_HXX 106 107