2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-06 12:12:33 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
|
|
|
|
2013-10-23 19:10:20 +02:00
|
|
|
#ifndef INCLUDED_VCL_FIXEDHYPER_HXX
|
|
|
|
#define INCLUDED_VCL_FIXEDHYPER_HXX
|
2007-06-20 12:57:55 +00:00
|
|
|
|
2012-11-10 23:22:47 +00:00
|
|
|
#include <vcl/dllapi.h>
|
|
|
|
#include <vcl/fixed.hxx>
|
2007-06-20 12:57:55 +00:00
|
|
|
|
2014-04-01 10:56:31 +02:00
|
|
|
class VCL_DLLPUBLIC FixedHyperlink : public FixedText
|
2007-06-20 12:57:55 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
long m_nTextLen;
|
|
|
|
Pointer m_aOldPointer;
|
2015-04-30 10:20:00 +02:00
|
|
|
Link<> m_aClickHdl;
|
2012-11-10 23:22:47 +00:00
|
|
|
OUString m_sURL;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** initializes the font (link color and underline).
|
|
|
|
|
|
|
|
Called by the Ctors.
|
|
|
|
*/
|
|
|
|
void Initialize();
|
|
|
|
|
2014-04-11 09:21:31 +02:00
|
|
|
/** is position X position hitting text */
|
2014-04-01 10:56:31 +02:00
|
|
|
SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition);
|
|
|
|
|
2007-06-20 12:57:55 +00:00
|
|
|
protected:
|
|
|
|
/** overwrites Window::MouseMove().
|
|
|
|
|
|
|
|
Changes the pointer only over the text.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** overwrites Window::MouseButtonUp().
|
|
|
|
|
|
|
|
Calls the set link if the mouse is over the text.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** overwrites Window::RequestHelp().
|
|
|
|
|
|
|
|
Shows tooltip only if the mouse is over the text.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** ctors
|
|
|
|
|
|
|
|
With ResId or WinBits.
|
|
|
|
*/
|
2014-09-23 11:20:40 +02:00
|
|
|
FixedHyperlink( vcl::Window* pParent, WinBits nWinStyle = 0 );
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** overwrites Window::GetFocus().
|
|
|
|
|
|
|
|
Changes the color of the text and shows a focus rectangle.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void GetFocus() SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** overwrites Window::LoseFocus().
|
|
|
|
|
|
|
|
Changes the color of the text and hides the focus rectangle.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void LoseFocus() SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
/** overwrites Window::KeyInput().
|
|
|
|
|
|
|
|
KEY_RETURN and KEY_SPACE calls the link handler.
|
|
|
|
*/
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
|
2012-11-10 23:22:47 +00:00
|
|
|
|
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
/** sets m_aClickHdl with rLink.
|
2007-06-20 12:57:55 +00:00
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
m_aClickHdl is called if the text is clicked.
|
2007-06-20 12:57:55 +00:00
|
|
|
*/
|
2015-04-30 10:20:00 +02:00
|
|
|
inline void SetClickHdl( const Link<>& rLink ) { m_aClickHdl = rLink; }
|
2007-06-20 12:57:55 +00:00
|
|
|
|
2014-02-04 19:55:39 +00:00
|
|
|
/** returns m_aClickHdl.
|
2007-06-20 12:57:55 +00:00
|
|
|
|
|
|
|
@return
|
2014-02-04 19:55:39 +00:00
|
|
|
m_aClickHdl
|
2007-06-20 12:57:55 +00:00
|
|
|
*/
|
2015-04-30 10:20:00 +02:00
|
|
|
inline const Link<>& GetClickHdl() const { return m_aClickHdl; }
|
2007-11-22 14:24:08 +00:00
|
|
|
|
2012-11-10 23:22:47 +00:00
|
|
|
// ::FixedHyperbaseLink
|
2008-01-29 14:24:43 +00:00
|
|
|
|
2007-11-22 14:24:08 +00:00
|
|
|
/** sets the URL of the hyperlink and uses it as tooltip. */
|
2012-11-10 23:22:47 +00:00
|
|
|
void SetURL(const OUString& rNewURL);
|
2007-11-22 14:24:08 +00:00
|
|
|
|
|
|
|
/** returns the URL of the hyperlink.
|
|
|
|
|
|
|
|
@return
|
2014-02-04 19:55:39 +00:00
|
|
|
m_sURL
|
2007-11-22 14:24:08 +00:00
|
|
|
*/
|
2014-06-12 14:06:28 +02:00
|
|
|
const OUString& GetURL() const { return m_sURL;}
|
2007-11-22 14:24:08 +00:00
|
|
|
|
|
|
|
/** sets new text and recalculates the text length. */
|
2014-03-26 16:37:00 +01:00
|
|
|
virtual void SetText(const OUString& rNewDescription) SAL_OVERRIDE;
|
2007-06-20 12:57:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|