bump product version to 4.1.6.2
[LibreOffice.git] / vcl / inc / cupsmgr.hxx
blob9a84b7790889e10149ae8e1710900ed8489833f3
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 _PSPRINT_CUPSMGR_HXX_
21 #define _PSPRINT_CUPSMGR_HXX_
23 #include "vcl/printerinfomanager.hxx"
24 #include "osl/module.h"
25 #include "osl/thread.h"
26 #include "osl/mutex.hxx"
28 namespace psp
31 class PPDParser;
33 struct FPtrHash
35 size_t operator()(const FILE* pPtr) const
36 { return (size_t)pPtr; }
39 class CUPSManager : public PrinterInfoManager
41 boost::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles;
42 int m_nDests;
43 void* m_pDests;
44 bool m_bNewDests;
45 boost::unordered_map< OUString, int, OUStringHash > m_aCUPSDestMap;
47 boost::unordered_map< OUString, PPDContext, OUStringHash > m_aDefaultContexts;
49 OString m_aUser;
50 // this is a security risk, but the CUPS API demands
51 // to deliver a pointer to a static buffer containing
52 // the password, so this cannot be helped
53 OString m_aPassword;
55 osl::Mutex m_aCUPSMutex;
56 oslThread m_aDestThread;
58 osl::Mutex m_aGetPPDMutex;
59 bool m_bPPDThreadRunning;
61 CUPSManager();
62 virtual ~CUPSManager();
64 virtual void initialize();
66 void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const;
67 void runDests();
68 OString threadedCupsGetPPD(const char* pPrinter);
69 public:
70 // public for stub
71 static void runDestThread(void* pMgr);
73 static CUPSManager* tryLoadCUPS();
75 const PPDParser* createCUPSParser( const OUString& rPrinter );
76 // wraps cupsGetPPD, so unlink after use !
78 const char* authenticateUser( const char* );
80 virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand );
81 virtual int endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner );
82 virtual void setupJobContextData( JobData& rData );
84 // changes the info about a named printer
85 virtual void changePrinterInfo( const OUString& rPrinter, const PrinterInfo& rNewInfo );
87 // check if the printer configuration has changed
88 virtual bool checkPrintersChanged( bool bWait );
90 // members for administration (->padmin)
91 // disable for CUPS
92 virtual bool addPrinter( const OUString& rPrinterName, const OUString& rDriverName );
93 virtual bool removePrinter( const OUString& rPrinterName, bool bCheckOnly = false );
94 virtual bool writePrinterConfig();
95 virtual bool setDefaultPrinter( const OUString& rPrinterName );
97 virtual bool addOrRemovePossible() const;
100 } // namespace psp
102 #endif
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */