1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_IDLE_DETECTION_HXX
25cdf0e10cSrcweir #define SD_IDLE_DETECTION_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/types.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class Window;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace sd { namespace tools {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /** Detect whether the system is idle and some time consuming operation may
34cdf0e10cSrcweir     be carried out.  This class ditinguishes between different states of
35cdf0e10cSrcweir     idle-ness.
36cdf0e10cSrcweir */
37cdf0e10cSrcweir class IdleDetection
38cdf0e10cSrcweir {
39cdf0e10cSrcweir public:
40cdf0e10cSrcweir     /** When GetIdleState() returns this value, then the system is idle.
41cdf0e10cSrcweir     */
42cdf0e10cSrcweir     static const sal_Int32 IDET_IDLE = 0x0000;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     /** There are system event pending.
45cdf0e10cSrcweir     */
46cdf0e10cSrcweir     static const sal_Int32 IDET_SYSTEM_EVENT_PENDING = 0x0001;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     /** A full screen slide show is running and is active.  In contrast
49cdf0e10cSrcweir         there may be a full screen show be running in an inactive window,
50cdf0e10cSrcweir         i.e. in the background.
51cdf0e10cSrcweir     */
52cdf0e10cSrcweir     static const sal_Int32 IDET_FULL_SCREEN_SHOW_ACTIVE = 0x0002;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     /** A slide show is running in a window.
55cdf0e10cSrcweir     */
56cdf0e10cSrcweir     static const sal_Int32 IDET_WINDOW_SHOW_ACTIVE = 0x0004;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     /** A window is being painted.
59cdf0e10cSrcweir     */
60cdf0e10cSrcweir     static const sal_Int32 IDET_WINDOW_PAINTING = 0x0008;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     /** Determine whether the system is idle.
63cdf0e10cSrcweir         @param pWindow
64cdf0e10cSrcweir             When a valid Window pointer is given then it is checked
65cdf0e10cSrcweir             whether the window is currently being painting.
66cdf0e10cSrcweir         @return
67cdf0e10cSrcweir             This method either returns IDET_IDLE or a combination of
68cdf0e10cSrcweir             IdleStates values or-ed together that describe what the system
69cdf0e10cSrcweir             is currently doing so that the caller can decide what to do.
70cdf0e10cSrcweir     */
71cdf0e10cSrcweir     static sal_Int32 GetIdleState (const ::Window* pWindow = NULL);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir     /** Check whether there are input events pending.
75cdf0e10cSrcweir     */
76cdf0e10cSrcweir     static sal_Int32 CheckInputPending (void);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     /** Check whether a slide show is running full screen or in a window.
79cdf0e10cSrcweir     */
80cdf0e10cSrcweir     static sal_Int32 CheckSlideShowRunning (void);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     static sal_Int32 CheckWindowPainting (const ::Window& rWindow);
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir } } // end of namespace ::sd::tools
86cdf0e10cSrcweir 
87cdf0e10cSrcweir #endif
88