fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / jvmfwk / source / fwkutil.hxx
blob0411869f8b72a04008cbcfa7950413a97fbc19ea
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 .
19 #ifndef INCLUDED_JVMFWK_FWKUTIL_HXX
20 #define INCLUDED_JVMFWK_FWKUTIL_HXX
22 #include "sal/config.h"
23 #include "osl/mutex.hxx"
24 #include "rtl/bootstrap.hxx"
25 #include "rtl/instance.hxx"
26 #include "rtl/ustrbuf.hxx"
27 #include "rtl/byteseq.hxx"
28 #include "osl/thread.hxx"
29 #if OSL_DEBUG_LEVEL >=2
30 #include <stdio.h>
31 #endif
34 namespace jfw
37 /** Returns the file URL of the directory where the framework library
38 (this library) resides.
40 OUString getLibraryLocation();
42 /** provides a bootstrap class which already knows the values from the
43 jvmfkwrc file.
45 struct Bootstrap :
46 public ::rtl::StaticWithInit< const rtl::Bootstrap *, Bootstrap > {
47 const rtl::Bootstrap * operator () () {
48 OUStringBuffer buf(256);
49 buf.append(getLibraryLocation());
50 buf.appendAscii(SAL_CONFIGFILE("/jvmfwk3"));
51 OUString sIni = buf.makeStringAndClear();
52 ::rtl::Bootstrap * bootstrap = new ::rtl::Bootstrap(sIni);
53 #if OSL_DEBUG_LEVEL >=2
54 OString o = OUStringToOString( sIni , osl_getThreadTextEncoding() );
55 fprintf(stderr, "[Java framework] Using configuration file %s\n" , o.getStr() );
56 #endif
57 return bootstrap;
61 struct FwkMutex: public ::rtl::Static<osl::Mutex, FwkMutex> {};
63 rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData);
64 rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data);
66 OUString getPlatform();
69 OUString getDirFromFile(const OUString& usFilePath);
71 /** Returns the file URL of the folder where the executable resides.
73 OUString getExecutableDirectory();
74 /** Locates the plugin library and returns the file URL.
76 First tries to locate plugin relative to baseUrl (if relative);
77 vnd.sun.star.expand URLs are supported. If that fails, tries to
78 locate plugin relative to the executable. If that fails, and plugin
79 contains no slashes, tries to locate plugin in a platform-specific way
80 (e.g., LD_LIBRARY_PATH).
82 @param baseUrl
83 The base file URL relative to which the plugin argument is interpreted.
85 @param plugin
86 The argument is an absolute or relative URL or just the name of the plugin.
88 OUString findPlugin(
89 const OUString & baseUrl, const OUString & plugin);
92 enum FileStatus
94 FILE_OK,
95 FILE_DOES_NOT_EXIST,
96 FILE_INVALID
99 /** checks if the URL is a file.
101 If it is a link to a file than
102 it is resolved. Assuming that the argument
103 represents a relative URL then FILE_INVALID
104 is returned.
107 @return
108 one of the values of FileStatus.
110 @exception
111 Errors occurred during determining if the file exists
113 FileStatus checkFileURL(const OUString & path);
115 bool isAccessibilitySupportDesired();
117 OUString buildClassPathFromDirectory(const OUString & relPath);
119 OUString retrieveClassPath( OUString const & macro );
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */