1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <rtl/ustring.hxx>
32 /* Definition of HyperlinkArea interface */
34 namespace slideshow::internal
36 /** HyperlinkArea interface
38 Implementers of this interface provide information for
39 hyperlink sensitive areas.
44 typedef std::pair
< ::basegfx::B2DRange
,
45 OUString
> HyperlinkRegion
;
47 typedef std::vector
<HyperlinkRegion
> HyperlinkRegions
;
49 /** Request hyperlink-sensitive areas.
51 @return a vector of hyperlink-sensitive areas, plus
52 the URI associated to them.
54 virtual HyperlinkRegions
getHyperlinkRegions() const = 0;
56 /** Retrieve priority of link area
58 @return the priority of the link area. Link areas with
59 higher priority will receive hyperlink clicks in favor
60 of areas with less priority, if they cover the same
63 virtual double getHyperlinkPriority() const = 0;
65 /** Functor struct, for area ordering
67 This defines a strict weak ordering of areas, sort key
68 is the object ptr value. Most typical use is for
69 associative containers holding areas.
73 // make functor adaptable (to boost::bind)
74 typedef bool result_type
;
76 bool operator()(const std::shared_ptr
< HyperlinkArea
>& rLHS
,
77 const std::shared_ptr
< HyperlinkArea
>& rRHS
) const
79 const double nPrioL( rLHS
->getHyperlinkPriority() );
80 const double nPrioR( rRHS
->getHyperlinkPriority() );
82 // if prios are equal, tie-break on ptr value
83 return nPrioL
== nPrioR
? rLHS
.get() < rRHS
.get() : nPrioL
< nPrioR
;
91 typedef std::shared_ptr
< HyperlinkArea
> HyperlinkAreaSharedPtr
;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */