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

Generated by: LCOV version 1.10