LibreOffice Module slideshow (master) 1
hyperlinkarea.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <rtl/ustring.hxx>
23
24#include <memory>
25#include <vector>
26#include <utility>
27
28namespace basegfx {
29 class B2DRange;
30}
31
32/* Definition of HyperlinkArea interface */
33
34namespace slideshow::internal
35 {
42 {
43 public:
44 typedef std::pair< ::basegfx::B2DRange,
45 OUString > HyperlinkRegion;
46
47 typedef std::vector<HyperlinkRegion> HyperlinkRegions;
48
55
63 virtual double getHyperlinkPriority() const = 0;
64
72 {
73 // make functor adaptable (to boost::bind)
74 typedef bool result_type;
75
76 bool operator()(const std::shared_ptr< HyperlinkArea >& rLHS,
77 const std::shared_ptr< HyperlinkArea >& rRHS) const
78 {
79 const double nPrioL( rLHS->getHyperlinkPriority() );
80 const double nPrioR( rRHS->getHyperlinkPriority() );
81
82 // if prios are equal, tie-break on ptr value
83 return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
84 }
85 };
86
87 protected:
89 };
90
91 typedef std::shared_ptr< HyperlinkArea > HyperlinkAreaSharedPtr;
92
93}
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
HyperlinkArea interface.
virtual double getHyperlinkPriority() const =0
Retrieve priority of link area.
std::pair< ::basegfx::B2DRange, OUString > HyperlinkRegion
virtual HyperlinkRegions getHyperlinkRegions() const =0
Request hyperlink-sensitive areas.
std::vector< HyperlinkRegion > HyperlinkRegions
std::shared_ptr< HyperlinkArea > HyperlinkAreaSharedPtr
Functor struct, for area ordering.
bool operator()(const std::shared_ptr< HyperlinkArea > &rLHS, const std::shared_ptr< HyperlinkArea > &rRHS) const