Use 'gb_Library_set_include' for GTK3_CFLAGS
[LibreOffice.git] / vcl / unx / kde4 / KDEXLib.hxx
blob452aae8b3286f9c31399c19150a3fd22ce7e57c1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <memory>
24 #include <unx/saldisp.hxx>
26 #include <fixx11h.h>
28 #include <QtCore/QHash>
29 #include <QtCore/QSocketNotifier>
30 #include <QtCore/QTimer>
32 #include <unx/salinst.h>
33 #include <osl/conditn.hxx>
35 class VCLKDEApplication;
37 class KDEXLib : public QObject, public SalXLib
39 Q_OBJECT
41 bool m_bStartupDone;
42 std::unique_ptr<VCLKDEApplication> m_pApplication;
43 std::unique_ptr<char*[]> m_pFreeCmdLineArgs;
44 std::unique_ptr<char*[]> m_pAppCmdLineArgs;
45 int m_nFakeCmdLineArgs;
46 struct SocketData
48 void* data;
49 YieldFunc pending;
50 YieldFunc queued;
51 YieldFunc handle;
52 QSocketNotifier* notifier;
54 QHash< int, SocketData > socketData; // key is fd
55 QTimer timeoutTimer;
56 bool m_isGlibEventLoopType;
57 bool m_allowKdeDialogs;
58 int m_timerEventId;
59 int m_postUserEventId;
60 osl::Condition m_aWaitingYieldCond;
61 bool m_bTimedOut;
63 void setupEventLoop();
65 private Q_SLOTS:
66 void socketNotifierActivated( int fd );
67 void timeoutActivated();
68 void startTimeoutTimer();
69 bool processYield( bool bWait, bool bHandleAllCurrentEvents );
71 Q_SIGNALS:
72 void startTimeoutTimerSignal();
73 bool processYieldSignal( bool bWait, bool bHandleAllCurrentEvents );
74 css::uno::Reference< css::ui::dialogs::XFilePicker2 >
75 createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >& );
77 public:
78 KDEXLib();
79 virtual ~KDEXLib() override;
81 virtual void Init() override;
82 virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ) override;
83 virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) override;
84 virtual void Remove( int fd ) override;
85 virtual void StartTimer( sal_uLong nMS ) override;
86 virtual void StopTimer() override;
87 virtual bool CheckTimeout( bool bExecuteTimers = true ) override;
88 virtual void Wakeup() override;
89 void TriggerUserEventProcessing();
91 void doStartup();
92 bool allowKdeDialogs() { return m_allowKdeDialogs; }
94 virtual void customEvent(QEvent* e) override;
96 public Q_SLOTS:
97 css::uno::Reference< css::ui::dialogs::XFilePicker2 >
98 createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& );
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */