Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / generic / geninst.h
blob9e2b5ca4751234f108bb7dd56959bd0ee7fedfc5
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 #ifndef _SV_GENERIC_INST_H
21 #define _SV_GENERIC_INST_H
23 #include <tools/solar.h>
24 #include <osl/thread.hxx>
25 #include <vclpluginapi.h>
26 #include <vcl/solarmutex.hxx>
27 #include <salinst.hxx>
28 #include <saldatabasic.hxx>
29 #include <generic/genprn.h>
31 class VCL_DLLPUBLIC SalYieldMutexReleaser
33 sal_uLong m_nYieldCount;
34 public:
35 inline SalYieldMutexReleaser();
36 inline ~SalYieldMutexReleaser();
39 inline SalYieldMutexReleaser::SalYieldMutexReleaser()
41 m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
44 inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
46 GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
49 class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject
51 protected:
52 sal_uIntPtr mnCount;
53 oslThreadIdentifier mnThreadId;
55 public:
56 SalYieldMutex();
57 ~SalYieldMutex();
59 virtual void acquire();
60 virtual void release();
61 virtual sal_Bool tryToAcquire();
63 virtual sal_uIntPtr GetAcquireCount() const { return mnCount; }
64 oslThreadIdentifier GetThreadId() const { return mnThreadId; }
68 * Abstract generic class to build vclplugin's instance classes from
70 class GenPspGraphics;
71 class ImplDevFontList;
72 class VCL_DLLPUBLIC SalGenericInstance : public SalInstance
74 protected:
75 bool mbPrinterInit;
76 SalYieldMutex *mpSalYieldMutex;
78 public:
79 SalGenericInstance( SalYieldMutex* pMutex )
80 : mbPrinterInit( false ), mpSalYieldMutex( pMutex ) {}
81 virtual ~SalGenericInstance();
83 // Yield mutex
84 virtual osl::SolarMutex* GetYieldMutex();
85 virtual sal_uIntPtr ReleaseYieldMutex();
86 virtual void AcquireYieldMutex( sal_uIntPtr nCount );
87 virtual bool CheckYieldMutex();
89 // Printing
90 virtual SalInfoPrinter* CreateInfoPrinter ( SalPrinterQueueInfo* pQueueInfo,
91 ImplJobSetup* pSetupData );
92 virtual void DestroyInfoPrinter ( SalInfoPrinter* pPrinter );
93 virtual SalPrinter* CreatePrinter ( SalInfoPrinter* pInfoPrinter );
94 virtual void DestroyPrinter ( SalPrinter* pPrinter );
95 virtual void GetPrinterQueueInfo ( ImplPrnQueueList* pList );
96 virtual void GetPrinterQueueState ( SalPrinterQueueInfo* pInfo );
97 virtual void DeletePrinterQueueInfo ( SalPrinterQueueInfo* pInfo );
98 virtual rtl::OUString GetDefaultPrinter();
99 virtual void PostPrintersChanged() = 0;
100 virtual void updatePrinterUpdate();
101 virtual void jobStartedPrinterUpdate();
102 virtual void jobEndedPrinterUpdate();
103 bool isPrinterInit() const { return mbPrinterInit; }
104 virtual GenPspGraphics *CreatePrintGraphics() = 0;
106 // prolly belongs somewhere else ... just a font help
107 static void RegisterFontSubstitutors( ImplDevFontList* pList );
108 static int FetchFontSubstitutionFlags();
110 protected:
111 void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
112 SalPrinterQueueInfo* pQueueInfo,
113 ImplJobSetup* pSetupData );
116 inline SalGenericInstance *GetGenericInstance()
118 return static_cast<SalGenericInstance *>(GetSalData()->m_pInstance);
121 #endif // _SV_GENERIC_INST_H
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */