From 040e022d06ecadc36d3ef5c52178095a4d2c828a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 10 Nov 2012 23:22:47 +0000 Subject: 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 --- cui/source/dialogs/SpellDialog.cxx | 4 +- cui/source/inc/SpellDialog.hxx | 10 +- cui/source/inc/about.hxx | 1 - cui/source/inc/optlingu.hxx | 6 +- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 6 +- desktop/source/deployment/gui/dp_gui_dialog2.hxx | 8 +- .../source/deployment/gui/dp_gui_extlistbox.cxx | 2 +- .../source/deployment/gui/dp_gui_extlistbox.hxx | 6 +- .../source/deployment/gui/dp_gui_updatedialog.cxx | 2 +- .../source/deployment/gui/dp_gui_updatedialog.hxx | 14 +-- sd/source/ui/dlg/RemoteDialogClientBox.hxx | 1 - sfx2/source/dialog/basedlgs.cxx | 1 - svtools/Library_svt.mk | 1 - svtools/Package_inc.mk | 1 - svtools/inc/svtools/fixedhyper.hxx | 133 --------------------- svtools/inc/svtools/templdlg.hxx | 4 +- svtools/source/control/fixedhyper.cxx | 133 --------------------- svtools/source/uno/unoiface.cxx | 4 +- toolkit/Library_tk.mk | 1 - toolkit/Package_inc.mk | 1 - toolkit/inc/toolkit/helper/fixedhyperbase.hxx | 50 -------- toolkit/source/awt/vclxwindows.cxx | 14 +-- toolkit/source/helper/fixedhyperbase.cxx | 63 ---------- vcl/Library_vcl.mk | 1 + vcl/Package_inc.mk | 1 + vcl/inc/vcl/fixedhyper.hxx | 127 ++++++++++++++++++++ vcl/source/control/fixedhyper.cxx | 133 +++++++++++++++++++++ vcl/source/window/builder.cxx | 3 + 28 files changed, 305 insertions(+), 426 deletions(-) delete mode 100644 svtools/inc/svtools/fixedhyper.hxx delete mode 100644 svtools/source/control/fixedhyper.cxx delete mode 100644 toolkit/inc/toolkit/helper/fixedhyperbase.hxx delete mode 100644 toolkit/source/helper/fixedhyperbase.cxx create mode 100644 vcl/inc/vcl/fixedhyper.hxx create mode 100644 vcl/source/control/fixedhyper.cxx diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 54f94cfdfc64..b5ba38030d2e 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -420,7 +420,7 @@ void SpellDialog::UpdateBoxes_Impl() } else { - bool bHasExplainLink = aExplainLink.GetURL().Len() != 0; + bool bHasExplainLink = !aExplainLink.GetURL().isEmpty(); aExplainLink.Show( bHasExplainLink ); sal_Int32 nExplainWidth = aExplainLink.GetPosPixel().X() - aExplainFT.GetPosPixel().X(); @@ -2156,7 +2156,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) pSpellDialog->aChangePB.Enable(); } -IMPL_LINK( SpellDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) +IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink ) { rtl::OUString sURL=pHyperlink->GetURL(); rtl::OUString sTitle=GetText(); diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index b2a9f94b17d7..4161407588fa 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -137,10 +137,10 @@ private: FixedText aLanguageFT; SvxLanguageBox aLanguageLB; - HelpFixedText aExplainFT; - svt::FixedHyperlink aExplainLink; + HelpFixedText aExplainFT; + FixedHyperlink aExplainLink; - FixedText aNotInDictFT; + FixedText aNotInDictFT; SentenceEditWindow_Impl aSentenceED; FixedText aSuggestionFT; @@ -201,7 +201,7 @@ private: DECL_LINK( AddToDictClickHdl, PushButton* ); DECL_LINK( LanguageSelectHdl, SvxLanguageBox* ); DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* ); - DECL_LINK( HandleHyperlink, svt::FixedHyperlink * ); + DECL_LINK( HandleHyperlink, FixedHyperlink * ); DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * ); diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx index 28e2fa5e6d2a..4f824e314f84 100644 --- a/cui/source/inc/about.hxx +++ b/cui/source/inc/about.hxx @@ -23,7 +23,6 @@ #include #include #include -#include "svtools/fixedhyper.hxx" #include ///< for SfxModalDialog #include diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx index 75e4b1214063..b870f618f17e 100644 --- a/cui/source/inc/optlingu.hxx +++ b/cui/source/inc/optlingu.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -59,7 +59,7 @@ class SvxEditModulesDlg : public ModalDialog PushButton aPrioUpPB; PushButton aPrioDownPB; PushButton aBackPB; - svt::FixedHyperlink aMoreDictsLink; + FixedHyperlink aMoreDictsLink; FixedLine aButtonsFL; HelpButton aHelpPB; @@ -110,7 +110,7 @@ private: FixedText aLinguOptionsFT; SvxCheckListBox aLinguOptionsCLB; PushButton aLinguOptionsEditPB; - svt::FixedHyperlink aMoreDictsLink; + FixedHyperlink aMoreDictsLink; String sCapitalWords; String sWordsWithDigits; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index cb80e01ea78a..b7d924a9b5f7 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -149,7 +149,7 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl DECL_DLLPRIVATE_LINK( HandleOptionsBtn, void * ); DECL_DLLPRIVATE_LINK( HandleEnableBtn, void * ); DECL_DLLPRIVATE_LINK( HandleRemoveBtn, void * ); - DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); + DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * ); public: ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ); @@ -1122,7 +1122,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn) } // ----------------------------------------------------------------------- -IMPL_LINK( ExtMgrDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) +IMPL_LINK( ExtMgrDialog, HandleHyperlink, FixedHyperlink*, pHyperlink ) { openWebBrowser( pHyperlink->GetURL(), GetText() ); @@ -1610,7 +1610,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn) } // ----------------------------------------------------------------------- -IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) +IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, FixedHyperlink*, pHyperlink ) { openWebBrowser( pHyperlink->GetURL(), GetText() ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 0aecee3d6a51..542e04082545 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -32,9 +32,9 @@ #include "vcl/dialog.hxx" #include "vcl/button.hxx" #include "vcl/fixed.hxx" +#include "vcl/fixedhyper.hxx" #include "vcl/timer.hxx" -#include "svtools/fixedhyper.hxx" #include "svtools/prgsbar.hxx" #include "svtools/svmedit.hxx" @@ -118,7 +118,7 @@ class ExtMgrDialog : public ModelessDialog, CheckBox m_aBundledCbx; CheckBox m_aSharedCbx; CheckBox m_aUserCbx; - svt::FixedHyperlink m_aGetExtensions; + FixedHyperlink m_aGetExtensions; FixedText m_aProgressText; ProgressBar m_aProgressBar; CancelButton m_aCancelBtn; @@ -145,7 +145,7 @@ class ExtMgrDialog : public ModelessDialog, DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * ); DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * ); DECL_DLLPRIVATE_LINK( HandleExtTypeCbx, void * ); - DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); + DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * ); DECL_DLLPRIVATE_LINK(TimeOutHdl, void *); DECL_DLLPRIVATE_LINK( startProgress, void * ); @@ -214,7 +214,7 @@ class UpdateRequiredDialog : public ModalDialog, DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * ); DECL_DLLPRIVATE_LINK(TimeOutHdl, void *); DECL_DLLPRIVATE_LINK( startProgress, void * ); - DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); + DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * ); bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 29511d247515..4163dc53474f 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -542,7 +542,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr // Init publisher link here if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() ) { - pEntry->m_pPublisher = new svt::FixedHyperlink( this ); + pEntry->m_pPublisher = new FixedHyperlink( this ); pEntry->m_pPublisher->SetBackground(); pEntry->m_pPublisher->SetPaintTransparent( true ); pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 0a6eca204c86..2ca3da7bb94c 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -29,10 +29,10 @@ #include "rtl/ustring.hxx" #include "vcl/scrbar.hxx" #include "vcl/fixed.hxx" +#include "vcl/fixedhyper.hxx" #include "vcl/dialog.hxx" #include "svtools/extensionlistbox.hxx" -#include "svtools/fixedhyper.hxx" #include "cppuhelper/implbase1.hxx" #include "unotools/collatorwrapper.hxx" @@ -54,7 +54,7 @@ namespace dp_gui { class TheExtensionManager; -typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink; +typedef ::boost::shared_ptr< FixedHyperlink > TFixedHyperlink; //------------------------------------------------------------------------------ // struct Entry_Impl @@ -85,7 +85,7 @@ struct Entry_Impl String m_sLicenseText; Image m_aIcon; Image m_aIconHC; - svt::FixedHyperlink *m_pPublisher; + FixedHyperlink* m_pPublisher; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 129663a28dec..c9b5c4ff2042 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -1390,7 +1390,7 @@ IMPL_LINK_NOARG(UpdateDialog, closeHandler) { return 0; } -IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) +IMPL_LINK( UpdateDialog, hyperlink_clicked, FixedHyperlink*, pHyperlink ) { ::rtl::OUString sURL; if ( pHyperlink ) diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index ea1cc8d56201..d267e9d16014 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -41,10 +41,10 @@ #include "svx/checklbx.hxx" #include "tools/link.hxx" #include "tools/solar.h" -#include "vcl/button.hxx" -#include "vcl/dialog.hxx" -#include "vcl/fixed.hxx" -#include +#include +#include +#include +#include #include #include "descedit.hxx" @@ -177,7 +177,7 @@ private: DECL_LINK(allHandler, void *); DECL_LINK(okHandler, void *); DECL_LINK(closeHandler, void *); - DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); + DECL_LINK(hyperlink_clicked, FixedHyperlink *); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_context; @@ -188,9 +188,9 @@ private: CheckBox m_all; FixedLine m_description; FixedText m_PublisherLabel; - svt::FixedHyperlink m_PublisherLink; + FixedHyperlink m_PublisherLink; FixedText m_ReleaseNotesLabel; - svt::FixedHyperlink m_ReleaseNotesLink; + FixedHyperlink m_ReleaseNotesLink; dp_gui::DescriptionEdit m_descriptions; FixedLine m_line; HelpButton m_help; diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index c9d272e3ecc9..fba0296cd23e 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -33,7 +33,6 @@ #include "vcl/field.hxx" #include "svtools/extensionlistbox.hxx" -#include "svtools/fixedhyper.hxx" #include "cppuhelper/implbase1.hxx" #include "com/sun/star/lang/Locale.hpp" diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index c784ab8a7f4c..e438d7eb6792 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include 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 - -//......................................................................... -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 m_aClickHdl with rLink. - - m_aClickHdl is called if the text is clicked. - */ - inline void SetClickHdl( const Link& rLink ) { m_aClickHdl = rLink; } - - /** returns m_aClickHdl. - - @return - m_aClickHdl - */ - 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 - m_sURL - */ - 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 #include #include -#include +#include 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 - -//......................................................................... -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 +#include #include #include #include #include #include -#include #include #include #include @@ -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 diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk index b7994783559d..cfd0079c2978 100644 --- a/toolkit/Library_tk.mk +++ b/toolkit/Library_tk.mk @@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,tk,\ toolkit/source/controls/unocontrols \ toolkit/source/helper/accessibilityclient \ toolkit/source/helper/externallock \ - toolkit/source/helper/fixedhyperbase \ toolkit/source/helper/formpdfexport \ toolkit/source/helper/imagealign \ toolkit/source/helper/listenermultiplexer \ diff --git a/toolkit/Package_inc.mk b/toolkit/Package_inc.mk index 2bd4246d9d58..b2e0b326bbea 100644 --- a/toolkit/Package_inc.mk +++ b/toolkit/Package_inc.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/accessiblefacto $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/convert.hxx,toolkit/helper/convert.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/emptyfontdescriptor.hxx,toolkit/helper/emptyfontdescriptor.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/externallock.hxx,toolkit/helper/externallock.hxx)) -$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/fixedhyperbase.hxx,toolkit/helper/fixedhyperbase.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/formpdfexport.hxx,toolkit/helper/formpdfexport.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/imagealign.hxx,toolkit/helper/imagealign.hxx)) $(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/listenermultiplexer.hxx,toolkit/helper/listenermultiplexer.hxx)) diff --git a/toolkit/inc/toolkit/helper/fixedhyperbase.hxx b/toolkit/inc/toolkit/helper/fixedhyperbase.hxx deleted file mode 100644 index 950d9e4ab214..000000000000 --- a/toolkit/inc/toolkit/helper/fixedhyperbase.hxx +++ /dev/null @@ -1,50 +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 TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX -#define TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX - -#include - -#include - -//........................................................................ -namespace toolkit -{ -//........................................................................ - - class TOOLKIT_DLLPUBLIC FixedHyperlinkBase : public FixedText - { - public: - FixedHyperlinkBase( Window* pParent, const ResId& rId ); - FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ); - virtual ~FixedHyperlinkBase(); - - virtual void SetURL( const String& rNewURL ); - virtual String GetURL() const; - virtual void SetDescription( const String& rNewDescription ); - }; - -//........................................................................ -} // namespace toolkit -//........................................................................ - -#endif // TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 434ae8b61736..41774812a48e 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -2919,7 +2919,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve { // open the URL ::rtl::OUString sURL; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) sURL = pBase->GetURL(); Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::com::sun::star::system::SystemShellExecute::create( @@ -2954,7 +2954,7 @@ void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun { SolarMutexGuard aGuard; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) pBase->SetDescription( Text ); } @@ -2974,7 +2974,7 @@ void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun:: { SolarMutexGuard aGuard; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) pBase->SetURL( URL ); } @@ -2984,7 +2984,7 @@ void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun:: SolarMutexGuard aGuard; ::rtl::OUString aText; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) aText = pBase->GetURL(); return aText; @@ -3074,7 +3074,7 @@ void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const { SolarMutexGuard aGuard; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); @@ -3109,7 +3109,7 @@ void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; - ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow(); + FixedHyperlink* pBase = (FixedHyperlink*)GetWindow(); if ( pBase ) { sal_uInt16 nPropType = GetPropertyId( PropertyName ); diff --git a/toolkit/source/helper/fixedhyperbase.cxx b/toolkit/source/helper/fixedhyperbase.cxx deleted file mode 100644 index 91a03a3249a8..000000000000 --- a/toolkit/source/helper/fixedhyperbase.cxx +++ /dev/null @@ -1,63 +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 - -//........................................................................ -namespace toolkit -{ -//........................................................................ - -// ---------------------------------------------------- -// class FixedHyperlinkBase -// ---------------------------------------------------- - -FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, const ResId& rId ) : - FixedText( pParent, rId ) -{ -} - -FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ) : - FixedText( pParent, nWinStyle ) -{ -} - -FixedHyperlinkBase::~FixedHyperlinkBase() -{ -} - -void FixedHyperlinkBase::SetURL( const String& ) -{ -} - -String FixedHyperlinkBase::GetURL() const -{ - return String::EmptyString(); -} - -void FixedHyperlinkBase::SetDescription( const String& ) -{ -} - -//........................................................................ -} // namespace toolkit -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index efb39b8e6473..212eb8e07c94 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -131,6 +131,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/field2 \ vcl/source/control/field \ vcl/source/control/fixed \ + vcl/source/control/fixedhyper \ vcl/source/control/group \ vcl/source/control/ilstbox \ vcl/source/control/imgctrl \ diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk index dfdc585c35cb..a079a7a20088 100644 --- a/vcl/Package_inc.mk +++ b/vcl/Package_inc.mk @@ -52,6 +52,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/evntpost.hxx,vcl/evntpost.hxx) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/extoutdevdata.hxx,vcl/extoutdevdata.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/field.hxx,vcl/field.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/fixed.hxx,vcl/fixed.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/fixedhyper.hxx,vcl/fixedhyper.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/floatwin.hxx,vcl/floatwin.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/fntstyle.hxx,vcl/fntstyle.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/font.hxx,vcl/font.hxx)) diff --git a/vcl/inc/vcl/fixedhyper.hxx b/vcl/inc/vcl/fixedhyper.hxx new file mode 100644 index 000000000000..2f53ba2e34cf --- /dev/null +++ b/vcl/inc/vcl/fixedhyper.hxx @@ -0,0 +1,127 @@ +/* -*- 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 VCL_FIXEDHYPER_HXX +#define VCL_FIXEDHYPER_HXX + +#include +#include + + //===================================================================== + //= FixedHyperlink + //===================================================================== + class VCL_DLLPUBLIC FixedHyperlink : public FixedText + { + private: + long m_nTextLen; + Pointer m_aOldPointer; + Link m_aClickHdl; + OUString 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 ); + + virtual bool set_property(const OString &rKey, const OString &rValue); + + + /** sets m_aClickHdl with rLink. + + m_aClickHdl is called if the text is clicked. + */ + inline void SetClickHdl( const Link& rLink ) { m_aClickHdl = rLink; } + + /** returns m_aClickHdl. + + @return + m_aClickHdl + */ + inline const Link& GetClickHdl() const { return m_aClickHdl; } + + // ::FixedHyperbaseLink + + /** sets the URL of the hyperlink and uses it as tooltip. */ + void SetURL(const OUString& rNewURL); + + /** returns the URL of the hyperlink. + + @return + m_sURL + */ + OUString GetURL() const; + + /** sets new text and recalculates the text length. */ + void SetDescription(const OUString& rNewDescription); + }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx new file mode 100644 index 000000000000..18de8a6fb41d --- /dev/null +++ b/vcl/source/control/fixedhyper.cxx @@ -0,0 +1,133 @@ +/* -*- 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 + +// class FixedHyperlink -------------------------------------------------- + +FixedHyperlink::FixedHyperlink(Window* pParent, const ResId& rResId) + : FixedText(pParent, rResId) + , m_nTextLen(0) +{ + Initialize(); +} + +FixedHyperlink::FixedHyperlink(Window* pParent, WinBits nWinStyle) + : FixedText(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 OUString& rNewURL ) +{ + m_sURL = rNewURL; + SetQuickHelpText( m_sURL ); +} + +OUString FixedHyperlink::GetURL() const +{ + return m_sURL; +} + +void FixedHyperlink::SetDescription(const OUString& rNewDescription) +{ + SetText(rNewDescription); + m_nTextLen = GetCtrlTextWidth(GetText()); +} + +bool FixedHyperlink::set_property(const OString &rKey, const OString &rValue) +{ + if (rKey == "uri") + SetURL(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8)); + else + return FixedText::set_property(rKey, rValue); + return true; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ffe728f2af34..55c9ecbf661c 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -702,6 +703,8 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri pWindow = pField; } } + else if (name == "GtkLinkButton") + pWindow = new FixedHyperlink(pParent); else if (name == "GtkComboBox") { extractModel(id, rMap); -- cgit