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

Generated by: LCOV version 1.11