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 <unx/salinst.h>
24 : #include <generic/gensys.h>
25 : #include <headless/svpinst.hxx>
26 : #include <gtk/gtk.h>
27 :
28 : namespace vcl
29 : {
30 : namespace unx
31 : {
32 : class GtkPrintWrapper;
33 : }
34 : }
35 :
36 : class GenPspGraphics;
37 2 : class GtkYieldMutex : public SalYieldMutex
38 : {
39 : std::list<sal_uLong> aYieldStack;
40 :
41 : public:
42 3 : GtkYieldMutex() {}
43 : void ThreadsEnter();
44 : void ThreadsLeave();
45 : };
46 :
47 : class GtkSalTimer;
48 : #if GTK_CHECK_VERSION(3,0,0)
49 : class GtkInstance : public SvpSalInstance
50 : #else
51 : class GtkInstance : public X11SalInstance
52 : #endif
53 : {
54 : #if GTK_CHECK_VERSION(3,0,0)
55 : typedef SvpSalInstance Superclass_t;
56 : #else
57 : typedef X11SalInstance Superclass_t;
58 : #endif
59 : public:
60 : GtkInstance( SalYieldMutex* pMutex );
61 : virtual ~GtkInstance();
62 : void EnsureInit();
63 : virtual void AfterAppInit() SAL_OVERRIDE;
64 :
65 : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
66 : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) SAL_OVERRIDE;
67 : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
68 : virtual SalSystem* CreateSalSystem() SAL_OVERRIDE;
69 : virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) SAL_OVERRIDE;
70 : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) SAL_OVERRIDE;
71 : virtual SalMenu* CreateMenu( bool, Menu* ) SAL_OVERRIDE;
72 : virtual void DestroyMenu( SalMenu* pMenu ) SAL_OVERRIDE;
73 : virtual SalMenuItem* CreateMenuItem( const SalItemParams* ) SAL_OVERRIDE;
74 : virtual void DestroyMenuItem( SalMenuItem* pItem ) SAL_OVERRIDE;
75 : virtual SalTimer* CreateSalTimer() SAL_OVERRIDE;
76 : virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) SAL_OVERRIDE;
77 : virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics*,
78 : long &nDX, long &nDY,
79 : sal_uInt16 nBitCount,
80 : const SystemGraphicsData* ) SAL_OVERRIDE;
81 : virtual SalBitmap* CreateSalBitmap() SAL_OVERRIDE;
82 :
83 : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
84 : virtual bool AnyInput( VclInputFlags nType ) SAL_OVERRIDE;
85 :
86 : virtual GenPspGraphics *CreatePrintGraphics() SAL_OVERRIDE;
87 :
88 0 : virtual bool hasNativeFileSelection() const SAL_OVERRIDE { return true; }
89 :
90 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
91 : createFilePicker( const com::sun::star::uno::Reference<
92 : com::sun::star::uno::XComponentContext >& ) SAL_OVERRIDE;
93 : virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFolderPicker2 >
94 : createFolderPicker( const com::sun::star::uno::Reference<
95 : com::sun::star::uno::XComponentContext >& ) SAL_OVERRIDE;
96 :
97 : void RemoveTimer (SalTimer *pTimer);
98 :
99 : // for managing a mirror of the in-flight un-dispatched gdk event queue
100 : void addEvent( sal_uInt16 nMask );
101 : void subtractEvent( sal_uInt16 nMask );
102 :
103 : std::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
104 :
105 : private:
106 : std::vector<GtkSalTimer *> m_aTimers;
107 : bool IsTimerExpired();
108 : bool bNeedsInit;
109 :
110 : mutable std::shared_ptr<vcl::unx::GtkPrintWrapper> m_xPrintWrapper;
111 : };
112 :
113 : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|