update dev300-m58
[ooovba.git] / slideshow / source / inc / hyperlinkarea.hxx
blob0c250fbe369695f124ff4992706ab0c709d5aedc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hyperlinkarea.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_HYPERLINKAREA_HXX
32 #define INCLUDED_SLIDESHOW_HYPERLINKAREA_HXX
34 #include <boost/shared_ptr.hpp>
35 #include <vector>
36 #include <utility>
38 namespace rtl {
39 class OUString;
41 namespace basegfx {
42 class B2DRange;
45 /* Definition of HyperlinkArea interface */
47 namespace slideshow
49 namespace internal
51 /** HyperlinkArea interface
53 Implementers of this interface provide information for
54 hyperlink sensitive areas.
56 class HyperlinkArea
58 public:
59 typedef std::pair< ::basegfx::B2DRange,
60 ::rtl::OUString > HyperlinkRegion;
62 typedef std::vector<HyperlinkRegion> HyperlinkRegions;
64 /** Request hyperlink-sensitive areas.
66 @return a vector of hyperlink-sensitive areas, plus
67 the URI associated to them.
69 virtual HyperlinkRegions getHyperlinkRegions() const = 0;
71 /** Retrieve priority of link area
73 @return the priority of the link area. Link areas with
74 higher priority will receive hyperlink clicks in favor
75 of areas with less priority, if they cover the same
76 place on screen.
78 virtual double getHyperlinkPriority() const = 0;
80 /** Functor struct, for area ordering
82 This defines a strict weak ordering of areas, sort key
83 is the object ptr value. Most typical use is for
84 associative containers holding areas.
86 struct lessThanArea
88 // make functor adaptable (to boost::bind)
89 typedef bool result_type;
91 bool operator()(const boost::shared_ptr< HyperlinkArea >& rLHS,
92 const boost::shared_ptr< HyperlinkArea >& rRHS) const
94 const double nPrioL( rLHS->getHyperlinkPriority() );
95 const double nPrioR( rRHS->getHyperlinkPriority() );
97 // if prios are equal, tie-break on ptr value
98 return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
103 typedef boost::shared_ptr< HyperlinkArea > HyperlinkAreaSharedPtr;
107 #endif /* INCLUDED_SLIDESHOW_HYPERLINKAREA_HXX */