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_GENERIC_GENINST_H 21 #define INCLUDED_VCL_INC_GENERIC_GENINST_H 22 23 #include <memory> 24 #include <comphelper/solarmutex.hxx> 25 #include <salinst.hxx> 26 #include <saldatabasic.hxx> 27 #include <unx/genprn.h> 28 29 class VCL_DLLPUBLIC SalYieldMutex : public comphelper::SolarMutex 30 { 31 public: 32 SalYieldMutex(); 33 virtual ~SalYieldMutex() override; 34 }; 35 36 /* 37 * Abstract generic class to build vclplugin's instance classes from 38 */ 39 class GenPspGraphics; 40 class PhysicalFontCollection; 41 class VCL_DLLPUBLIC SalGenericInstance : public SalInstance 42 { 43 protected: 44 bool mbPrinterInit; 45 46 public: SalGenericInstance(std::unique_ptr<comphelper::SolarMutex> pMutex)47 SalGenericInstance( std::unique_ptr<comphelper::SolarMutex> pMutex ) 48 : SalInstance(std::move(pMutex)), mbPrinterInit(false) {} 49 virtual ~SalGenericInstance() override; 50 51 // Printing 52 virtual SalInfoPrinter* CreateInfoPrinter ( SalPrinterQueueInfo* pQueueInfo, 53 ImplJobSetup* pSetupData ) override; 54 virtual void DestroyInfoPrinter ( SalInfoPrinter* pPrinter ) override; 55 virtual std::unique_ptr<SalPrinter> CreatePrinter ( SalInfoPrinter* pInfoPrinter ) override; 56 virtual void GetPrinterQueueInfo ( ImplPrnQueueList* pList ) override; 57 virtual void GetPrinterQueueState ( SalPrinterQueueInfo* pInfo ) override; 58 virtual OUString GetDefaultPrinter() override; 59 virtual void PostPrintersChanged() = 0; 60 virtual void updatePrinterUpdate() override; 61 virtual void jobStartedPrinterUpdate() override; 62 virtual void jobEndedPrinterUpdate() override; isPrinterInit()63 bool isPrinterInit() const { return mbPrinterInit; } 64 virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() = 0; 65 66 virtual OUString getOSVersion() override; 67 68 // prolly belongs somewhere else ... just a font help 69 static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ); 70 71 protected: 72 static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter, 73 SalPrinterQueueInfo const * pQueueInfo, 74 ImplJobSetup* pSetupData ); 75 }; 76 GetGenericInstance()77inline SalGenericInstance *GetGenericInstance() 78 { 79 return static_cast<SalGenericInstance *>(GetSalData()->m_pInstance); 80 } 81 82 #endif // INCLUDED_VCL_INC_GENERIC_GENINST_H 83 84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 85