LCOV - code coverage report
Current view: top level - vcl/inc - cupsmgr.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_CUPSMGR_HXX
      21             : #define INCLUDED_VCL_INC_CUPSMGR_HXX
      22             : 
      23             : #include "vcl/printerinfomanager.hxx"
      24             : #include "osl/module.h"
      25             : #include "osl/thread.h"
      26             : #include "osl/mutex.hxx"
      27             : 
      28             : namespace psp
      29             : {
      30             : 
      31             : class PPDParser;
      32             : 
      33             : struct FPtrHash
      34             : {
      35           0 :     size_t operator()(const FILE* pPtr) const
      36           0 :     { return reinterpret_cast<size_t>(pPtr); }
      37             : };
      38             : 
      39             : class CUPSManager : public PrinterInfoManager
      40             : {
      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;
      46             : 
      47             :     boost::unordered_map< OUString, PPDContext, OUStringHash > m_aDefaultContexts;
      48             : 
      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;
      54             : 
      55             :     osl::Mutex                                                  m_aCUPSMutex;
      56             :     oslThread                                                   m_aDestThread;
      57             : 
      58             :     osl::Mutex                                                  m_aGetPPDMutex;
      59             :     bool                                                        m_bPPDThreadRunning;
      60             : 
      61             :     CUPSManager();
      62             :     virtual ~CUPSManager();
      63             : 
      64             :     virtual void initialize() SAL_OVERRIDE;
      65             : 
      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             :     static void runDestThread(void* pMgr);
      71             : 
      72             :     static CUPSManager* tryLoadCUPS();
      73             : 
      74             :     /// wraps cupsGetPPD, so unlink after use !
      75             :     const PPDParser* createCUPSParser( const OUString& rPrinter );
      76             : 
      77             :     const char* authenticateUser( const char* );
      78             : 
      79             :     virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand ) SAL_OVERRIDE;
      80             :     virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString& rFaxNumber ) SAL_OVERRIDE;
      81             :     virtual void setupJobContextData( JobData& rData ) SAL_OVERRIDE;
      82             : 
      83             :     /// changes the info about a named printer
      84             :     virtual void changePrinterInfo( const OUString& rPrinter, const PrinterInfo& rNewInfo ) SAL_OVERRIDE;
      85             : 
      86             :     /// check if the printer configuration has changed
      87             :     virtual bool checkPrintersChanged( bool bWait ) SAL_OVERRIDE;
      88             : 
      89             :     // members for administration
      90             :     // disable for CUPS
      91             :     virtual bool addPrinter( const OUString& rPrinterName, const OUString& rDriverName ) SAL_OVERRIDE;
      92             :     virtual bool removePrinter( const OUString& rPrinterName, bool bCheckOnly = false ) SAL_OVERRIDE;
      93             :     virtual bool writePrinterConfig() SAL_OVERRIDE;
      94             :     virtual bool setDefaultPrinter( const OUString& rPrinterName ) SAL_OVERRIDE;
      95             : };
      96             : 
      97             : } // namespace psp
      98             : 
      99             : #endif
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10