summaryrefslogtreecommitdiffstats
path: root/sd/inc/slidehack.hxx
blob: 822e160e3e5198a14afd4039b93a54f0344cee7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

/*
 * This API is asynchronous, and will emit its callbacks in the LibreOffice
 * main-thread, ie. it is not necessarily thread-safe, take the solar mutex
 * to use it. All methods should be fast - ie. can be called in a user
 * interface context without significant blocking. Any threading used by
 * implementations should not be exposed to the caller directly.
 */

// Would be nice if boost::signals2 was less dirty ...
#ifdef __GNUC__
#  pragma GCC diagnostic ignored "-Wshadow"
#  pragma GCC diagnostic ignored "-Wundef"
#  pragma GCC diagnostic ignored "-Wempty-body"
#endif

#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include <boost/signals2.hpp>

#ifdef __GNUC__
#  pragma GCC diagnostic pop
#  pragma GCC diagnostic pop
#  pragma GCC diagnostic pop
#endif

#include <rtl/ustring.hxx>
#include <tools/datetime.hxx>
#include <vcl/bitmapex.hxx>

namespace SlideHack {

typedef boost::shared_ptr< class Store > StorePtr;
typedef boost::shared_ptr< class Group > GroupPtr;
typedef boost::shared_ptr< class GroupMeta > GroupMetaPtr;
typedef boost::shared_ptr< class VersionData > VersionDataPtr;
typedef boost::shared_ptr< class Alternatives > AlternativesPtr;

/// version history
class VersionData : public boost::enable_shared_from_this< VersionData >,
                    private boost::noncopyable
{
public:
    virtual ~VersionData() {}
    virtual OUString getVersion() = 0;
    virtual DateTime getCheckinTime() = 0;
    virtual OUString getCheckinComment() = 0;
};

/// Defines information about a group of slides
class GroupMeta : public boost::enable_shared_from_this< GroupMeta >,
                  private boost::noncopyable
{
public:
    virtual ~GroupMeta() {}
    virtual OUString getName() = 0;
    virtual OUString getUserName() = 0;
    virtual OUString getTopic() = 0;

    /// number of slides
    virtual int      getLength() = 0;

    // Cedric: can this be easily fetched in one chunk ?
    virtual VersionDataPtr getVersionData() = 0;
};

/// Defines a group of slides on a related topic
class Group : public boost::enable_shared_from_this< Group >,
              private boost::noncopyable
{
public:
    virtual ~Group() {}

    virtual GroupMeta *getMetaData() = 0;

    /// fetches slide data from the potentially remote store

    /// initiate reading the slide thumbnail and/or ODP
    virtual void fetchData( bool bThumbnail, bool bODPStream ) = 0;
    /// data fetch completed signal - always in the main thread
    boost::signals2::signal< void (BitmapEx &, SvStream *) > maDataComplete;

    /// start fetch of all version numbers
    virtual void     getVersions() = 0;
    /// version number fetch completed - ver history is linear
    boost::signals2::signal< void (const std::vector< VersionDataPtr > &) > maVersions;
};

/// We can have multiple (different length) pitches for the same topic
class Alternatives : public boost::enable_shared_from_this< Alternatives >,
                     private boost::noncopyable
{
public:
    virtual ~Alternatives() {}
    virtual std::vector< GroupPtr > getAlternatives() = 0;
};

/// Overall factory and store for these guys
class Store : public boost::enable_shared_from_this< Store >,
              private boost::noncopyable
{
public:
    virtual ~Store() {}

    /// initiate search returns a handle
    virtual sal_uInt32 search( OUString aSearchEntry ) = 0;
    /// cancel a running search
    virtual void  cancelSearch( sal_uInt32 nHandle ) = 0;
    /// search completed signal - always in the main thread
    boost::signals2::signal< void(sal_uInt32, std::vector< AlternativesPtr >) > maSearchCompleted;

    /// used to create a group handle from a stored slide, so we can
    /// check for updated versions etc.
    virtual GroupPtr createGroup( OUString aName, OUString aVersion ) = 0;

    /// factory function: to get the root
    static StorePtr getStore();
};

}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */