diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-11-10 23:22:47 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-12 12:01:39 +0000 |
commit | 040e022d06ecadc36d3ef5c52178095a4d2c828a (patch) | |
tree | d60733f77650b251276b3313ad802d7c007d1f36 /svtools | |
parent | bfd8721577f0b26e890ab1528e2a71ad4889cb70 (diff) |
move svtools's FixedHyper.hxx to vcl
merge with fixedhyperbase and map GtkLinkButton
to FixedHyper. Convert to String while I'm at it.
Change-Id: Ibc61fd29c01796561eeef952a159c82ff215a095
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/Package_inc.mk | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/fixedhyper.hxx | 133 | ||||
-rw-r--r-- | svtools/inc/svtools/templdlg.hxx | 4 | ||||
-rw-r--r-- | svtools/source/control/fixedhyper.cxx | 133 | ||||
-rw-r--r-- | svtools/source/uno/unoiface.cxx | 4 |
6 files changed, 4 insertions, 272 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 21988dd45027..4916808e748c 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/filectrl \ svtools/source/control/filectrl2 \ svtools/source/control/fileurlbox \ - svtools/source/control/fixedhyper \ svtools/source/control/fmtfield \ svtools/source/control/headbar \ svtools/source/control/hyperlabel \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index ecd6fb589262..3aeb5d36d2f7 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -69,7 +69,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fileurlbox.hxx,svtools $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fileview.hxx,svtools/fileview.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filter.hxx,svtools/filter.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filechangedchecker.hxx,svtools/filechangedchecker.hxx)) -$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fixedhyper.hxx,svtools/fixedhyper.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fltcall.hxx,svtools/fltcall.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fmtfield.hxx,svtools/fmtfield.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fontsubstconfig.hxx,svtools/fontsubstconfig.hxx)) diff --git a/svtools/inc/svtools/fixedhyper.hxx b/svtools/inc/svtools/fixedhyper.hxx deleted file mode 100644 index 07c5e54848e1..000000000000 --- a/svtools/inc/svtools/fixedhyper.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#ifndef SVTOOLS_FIXEDHYPER_HXX -#define SVTOOLS_FIXEDHYPER_HXX - -#include "svtools/svtdllapi.h" - -#include <toolkit/helper/fixedhyperbase.hxx> - -//......................................................................... -namespace svt -{ -//......................................................................... - - //===================================================================== - //= FixedHyperlink - //===================================================================== - class SVT_DLLPUBLIC FixedHyperlink : public ::toolkit::FixedHyperlinkBase - { - private: - long m_nTextLen; - Pointer m_aOldPointer; - Link m_aClickHdl; - String m_sURL; - - /** initializes the font (link color and underline). - - Called by the Ctors. - */ - void Initialize(); - - protected: - /** overwrites Window::MouseMove(). - - Changes the pointer only over the text. - */ - virtual void MouseMove( const MouseEvent& rMEvt ); - - /** overwrites Window::MouseButtonUp(). - - Calls the set link if the mouse is over the text. - */ - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - - /** overwrites Window::RequestHelp(). - - Shows tooltip only if the mouse is over the text. - */ - virtual void RequestHelp( const HelpEvent& rHEvt ); - - public: - /** ctors - - With ResId or WinBits. - */ - FixedHyperlink( Window* pParent, const ResId& rId ); - FixedHyperlink( Window* pParent, WinBits nWinStyle = 0 ); - - /** dtor - - */ - virtual ~FixedHyperlink(); - - /** overwrites Window::GetFocus(). - - Changes the color of the text and shows a focus rectangle. - */ - virtual void GetFocus(); - - /** overwrites Window::LoseFocus(). - - Changes the color of the text and hides the focus rectangle. - */ - virtual void LoseFocus(); - - /** overwrites Window::KeyInput(). - - KEY_RETURN and KEY_SPACE calls the link handler. - */ - virtual void KeyInput( const KeyEvent& rKEvt ); - - /** sets <member>m_aClickHdl</member> with <arg>rLink</arg>. - - <member>m_aClickHdl</member> is called if the text is clicked. - */ - inline void SetClickHdl( const Link& rLink ) { m_aClickHdl = rLink; } - - /** returns <member>m_aClickHdl</member>. - - @return - <member>m_aClickHdl</member> - */ - inline const Link& GetClickHdl() const { return m_aClickHdl; } - - // ::toolkit::FixedHyperbaseLink - - /** sets the URL of the hyperlink and uses it as tooltip. */ - virtual void SetURL( const String& rNewURL ); - - /** returns the URL of the hyperlink. - - @return - <member>m_sURL</member> - */ - virtual String GetURL() const; - - /** sets new text and recalculates the text length. */ - virtual void SetDescription( const String& rNewDescription ); - }; -//......................................................................... -} // namespace svt -//......................................................................... - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/templdlg.hxx b/svtools/inc/svtools/templdlg.hxx index f2595150fdc3..ba195a579b8d 100644 --- a/svtools/inc/svtools/templdlg.hxx +++ b/svtools/inc/svtools/templdlg.hxx @@ -33,7 +33,7 @@ #include <vcl/button.hxx> #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> -#include <svtools/fixedhyper.hxx> +#include <vcl/fixedhyper.hxx> struct SvtTmplDlg_Impl; @@ -44,7 +44,7 @@ class SvtTemplateWindow; class SVT_DLLPUBLIC SvtDocumentTemplateDialog : public ModalDialog { private: - svt::FixedHyperlink aMoreTemplatesLink; + FixedHyperlink aMoreTemplatesLink; FixedLine aLine; PushButton aManageBtn; PushButton aEditBtn; diff --git a/svtools/source/control/fixedhyper.cxx b/svtools/source/control/fixedhyper.cxx deleted file mode 100644 index 5d4c1bc77509..000000000000 --- a/svtools/source/control/fixedhyper.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#include <svtools/fixedhyper.hxx> - -//......................................................................... -namespace svt -{ -//......................................................................... - -// class FixedHyperlink -------------------------------------------------- - -FixedHyperlink::FixedHyperlink( Window* pParent, const ResId& rResId ) : - ::toolkit::FixedHyperlinkBase( pParent, rResId ), - m_nTextLen(0) -{ - Initialize(); -} - -FixedHyperlink::FixedHyperlink( Window* pParent, WinBits nWinStyle ) : - ::toolkit::FixedHyperlinkBase( pParent, nWinStyle ), - m_nTextLen(0) -{ - Initialize(); -} - -FixedHyperlink::~FixedHyperlink() -{ -} - -void FixedHyperlink::Initialize() -{ - // saves the old pointer - m_aOldPointer = GetPointer(); - // changes the font - Font aFont = GetControlFont( ); - // to underline - aFont.SetUnderline( UNDERLINE_SINGLE ); - SetControlFont( aFont ); - // changes the color to light blue - SetTextColor( Color( COL_LIGHTBLUE ) ); - // calculates text len - m_nTextLen = GetCtrlTextWidth( GetText() ); -} - -void FixedHyperlink::MouseMove( const MouseEvent& rMEvt ) -{ - // changes the pointer if the control is enabled and the mouse is over the text. - if ( !rMEvt.IsLeaveWindow() && IsEnabled() && GetPointerPosPixel().X() < m_nTextLen ) - SetPointer( POINTER_REFHAND ); - else - SetPointer( m_aOldPointer ); -} - -void FixedHyperlink::MouseButtonUp( const MouseEvent& ) -{ - // calls the link if the control is enabled and the mouse is over the text. - if ( IsEnabled() && GetPointerPosPixel().X() < m_nTextLen ) - ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, m_aClickHdl, this ); -} - -void FixedHyperlink::RequestHelp( const HelpEvent& rHEvt ) -{ - if ( IsEnabled() && GetPointerPosPixel().X() < m_nTextLen ) - FixedText::RequestHelp( rHEvt ); -} - -void FixedHyperlink::GetFocus() -{ - SetTextColor( Color( COL_LIGHTRED ) ); - Paint( Rectangle( Point(), GetSizePixel() ) ); - ShowFocus( Rectangle( Point( 1, 1 ), Size( m_nTextLen + 4, GetSizePixel().Height() - 2 ) ) ); -} - -void FixedHyperlink::LoseFocus() -{ - SetTextColor( Color( COL_LIGHTBLUE ) ); - Paint( Rectangle( Point(), GetSizePixel() ) ); - HideFocus(); -} - -void FixedHyperlink::KeyInput( const KeyEvent& rKEvt ) -{ - switch ( rKEvt.GetKeyCode().GetCode() ) - { - case KEY_SPACE: - case KEY_RETURN: - m_aClickHdl.Call( this ); - break; - - default: - FixedText::KeyInput( rKEvt ); - } -} - -void FixedHyperlink::SetURL( const String& rNewURL ) -{ - m_sURL = rNewURL; - SetQuickHelpText( m_sURL ); -} - -String FixedHyperlink::GetURL() const -{ - return m_sURL; -} - -void FixedHyperlink::SetDescription( const String& rNewDescription ) -{ - SetText( rNewDescription ); - m_nTextLen = GetCtrlTextWidth( GetText() ); -} - -//......................................................................... -} // namespace svt -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index cd1688c392dc..bb05a95e5a89 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -28,12 +28,12 @@ #include <tools/debug.hxx> +#include <vcl/fixedhyper.hxx> #include <vcl/svapp.hxx> #include <svtools/svmedit.hxx> #include <unoiface.hxx> #include <svtools/filectrl.hxx> #include <svtools/roadmap.hxx> -#include <svtools/fixedhyper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> @@ -151,7 +151,7 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: { if ( pParent ) { - pWindow = new ::svt::FixedHyperlink( pParent, nWinBits ); + pWindow = new FixedHyperlink( pParent, nWinBits ); *ppNewComp = new VCLXFixedHyperlink; } else |