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 <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 namespace dp_misc {
36 
37 const sal_Char CR = 0x0d;
38 const sal_Char LF = 0x0a;
39 
40 
42 {
43  mutable ::osl::Mutex m_mutex;
44 protected:
45  ::osl::Mutex & getMutex() const { return m_mutex; }
46 };
47 
48 
49 inline void try_dispose( css::uno::Reference< css::uno::XInterface> const & x )
50 {
51  css::uno::Reference< css::lang::XComponent> xComp( x, css::uno::UNO_QUERY );
52  if (xComp.is())
53  xComp->dispose();
54 }
55 
56 
57 
58 
60 OUString expandUnoRcTerm( OUString const & term );
61 
63 OUString makeRcTerm( OUString const & url );
64 
65 
67 OUString expandUnoRcUrl( OUString const & url );
68 
69 
70 
78  OUString const & baseURL, OUString const & relPath );
79 
80 
87  OUString const & baseURL, OUString const & relPath );
88 
89 
91 
92 class AbortChannel;
93 
95 css::uno::Reference< css::uno::XInterface> resolveUnoURL(
96  OUString const & connectString,
97  css::uno::Reference< css::uno::XComponentContext> const & xLocalContext,
98  AbortChannel const * abortChannel = nullptr );
99 
100 
102 
103 
105 oslProcess raiseProcess( OUString const & appURL,
106  css::uno::Sequence< OUString > const & args );
107 
108 
109 
117 void writeConsole(OUString const & sText);
118 
123 void writeConsoleError(OUString const & sText);
124 
125 
132 OUString readConsole();
133 
139 void TRACE(OUString const & sText);
140 
145 void syncRepositories(
146  bool force,
147  css::uno::Reference<
148  css::ucb::XCommandEnvironment> const & xCmdEnv);
149 
154 void disposeBridges(
155  css::uno::Reference< css::uno::XComponentContext >
156  const & ctx);
157 
158 }
159 
160 #endif
161 
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::osl::Mutex & getMutex() const
Definition: dp_misc.h:45
OUString generateRandomPipeId()
Definition: dp_misc.cxx:422
OUString expandUnoRcTerm(OUString const &term_)
Definition: dp_misc.cxx:307
const sal_Char LF
Definition: dp_misc.h:38
bool office_is_running()
Definition: dp_misc.cxx:348
void syncRepositories(bool force, Reference< ucb::XCommandEnvironment > const &xCmdEnv)
Definition: dp_misc.cxx:532
OUString makeURL(OUString const &baseURL, OUString const &relPath_)
appends a relative path to a url.
Definition: dp_misc.cxx:266
OUString makeURLAppendSysPathSegment(OUString const &baseURL, OUString const &segment)
appends a relative path to a url.
Definition: dp_misc.cxx:296
Reference< XInterface > resolveUnoURL(OUString const &connectString, Reference< XComponentContext > const &xLocalContext, AbortChannel const *abortChannel)
Definition: dp_misc.cxx:441
char sal_Char
void writeConsole(OUString const &sText)
writes the argument string to the console.
Definition: dp_misc.cxx:484
#define DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
Definition: dp_misc_api.hxx:29
const sal_Char CR
Definition: dp_misc.h:37
oslProcess raiseProcess(OUString const &appURL, Sequence< OUString > const &args)
Definition: dp_misc.cxx:386
OUString makeRcTerm(OUString const &url)
Definition: dp_misc.cxx:314
OUString expandUnoRcUrl(OUString const &url)
Definition: dp_misc.cxx:330
void writeConsoleError(OUString const &sText)
writes the argument to the console using the error stream.
Definition: dp_misc.cxx:493
void TRACE(OUString const &sText)
print the text to the console in a debug build.
Definition: dp_misc.cxx:527
void try_dispose(css::uno::Reference< css::uno::XInterface > const &x)
Definition: dp_misc.h:49
mutable::osl::Mutex m_mutex
Definition: dp_misc.h:43
void disposeBridges(Reference< css::uno::XComponentContext > const &ctx)
Definition: dp_misc.cxx:569
OUString readConsole()
reads from the console.
Definition: dp_misc.cxx:502