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 SVTOOLS_HYPERLABEL_HXX 28 #define SVTOOLS_HYPERLABEL_HXX 29 30 #include <vcl/event.hxx> 31 32 33 #include <vcl/fixed.hxx> 34 35 #define LABELBASEMAPHEIGHT 8 36 37 38 //......................................................................... 39 namespace svt 40 { 41 //......................................................................... 42 43 class HyperLabelImpl; 44 45 class HyperLabel : public FixedText 46 { 47 protected: 48 HyperLabelImpl* m_pImpl; 49 Link maClickHdl; 50 51 virtual void MouseMove( const MouseEvent& rMEvt ); 52 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 53 virtual void GetFocus(); 54 virtual void LoseFocus(); 55 56 void DeactivateHyperMode(Font aFont, const Color aColor); 57 void ActivateHyperMode(Font aFont, const Color aColor); 58 59 protected: 60 void implInit(); 61 62 public: 63 HyperLabel( Window* _pParent, const ResId& _rId ); 64 HyperLabel( Window* _pParent, WinBits _nWinStyle = 0 ); 65 ~HyperLabel( ); 66 67 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 68 69 void SetID( sal_Int16 _ID ); 70 sal_Int16 GetID() const; 71 72 void SetIndex( sal_Int32 _Index ); 73 sal_Int32 GetIndex() const; 74 75 void SetLabel( const ::rtl::OUString& _rText ); 76 sal_Int32 GetLogicWidth(); 77 78 ::rtl::OUString GetLabel( ); 79 80 void ToggleBackgroundColor( const Color& _rGBColor ); 81 void SetInteractive( sal_Bool _bInteractive ); 82 83 void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } 84 const Link& GetClickHdl() const { return maClickHdl; } 85 86 Size CalcMinimumSize( long nMaxWidth = 0 ) const; 87 88 private: 89 90 DECL_LINK(ImplClickHdl, HyperLabel*); 91 92 private: 93 using FixedText::CalcMinimumSize; 94 }; 95 } 96 97 #endif 98 99