1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef FORMULA_FUNCUTL_HXX 25 #define FORMULA_FUNCUTL_HXX 26 27 // #include <vcl/scrbar.hxx> 28 #include <vcl/fixed.hxx> 29 #include <vcl/button.hxx> 30 #include <vcl/edit.hxx> 31 #include "formula/formuladllapi.h" 32 33 34 namespace formula 35 { 36 class IControlReferenceHandler; 37 38 class FORMULA_DLLPUBLIC RefEdit : public Edit 39 { 40 private: 41 Timer aTimer; 42 IControlReferenceHandler* pAnyRefDlg; // parent dialog 43 sal_Bool bSilentFocus; // for SilentGrabFocus() 44 45 DECL_LINK( UpdateHdl, Timer* ); 46 47 protected: 48 virtual void KeyInput( const KeyEvent& rKEvt ); 49 virtual void GetFocus(); 50 virtual void LoseFocus(); 51 52 public: 53 RefEdit( Window* _pParent,IControlReferenceHandler* pParent, const ResId& rResId ); 54 RefEdit( Window* pParent, const ResId& rResId ); 55 virtual ~RefEdit(); 56 57 void SetRefString( const XubString& rStr ); 58 using Edit::SetText; 59 virtual void SetText( const XubString& rStr ); 60 virtual void Modify(); 61 62 void StartUpdateData(); 63 64 void SilentGrabFocus(); // does not update any references 65 66 void SetRefDialog( IControlReferenceHandler* pDlg ); GetRefDialog()67 inline IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; } 68 }; 69 70 71 //============================================================================ 72 73 class FORMULA_DLLPUBLIC RefButton : public ImageButton 74 { 75 private: 76 Image aImgRefStart; /// Start reference input 77 Image aImgRefStartHC; /// Start reference input (high contrast) 78 Image aImgRefDone; /// Stop reference input 79 Image aImgRefDoneHC; /// Stop reference input (high contrast) 80 IControlReferenceHandler* pAnyRefDlg; // parent dialog 81 RefEdit* pRefEdit; // zugeordnetes Edit-Control 82 83 protected: 84 virtual void Click(); 85 virtual void KeyInput( const KeyEvent& rKEvt ); 86 virtual void GetFocus(); 87 virtual void LoseFocus(); 88 89 public: 90 RefButton( Window* _pParent, const ResId& rResId); 91 RefButton( Window* _pParent, const ResId& rResId, RefEdit* pEdit ,IControlReferenceHandler* pDlg); 92 93 void SetReferences( IControlReferenceHandler* pDlg, RefEdit* pEdit ); 94 95 void SetStartImage(); 96 void SetEndImage(); DoRef()97 inline void DoRef() { Click(); } 98 }; 99 100 } // formula 101 #endif // FORMULA_FUNCUTL_HXX 102 103