Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
21 : #define INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
22 :
23 : #include <boost/shared_ptr.hpp>
24 :
25 : #include <unx/salinst.h>
26 : #include <generic/gensys.h>
27 : #include <headless/svpinst.hxx>
28 : #include <gtk/gtk.h>
29 :
30 : namespace vcl
31 : {
32 : namespace unx
33 : {
34 : class GtkPrintWrapper;
35 : }
36 : }
37 :
38 : class GenPspGraphics;
39 0 : class GtkYieldMutex : public SalYieldMutex
40 : {
41 : std::list<sal_uLong> aYieldStack;
42 :
43 : public:
44 : GtkYieldMutex();
45 : virtual void acquire() SAL_OVERRIDE;
46 : virtual void release() SAL_OVERRIDE;
47 :
48 : void ThreadsEnter();
49 : void ThreadsLeave();
50 : };
51 :
52 : class GtkSalTimer;
53 : #if GTK_CHECK_VERSION(3,0,0)
54 : class GtkInstance : public SvpSalInstance
55 : #else
56 : class GtkInstance : public X11SalInstance
57 : #endif
58 : {
59 : #if GTK_CHECK_VERSION(3,0,0)
60 : typedef SvpSalInstance Superclass_t;
61 : #else
62 : typedef X11SalInstance Superclass_t;
63 : #endif
64 : public:
65 : GtkInstance( SalYieldMutex* pMutex );
66 : virtual ~GtkInstance();
67 : void EnsureInit();
68 : virtual void AfterAppInit() SAL_OVERRIDE;
69 :
70 : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
71 : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
72 : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
73 : virtual SalSystem* CreateSalSystem() SAL_OVERRIDE;
74 : virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) SAL_OVERRIDE;
75 : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
76 : virtual SalMenu* CreateMenu( bool, Menu* ) SAL_OVERRIDE;
77 : virtual void DestroyMenu( SalMenu* pMenu ) SAL_OVERRIDE;
78 : virtual SalMenuItem* CreateMenuItem( const SalItemParams* ) SAL_OVERRIDE;
79 : virtual void DestroyMenuItem( SalMenuItem* pItem ) SAL_OVERRIDE;
80 : virtual SalTimer* CreateSalTimer() SAL_OVERRIDE;
81 : virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE;
82 : virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics*,
83 : long nDX, long nDY,
84 : sal_uInt16 nBitCount,
85 : const SystemGraphicsData* ) SAL_OVERRIDE;
86 : virtual SalBitmap* CreateSalBitmap() SAL_OVERRIDE;
87 :
88 : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
89 : virtual bool AnyInput( sal_uInt16 nType ) SAL_OVERRIDE;
90 :
91 : virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE;
92 :
93 0 : virtual bool hasNativeFileSelection() const SAL_OVERRIDE { return true; }
94 :
95 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
96 : createFilePicker( const com::sun::star::uno::Reference<
97 : com::sun::star::uno::XComponentContext >& ) SAL_OVERRIDE;
98 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
99 : createFolderPicker( const com::sun::star::uno::Reference<
100 : com::sun::star::uno::XComponentContext >& ) SAL_OVERRIDE;
101 :
102 : void RemoveTimer (SalTimer *pTimer);
103 :
104 : // for managing a mirror of the in-flight un-dispatched gdk event queue
105 : void addEvent( sal_uInt16 nMask );
106 : void subtractEvent( sal_uInt16 nMask );
107 :
108 : boost::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
109 :
110 : private:
111 : std::vector<GtkSalTimer *> m_aTimers;
112 : bool IsTimerExpired();
113 : bool bNeedsInit;
114 :
115 : mutable boost::shared_ptr<vcl::unx::GtkPrintWrapper> m_pPrintWrapper;
116 : };
117 :
118 : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|