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 #ifndef INCLUDED_DESKTOP_INC_DP_MISC_H
21 #define INCLUDED_DESKTOP_INC_DP_MISC_H
22 
23 #include <osl/mutex.hxx>
24 #include <osl/process.h>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
28 #include <dp_misc_api.hxx>
29 
30 namespace dp_misc {
31 
32 const char CR = 0x0d;
33 const char LF = 0x0a;
34 
35 
37 {
38  mutable ::osl::Mutex m_mutex;
39 protected:
40  ::osl::Mutex & getMutex() const { return m_mutex; }
41 };
42 
43 
44 inline void try_dispose( css::uno::Reference< css::uno::XInterface> const & x )
45 {
46  css::uno::Reference< css::lang::XComponent> xComp( x, css::uno::UNO_QUERY );
47  if (xComp.is())
48  xComp->dispose();
49 }
50 
51 
52 
53 
55 OUString expandUnoRcTerm( OUString const & term );
56 
58 OUString makeRcTerm( OUString const & url );
59 
60 
62 OUString expandUnoRcUrl( OUString const & url );
63 
64 
65 
73  OUString const & baseURL, OUString const & relPath );
74 
75 
82  OUString const & baseURL, OUString const & relPath );
83 
84 
86 
87 class AbortChannel;
88 
90 css::uno::Reference< css::uno::XInterface> resolveUnoURL(
91  OUString const & connectString,
92  css::uno::Reference< css::uno::XComponentContext> const & xLocalContext,
93  AbortChannel const * abortChannel = nullptr );
94 
95 
97 
98 
100 oslProcess raiseProcess( OUString const & appURL,
101  css::uno::Sequence< OUString > const & args );
102 
103 
104 
110 void writeConsole(OUString const & sText);
111 
116 void writeConsoleError(OUString const & sText);
117 
118 
125 OUString readConsole();
126 
132 void TRACE(OUString const & sText);
133 
138 void syncRepositories(
139  bool force,
140  css::uno::Reference<
141  css::ucb::XCommandEnvironment> const & xCmdEnv);
142 
147 void disposeBridges(
148  css::uno::Reference< css::uno::XComponentContext >
149  const & ctx);
150 
151 }
152 
153 #endif
154 
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::osl::Mutex & getMutex() const
Definition: dp_misc.h:40
OUString generateRandomPipeId()
Definition: dp_misc.cxx:412
OUString expandUnoRcTerm(OUString const &term_)
Definition: dp_misc.cxx:292
bool office_is_running()
Definition: dp_misc.cxx:333
void syncRepositories(bool force, Reference< ucb::XCommandEnvironment > const &xCmdEnv)
Definition: dp_misc.cxx:493
OUString makeURL(OUString const &baseURL, OUString const &relPath_)
appends a relative path to a url.
Definition: dp_misc.cxx:251
OUString makeURLAppendSysPathSegment(OUString const &baseURL, OUString const &segment)
appends a relative path to a url.
Definition: dp_misc.cxx:281
Reference< XInterface > resolveUnoURL(OUString const &connectString, Reference< XComponentContext > const &xLocalContext, AbortChannel const *abortChannel)
Definition: dp_misc.cxx:431
void writeConsole(OUString const &sText)
writes the argument string to the console.
Definition: dp_misc.cxx:465
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:29
oslProcess raiseProcess(OUString const &appURL, Sequence< OUString > const &args)
Definition: dp_misc.cxx:376
OUString makeRcTerm(OUString const &url)
Definition: dp_misc.cxx:299
OUString expandUnoRcUrl(OUString const &url)
Definition: dp_misc.cxx:315
void writeConsoleError(OUString const &sText)
writes the argument to the console using the error stream.
Definition: dp_misc.cxx:470
void TRACE(OUString const &sText)
print the text to the console in a debug build.
Definition: dp_misc.cxx:488
void try_dispose(css::uno::Reference< css::uno::XInterface > const &x)
Definition: dp_misc.h:44
mutable::osl::Mutex m_mutex
Definition: dp_misc.h:38
const char LF
Definition: dp_misc.h:33
void disposeBridges(Reference< css::uno::XComponentContext > const &ctx)
Definition: dp_misc.cxx:530
const char CR
Definition: dp_misc.h:32
OUString readConsole()
reads from the console.
Definition: dp_misc.cxx:475