LCOV - code coverage report
Current view: top level - vcl/inc - cupsmgr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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                 :            : 
      29                 :            : #ifndef _PSPRINT_CUPSMGR_HXX_
      30                 :            : #define _PSPRINT_CUPSMGR_HXX_
      31                 :            : 
      32                 :            : #include "vcl/printerinfomanager.hxx"
      33                 :            : #include "osl/module.h"
      34                 :            : #include "osl/thread.h"
      35                 :            : #include "osl/mutex.hxx"
      36                 :            : 
      37                 :            : namespace psp
      38                 :            : {
      39                 :            : 
      40                 :            : class CUPSWrapper;
      41                 :            : class PPDParser;
      42                 :            : 
      43                 :            : struct FPtrHash
      44                 :            : {
      45                 :          0 :     size_t operator()(const FILE* pPtr) const
      46                 :          0 :     { return (size_t)pPtr; }
      47                 :            : };
      48                 :            : 
      49                 :            : class CUPSManager : public PrinterInfoManager
      50                 :            : {
      51                 :            :     CUPSWrapper*                                                m_pCUPSWrapper;
      52                 :            :     boost::unordered_map< FILE*, rtl::OString, FPtrHash >               m_aSpoolFiles;
      53                 :            :     int                                                         m_nDests;
      54                 :            :     void*                                                       m_pDests;
      55                 :            :     bool                                                        m_bNewDests;
      56                 :            :     boost::unordered_map< rtl::OUString, int, rtl::OUStringHash >       m_aCUPSDestMap;
      57                 :            : 
      58                 :            :     boost::unordered_map< rtl::OUString, PPDContext, rtl::OUStringHash > m_aDefaultContexts;
      59                 :            : 
      60                 :            :     rtl::OString                                                m_aUser;
      61                 :            :     // this is a security risk, but the CUPS API demands
      62                 :            :     // to deliver a pointer to a static buffer containing
      63                 :            :     // the password, so this cannot be helped
      64                 :            :     rtl::OString                                                m_aPassword;
      65                 :            : 
      66                 :            :     osl::Mutex                                                  m_aCUPSMutex;
      67                 :            :     oslThread                                                   m_aDestThread;
      68                 :            : 
      69                 :            :     CUPSManager( CUPSWrapper* );
      70                 :            :     virtual ~CUPSManager();
      71                 :            : 
      72                 :            :     virtual void initialize();
      73                 :            : 
      74                 :            :     void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const;
      75                 :            :     void runDests();
      76                 :            : public:
      77                 :            :     // public for stub
      78                 :            :     static void runDestThread(void* pMgr);
      79                 :            : 
      80                 :            :     static CUPSManager* tryLoadCUPS();
      81                 :            : 
      82                 :            :     const PPDParser* createCUPSParser( const rtl::OUString& rPrinter );
      83                 :            :     // wraps cupsGetPPD, so unlink after use !
      84                 :            : 
      85                 :            :     const char* authenticateUser( const char* );
      86                 :            : 
      87                 :            :     virtual FILE* startSpool( const rtl::OUString& rPrinterName, bool bQuickCommand );
      88                 :            :     virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner );
      89                 :            :     virtual void setupJobContextData( JobData& rData );
      90                 :            : 
      91                 :            :     // changes the info about a named printer
      92                 :            :     virtual void changePrinterInfo( const ::rtl::OUString& rPrinter, const PrinterInfo& rNewInfo );
      93                 :            : 
      94                 :            :     // check if the printer configuration has changed
      95                 :            :     virtual bool checkPrintersChanged( bool bWait );
      96                 :            : 
      97                 :            :     // members for administration (->padmin)
      98                 :            :     // disable for CUPS
      99                 :            :     virtual bool addPrinter( const rtl::OUString& rPrinterName, const ::rtl::OUString& rDriverName );
     100                 :            :     virtual bool removePrinter( const rtl::OUString& rPrinterName, bool bCheckOnly = false );
     101                 :            :     virtual bool writePrinterConfig();
     102                 :            :     virtual bool setDefaultPrinter( const rtl::OUString& rPrinterName );
     103                 :            : 
     104                 :            :     virtual bool addOrRemovePossible() const;
     105                 :            : };
     106                 :            : 
     107                 :            : } // namespace psp
     108                 :            : 
     109                 :            : #endif
     110                 :            : 
     111                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10