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_HYPERLINKAREA_HXX
21 #define INCLUDED_SLIDESHOW_HYPERLINKAREA_HXX
23 #include <boost/shared_ptr.hpp>
34 /* Definition of HyperlinkArea interface */
40 /** HyperlinkArea interface
42 Implementers of this interface provide information for
43 hyperlink sensitive areas.
48 typedef std::pair
< ::basegfx::B2DRange
,
49 ::rtl::OUString
> HyperlinkRegion
;
51 typedef std::vector
<HyperlinkRegion
> HyperlinkRegions
;
53 /** Request hyperlink-sensitive areas.
55 @return a vector of hyperlink-sensitive areas, plus
56 the URI associated to them.
58 virtual HyperlinkRegions
getHyperlinkRegions() const = 0;
60 /** Retrieve priority of link area
62 @return the priority of the link area. Link areas with
63 higher priority will receive hyperlink clicks in favor
64 of areas with less priority, if they cover the same
67 virtual double getHyperlinkPriority() const = 0;
69 /** Functor struct, for area ordering
71 This defines a strict weak ordering of areas, sort key
72 is the object ptr value. Most typical use is for
73 associative containers holding areas.
77 // make functor adaptable (to boost::bind)
78 typedef bool result_type
;
80 bool operator()(const boost::shared_ptr
< HyperlinkArea
>& rLHS
,
81 const boost::shared_ptr
< HyperlinkArea
>& rRHS
) const
83 const double nPrioL( rLHS
->getHyperlinkPriority() );
84 const double nPrioR( rRHS
->getHyperlinkPriority() );
86 // if prios are equal, tie-break on ptr value
87 return nPrioL
== nPrioR
? rLHS
.get() < rRHS
.get() : nPrioL
< nPrioR
;
95 typedef boost::shared_ptr
< HyperlinkArea
> HyperlinkAreaSharedPtr
;
99 #endif /* INCLUDED_SLIDESHOW_HYPERLINKAREA_HXX */
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */