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 : : #ifndef _SV_GENERIC_INST_H
29 : : #define _SV_GENERIC_INST_H
30 : :
31 : : #include <tools/solar.h>
32 : : #include <osl/thread.hxx>
33 : : #include <vclpluginapi.h>
34 : : #include <vcl/solarmutex.hxx>
35 : : #include <salinst.hxx>
36 : : #include <saldatabasic.hxx>
37 : : #include <generic/genprn.h>
38 : :
39 : : class VCL_DLLPUBLIC SalYieldMutexReleaser
40 : : {
41 : : sal_uLong m_nYieldCount;
42 : : public:
43 : : inline SalYieldMutexReleaser();
44 : : inline ~SalYieldMutexReleaser();
45 : : };
46 : :
47 : 0 : inline SalYieldMutexReleaser::SalYieldMutexReleaser()
48 : : {
49 : 0 : m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
50 : 0 : }
51 : :
52 : 0 : inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
53 : : {
54 : 0 : GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
55 : 0 : }
56 : :
57 : : class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject
58 : : {
59 : : protected:
60 : : sal_uIntPtr mnCount;
61 : : oslThreadIdentifier mnThreadId;
62 : :
63 : : public:
64 : : SalYieldMutex();
65 : : ~SalYieldMutex();
66 : :
67 : : virtual void acquire();
68 : : virtual void release();
69 : : virtual sal_Bool tryToAcquire();
70 : :
71 : 392126 : virtual sal_uIntPtr GetAcquireCount() const { return mnCount; }
72 : 392126 : oslThreadIdentifier GetThreadId() const { return mnThreadId; }
73 : : };
74 : :
75 : : /*
76 : : * Abstract generic class to build vclplugin's instance classes from
77 : : */
78 : : class GenPspGraphics;
79 : : class ImplDevFontList;
80 : : class VCL_DLLPUBLIC SalGenericInstance : public SalInstance
81 : : {
82 : : protected:
83 : : bool mbPrinterInit;
84 : : SalYieldMutex *mpSalYieldMutex;
85 : :
86 : : public:
87 : 266 : SalGenericInstance( SalYieldMutex* pMutex )
88 : 266 : : mbPrinterInit( false ), mpSalYieldMutex( pMutex ) {}
89 : : virtual ~SalGenericInstance();
90 : :
91 : : // Yield mutex
92 : : virtual osl::SolarMutex* GetYieldMutex();
93 : : virtual sal_uIntPtr ReleaseYieldMutex();
94 : : virtual void AcquireYieldMutex( sal_uIntPtr nCount );
95 : : virtual bool CheckYieldMutex();
96 : :
97 : : // Printing
98 : : virtual SalInfoPrinter* CreateInfoPrinter ( SalPrinterQueueInfo* pQueueInfo,
99 : : ImplJobSetup* pSetupData );
100 : : virtual void DestroyInfoPrinter ( SalInfoPrinter* pPrinter );
101 : : virtual SalPrinter* CreatePrinter ( SalInfoPrinter* pInfoPrinter );
102 : : virtual void DestroyPrinter ( SalPrinter* pPrinter );
103 : : virtual void GetPrinterQueueInfo ( ImplPrnQueueList* pList );
104 : : virtual void GetPrinterQueueState ( SalPrinterQueueInfo* pInfo );
105 : : virtual void DeletePrinterQueueInfo ( SalPrinterQueueInfo* pInfo );
106 : : virtual rtl::OUString GetDefaultPrinter();
107 : : virtual void PostPrintersChanged() = 0;
108 : : virtual void updatePrinterUpdate();
109 : : virtual void jobStartedPrinterUpdate();
110 : : virtual void jobEndedPrinterUpdate();
111 : 0 : bool isPrinterInit() const { return mbPrinterInit; }
112 : : virtual GenPspGraphics *CreatePrintGraphics() = 0;
113 : :
114 : : // prolly belongs somewhere else ... just a font help
115 : : static void RegisterFontSubstitutors( ImplDevFontList* pList );
116 : : static int FetchFontSubstitutionFlags();
117 : :
118 : : protected:
119 : : void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
120 : : SalPrinterQueueInfo* pQueueInfo,
121 : : ImplJobSetup* pSetupData );
122 : : };
123 : :
124 : 112 : inline SalGenericInstance *GetGenericInstance()
125 : : {
126 : 112 : return static_cast<SalGenericInstance *>(GetSalData()->m_pInstance);
127 : : }
128 : :
129 : : #endif // _SV_GENERIC_INST_H
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|