xref: /trunk/main/comphelper/source/officeinstdir/officeinstallationdirectories.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_OFFICEINSTALLATIONDIRECTORIES_HXX
25 #define INCLUDED_OFFICEINSTALLATIONDIRECTORIES_HXX
26 
27 #include "osl/mutex.hxx"
28 #include "cppuhelper/implbase2.hxx"
29 
30 #include "com/sun/star/lang/XServiceInfo.hpp"
31 #include "com/sun/star/uno/XComponentContext.hpp"
32 #include "com/sun/star/util/XOfficeInstallationDirectories.hpp"
33 
34 namespace comphelper {
35 
36 //=========================================================================
37 
38 typedef cppu::WeakImplHelper2<
39             com::sun::star::util::XOfficeInstallationDirectories,
40             com::sun::star::lang::XServiceInfo > UnoImplBase;
41 
42 struct mutex_holder
43 {
44     osl::Mutex m_aMutex;
45 };
46 
47 class OfficeInstallationDirectories : public mutex_holder, public UnoImplBase
48 {
49 public:
50     OfficeInstallationDirectories(
51         const com::sun::star::uno::Reference<
52             com::sun::star::uno::XComponentContext > & xCtx );
53     virtual ~OfficeInstallationDirectories();
54 
55     // XOfficeInstallationDirectories
56     virtual ::rtl::OUString SAL_CALL
57     getOfficeInstallationDirectoryURL();
58     virtual ::rtl::OUString SAL_CALL
59     getOfficeUserDataDirectoryURL();
60     virtual ::rtl::OUString SAL_CALL
61     makeRelocatableURL( const ::rtl::OUString& URL );
62     virtual ::rtl::OUString SAL_CALL
63     makeAbsoluteURL( const ::rtl::OUString& URL );
64 
65     // XServiceInfo
66     virtual ::rtl::OUString SAL_CALL
67     getImplementationName();
68     virtual sal_Bool SAL_CALL
69     supportsService( const ::rtl::OUString& ServiceName );
70     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
71     getSupportedServiceNames();
72 
73     // XServiceInfo - static versions (used for component registration)
74     static ::rtl::OUString SAL_CALL
75         getImplementationName_static();
76     static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
77         getSupportedServiceNames_static();
78     static ::rtl::OUString SAL_CALL
79         getSingletonName_static();
80     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
81         Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
82 
83 private:
84     void initDirs();
85 
86     rtl::OUString                                   m_aOfficeBrandDirMacro;
87     rtl::OUString                                   m_aOfficeBaseDirMacro;
88     rtl::OUString                                   m_aUserDirMacro;
89     com::sun::star::uno::Reference<
90         com::sun::star::uno::XComponentContext >    m_xCtx;
91     rtl::OUString *                                 m_pOfficeBrandDir;
92     rtl::OUString *                                 m_pOfficeBaseDir;
93     rtl::OUString *                                 m_pUserDir;
94 };
95 
96 } // namespace comphelper
97 
98 #endif /* !INCLUDED_OFFICEINSTALLATIONDIRECTORIES_HXX */
99