extensions.h 1.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/***************************************************************************
 *   Copyright (C) 2002 by Wilco Greven <greven@kde.org>                   *
 *   Copyright (C) 2008 by Pino Toscano <pino@kde.org>                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef _EXTENSIONS_H_
#define _EXTENSIONS_H_

#include <kparts/browserextension.h>
15
#include <kparts/liveconnectextension.h>
16

17 18 19
namespace Okular
{

20 21 22 23 24 25 26
class Part;

class BrowserExtension : public KParts::BrowserExtension
{
    Q_OBJECT

    public:
Yuri Chornoivan's avatar
Yuri Chornoivan committed
27
        explicit BrowserExtension(Part*);
28

29
    public Q_SLOTS:
30 31 32 33 34 35 36 37 38 39 40 41
        // Automatically detected by the host.
        void print();

    private:
        Part *m_part;
};

class OkularLiveConnectExtension : public KParts::LiveConnectExtension
{
    Q_OBJECT

    public:
Yuri Chornoivan's avatar
Yuri Chornoivan committed
42
        explicit OkularLiveConnectExtension( Part *parent );
43 44

        // from LiveConnectExtension
Albert Astals Cid's avatar
Albert Astals Cid committed
45 46 47 48 49
        bool get( const unsigned long objid, const QString &field, Type &type,
                          unsigned long &retobjid, QString &value ) override;
        bool put( const unsigned long objid, const QString &field, const QString &value ) override;
        bool call( const unsigned long objid, const QString &func, const QStringList &args,
                           Type &type, unsigned long &retobjid, QString &value ) override;
50 51 52 53 54 55 56 57

    private:
        QString eval( const QString &script );
        void postMessage( const QStringList &args );

        bool m_inEval;
        QString m_evalRes;
};
58 59 60

}

61 62 63
#endif

/* kate: replace-tabs on; indent-width 4; */