summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-03 19:32:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-07 11:22:10 +0200
commit1cfd13586a8af00bb7055405a98ee7df21744e7f (patch)
tree823ea7cea866314477b2d703b2ad33a11d73ebbf /svtools
parent2f9d71b571fa8cb66b3af0b1b8e1ad6c032cb538 (diff)
move HyperLabel into vcl
could this be merged with FixedHyperlink? Change-Id: I00abe4bfa62a55c7b62ccd40e6c0294699317f26 Reviewed-on: https://gerrit.libreoffice.org/76897 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/inc/roadmap.hxx5
-rw-r--r--svtools/source/control/hyperlabel.cxx203
-rw-r--r--svtools/source/control/roadmap.cxx10
4 files changed, 7 insertions, 212 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index c2ebdbfb4e47..0c811012b30a 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -105,7 +105,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/control/ctrltool \
svtools/source/control/filectrl \
svtools/source/control/fileurlbox \
- svtools/source/control/hyperlabel \
svtools/source/control/indexentryres \
svtools/source/control/inettbc \
svtools/source/control/managedmenubutton \
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index 3056dfb0bff6..b09afcd4e238 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -21,9 +21,8 @@
#include <svtools/svtdllapi.h>
#include <vcl/ctrl.hxx>
+#include <vcl/hyperlabel.hxx>
#include <vcl/imgctrl.hxx>
-
-#include <svtools/hyperlabel.hxx>
#include <memory>
class Bitmap;
@@ -83,7 +82,7 @@ private:
/// called when an item has been selected by any means
void Select();
- DECL_LINK(ImplClickHdl, HyperLabel*, void);
+ DECL_LINK(ImplClickHdl, vcl::HyperLabel*, void);
RoadmapItem* GetByIndex( ItemIndex _nItemIndex );
const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const;
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
deleted file mode 100644
index d81f0cbdece6..000000000000
--- a/svtools/source/control/hyperlabel.cxx
+++ /dev/null
@@ -1,203 +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/hyperlabel.hxx>
-#include <tools/color.hxx>
-#include <vcl/event.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/ptrstyle.hxx>
-
-
-namespace svt
-{
- class HyperLabelImpl
- {
- public:
- sal_Int16 ID;
- sal_Int32 Index;
- bool bInteractive;
- Size m_aMinSize;
- bool m_bHyperMode;
-
- HyperLabelImpl();
- };
-
-
- HyperLabelImpl::HyperLabelImpl()
- : ID(0)
- , Index(0)
- , bInteractive(false)
- , m_bHyperMode(false)
- {
- }
-
- HyperLabel::HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle )
- :FixedText( _pParent, _nWinStyle )
- ,m_pImpl( new HyperLabelImpl )
- {
- implInit();
- }
-
- Size const & HyperLabel::CalcMinimumSize( long nMaxWidth ) const
- {
- m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth );
- // the MinimumSize is used to size the FocusRectangle
- // and for the MouseMove method
- m_pImpl->m_aMinSize.AdjustHeight(2 );
- m_pImpl->m_aMinSize.AdjustWidth(1 );
- return m_pImpl->m_aMinSize;
- }
-
- void HyperLabel::implInit()
- {
- ToggleBackgroundColor( COL_TRANSPARENT );
-
- WinBits nWinStyle = GetStyle();
- nWinStyle |= WB_EXTRAOFFSET;
- SetStyle( nWinStyle );
-
- Show();
- }
-
- void HyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
- {
- SetControlBackground( _rGBColor );
- }
-
- void HyperLabel::MouseMove( const MouseEvent& rMEvt )
- {
- vcl::Font aFont = GetControlFont( );
-
- bool bHyperMode = false;
- if (!rMEvt.IsLeaveWindow() && IsEnabled() && m_pImpl->bInteractive)
- {
- Point aPoint = GetPointerPosPixel();
- if (aPoint.X() < m_pImpl->m_aMinSize.Width())
- bHyperMode = true;
- }
-
- m_pImpl->m_bHyperMode = bHyperMode;
- if (bHyperMode)
- {
- aFont.SetUnderline(LINESTYLE_SINGLE);
- SetPointer(PointerStyle::RefHand);
- }
- else
- {
- aFont.SetUnderline(LINESTYLE_NONE);
- SetPointer(PointerStyle::Arrow);
- }
- SetControlFont(aFont);
- }
-
- void HyperLabel::MouseButtonDown( const MouseEvent& )
- {
- if ( m_pImpl->m_bHyperMode && m_pImpl->bInteractive )
- {
- maClickHdl.Call( this );
- }
- }
-
- void HyperLabel::GetFocus()
- {
- if ( IsEnabled() && m_pImpl->bInteractive )
- {
- Point aPoint(0,0);
- tools::Rectangle rRect(aPoint, Size( m_pImpl->m_aMinSize.Width(), GetSizePixel().Height() ) );
- ShowFocus( rRect );
- }
- }
-
- void HyperLabel::LoseFocus()
- {
- HideFocus();
- }
-
- HyperLabel::~HyperLabel( )
- {
- disposeOnce();
- }
-
- void HyperLabel::dispose()
- {
- m_pImpl.reset();
- FixedText::dispose();
- }
-
- void HyperLabel::SetInteractive( bool _bInteractive )
- {
- m_pImpl->bInteractive = ( _bInteractive && IsEnabled() );
- }
-
- sal_Int16 HyperLabel::GetID() const
- {
- return m_pImpl->ID;
- }
-
- sal_Int32 HyperLabel::GetIndex() const
- {
- return m_pImpl->Index;
- }
-
- void HyperLabel::SetID( sal_Int16 ID )
- {
- m_pImpl->ID = ID;
- }
-
- void HyperLabel::SetIndex( sal_Int32 Index )
- {
- m_pImpl->Index = Index;
- }
-
- void HyperLabel::SetLabel( const OUString& _rText )
- {
- SetText(_rText);
- }
-
- void HyperLabel::ApplySettings(vcl::RenderContext& rRenderContext)
- {
- FixedText::ApplySettings(rRenderContext);
-
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- if (GetControlBackground() == COL_TRANSPARENT)
- rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
- else
- rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
- }
-
- void HyperLabel::DataChanged( const DataChangedEvent& rDCEvt )
- {
- FixedText::DataChanged( rDCEvt );
-
- if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) ||
- ( rDCEvt.GetType() == DataChangedEventType::DISPLAY )) &&
- ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ))
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if (GetControlBackground() != COL_TRANSPARENT)
- SetControlBackground(rStyleSettings.GetHighlightColor());
- Invalidate();
- }
- }
-
-} // namespace svt
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index bee30e776af3..7813a2394a0f 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -49,7 +49,7 @@ class RoadmapItem : public RoadmapTypes
{
private:
VclPtr<IDLabel> mpID;
- VclPtr<HyperLabel> mpDescription;
+ VclPtr<vcl::HyperLabel> mpDescription;
const Size m_aItemPlayground;
public:
@@ -69,7 +69,7 @@ public:
void ToggleBackgroundColor( const Color& _rGBColor );
void SetInteractive( bool _bInteractive );
- void SetClickHdl( const Link<HyperLabel*,void>& rLink );
+ void SetClickHdl( const Link<vcl::HyperLabel*,void>& rLink );
void Enable( bool bEnable );
bool IsEnabled() const;
void GrabFocus();
@@ -622,7 +622,7 @@ bool ORoadmap::PreNotify(NotifyEvent& _rNEvt)
return Window::PreNotify( _rNEvt );
}
-IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, CurHyperLabel, void)
+IMPL_LINK(ORoadmap, ImplClickHdl, vcl::HyperLabel*, CurHyperLabel, void)
{
SelectRoadmapItemByID( CurHyperLabel->GetID() );
}
@@ -666,7 +666,7 @@ RoadmapItem::RoadmapItem(ORoadmap& _rParent, const Size& _rItemPlayground)
{
mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK );
mpID->Show();
- mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription = VclPtr<vcl::HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
mpDescription->Show();
}
@@ -794,7 +794,7 @@ void RoadmapItem::Update(ItemIndex RMIndex, const OUString& _rText)
ImplUpdateIndex( RMIndex );
}
-void RoadmapItem::SetClickHdl(const Link<HyperLabel*,void>& rLink)
+void RoadmapItem::SetClickHdl(const Link<vcl::HyperLabel*,void>& rLink)
{
if ( mpDescription )
mpDescription->SetClickHdl( rLink);