summaryrefslogtreecommitdiff
path: root/extensions/source/plugin/base/nfuncs.cxx
blob: f4164fd71a46dd03727718d052ab6ffac1bd6b6f (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_extensions.hxx"

#if STLPORT_VERSION>=321
#include <cstdarg>
#endif

#include <list>

#include <plugin/impl.hxx>
#include <vcl/svapp.hxx>

#if OSL_DEBUG_LEVEL > 1
#include <osl/thread.h>
#include <stdio.h>
static FILE * s_file = 0;
void TRACE( char const * s )
{
    if (! s_file)
        s_file = stderr;
    if (s_file)
    {
        oslThreadIdentifier t = osl_getThreadIdentifier(0);
        fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s\n", t, s );
        fflush( s_file );
    }
}
void TRACEN( char const * s, long n )
{
    if (! s_file)
        s_file = stderr;
    if (s_file)
    {
        oslThreadIdentifier t = osl_getThreadIdentifier(0);
        fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s%ld\n", t, s, n );
        fflush( s_file );
    }
}
void TRACES( char const* s, char const* s2 )
{
    if (! s_file)
        s_file = stderr;
    if (s_file)
    {
        oslThreadIdentifier t = osl_getThreadIdentifier(0);
        fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s %s\n", t, s, s2 );
        fflush( s_file );
    }
}
#else
#define TRACE(x)
#define TRACEN(x,n)
#define TRACES(x,s)
#endif

using namespace rtl;
using namespace com::sun::star::lang;

NPNetscapeFuncs aNPNFuncs =
{
    sizeof( NPNetscapeFuncs ),
    (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR,
    NPN_GetURL,
    NPN_PostURL,
    NPN_RequestRead,
    NPN_NewStream,
    NPN_Write,
    NPN_DestroyStream,
    NPN_Status,
    NPN_UserAgent,
    NPN_MemAlloc,
    NPN_MemFree,
    NPN_MemFlush,
    NPN_ReloadPlugins,
#ifdef OJI
    NPN_GetJavaEnv,
    NPN_GetJavaPeer,
#else
    0,
    0,
#endif
    NPN_GetURLNotify,
    NPN_PostURLNotify,
    NPN_GetValue,
    NPN_SetValue,
    NPN_InvalidateRect,
    NPN_InvalidateRegion,
    NPN_ForceRedraw
};

static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url )
{
    ::rtl::OString aLoadURL;
    if( url.indexOf( ":" ) == -1 )
    {
        aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() );
        int nPos;
        if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 )
        {
            if( url.getLength() && (url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1) )
            {
                // this means same server but new path
                nPos = aLoadURL.indexOf( '/', nPos+3 );

                if( nPos != -1 )
                    aLoadURL = aLoadURL.copy( 0, url.getStr()[0] == '/' ? nPos : nPos+1 );
            }
            else
            {
                // same server but new file
                nPos = aLoadURL.lastIndexOf( '/' );
                aLoadURL = aLoadURL.copy( 0, nPos+1 );
            }
            aLoadURL += url;
        }
        else
            aLoadURL = url;
    }
    else if( url.indexOf( ":/" ) != -1 )
        aLoadURL = url;

    return aLoadURL;
}

struct AsynchronousGetURL
{
    OUString                        aUrl;
    OUString                        aTarget;
    Reference< XEventListener >     xListener;

    DECL_LINK( getURL, XPlugin_Impl* );
};

IMPL_LINK( AsynchronousGetURL, getURL, XPlugin_Impl*, pImpl )
{
    try
    {
        pImpl->enterPluginCallback();
        if( xListener.is() )
            pImpl->getPluginContext()->
                getURLNotify( pImpl,
                              aUrl,
                              aTarget,
                              xListener );
        else
            pImpl->getPluginContext()->
                getURL( pImpl,
                        aUrl,
                        aTarget );
    }
    catch( ::com::sun::star::plugin::PluginException& e )
    {
        (void)e;
    }
    pImpl->leavePluginCallback();
    delete this;
    return 0;
}


extern "C" {

    void* SAL_CALL NP_LOADDS  NPN_MemAlloc( uint32 nBytes )
    {
        TRACE( "NPN_MemAlloc" );
        void* pMem = malloc( nBytes );
        return pMem;
    }

    void SAL_CALL NP_LOADDS  NPN_MemFree( void* pMem )
    {
        TRACE( "NPN_MemFree" );
        free( pMem );
    }

    uint32 SAL_CALL NP_LOADDS  NPN_MemFlush( uint32 /*nSize*/ )
    {
        TRACE( "NPN_MemFlush" );
        return 0;
    }

    NPError SAL_CALL NP_LOADDS  NPN_DestroyStream( NPP instance, NPStream* stream, NPError /*reason*/ )
    {
        TRACE( "NPN_DestroyStream" );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
        if( pStream )
        {
            if( pStream->getStreamType() == InputStream )
                static_cast<PluginInputStream*>(pStream)->releaseSelf();
            else
                delete pStream;
        }

        return NPERR_NO_ERROR;
    }

    #ifdef OJI
    const JRIEnvInterface** SAL_CALL NP_LOADDS  NPN_GetJavaEnv()
    {
        TRACE( "NPN_GetJavaEnv" );
        // no java in this program
        return NULL;
    }

    jref SAL_CALL NP_LOADDS  NPN_GetJavaPeer( NPP /*instance*/ )
    {
        TRACE( "NPN_GetJavaPeer" );
        return NULL;
    }
    #endif

    NPError SAL_CALL NP_LOADDS  NPN_GetURL( NPP instance, const char* url, const char* window )
    {
        TRACES( "NPN_GetURL", url );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        AsynchronousGetURL* pAsync = new AsynchronousGetURL();

        OString aLoadURL = normalizeURL( pImpl, url );
        TRACES( "NPN_GetURL", aLoadURL.getStr() );
        pAsync->aUrl = OStringToOUString( aLoadURL, pImpl->getTextEncoding() );
        pAsync->aTarget = OStringToOUString( window, pImpl->getTextEncoding() );
        pImpl->setLastGetUrl( aLoadURL );
        Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl );
        return NPERR_NO_ERROR;
    }

    NPError SAL_CALL NP_LOADDS  NPN_GetURLNotify( NPP instance, const char* url, const char* target,
                          void* notifyData )
    {
        TRACES( "NPN_GetURLNotify", url );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        OString aLoadURL = normalizeURL( pImpl, url );
        if( !aLoadURL.getLength() )
            return NPERR_INVALID_URL;

        AsynchronousGetURL* pAsync = new AsynchronousGetURL();
        PluginEventListener* pListener =
            new PluginEventListener( pImpl, url, aLoadURL.getStr(), notifyData );
        if( ! target || ! *target )
        {
            // stream will be fed back to plugin,
            // notify immediately after destruction of stream
            pImpl->addPluginEventListener( pListener );
            pListener = NULL;
        }
        pAsync->aUrl        = OStringToOUString( aLoadURL, pImpl->getTextEncoding() );
        pAsync->aTarget     = OStringToOUString( target, pImpl->getTextEncoding() );
        pAsync->xListener   = pListener;
        pImpl->setLastGetUrl( aLoadURL );
        Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl );

        return NPERR_NO_ERROR;
    }

    NPError SAL_CALL NP_LOADDS  NPN_NewStream( NPP instance, NPMIMEType type, const char* target,
                           NPStream** stream )
        // stream is a return value
    {
        TRACE( "NPN_NewStream" );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        PluginOutputStream* pStream = new PluginOutputStream( pImpl,
                                                              "", 0, 0 );
        *stream = pStream->getStream();

        try
        {
            pImpl->enterPluginCallback();
            pImpl->getPluginContext()->
                newStream(
                    pImpl,
                    ::rtl::OStringToOUString( type, pImpl->getTextEncoding () ),
                    ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
                    ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY )
                    );
            pImpl->leavePluginCallback();
        }
        catch( ::com::sun::star::plugin::PluginException& e )
        {
            pImpl->leavePluginCallback();
            return e.ErrorCode;
        }

        return NPERR_NO_ERROR;
    }

    NPError SAL_CALL NP_LOADDS  NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData )
    {
        TRACE( "NPN_PostURLNotify" );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );

        ::rtl::OString aPostURL = normalizeURL( pImpl, url );
        PluginEventListener* pListener =
            new PluginEventListener( pImpl, url, aPostURL.getStr(), notifyData );

        if( ! target || ! *target )
        {
            // stream will be fed back to plugin,
            // notify immediately after destruction of stream
            pImpl->addPluginEventListener( pListener );
            pListener = NULL;
        }

        try
        {
            pImpl->enterPluginCallback();
            pImpl->getPluginContext()->
                postURLNotify( pImpl,
                               ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
                               ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
                               Bytes,
                               file,
                               ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
            pImpl->leavePluginCallback();
        }
        catch( ::com::sun::star::plugin::PluginException& e )
        {
            pImpl->leavePluginCallback();
            return e.ErrorCode;
        }

        return NPERR_NO_ERROR;
    }

    NPError SAL_CALL NP_LOADDS  NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file )
    {
        TRACE( "NPN_PostURL" );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return NPERR_INVALID_INSTANCE_ERROR;

        ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
        ::rtl::OString aPostURL = normalizeURL( pImpl, url );
        try
        {
            pImpl->enterPluginCallback();
            pImpl->getPluginContext()->
                postURL( pImpl,
                         ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
                         ::rtl::OStringToOUString( window, pImpl->getTextEncoding () ),
                         Bytes,
                         file );
            pImpl->leavePluginCallback();
        }
        catch( ::com::sun::star::plugin::PluginException& e )
        {
            pImpl->leavePluginCallback();
            return e.ErrorCode;
        }

        return NPERR_NO_ERROR;
    }

    NPError SAL_CALL NP_LOADDS  NPN_RequestRead( NPStream* stream, NPByteRange* rangeList )
    {
        TRACE( "NPN_RequestRead" );
        if( ! rangeList )
            return NPERR_NO_ERROR;

        ::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
        ::std::list<XPlugin_Impl*>::iterator iter;
        XPlugin_Impl* pPlugin = NULL;
        PluginStream* pStream = NULL;
        for( iter = rList.begin(); iter!= rList.end(); ++iter )
        {
            pStream = (*iter)->getStreamFromNPStream( stream );
            if( pStream )
            {
                pPlugin = *iter;
                break;
            }
        }
        if( ! pPlugin )
            return NPERR_INVALID_INSTANCE_ERROR;
        if( ! pStream || pStream->getStreamType() != InputStream )
            return NPERR_FILE_NOT_FOUND;

        PluginInputStream* pInputStream = (PluginInputStream*)pStream;
        sal_Int8* pBytes = NULL;
        int   nBytes = 0;
        pPlugin->enterPluginCallback();
        while( rangeList )
        {
            if( pBytes && nBytes < (int)rangeList->length )
            {
                delete [] pBytes;
                pBytes = NULL;
            }
            if( ! pBytes )
                pBytes = new sal_Int8[ nBytes = rangeList->length ];
            int nRead =
                pInputStream->read( rangeList->offset, pBytes, rangeList->length );
            int nPos = 0;
            int nNow;
            do
            {
                nNow = pPlugin->getPluginComm()->
                    NPP_WriteReady( pPlugin->getNPPInstance(),
                                    stream );
                nNow = pPlugin->getPluginComm()->
                    NPP_Write( pPlugin->getNPPInstance(),
                               stream,
                               rangeList->offset + nPos,
                               nNow,
                               pBytes+nPos );
                nPos += nNow;
                nRead -= nNow;
            } while( nRead > 0 && nNow );
            rangeList = rangeList->next;
        }
        pPlugin->leavePluginCallback();

        return NPERR_NO_ERROR;
    }

    void SAL_CALL NP_LOADDS  NPN_Status( NPP instance, const char* message )
    {
        TRACE( "NPN_Status" );
        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( ! pImpl )
            return;

        try
        {
            pImpl->enterPluginCallback();
            pImpl->getPluginContext()->
                displayStatusText( pImpl, ::rtl::OStringToOUString( message, pImpl->getTextEncoding() ) );
            pImpl->leavePluginCallback();
        }
        catch( ::com::sun::star::plugin::PluginException& )
        {
            pImpl->leavePluginCallback();
            return;
        }
    }

    const char* SAL_CALL NP_LOADDS  NPN_UserAgent( NPP instance )
    {
        static char* pAgent = strdup( "Mozilla 3.0" );

        XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
        if( pImpl )
        {
            rtl::OUString UserAgent;
            try
            {
                pImpl->enterPluginCallback();
                UserAgent = pImpl->getPluginContext()->
                    getUserAgent( pImpl );
                pImpl->leavePluginCallback();
                if( pAgent )
                    free( pAgent );
                pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
            }
            catch( ::com::sun::star::plugin::PluginException& )
            {
                pImpl->leavePluginCallback();
            }
        }

        TRACES( "NPN_UserAgent: returning", pAgent );

        return pAgent;
    }

void SAL_CALL NP_LOADDS  NPN_Version( int* major, int* minor, int* net_major, int* net_minor )
{
    TRACE( "NPN_Version" );
    *major = 4;
    *minor = 0;
    *net_major = 4;
    *net_minor = 5;
}

int32 SAL_CALL NP_LOADDS  NPN_Write( NPP instance, NPStream* stream, int32 len,
                 void* buffer )
{
    TRACE( "NPN_Write" );
    XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
    if( ! pImpl )
        return 0;

    PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
    if( ! pStream || pStream->getStreamType() != OutputStream )
        return 0;

    pImpl->enterPluginCallback();
    ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buffer, len );
    ((PluginOutputStream*)pStream)->getOutputStream()->writeBytes( Bytes );
    pImpl->leavePluginCallback();

    return len;
}


NPError SAL_CALL NP_LOADDS  NPN_GetValue( NPP instance, NPNVariable variable, void* value )
{
    TRACEN( "NPN_GetValue: ", variable );
    XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );

    if( ! pImpl )
        return 0;

    NPError aResult( NPERR_NO_ERROR );

    switch( variable )
    {
        case NPNVxDisplay:
            // Unix only, handled in sysdep part
        case NPNVxtAppContext:
            // Unix only, handled in sysdep part
         default:
            aResult = NPERR_INVALID_PARAM;
            break;
        #ifdef QUARTZ
        case 2000: // NPNVsupportsQuickDrawBool
            *(NPBool*)value = false;
            break;
        case 2001: // NPNVsupportsCoreGraphicsBool
            *(NPBool*)value = true;
            break;
        #endif
        case NPNVjavascriptEnabledBool:
            // no javascript
            *(NPBool*)value = false;
            break;
        case NPNVasdEnabledBool:
            // no SmartUpdate
            *(NPBool*)value = false;
            break;
        case NPNVisOfflineBool:
            // no offline browsing
            *(NPBool*)value = false;
            break;
    }
    /*
    provisional code should there ever be NPNVariables that we actually
    want to query from the PluginContext
    ::rtl::OUString aValue;
    try
    {
        pImpl->enterPluginCallback();
        aValue = pImpl->getPluginContext()->
            getValue( pImpl, (::com::sun::star::plugin::PluginVariable)variable );
        pImpl->leavePluginCallback();
    }
    catch( ::com::sun::star::plugin::PluginException& e )
    {
        pImpl->leavePluginCallback();
        return e.ErrorCode;
    }
    */

    return aResult;
}

void SAL_CALL NP_LOADDS  NPN_ReloadPlugins(NPBool /*reloadPages*/)
{
    TRACE( "NPN_ReloadPlugins" );
}


NPError SAL_CALL NP_LOADDS  NPN_SetValue( NPP instance,
                                          NPPVariable variable,
                                          void* value )
{
    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
    (void)instance;
    (void)value;
    #endif
    return nError;
}

void SAL_CALL NP_LOADDS  NPN_InvalidateRect(NPP instance, NPRect* /*invalidRect*/)
{
    TRACE( "NPN_InvalidateRect" );

    #ifdef QUARTZ
    NPN_ForceRedraw( instance );
    #else
    (void)instance;
    #endif
}

void SAL_CALL NP_LOADDS  NPN_InvalidateRegion(NPP instance, NPRegion /*invalidRegion*/)
{
    TRACE( "NPN_InvalidateRegion" );

    #ifdef QUARTZ
    NPN_ForceRedraw( instance );
    #else
    (void)instance;
    #endif
}

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];
    }
    #else
    (void)instance;
    #endif
}

}