Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / unx / kde4 / KDEXLib.hxx
blob0a1aec3f7ea0bb13bad7557d66e6a675e27c4136
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 <unx/saldisp.hxx>
24 #include <fixx11h.h>
26 #include <qhash.h>
27 #include <qsocketnotifier.h>
28 #include <qtimer.h>
30 #include <unx/salinst.h>
32 class VCLKDEApplication;
34 class KDEXLib : public QObject, public SalXLib
36 Q_OBJECT
37 private:
38 bool m_bStartupDone;
39 VCLKDEApplication* m_pApplication;
40 char** m_pFreeCmdLineArgs;
41 char** m_pAppCmdLineArgs;
42 int m_nFakeCmdLineArgs;
43 struct SocketData
45 void* data;
46 YieldFunc pending;
47 YieldFunc queued;
48 YieldFunc handle;
49 QSocketNotifier* notifier;
51 QHash< int, SocketData > socketData; // key is fd
52 QTimer timeoutTimer;
53 QTimer userEventTimer;
54 int m_frameWidth;
55 bool m_isGlibEventLoopType;
56 bool m_allowKdeDialogs;
57 bool blockIdleTimeout;
59 private:
60 void setupEventLoop();
62 private Q_SLOTS:
63 void socketNotifierActivated( int fd );
64 void timeoutActivated();
65 void userEventActivated();
66 void startTimeoutTimer();
67 void startUserEventTimer();
68 void processYield( bool bWait, bool bHandleAllCurrentEvents );
69 Q_SIGNALS:
70 void startTimeoutTimerSignal();
71 void startUserEventTimerSignal();
72 void processYieldSignal( bool bWait, bool bHandleAllCurrentEvents );
73 com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
74 createFilePickerSignal( const com::sun::star::uno::Reference<
75 com::sun::star::uno::XComponentContext >& );
76 int getFrameWidthSignal();
78 public:
79 KDEXLib();
80 virtual ~KDEXLib();
82 virtual void Init() SAL_OVERRIDE;
83 virtual void Yield( bool bWait, bool bHandleAllCurrentEvents ) SAL_OVERRIDE;
84 virtual void Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle ) SAL_OVERRIDE;
85 virtual void Remove( int fd ) SAL_OVERRIDE;
86 virtual void StartTimer( sal_uLong nMS ) SAL_OVERRIDE;
87 virtual void StopTimer() SAL_OVERRIDE;
88 virtual void Wakeup() SAL_OVERRIDE;
89 virtual void PostUserEvent() SAL_OVERRIDE;
91 void doStartup();
92 bool allowKdeDialogs() { return m_allowKdeDialogs; }
94 public Q_SLOTS:
95 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 >& );
98 int getFrameWidth();
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */