summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/source/plugin/aqua/sysplug.mm72
-rw-r--r--extensions/source/plugin/base/nfuncs.cxx31
-rw-r--r--extensions/source/plugin/base/xplugin.cxx4
-rw-r--r--extensions/source/plugin/inc/plugin/aqua/sysplug.hxx27
-rw-r--r--extensions/source/plugin/inc/plugin/impl.hxx29
-rw-r--r--extensions/source/plugin/unx/sysplug.cxx6
-rw-r--r--extensions/source/plugin/win/sysplug.cxx4
7 files changed, 117 insertions, 56 deletions
diff --git a/extensions/source/plugin/aqua/sysplug.mm b/extensions/source/plugin/aqua/sysplug.mm
index 415ca936c46f..8db2dceecc00 100644
--- a/extensions/source/plugin/aqua/sysplug.mm
+++ b/extensions/source/plugin/aqua/sysplug.mm
@@ -30,6 +30,11 @@
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
+
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+
#include <osl/thread.h>
#include <plugin/impl.hxx>
@@ -51,6 +56,73 @@ void TRACEN( char const * s, long n );
#define TRACEN(x,n)
#endif
+
+struct SysPlugData
+{
+ MacPluginComm::NP_CGContext m_aCGContext;
+ NP_Port m_aNPPort;
+ NSView* m_pParentView;
+ NSView* m_pPlugView;
+ int m_nDrawingModel;
+ NSPoint m_aLastPlugViewOrigin;
+ bool m_bSetWindowOnDraw;
+ SysPlugData()
+ {
+ memset( this, 0, sizeof(*this) );
+ }
+};
+
+::boost::shared_ptr<SysPlugData> CreateSysPlugData()
+{
+ return ::boost::shared_ptr<SysPlugData>(new SysPlugData);
+}
+
+void XPlugin_Impl::SetSysPlugDataParentView(SystemEnvData* pEnvData)
+{
+ m_pSysPlugData.m_pParentView = pEnvData->pView;
+}
+
+extern "C" {
+
+void /*SAL_CALL NP_LOADDS*/ NPN_ForceRedraw_Impl(NPP instance)
+{
+ TRACE( "NPN_ForceRedraw_Impl" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( pImpl )
+ {
+ SysPlugData& rPlugData( pImpl->getSysPlugData() );
+ if( rPlugData.m_pPlugView )
+ [rPlugData.m_pPlugView setNeedsDisplay: YES];
+ }
+}
+
+NPError /*SAL_CALL NP_LOADDS*/ NPN_SetValue_Impl( NPP instance,
+ NPPVariable variable,
+ void* value )
+{
+ TRACE( "NPN_SetValue_Impl" );
+ switch( variable )
+ {
+ case (NPPVariable)1000: // NPNVpluginDrawingModel
+ {
+ // ugly, but that's the way we need to do it
+ int nDrawingModel = (int)value;
+
+ TRACEN( "drawing model: ", nDrawingModel );
+ XPlugin_Impl* pImpl =
+ XPluginManager_Impl::getXPluginFromNPP( instance );
+ if (pImpl)
+ pImpl->getSysPlugData().m_nDrawingModel = nDrawingModel;
+ }
+ break;
+ default:
+ break;
+ }
+ return NPERR_NO_ERROR;
+}
+
+} // extern "C"
+
struct FakeEventRecord : public EventRecord
{
FakeEventRecord()
diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx
index d06c5b808927..69b73f52df0d 100644
--- a/extensions/source/plugin/base/nfuncs.cxx
+++ b/extensions/source/plugin/base/nfuncs.cxx
@@ -600,28 +600,11 @@ NPError SAL_CALL NP_LOADDS NPN_SetValue( NPP instance,
{
NPError nError = NPERR_NO_ERROR;
TRACEN( "NPN_SetValue ", variable );
- switch( variable )
- {
#ifdef QUARTZ
- case (NPPVariable)1000: // NPNVpluginDrawingModel
- {
- int nDrawingModel = (int)value; // ugly, but that's the way we need to do it
-
- TRACEN( "drawing model: ", nDrawingModel );
-
- XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
- if( pImpl )
- pImpl->getSysPlugData().m_nDrawingModel = nDrawingModel;
- }
- break;
- #endif
- case NPPVpluginNameString: // make the windows compiler happy, it needs at least one case statement
- break;
- default:
- break;
- }
- #ifndef QUARTZ
+ NPN_SetValue_Impl(instance, variable, value);
+ #else
(void)instance;
+ (void)variable;
(void)value;
#endif
return nError;
@@ -653,13 +636,7 @@ void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance)
{
TRACE( "NPN_ForceRedraw" );
#ifdef QUARTZ
- XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
- if( pImpl )
- {
- SysPlugData& rPlugData( pImpl->getSysPlugData() );
- if( rPlugData.m_pPlugView )
- [rPlugData.m_pPlugView setNeedsDisplay: YES];
- }
+ NPN_ForceRedraw_Impl(instance);
#else
(void)instance;
#endif
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index fa9798e273f8..4cce131d93e7 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -119,6 +119,7 @@ XPlugin_Impl::XPlugin_Impl( const uno::Reference< com::sun::star::lang::XMultiSe
PluginControl_Impl(),
m_xSMgr( rSMgr ),
m_pPluginComm( NULL ),
+ m_pSysPlugData( CreateSysPlugData() ),
m_aEncoding( osl_getThreadTextEncoding() ),
m_pArgv( NULL ),
m_pArgn( NULL ),
@@ -131,7 +132,6 @@ XPlugin_Impl::XPlugin_Impl( const uno::Reference< com::sun::star::lang::XMultiSe
{
memset( &m_aInstance, 0, sizeof( m_aInstance ) );
memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) );
- memset( &m_aSysPlugData, 0, sizeof( m_aSysPlugData ) );
m_xModel = new PluginModel();
uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
@@ -566,7 +566,7 @@ void XPlugin_Impl::loadPlugin()
NULL );
#ifdef QUARTZ
// m_aNPWindow is set up in the MacPluginComm from the view
- m_aSysPlugData.m_pParentView = pEnvData->pView;
+ SetSysPlugDataParentView(pEnvData);
#elif defined( UNX )
XSync( (Display*)pEnvData->pDisplay, False );
m_aNPWindow.window = (void*)pEnvData->aWindow;
diff --git a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx b/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx
index ab3e5ddda514..ebf302504cd7 100644
--- a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx
+++ b/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx
@@ -25,8 +25,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef __PLUGIN_INC_MACPLUG_HXX
-#define __PLUGIN_INC_MACPLUG_HXX
+#ifndef PLUGIN_INC_MACPLUG_HXX
+#define PLUGIN_INC_MACPLUG_HXX
#include <unistd.h>
@@ -44,15 +44,18 @@
#include "npsdk/npupp.h"
#include "plugin/plcom.hxx"
-#include "premac.h"
-#include <Cocoa/Cocoa.h>
-#include "postmac.h"
#include "vcl/sysdata.hxx"
#include "vcl/threadex.hxx"
#include "vcl/timer.hxx"
#include "osl/module.h"
+#ifdef __OBJC__
+@class NSView;
+#else
+class NSView;
+#endif
+
class XPlugin_Impl;
namespace plugstringhelper
@@ -150,20 +153,6 @@ private:
std::list< XPlugin_Impl* > m_aNullEventClients;
};
-struct SysPlugData
-{
- MacPluginComm::NP_CGContext m_aCGContext;
- NP_Port m_aNPPort;
- NSView* m_pParentView;
- NSView* m_pPlugView;
- int m_nDrawingModel;
- NSPoint m_aLastPlugViewOrigin;
- bool m_bSetWindowOnDraw;
-};
-
-
-
#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx
index 6b1ce4a134f5..4ba1b9a3d512 100644
--- a/extensions/source/plugin/inc/plugin/impl.hxx
+++ b/extensions/source/plugin/inc/plugin/impl.hxx
@@ -25,13 +25,15 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef __PLUGIN_SOURCE_MGR_IMPL_HXX
-#define __PLUGIN_SOURCE_MGR_IMPL_HXX
+#ifndef PLUGIN_SOURCE_MGR_IMPL_HXX
+#define PLUGIN_SOURCE_MGR_IMPL_HXX
#ifdef SOLARIS
#include <limits>
#endif
+#include <boost/shared_ptr.hpp>
+
#include "cppuhelper/weak.hxx"
#include "com/sun/star/awt/Key.hpp"
@@ -81,10 +83,17 @@
#include "plugin/unx/sysplug.hxx"
#endif
-#if ! defined (QUARTZ)
-// the QUARTZ implementation needs special instance data
-typedef int SysPlugData;
-#endif
+struct SysPlugData;
+
+::boost::shared_ptr<SysPlugData> CreateSysPlugData();
+
+extern "C" {
+
+void /*SAL_CALL NP_LOADDS*/ NPN_ForceRedraw_Impl(NPP instance);
+NPError /*SAL_CALL NP_LOADDS*/ NPN_SetValue_Impl( NPP instance,
+ NPPVariable variable,
+ void* value );
+} // extern "C"
#include "plugin/plctrl.hxx"
#include "plugin/model.hxx"
@@ -123,7 +132,7 @@ private:
PluginComm* m_pPluginComm;
NPP_t m_aInstance;
NPWindow m_aNPWindow;
- SysPlugData m_aSysPlugData;
+ ::boost::shared_ptr<SysPlugData> m_pSysPlugData;
rtl_TextEncoding m_aEncoding;
const char** m_pArgv;
@@ -147,6 +156,10 @@ private:
sal_Bool m_bIsDisposed;
+#ifdef QUARTZ
+ void SetSysPlugDataParentView(SystemEnvData* pEnvData);
+#endif
+
void prependArg( const char* pName, const char* pValue ); // arguments will be strdup'ed
void initArgs( const Sequence< rtl::OUString >& argn,
const Sequence< rtl::OUString >& argv,
@@ -186,7 +199,7 @@ public:
rtl_TextEncoding getTextEncoding() { return m_aEncoding; }
NPP getNPPInstance() { return &m_aInstance; }
NPWindow* getNPWindow() { return &m_aNPWindow; }
- SysPlugData& getSysPlugData() { return m_aSysPlugData; }
+ SysPlugData& getSysPlugData() { return *m_pSysPlugData; }
void enterPluginCallback() { m_nCalledFromPlugin++; }
void leavePluginCallback() { m_nCalledFromPlugin--; }
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
index 8a2d24078ad0..24968feed942 100644
--- a/extensions/source/plugin/unx/sysplug.cxx
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -44,6 +44,12 @@
#include <plugin/impl.hxx>
+
+::boost::shared_ptr<SysPlugData> CreateSysPlugData()
+{
+ return ::boost::shared_ptr<SysPlugData>();
+}
+
int UnxPluginComm::nConnCounter = 0;
UnxPluginComm::UnxPluginComm(
diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx
index c60242e6b5fd..b44671924e43 100644
--- a/extensions/source/plugin/win/sysplug.cxx
+++ b/extensions/source/plugin/win/sysplug.cxx
@@ -63,6 +63,10 @@ void TRACEN( char const * s, long n );
#define TRACEN(x,n)
#endif
+::boost::shared_ptr<SysPlugData> CreateSysPlugData()
+{
+ return ::boost::shared_ptr<SysPlugData>();
+}
//--------------------------------------------------------------------------------------------------
PluginComm_Impl::PluginComm_Impl( const OUString& /*rMIME*/, const OUString& rName, HWND /*hWnd*/ )