Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SVTOOLS_FIXEDHYPER_HXX
29 : : #define SVTOOLS_FIXEDHYPER_HXX
30 : :
31 : : #include "svtools/svtdllapi.h"
32 : :
33 : : #include <toolkit/helper/fixedhyperbase.hxx>
34 : :
35 : : //.........................................................................
36 : : namespace svt
37 : : {
38 : : //.........................................................................
39 : :
40 : : //=====================================================================
41 : : //= FixedHyperlink
42 : : //=====================================================================
43 : : class SVT_DLLPUBLIC FixedHyperlink : public ::toolkit::FixedHyperlinkBase
44 : : {
45 : : private:
46 : : long m_nTextLen;
47 : : Pointer m_aOldPointer;
48 : : Link m_aClickHdl;
49 : : String m_sURL;
50 : :
51 : : /** initializes the font (link color and underline).
52 : :
53 : : Called by the Ctors.
54 : : */
55 : : void Initialize();
56 : :
57 : : protected:
58 : : /** overwrites Window::MouseMove().
59 : :
60 : : Changes the pointer only over the text.
61 : : */
62 : : virtual void MouseMove( const MouseEvent& rMEvt );
63 : :
64 : : /** overwrites Window::MouseButtonUp().
65 : :
66 : : Calls the set link if the mouse is over the text.
67 : : */
68 : : virtual void MouseButtonUp( const MouseEvent& rMEvt );
69 : :
70 : : /** overwrites Window::RequestHelp().
71 : :
72 : : Shows tooltip only if the mouse is over the text.
73 : : */
74 : : virtual void RequestHelp( const HelpEvent& rHEvt );
75 : :
76 : : public:
77 : : /** ctors
78 : :
79 : : With ResId or WinBits.
80 : : */
81 : : FixedHyperlink( Window* pParent, const ResId& rId );
82 : : FixedHyperlink( Window* pParent, WinBits nWinStyle = 0 );
83 : :
84 : : /** dtor
85 : :
86 : : */
87 : : virtual ~FixedHyperlink();
88 : :
89 : : /** overwrites Window::GetFocus().
90 : :
91 : : Changes the color of the text and shows a focus rectangle.
92 : : */
93 : : virtual void GetFocus();
94 : :
95 : : /** overwrites Window::LoseFocus().
96 : :
97 : : Changes the color of the text and hides the focus rectangle.
98 : : */
99 : : virtual void LoseFocus();
100 : :
101 : : /** overwrites Window::KeyInput().
102 : :
103 : : KEY_RETURN and KEY_SPACE calls the link handler.
104 : : */
105 : : virtual void KeyInput( const KeyEvent& rKEvt );
106 : :
107 : : /** sets <member>m_aClickHdl</member> with <arg>rLink</arg>.
108 : :
109 : : <member>m_aClickHdl</member> is called if the text is clicked.
110 : : */
111 : 0 : inline void SetClickHdl( const Link& rLink ) { m_aClickHdl = rLink; }
112 : :
113 : : /** returns <member>m_aClickHdl</member>.
114 : :
115 : : @return
116 : : <member>m_aClickHdl</member>
117 : : */
118 : : inline const Link& GetClickHdl() const { return m_aClickHdl; }
119 : :
120 : : // ::toolkit::FixedHyperbaseLink
121 : :
122 : : /** sets the URL of the hyperlink and uses it as tooltip. */
123 : : virtual void SetURL( const String& rNewURL );
124 : :
125 : : /** returns the URL of the hyperlink.
126 : :
127 : : @return
128 : : <member>m_sURL</member>
129 : : */
130 : : virtual String GetURL() const;
131 : :
132 : : /** sets new text and recalculates the text length. */
133 : : virtual void SetDescription( const String& rNewDescription );
134 : : };
135 : : //.........................................................................
136 : : } // namespace svt
137 : : //.........................................................................
138 : :
139 : : #endif
140 : :
141 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|