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_WIN_SALINST_H
21 #define INCLUDED_VCL_INC_WIN_SALINST_H
22 
23 #include <sal/config.h>
24 
25 #include <osl/conditn.hxx>
26 
27 #include <salinst.hxx>
28 
29 class SalYieldMutex;
30 
31 class WinSalInstance : public SalInstance
32 {
33 public:
34     /// Instance Handle
35     HINSTANCE           mhInst;
36     /// invisible Window so non-main threads can SendMessage() the main thread
37     HWND                mhComWnd;
38 
39     osl::Condition      maWaitingYieldCond;
40     unsigned            m_nNoYieldLock;
41 
42 public:
43     WinSalInstance();
44     virtual ~WinSalInstance() override;
45 
46     virtual SalFrame*       CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
47     virtual SalFrame*       CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
48     virtual void            DestroyFrame( SalFrame* pFrame ) override;
49     virtual SalObject*      CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override;
50     virtual void            DestroyObject( SalObject* pObject ) override;
51     virtual std::unique_ptr<SalVirtualDevice>
52                             CreateVirtualDevice( SalGraphics& rGraphics,
53                                                      tools::Long &nDX, tools::Long &nDY,
54                                                      DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
55     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
56                                                ImplJobSetup* pSetupData ) override;
57     virtual void            DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override;
58     virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override;
59     virtual void            GetPrinterQueueInfo( ImplPrnQueueList* pList ) override;
60     virtual void            GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override;
61     virtual OUString            GetDefaultPrinter() override;
62     virtual SalTimer*           CreateSalTimer() override;
63     virtual SalSystem*          CreateSalSystem() override;
64     virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
65     virtual bool                IsMainThread() const override;
66 
67     virtual bool                DoYield(bool bWait, bool bHandleAllCurrentEvents) override;
68     virtual bool                AnyInput( VclInputFlags nType ) override;
69     virtual std::unique_ptr<SalMenu>     CreateMenu( bool bMenuBar, Menu* ) override;
70     virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams & rItemData ) override;
71     virtual OpenGLContext*      CreateOpenGLContext() override;
72     virtual OUString            GetConnectionIdentifier() override;
73     virtual void                AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override;
74 
75     virtual OUString            getOSVersion() override;
76     virtual void BeforeAbort(const OUString&, bool) override;
77 
78     static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo);
79 };
80 
81 SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND hWndParent, SalFrameStyleFlags nSalFrameStyle );
82 SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent );
83 HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, bool bAsChild );
84 
85 #endif // INCLUDED_VCL_INC_WIN_SALINST_H
86 
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
88