vml whitespace-check mangled Částečně to ste n
[LibreOffice.git] / desktop / inc / dp_misc.h
blob0d9eadb90cb3bf18a207d5d1950706832401c19b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <string_view>
26 #include <osl/mutex.hxx>
27 #include <osl/process.h>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
31 #include <dp_misc_api.hxx>
33 namespace dp_misc {
35 const char CR = 0x0d;
36 const char LF = 0x0a;
39 class MutexHolder
41 mutable ::osl::Mutex m_mutex;
42 protected:
43 ::osl::Mutex & getMutex() const { return m_mutex; }
47 inline void try_dispose( css::uno::Reference< css::uno::XInterface> const & x )
49 css::uno::Reference< css::lang::XComponent> xComp( x, css::uno::UNO_QUERY );
50 if (xComp.is())
51 xComp->dispose();
57 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
58 OUString expandUnoRcTerm( OUString const & term );
60 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
61 OUString makeRcTerm( OUString const & url );
64 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
65 OUString expandUnoRcUrl( OUString const & url );
69 /** appends a relative path to a url.
71 The relative path must already be correctly encoded for use in a URL.
72 If the URL starts with vnd.sun.star.expand then the relative path will
73 be again encoded for use in an "expand" URL.
75 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString makeURL(
76 OUString const & baseURL, OUString const & relPath );
79 /** appends a relative path to a url.
81 This is the same as makeURL, but the relative Path must me a segment
82 of an system path.
84 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString makeURLAppendSysPathSegment(
85 OUString const & baseURL, OUString const & relPath );
88 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString generateRandomPipeId();
90 class AbortChannel;
92 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
93 css::uno::Reference< css::uno::XInterface> resolveUnoURL(
94 OUString const & connectString,
95 css::uno::Reference< css::uno::XComponentContext> const & xLocalContext,
96 AbortChannel const * abortChannel = nullptr );
99 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool office_is_running();
102 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
103 oslProcess raiseProcess( OUString const & appURL,
104 css::uno::Sequence< OUString > const & args );
108 /** writes the argument string to the console.
109 It converts the UTF16 string to an ANSI string using osl_getThreadTextEncoding()
110 as target encoding.
112 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
113 void writeConsole(std::u16string_view sText);
115 /** writes the argument to the console using the error stream.
116 Otherwise the same as writeConsole.
118 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
119 void writeConsoleError(std::u16string_view sText);
122 /** reads from the console.
123 It uses fgets to read char values and converts them to OUString using
124 osl_getThreadTextEncoding as target encoding. The returned string has a maximum size of
125 1024 and does NOT include leading and trailing white space(applied OUString::trim())
127 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
128 OUString readConsole();
130 /** print the text to the console in a debug build.
131 The argument is forwarded to writeConsole. The function does not add new line.
132 The code is only executed if OSL_DEBUG_LEVEL > 1
134 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
135 void TRACE(OUString const & sText);
137 /** registers or revokes shared or bundled extensions which have been
138 recently added or removed.
140 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
141 void syncRepositories(
142 bool force,
143 css::uno::Reference<
144 css::ucb::XCommandEnvironment> const & xCmdEnv);
146 /** workaround: for some reason the bridge threads which communicate with the
147 uno.exe process are not released on time
149 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
150 void disposeBridges(
151 css::uno::Reference< css::uno::XComponentContext >
152 const & ctx);
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */