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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_HYPERLINKAREA_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_HYPERLINKAREA_HXX
23 #include <boost/shared_ptr.hpp>
31 /* Definition of HyperlinkArea interface */
37 /** HyperlinkArea interface
39 Implementers of this interface provide information for
40 hyperlink sensitive areas.
45 typedef std::pair
< ::basegfx::B2DRange
,
46 OUString
> HyperlinkRegion
;
48 typedef std::vector
<HyperlinkRegion
> HyperlinkRegions
;
50 /** Request hyperlink-sensitive areas.
52 @return a vector of hyperlink-sensitive areas, plus
53 the URI associated to them.
55 virtual HyperlinkRegions
getHyperlinkRegions() const = 0;
57 /** Retrieve priority of link area
59 @return the priority of the link area. Link areas with
60 higher priority will receive hyperlink clicks in favor
61 of areas with less priority, if they cover the same
64 virtual double getHyperlinkPriority() const = 0;
66 /** Functor struct, for area ordering
68 This defines a strict weak ordering of areas, sort key
69 is the object ptr value. Most typical use is for
70 associative containers holding areas.
74 // make functor adaptable (to boost::bind)
75 typedef bool result_type
;
77 bool operator()(const boost::shared_ptr
< HyperlinkArea
>& rLHS
,
78 const boost::shared_ptr
< HyperlinkArea
>& rRHS
) const
80 const double nPrioL( rLHS
->getHyperlinkPriority() );
81 const double nPrioR( rRHS
->getHyperlinkPriority() );
83 // if prios are equal, tie-break on ptr value
84 return nPrioL
== nPrioR
? rLHS
.get() < rRHS
.get() : nPrioL
< nPrioR
;
92 typedef boost::shared_ptr
< HyperlinkArea
> HyperlinkAreaSharedPtr
;
96 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_HYPERLINKAREA_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */