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