Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVP_SALINST_HXX
30 : : #define _SVP_SALINST_HXX
31 : :
32 : : #include <vcl/solarmutex.hxx>
33 : :
34 : : #include <osl/mutex.hxx>
35 : : #include <osl/thread.hxx>
36 : : #include <salinst.hxx>
37 : : #include <salwtype.hxx>
38 : : #include <saltimer.hxx>
39 : : #include <generic/geninst.h>
40 : : #include <generic/genprn.h>
41 : :
42 : : #include <list>
43 : :
44 : : #include <time.h> // timeval
45 : :
46 : : #define VIRTUAL_DESKTOP_WIDTH 1024
47 : : #define VIRTUAL_DESKTOP_HEIGHT 768
48 : :
49 : : // ---------------
50 : : // - SalTimer -
51 : : // ---------------
52 : : class SvpSalInstance;
53 : : class SvpSalTimer : public SalTimer
54 : : {
55 : : SvpSalInstance* m_pInstance;
56 : : public:
57 : 233 : SvpSalTimer( SvpSalInstance* pInstance ) : m_pInstance( pInstance ) {}
58 : : virtual ~SvpSalTimer();
59 : :
60 : : // overload all pure virtual methods
61 : : virtual void Start( sal_uLong nMS );
62 : : virtual void Stop();
63 : : };
64 : :
65 : : // ---------------
66 : : // - SalInstance -
67 : : // ---------------
68 : : class SvpSalFrame;
69 : : class GenPspGraphics;
70 : : class SvpSalInstance : public SalGenericInstance
71 : : {
72 : : timeval m_aTimeout;
73 : : sal_uLong m_nTimeoutMS;
74 : : int m_pTimeoutFDS[2];
75 : :
76 : : // internal event queue
77 : : struct SalUserEvent
78 : : {
79 : : const SalFrame* m_pFrame;
80 : : void* m_pData;
81 : : sal_uInt16 m_nEvent;
82 : :
83 : 41676 : SalUserEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent = SALEVENT_USEREVENT )
84 : : : m_pFrame( pFrame ),
85 : : m_pData( pData ),
86 : 41676 : m_nEvent( nEvent )
87 : 41676 : {}
88 : : };
89 : :
90 : : oslMutex m_aEventGuard;
91 : : std::list< SalUserEvent > m_aUserEvents;
92 : :
93 : : std::list< SalFrame* > m_aFrames;
94 : :
95 : : bool isFrameAlive( const SalFrame* pFrame ) const;
96 : :
97 : : protected:
98 : : virtual void DoReleaseYield( int nTimeoutMS );
99 : :
100 : : public:
101 : : static SvpSalInstance* s_pDefaultInstance;
102 : :
103 : : SvpSalInstance( SalYieldMutex *pMutex );
104 : : virtual ~SvpSalInstance();
105 : :
106 : : void PostEvent( const SalFrame* pFrame, void* pData, sal_uInt16 nEvent );
107 : :
108 : : void StartTimer( sal_uLong nMS );
109 : : void StopTimer();
110 : : void Wakeup();
111 : :
112 : 5988 : void registerFrame( SalFrame* pFrame ) { m_aFrames.push_back( pFrame ); }
113 : : void deregisterFrame( SalFrame* pFrame );
114 : 42 : const std::list< SalFrame* >& getFrames() const { return m_aFrames; }
115 : :
116 : : bool CheckTimeout( bool bExecuteTimers = true );
117 : :
118 : : // Frame
119 : : virtual SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
120 : : virtual SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
121 : : virtual void DestroyFrame( SalFrame* pFrame );
122 : :
123 : : // Object (System Child Window)
124 : : virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
125 : : virtual void DestroyObject( SalObject* pObject );
126 : :
127 : : // VirtualDevice
128 : : // nDX and nDY in Pixel
129 : : // nBitCount: 0 == Default(=as window) / 1 == Mono
130 : : // pData allows for using a system dependent graphics or device context
131 : : virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
132 : : long nDX, long nDY,
133 : : sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL );
134 : : virtual void DestroyVirtualDevice( SalVirtualDevice* pDevice );
135 : :
136 : : // Printer
137 : : // pSetupData->mpDriverData can be 0
138 : : // pSetupData must be updatet with the current
139 : : // JobSetup
140 : : virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
141 : : ImplJobSetup* pSetupData );
142 : : virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter );
143 : : virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter );
144 : : virtual void DestroyPrinter( SalPrinter* pPrinter );
145 : :
146 : : virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList );
147 : : virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo );
148 : : virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
149 : : virtual rtl::OUString GetDefaultPrinter();
150 : : virtual void PostPrintersChanged();
151 : :
152 : : // SalTimer
153 : : virtual SalTimer* CreateSalTimer();
154 : : // SalI18NImeStatus
155 : : virtual SalI18NImeStatus* CreateI18NImeStatus();
156 : : // SalSystem
157 : : virtual SalSystem* CreateSalSystem();
158 : : // SalBitmap
159 : : virtual SalBitmap* CreateSalBitmap();
160 : :
161 : : // wait next event and dispatch
162 : : // must returned by UserEvent (SalFrame::PostEvent)
163 : : // and timer
164 : : virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
165 : : virtual bool AnyInput( sal_uInt16 nType );
166 : :
167 : : // may return NULL to disable session management
168 : : virtual SalSession* CreateSalSession();
169 : :
170 : : virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
171 : :
172 : : virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
173 : :
174 : : virtual GenPspGraphics *CreatePrintGraphics();
175 : : };
176 : :
177 : : #endif // _SV_SALINST_HXX
178 : :
179 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|