Bump version to 6.4-15
[LibreOffice.git] / include / vcl / toolkit / fixedhyper.hxx
blob9eb1af116e5e76d6445dd71c150b4c924d3dc304
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_FIXEDHYPER_HXX
21 #define INCLUDED_VCL_FIXEDHYPER_HXX
23 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION)
24 #error "don't use this in new code"
25 #endif
27 #include <vcl/dllapi.h>
28 #include <vcl/fixed.hxx>
30 class VCL_DLLPUBLIC FixedHyperlink : public FixedText
32 private:
33 long m_nTextLen;
34 PointerStyle m_aOldPointer;
35 Link<FixedHyperlink&,void> m_aClickHdl;
36 OUString m_sURL;
38 /** initializes the font (link color and underline).
40 Called by the Ctors.
42 void Initialize();
44 /** is position X position hitting text */
45 SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition);
47 DECL_LINK(HandleClick, FixedHyperlink&, void);
49 protected:
50 /** overwrites Window::MouseMove().
52 Changes the pointer only over the text.
54 virtual void MouseMove( const MouseEvent& rMEvt ) override;
56 /** overwrites Window::MouseButtonUp().
58 Calls the set link if the mouse is over the text.
60 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
62 /** overwrites Window::RequestHelp().
64 Shows tooltip only if the mouse is over the text.
66 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
68 public:
69 /** ctors
71 With WinBits.
73 FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 );
75 /** overwrites Window::GetFocus().
77 Changes the color of the text and shows a focus rectangle.
79 virtual void GetFocus() override;
81 /** overwrites Window::LoseFocus().
83 Changes the color of the text and hides the focus rectangle.
85 virtual void LoseFocus() override;
87 /** overwrites Window::KeyInput().
89 KEY_RETURN and KEY_SPACE calls the link handler.
91 virtual void KeyInput( const KeyEvent& rKEvt ) override;
93 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
96 /** sets m_aClickHdl with rLink.
98 m_aClickHdl is called if the text is clicked.
100 void SetClickHdl( const Link<FixedHyperlink&,void>& rLink ) { m_aClickHdl = rLink; }
101 const Link<FixedHyperlink&,void>& GetClickHdl() const { return m_aClickHdl; }
103 // ::FixedHyperbaseLink
105 /** sets the URL of the hyperlink and uses it as tooltip. */
106 void SetURL(const OUString& rNewURL);
108 /** returns the URL of the hyperlink.
110 @return
111 m_sURL
113 const OUString& GetURL() const { return m_sURL;}
115 /** sets new text and recalculates the text length. */
116 virtual void SetText(const OUString& rNewDescription) override;
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */