merge the formfield patch from ooo-build
[ooovba.git] / vcl / unx / inc / plugins / gtk / gtkinst.hxx
blob4be77697b4b98484569a8288c9d56e4061d3600e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gtkinst.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _VCL_GTKINST_HXX
32 #define _VCL_GTKINST_HXX
34 #include <salinst.h>
35 #include <salsys.h>
37 class GtkYieldMutex : public SalYieldMutex
39 public:
40 GtkYieldMutex();
41 virtual void acquire();
42 virtual void release();
43 virtual sal_Bool tryToAcquire();
45 virtual int Grab();
46 virtual void Ungrab( int );
48 class GtkYieldGuard
50 GtkYieldMutex* m_pMutex;
51 int m_nGrab;
52 public:
53 GtkYieldGuard( GtkYieldMutex* pMutex )
54 : m_pMutex( pMutex )
56 m_nGrab = m_pMutex->Grab();
58 ~GtkYieldGuard()
60 m_pMutex->Ungrab( m_nGrab );
65 class GtkHookedYieldMutex : public GtkYieldMutex
67 virtual int Grab() { return 0; };
68 virtual void Ungrab(int ) {};
69 std::list<ULONG> aYieldStack;
70 public:
71 GtkHookedYieldMutex();
72 virtual void acquire();
73 virtual void release();
74 virtual sal_Bool tryToAcquire() { return SalYieldMutex::tryToAcquire(); }
75 void ThreadsEnter();
76 void ThreadsLeave();
80 #define GTK_YIELD_GRAB() GtkYieldMutex::GtkYieldGuard aLocalGtkYieldGuard( static_cast<GtkYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex()) )
82 class GtkInstance : public X11SalInstance
84 public:
85 GtkInstance( SalYieldMutex* pMutex )
86 : X11SalInstance( pMutex )
88 virtual ~GtkInstance();
90 virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
91 virtual SalFrame* CreateChildFrame( SystemParentData* pParent, ULONG nStyle );
92 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, BOOL bShow = TRUE );
93 virtual SalSystem* CreateSalSystem();
94 virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
97 class GtkSalSystem : public X11SalSystem
99 public:
100 GtkSalSystem() : X11SalSystem() {}
101 virtual ~GtkSalSystem();
102 virtual int ShowNativeDialog( const String& rTitle,
103 const String& rMessage,
104 const std::list< String >& rButtons,
105 int nDefButton );
108 #endif // _VCL_GTKINST_HXX