Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : *
6 : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : *
8 : * OpenOffice.org - a multi-platform office productivity suite
9 : *
10 : * This file is part of OpenOffice.org.
11 : *
12 : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : * it under the terms of the GNU Lesser General Public License version 3
14 : * only, as published by the Free Software Foundation.
15 : *
16 : * OpenOffice.org is distributed in the hope that it will be useful,
17 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : * GNU Lesser General Public License version 3 for more details
20 : * (a copy is included in the LICENSE file that accompanied this code).
21 : *
22 : * You should have received a copy of the GNU Lesser General Public License
23 : * version 3 along with OpenOffice.org. If not, see
24 : * <http://www.openoffice.org/license.html>
25 : * for a copy of the LGPLv3 License.
26 : *
27 : ************************************************************************/
28 : #ifndef __PLUGIN_INC_PLCOM_HXX
29 : #define __PLUGIN_INC_PLCOM_HXX
30 :
31 : #include <tools/string.hxx>
32 : #include <list>
33 :
34 : class XPlugin_Impl;
35 :
36 : class PluginComm
37 : {
38 : protected:
39 : int m_nRefCount;
40 : ::rtl::OString m_aLibName;
41 : std::list< String > m_aFilesToDelete;
42 : public:
43 : PluginComm( const ::rtl::OString& rLibName, bool bReusable = true );
44 : virtual ~PluginComm();
45 :
46 : int getRefCount() { return m_nRefCount; }
47 0 : void addRef() { m_nRefCount++; }
48 0 : void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; }
49 :
50 0 : const ::rtl::OString& getLibName() { return m_aLibName; }
51 : void setLibName( const ::rtl::OString& rName ) { m_aLibName = rName; }
52 :
53 0 : void addFileToDelete( const String& filename )
54 0 : { m_aFilesToDelete.push_back( filename ); }
55 :
56 : virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) = 0;
57 : virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
58 : NPError reason ) = 0;
59 : virtual void* NPP_GetJavaClass() = 0;
60 : virtual NPError NPP_Initialize() = 0;
61 : virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
62 : uint16_t mode, int16_t argc,
63 : char* argn[], char* argv[],
64 : NPSavedData *saved ) = 0;
65 : virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
66 : NPStream* stream,
67 : NPBool seekable, uint16_t* stype ) = 0;
68 : virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0;
69 : virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0;
70 : virtual void NPP_Shutdown() = 0;
71 : virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
72 : const char* fname ) = 0;
73 : virtual void NPP_URLNotify( NPP instance, const char* url,
74 : NPReason reason, void* notifyData ) = 0;
75 : virtual int32_t NPP_Write( NPP instance, NPStream* stream, int32_t offset,
76 : int32_t len, void* buffer ) = 0;
77 : virtual int32_t NPP_WriteReady( NPP instance, NPStream* stream ) = 0;
78 : virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0;
79 : virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
80 : void *value) = 0;
81 :
82 : virtual NPError NPP_SetWindow( XPlugin_Impl* );
83 : virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save );
84 : };
85 :
86 : #endif
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|