LCOV - code coverage report
Current view: top level - extensions/source/plugin/inc/plugin/unx - plugcon.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 9 0.0 %
Date: 2014-04-11 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          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 _PLUGCON_HXX
      29             : #define _PLUGCON_HXX
      30             : 
      31             : #include <stdarg.h>
      32             : #include <string.h>
      33             : 
      34             : #include <list>
      35             : #include <vector>
      36             : #include <plugin/unx/mediator.hxx>
      37             : 
      38             : #if defined SOLARIS
      39             : #    define USE_MOTIF
      40             : #endif
      41             : 
      42             : #define Window      XLIB_Window
      43             : #define Font        XLIB_Font
      44             : #define KeyCode     XLIB_KeyCode
      45             : #define Time        XLIB_Time
      46             : #define Cursor      XLIB_Cursor
      47             : #define Region      XLIB_Region
      48             : #define String      XLIB_String
      49             : #define Boolean     XLIB_Boolean
      50             : #define XPointer    XLIB_XPointer
      51             : #include <X11/Xlib.h>
      52             : extern "C" {
      53             : #include <X11/Intrinsic.h>
      54             : }
      55             : #include <X11/Shell.h>
      56             : #include <X11/IntrinsicP.h>     /* Intrinsics Definitions*/
      57             : #include <X11/StringDefs.h>    /* Standard Name-String definitions*/
      58             : #if defined USE_MOTIF
      59             : #include <Xm/DrawingA.h>
      60             : #else
      61             : #include <X11/Composite.h>
      62             : #endif
      63             : #include <X11/Xatom.h>
      64             : #ifndef XP_UNIX
      65             : #    define XP_UNIX
      66             : #endif
      67             : #define MOZ_X11
      68             : #include <stdio.h>
      69             : #ifdef SYSTEM_MOZILLA
      70             : #ifndef OJI
      71             : #  define OJI
      72             : #endif
      73             : #define MOZ_X11
      74             : #endif
      75             : 
      76             : #if ! defined ( _NPAPI_H_) && ! defined (npapi_h_)
      77             : extern "C" {
      78             : #include <npsdk/npupp.h>
      79             : }
      80             : #include "npapi.h"
      81             : 
      82             : #if NP_VERSION_MINOR < 17
      83             : // compatibility hack: compile with older NPN api header, but define
      84             : // some later introduced constants
      85             : // for gcc 3
      86             : #define NP_ABI_MASK 0x10000000
      87             : #define NPNVSupportsXEmbedBool ((NPNVariable)14)
      88             : #define NPPVpluginNeedsXEmbed  ((NPPVariable)14)
      89             : #define NPNVToolkit            ((int)(13 | NP_ABI_MASK))
      90             : #define NPNVGtk12 1
      91             : #define NPNVGtk2  2
      92             : #endif
      93             : #endif
      94             : 
      95             : #include <config_vclplug.h>
      96             : 
      97             : #if ENABLE_GTK
      98             : #define GLIB_DISABLE_DEPRECATION_WARNINGS
      99             : #include <gtk/gtk.h>
     100             : #include <gdk/gdkx.h>
     101             : #else
     102             : #define GtkWidget void
     103             : #endif
     104             : 
     105             : #undef Window
     106             : #undef Font
     107             : #undef KeyCode
     108             : #undef Time
     109             : #undef Cursor
     110             : #undef String
     111             : #undef Region
     112             : #undef Boolean
     113             : #undef XPointer
     114             : 
     115             : class ConnectorInstance
     116             : {
     117             : public:
     118             :     NPP                         instance;
     119             :     NPWindow                    window;
     120             :     NPSetWindowCallbackStruct   ws_info;
     121             :     char*                       pMimeType;
     122             :     void*                       pShell;
     123             :     void*                       pWidget;
     124             :     void*                       pForm;
     125             : 
     126             :     GtkWidget*                  pGtkWindow;
     127             :     GtkWidget*                  pGtkWidget;
     128             : 
     129             :     bool                        bShouldUseXEmbed;
     130             : 
     131             :     int nArg;
     132             :     char** argn;
     133             :     char** argv;
     134             :     char* pArgnBuf;
     135             :     char* pArgvBuf;
     136             :     NPSavedData aData;
     137             : 
     138             :     ConnectorInstance( NPP inst, char* type,
     139             :                        int args, char* pargnbuf, sal_uLong nargnbytes,
     140             :                        char* pargvbuf, sal_uLong nargvbytes,
     141             :                        char* savedata, sal_uLong savebytes );
     142             :     ~ConnectorInstance();
     143             : };
     144             : 
     145             : class PluginConnector : public Mediator
     146             : {
     147             : protected:
     148             :     osl::Mutex               m_aUserEventMutex;
     149             : 
     150             :     static std::vector<PluginConnector*>  allConnectors;
     151             : 
     152             :     DECL_LINK( NewMessageHdl, Mediator* );
     153             :     DECL_LINK( WorkOnNewMessageHdl, Mediator* );
     154             : 
     155             :     std::vector<NPStream*>              m_aNPWrapStreams;
     156             :     std::vector<ConnectorInstance*>     m_aInstances;
     157             : 
     158             :     sal_uLong   FillBuffer( char*&, const char*, sal_uLong, va_list );
     159             : public:
     160             :     PluginConnector( int nSocket );
     161             :     virtual ~PluginConnector();
     162             : 
     163             :     virtual MediatorMessage* WaitForAnswer( sal_uLong nMessageID ) SAL_OVERRIDE;
     164             :     MediatorMessage*    Transact( const char*, sal_uLong, ... );
     165             :     MediatorMessage*    Transact( sal_uInt32, ... );
     166             :     void                Respond( sal_uLong nID, char*, sal_uLong, ... );
     167             :     sal_uLong               Send( sal_uInt32, ... );
     168             : 
     169             :     static const sal_uInt32 UnknownStreamID = 0xffffffff;
     170             :     static const sal_uInt32 UnknownNPPID = 0xffffffff;
     171             : 
     172             :     sal_uInt32  GetStreamID( NPStream* pStream );
     173             :     sal_uInt32  GetNPPID( NPP );
     174             : 
     175           0 :     std::vector<NPStream*>& getStreamList() { return m_aNPWrapStreams; }
     176             : 
     177           0 :     NPError GetNPError( MediatorMessage* pMes )
     178             :     {
     179           0 :         NPError* pErr = (NPError*)pMes->GetBytes();
     180           0 :         NPError aErr = *pErr;
     181           0 :         delete [] pErr;
     182           0 :         return aErr;
     183             :     }
     184             : 
     185           0 :     void CallWorkHandler()
     186             :     {
     187             :         LINK( this, PluginConnector, WorkOnNewMessageHdl ).
     188           0 :             Call( (Mediator*)this );
     189           0 :     }
     190             : };
     191             : 
     192             : enum CommandAtoms
     193             : {
     194             :         eNPN_GetURL,
     195             :         eNPN_GetURLNotify,
     196             :         eNPN_DestroyStream,
     197             :         eNPN_NewStream,
     198             :         eNPN_PostURLNotify,
     199             :         eNPN_PostURL,
     200             :         eNPN_RequestRead,
     201             :         eNPN_Status,
     202             :         eNPN_Version,
     203             :         eNPN_Write,
     204             :         eNPN_UserAgent,
     205             : 
     206             :         eNPP_DestroyStream,
     207             :         eNPP_Destroy,
     208             :         eNPP_DestroyPhase2,
     209             :         eNPP_NewStream,
     210             :         eNPP_New,
     211             :         eNPP_SetWindow,
     212             :         eNPP_StreamAsFile,
     213             :         eNPP_URLNotify,
     214             :         eNPP_WriteReady,
     215             :         eNPP_Write,
     216             :         eNPP_GetMIMEDescription,
     217             :         eNPP_Initialize,
     218             :         eNPP_Shutdown,
     219             : 
     220             :         eMaxCommand
     221             : };
     222             : 
     223             : const char* GetCommandName( CommandAtoms );
     224             : 
     225             : #define POST_STRING( x ) x ? x : const_cast<char*>(""), x ? strlen(x) : 1
     226             : 
     227             : #endif // _PLUGCON_HXX
     228             : 
     229             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10