1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <string_view>
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/ucb/XCommandEnvironment.hpp>
30 #include <dp_misc_api.hxx>
38 inline void try_dispose( css::uno::Reference
< css::uno::XInterface
> const & x
)
40 css::uno::Reference
< css::lang::XComponent
> xComp( x
, css::uno::UNO_QUERY
);
48 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
49 OUString
expandUnoRcTerm( OUString
const & term
);
51 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
52 OUString
makeRcTerm( OUString
const & url
);
55 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
56 OUString
expandUnoRcUrl( OUString
const & url
);
60 /** appends a relative path to a url.
62 The relative path must already be correctly encoded for use in a URL.
63 If the URL starts with vnd.sun.star.expand then the relative path will
64 be again encoded for use in an "expand" URL.
66 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString
makeURL(
67 std::u16string_view baseURL
, OUString
const & relPath
);
70 /** appends a relative path to a url.
72 This is the same as makeURL, but the relative Path must me a segment
75 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString
makeURLAppendSysPathSegment(
76 std::u16string_view baseURL
, OUString
const & relPath
);
79 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString
generateRandomPipeId();
83 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
84 css::uno::Reference
< css::uno::XInterface
> resolveUnoURL(
85 OUString
const & connectString
,
86 css::uno::Reference
< css::uno::XComponentContext
> const & xLocalContext
,
87 AbortChannel
const * abortChannel
= nullptr );
90 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool office_is_running();
93 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
94 oslProcess
raiseProcess( OUString
const & appURL
,
95 css::uno::Sequence
< OUString
> const & args
);
99 /** writes the argument string to the console.
100 It converts the UTF16 string to an ANSI string using osl_getThreadTextEncoding()
103 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
104 void writeConsole(std::u16string_view sText
);
106 /** writes the argument to the console using the error stream.
107 Otherwise the same as writeConsole.
109 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
110 void writeConsoleError(std::u16string_view sText
);
113 /** reads from the console.
114 It uses fgets to read char values and converts them to OUString using
115 osl_getThreadTextEncoding as target encoding. The returned string has a maximum size of
116 1024 and does NOT include leading and trailing white space(applied OUString::trim())
118 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
119 OUString
readConsole();
121 /** print the text to the console in a debug build.
122 The argument is forwarded to writeConsole. The function does not add new line.
123 The code is only executed if OSL_DEBUG_LEVEL > 1
125 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
126 void TRACE(OUString
const & sText
);
128 /** registers or revokes shared or bundled extensions which have been
129 recently added or removed.
131 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
132 void syncRepositories(
135 css::ucb::XCommandEnvironment
> const & xCmdEnv
);
137 /** workaround: for some reason the bridge threads which communicate with the
138 uno.exe process are not released on time
140 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
142 css::uno::Reference
< css::uno::XComponentContext
>
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */