LibreOffice Module desktop (master)  1
dp_misc.h
Go to the documentation of this file.
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 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <string_view>
25 
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>
31 
32 namespace dp_misc {
33 
34 const char CR = 0x0d;
35 const char LF = 0x0a;
36 
37 
38 inline void try_dispose( css::uno::Reference< css::uno::XInterface> const & x )
39 {
40  css::uno::Reference< css::lang::XComponent> xComp( x, css::uno::UNO_QUERY );
41  if (xComp.is())
42  xComp->dispose();
43 }
44 
45 
46 
47 
49 OUString expandUnoRcTerm( OUString const & term );
50 
52 OUString makeRcTerm( OUString const & url );
53 
54 
56 OUString expandUnoRcUrl( OUString const & url );
57 
58 
59 
67  OUString const & baseURL, OUString const & relPath );
68 
69 
76  OUString const & baseURL, OUString const & relPath );
77 
78 
80 
81 class AbortChannel;
82 
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 );
88 
89 
91 
92 
94 oslProcess raiseProcess( OUString const & appURL,
95  css::uno::Sequence< OUString > const & args );
96 
97 
98 
104 void writeConsole(std::u16string_view sText);
105 
110 void writeConsoleError(std::u16string_view sText);
111 
112 
119 OUString readConsole();
120 
126 void TRACE(OUString const & sText);
127 
132 void syncRepositories(
133  bool force,
134  css::uno::Reference<
135  css::ucb::XCommandEnvironment> const & xCmdEnv);
136 
141 void disposeBridges(
142  css::uno::Reference< css::uno::XComponentContext >
143  const & ctx);
144 
145 }
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString generateRandomPipeId()
Definition: dp_misc.cxx:411
OUString expandUnoRcTerm(OUString const &term_)
Definition: dp_misc.cxx:291
bool office_is_running()
Definition: dp_misc.cxx:332
void syncRepositories(bool force, Reference< ucb::XCommandEnvironment > const &xCmdEnv)
Definition: dp_misc.cxx:492
OUString makeURL(OUString const &baseURL, OUString const &relPath_)
appends a relative path to a url.
Definition: dp_misc.cxx:250
OUString makeURLAppendSysPathSegment(OUString const &baseURL, OUString const &segment)
appends a relative path to a url.
Definition: dp_misc.cxx:280
Reference< XInterface > resolveUnoURL(OUString const &connectString, Reference< XComponentContext > const &xLocalContext, AbortChannel const *abortChannel)
Definition: dp_misc.cxx:430
void writeConsoleError(std::u16string_view sText)
writes the argument to the console using the error stream.
Definition: dp_misc.cxx:469
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:28
void writeConsole(std::u16string_view sText)
writes the argument string to the console.
Definition: dp_misc.cxx:464
oslProcess raiseProcess(OUString const &appURL, Sequence< OUString > const &args)
Definition: dp_misc.cxx:375
OUString makeRcTerm(OUString const &url)
Definition: dp_misc.cxx:298
OUString expandUnoRcUrl(OUString const &url)
Definition: dp_misc.cxx:314
void TRACE(OUString const &sText)
print the text to the console in a debug build.
Definition: dp_misc.cxx:487
void try_dispose(css::uno::Reference< css::uno::XInterface > const &x)
Definition: dp_misc.h:38
const char LF
Definition: dp_misc.h:35
void disposeBridges(Reference< css::uno::XComponentContext > const &ctx)
Definition: dp_misc.cxx:529
const char CR
Definition: dp_misc.h:34
OUString readConsole()
reads from the console.
Definition: dp_misc.cxx:474