LCOV - code coverage report
Current view: top level - desktop/source/deployment/inc - dp_misc.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 8 62.5 %

           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 INCLUDED_DP_MISC_H
      30                 :            : #define INCLUDED_DP_MISC_H
      31                 :            : 
      32                 :            : #include "rtl/ustrbuf.hxx"
      33                 :            : #include "rtl/instance.hxx"
      34                 :            : #include "osl/mutex.hxx"
      35                 :            : #include "osl/process.h"
      36                 :            : #include "com/sun/star/uno/XComponentContext.hpp"
      37                 :            : #include "com/sun/star/lang/XComponent.hpp"
      38                 :            : #include "com/sun/star/lang/DisposedException.hpp"
      39                 :            : #include "com/sun/star/deployment/XPackageRegistry.hpp"
      40                 :            : #include "com/sun/star/ucb/XCommandEnvironment.hpp"
      41                 :            : #include "com/sun/star/awt/XWindow.hpp"
      42                 :            : #include "dp_misc_api.hxx"
      43                 :            : 
      44                 :            : #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
      45                 :            : #define ARLEN(x) (sizeof (x) / sizeof *(x))
      46                 :            : 
      47                 :            : namespace dp_misc {
      48                 :            : 
      49                 :            : const sal_Char CR = 0x0d;
      50                 :            : const sal_Char LF = 0x0a;
      51                 :            : 
      52                 :            : //==============================================================================
      53                 :      20760 : class MutexHolder
      54                 :            : {
      55                 :            :     mutable ::osl::Mutex m_mutex;
      56                 :            : protected:
      57                 :     104374 :     inline ::osl::Mutex & getMutex() const { return m_mutex; }
      58                 :            : };
      59                 :            : 
      60                 :            : //==============================================================================
      61                 :       8762 : inline void try_dispose( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> const & x )
      62                 :            : {
      63         [ +  - ]:       8762 :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xComp( x, ::com::sun::star::uno::UNO_QUERY );
      64         [ +  + ]:       8762 :     if (xComp.is())
      65 [ +  - ][ +  - ]:       8762 :         xComp->dispose();
      66                 :       8762 : }
      67                 :            : 
      68                 :            : //##############################################################################
      69                 :            : 
      70                 :            : //==============================================================================
      71                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
      72                 :            : ::rtl::OUString expandUnoRcTerm( ::rtl::OUString const & term );
      73                 :            : 
      74                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
      75                 :            : ::rtl::OUString makeRcTerm( ::rtl::OUString const & url );
      76                 :            : 
      77                 :            : //==============================================================================
      78                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
      79                 :            : ::rtl::OUString expandUnoRcUrl( ::rtl::OUString const & url );
      80                 :            : 
      81                 :            : //==============================================================================
      82                 :            : 
      83                 :            : /** appends a relative path to a url.
      84                 :            : 
      85                 :            :     The relative path must already be correctly encoded for use in an URL.
      86                 :            :     If the URL starts with vnd.sun.star.expand then the relative path will
      87                 :            :     be again encoded for use in an "expand" URL.
      88                 :            :  */
      89                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURL(
      90                 :            :     ::rtl::OUString const & baseURL, ::rtl::OUString const & relPath );
      91                 :            : 
      92                 :            : 
      93                 :            : /** appends a relative path to a url.
      94                 :            : 
      95                 :            :     This is the same as makeURL, but the relative Path must me a segment
      96                 :            :     of an system path.
      97                 :            :  */
      98                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString makeURLAppendSysPathSegment(
      99                 :            :     ::rtl::OUString const & baseURL, ::rtl::OUString const & relPath );
     100                 :            : 
     101                 :            : //==============================================================================
     102                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString generateRandomPipeId();
     103                 :            : 
     104                 :            : class AbortChannel;
     105                 :            : //==============================================================================
     106                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     107                 :            : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> resolveUnoURL(
     108                 :            :     ::rtl::OUString const & connectString,
     109                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xLocalContext,
     110                 :            :     AbortChannel * abortChannel = 0 );
     111                 :            : 
     112                 :            : //==============================================================================
     113                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool office_is_running();
     114                 :            : 
     115                 :            : //==============================================================================
     116                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     117                 :            : oslProcess raiseProcess( ::rtl::OUString const & appURL,
     118                 :            :                          ::com::sun::star::uno::Sequence< ::rtl::OUString > const & args );
     119                 :            : 
     120                 :            : //==============================================================================
     121                 :            : 
     122                 :            : /** writes the argument string to the console.
     123                 :            :     On Linux/Unix/etc. it converts the UTF16 string to an ANSI string using
     124                 :            :     osl_getThreadTextEncoding() as target encoding. On Windows it uses WriteFile
     125                 :            :     with the standard out stream. unopkg.com reads the data and prints them out using
     126                 :            :     WriteConsoleW.
     127                 :            : */
     128                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     129                 :            : void writeConsole(::rtl::OUString const & sText);
     130                 :            : 
     131                 :            : /** writes the argument to the console using the error stream.
     132                 :            :     Otherwise the same as writeConsole.
     133                 :            : */
     134                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     135                 :            : void writeConsoleError(::rtl::OUString const & sText);
     136                 :            : 
     137                 :            : 
     138                 :            : /** reads from the console.
     139                 :            :     On Linux/Unix/etc. it uses fgets to read char values and converts them to OUString
     140                 :            :     using osl_getThreadTextEncoding as target encoding. The returned string has a maximum
     141                 :            :     size of 1024 and does NOT include leading and trailing white space(applied OUString::trim())
     142                 :            : */
     143                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     144                 :            : ::rtl::OUString readConsole();
     145                 :            : 
     146                 :            : /** print the text to the console in a debug build.
     147                 :            :     The argument is forwarded to writeConsole. The function does not add new line.
     148                 :            :     The code is only executed if  OSL_DEBUG_LEVEL > 1
     149                 :            : */
     150                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     151                 :            : void TRACE(::rtl::OUString const & sText);
     152                 :            : 
     153                 :            : /** registers or revokes shared or bundled extensions which have been
     154                 :            :     recently added or removed.
     155                 :            : */
     156                 :            : DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
     157                 :            : void syncRepositories(::com::sun::star::uno::Reference<
     158                 :            :                       ::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv);
     159                 :            : 
     160                 :            : }
     161                 :            : 
     162                 :            : #endif
     163                 :            : 
     164                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10