1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_comphelper.hxx"
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #include "comphelper_module.hxx"
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski /**************************************************************************
30*b1cdbd2cSJim Jagielski TODO
31*b1cdbd2cSJim Jagielski **************************************************************************
32*b1cdbd2cSJim Jagielski
33*b1cdbd2cSJim Jagielski *************************************************************************/
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielski #include "osl/file.hxx"
36*b1cdbd2cSJim Jagielski #include "com/sun/star/beans/XPropertySet.hpp"
37*b1cdbd2cSJim Jagielski #include "com/sun/star/util/XMacroExpander.hpp"
38*b1cdbd2cSJim Jagielski
39*b1cdbd2cSJim Jagielski #include "officeinstallationdirectories.hxx"
40*b1cdbd2cSJim Jagielski
41*b1cdbd2cSJim Jagielski using namespace com::sun::star;
42*b1cdbd2cSJim Jagielski
43*b1cdbd2cSJim Jagielski using namespace comphelper;
44*b1cdbd2cSJim Jagielski
45*b1cdbd2cSJim Jagielski //=========================================================================
46*b1cdbd2cSJim Jagielski // helpers
47*b1cdbd2cSJim Jagielski //=========================================================================
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski //=========================================================================
makeCanonicalFileURL(rtl::OUString & rURL)50*b1cdbd2cSJim Jagielski static bool makeCanonicalFileURL( rtl::OUString & rURL )
51*b1cdbd2cSJim Jagielski {
52*b1cdbd2cSJim Jagielski OSL_ENSURE( rURL.matchAsciiL( "file:", sizeof( "file:" ) - 1 , 0 ) ,
53*b1cdbd2cSJim Jagielski "File URL expected!" );
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski rtl::OUString aNormalizedURL;
56*b1cdbd2cSJim Jagielski if ( osl::FileBase::getAbsoluteFileURL( rtl::OUString(),
57*b1cdbd2cSJim Jagielski rURL,
58*b1cdbd2cSJim Jagielski aNormalizedURL )
59*b1cdbd2cSJim Jagielski == osl::DirectoryItem::E_None )
60*b1cdbd2cSJim Jagielski {
61*b1cdbd2cSJim Jagielski osl::DirectoryItem aDirItem;
62*b1cdbd2cSJim Jagielski if ( osl::DirectoryItem::get( aNormalizedURL, aDirItem )
63*b1cdbd2cSJim Jagielski == osl::DirectoryItem::E_None )
64*b1cdbd2cSJim Jagielski {
65*b1cdbd2cSJim Jagielski osl::FileStatus aFileStatus( FileStatusMask_FileURL );
66*b1cdbd2cSJim Jagielski
67*b1cdbd2cSJim Jagielski if ( aDirItem.getFileStatus( aFileStatus )
68*b1cdbd2cSJim Jagielski == osl::DirectoryItem::E_None )
69*b1cdbd2cSJim Jagielski {
70*b1cdbd2cSJim Jagielski aNormalizedURL = aFileStatus.getFileURL();
71*b1cdbd2cSJim Jagielski
72*b1cdbd2cSJim Jagielski if ( !aNormalizedURL.isEmpty() )
73*b1cdbd2cSJim Jagielski {
74*b1cdbd2cSJim Jagielski if ( aNormalizedURL
75*b1cdbd2cSJim Jagielski .getStr()[ aNormalizedURL.getLength() - 1 ]
76*b1cdbd2cSJim Jagielski != sal_Unicode( '/' ) )
77*b1cdbd2cSJim Jagielski rURL = aNormalizedURL;
78*b1cdbd2cSJim Jagielski else
79*b1cdbd2cSJim Jagielski rURL = aNormalizedURL
80*b1cdbd2cSJim Jagielski .copy( 0, aNormalizedURL.getLength() - 1 );
81*b1cdbd2cSJim Jagielski
82*b1cdbd2cSJim Jagielski return true;
83*b1cdbd2cSJim Jagielski }
84*b1cdbd2cSJim Jagielski }
85*b1cdbd2cSJim Jagielski }
86*b1cdbd2cSJim Jagielski }
87*b1cdbd2cSJim Jagielski return false;
88*b1cdbd2cSJim Jagielski }
89*b1cdbd2cSJim Jagielski
90*b1cdbd2cSJim Jagielski //=========================================================================
91*b1cdbd2cSJim Jagielski //=========================================================================
92*b1cdbd2cSJim Jagielski //
93*b1cdbd2cSJim Jagielski // OfficeInstallationDirectories Implementation.
94*b1cdbd2cSJim Jagielski //
95*b1cdbd2cSJim Jagielski //=========================================================================
96*b1cdbd2cSJim Jagielski //=========================================================================
97*b1cdbd2cSJim Jagielski
OfficeInstallationDirectories(const uno::Reference<uno::XComponentContext> & xCtx)98*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::OfficeInstallationDirectories(
99*b1cdbd2cSJim Jagielski const uno::Reference< uno::XComponentContext > & xCtx )
100*b1cdbd2cSJim Jagielski : m_aOfficeBrandDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(brandbaseurl)" ) ),
101*b1cdbd2cSJim Jagielski m_aOfficeBaseDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(baseinsturl)" ) ),
102*b1cdbd2cSJim Jagielski m_aUserDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(userdataurl)" ) ),
103*b1cdbd2cSJim Jagielski m_xCtx( xCtx ),
104*b1cdbd2cSJim Jagielski m_pOfficeBrandDir( 0 ),
105*b1cdbd2cSJim Jagielski m_pOfficeBaseDir( 0 ),
106*b1cdbd2cSJim Jagielski m_pUserDir( 0 )
107*b1cdbd2cSJim Jagielski {
108*b1cdbd2cSJim Jagielski }
109*b1cdbd2cSJim Jagielski
110*b1cdbd2cSJim Jagielski //=========================================================================
111*b1cdbd2cSJim Jagielski // virtual
~OfficeInstallationDirectories()112*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::~OfficeInstallationDirectories()
113*b1cdbd2cSJim Jagielski {
114*b1cdbd2cSJim Jagielski delete m_pOfficeBrandDir;
115*b1cdbd2cSJim Jagielski delete m_pOfficeBaseDir;
116*b1cdbd2cSJim Jagielski delete m_pUserDir;
117*b1cdbd2cSJim Jagielski }
118*b1cdbd2cSJim Jagielski
119*b1cdbd2cSJim Jagielski //=========================================================================
120*b1cdbd2cSJim Jagielski // util::XOfficeInstallationDirectories
121*b1cdbd2cSJim Jagielski //=========================================================================
122*b1cdbd2cSJim Jagielski
123*b1cdbd2cSJim Jagielski // virtual
124*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
getOfficeInstallationDirectoryURL()125*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getOfficeInstallationDirectoryURL()
126*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
127*b1cdbd2cSJim Jagielski {
128*b1cdbd2cSJim Jagielski initDirs();
129*b1cdbd2cSJim Jagielski return rtl::OUString( *m_pOfficeBrandDir );
130*b1cdbd2cSJim Jagielski }
131*b1cdbd2cSJim Jagielski
132*b1cdbd2cSJim Jagielski //=========================================================================
133*b1cdbd2cSJim Jagielski // virtual
134*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
getOfficeUserDataDirectoryURL()135*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getOfficeUserDataDirectoryURL()
136*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
137*b1cdbd2cSJim Jagielski {
138*b1cdbd2cSJim Jagielski initDirs();
139*b1cdbd2cSJim Jagielski return rtl::OUString( *m_pUserDir );
140*b1cdbd2cSJim Jagielski }
141*b1cdbd2cSJim Jagielski
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski //=========================================================================
144*b1cdbd2cSJim Jagielski // virtual
145*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
makeRelocatableURL(const rtl::OUString & URL)146*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL )
147*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
148*b1cdbd2cSJim Jagielski {
149*b1cdbd2cSJim Jagielski if ( !URL.isEmpty() )
150*b1cdbd2cSJim Jagielski {
151*b1cdbd2cSJim Jagielski initDirs();
152*b1cdbd2cSJim Jagielski
153*b1cdbd2cSJim Jagielski rtl::OUString aCanonicalURL( URL );
154*b1cdbd2cSJim Jagielski makeCanonicalFileURL( aCanonicalURL );
155*b1cdbd2cSJim Jagielski
156*b1cdbd2cSJim Jagielski sal_Int32 nIndex = aCanonicalURL.indexOf( *m_pOfficeBrandDir );
157*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
158*b1cdbd2cSJim Jagielski {
159*b1cdbd2cSJim Jagielski return rtl::OUString(
160*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
161*b1cdbd2cSJim Jagielski m_pOfficeBrandDir->getLength(),
162*b1cdbd2cSJim Jagielski m_aOfficeBrandDirMacro ) );
163*b1cdbd2cSJim Jagielski }
164*b1cdbd2cSJim Jagielski else
165*b1cdbd2cSJim Jagielski {
166*b1cdbd2cSJim Jagielski nIndex = aCanonicalURL.indexOf( *m_pOfficeBaseDir );
167*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
168*b1cdbd2cSJim Jagielski {
169*b1cdbd2cSJim Jagielski return rtl::OUString(
170*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
171*b1cdbd2cSJim Jagielski m_pOfficeBaseDir->getLength(),
172*b1cdbd2cSJim Jagielski m_aOfficeBaseDirMacro ) );
173*b1cdbd2cSJim Jagielski }
174*b1cdbd2cSJim Jagielski else
175*b1cdbd2cSJim Jagielski {
176*b1cdbd2cSJim Jagielski nIndex = aCanonicalURL.indexOf( *m_pUserDir );
177*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
178*b1cdbd2cSJim Jagielski {
179*b1cdbd2cSJim Jagielski return rtl::OUString(
180*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
181*b1cdbd2cSJim Jagielski m_pUserDir->getLength(),
182*b1cdbd2cSJim Jagielski m_aUserDirMacro ) );
183*b1cdbd2cSJim Jagielski }
184*b1cdbd2cSJim Jagielski }
185*b1cdbd2cSJim Jagielski }
186*b1cdbd2cSJim Jagielski }
187*b1cdbd2cSJim Jagielski return rtl::OUString( URL );
188*b1cdbd2cSJim Jagielski }
189*b1cdbd2cSJim Jagielski
190*b1cdbd2cSJim Jagielski //=========================================================================
191*b1cdbd2cSJim Jagielski // virtual
192*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
makeAbsoluteURL(const rtl::OUString & URL)193*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::makeAbsoluteURL( const rtl::OUString& URL )
194*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
195*b1cdbd2cSJim Jagielski {
196*b1cdbd2cSJim Jagielski if ( !URL.isEmpty() )
197*b1cdbd2cSJim Jagielski {
198*b1cdbd2cSJim Jagielski sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro );
199*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
200*b1cdbd2cSJim Jagielski {
201*b1cdbd2cSJim Jagielski initDirs();
202*b1cdbd2cSJim Jagielski
203*b1cdbd2cSJim Jagielski return rtl::OUString(
204*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
205*b1cdbd2cSJim Jagielski m_aOfficeBrandDirMacro.getLength(),
206*b1cdbd2cSJim Jagielski *m_pOfficeBrandDir ) );
207*b1cdbd2cSJim Jagielski }
208*b1cdbd2cSJim Jagielski else
209*b1cdbd2cSJim Jagielski {
210*b1cdbd2cSJim Jagielski nIndex = URL.indexOf( m_aOfficeBaseDirMacro );
211*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
212*b1cdbd2cSJim Jagielski {
213*b1cdbd2cSJim Jagielski initDirs();
214*b1cdbd2cSJim Jagielski
215*b1cdbd2cSJim Jagielski return rtl::OUString(
216*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
217*b1cdbd2cSJim Jagielski m_aOfficeBaseDirMacro.getLength(),
218*b1cdbd2cSJim Jagielski *m_pOfficeBaseDir ) );
219*b1cdbd2cSJim Jagielski }
220*b1cdbd2cSJim Jagielski else
221*b1cdbd2cSJim Jagielski {
222*b1cdbd2cSJim Jagielski nIndex = URL.indexOf( m_aUserDirMacro );
223*b1cdbd2cSJim Jagielski if ( nIndex != -1 )
224*b1cdbd2cSJim Jagielski {
225*b1cdbd2cSJim Jagielski initDirs();
226*b1cdbd2cSJim Jagielski
227*b1cdbd2cSJim Jagielski return rtl::OUString(
228*b1cdbd2cSJim Jagielski URL.replaceAt( nIndex,
229*b1cdbd2cSJim Jagielski m_aUserDirMacro.getLength(),
230*b1cdbd2cSJim Jagielski *m_pUserDir ) );
231*b1cdbd2cSJim Jagielski }
232*b1cdbd2cSJim Jagielski }
233*b1cdbd2cSJim Jagielski }
234*b1cdbd2cSJim Jagielski }
235*b1cdbd2cSJim Jagielski return rtl::OUString( URL );
236*b1cdbd2cSJim Jagielski }
237*b1cdbd2cSJim Jagielski
238*b1cdbd2cSJim Jagielski //=========================================================================
239*b1cdbd2cSJim Jagielski // lang::XServiceInfo
240*b1cdbd2cSJim Jagielski //=========================================================================
241*b1cdbd2cSJim Jagielski
242*b1cdbd2cSJim Jagielski // virtual
243*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
getImplementationName()244*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getImplementationName()
245*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
246*b1cdbd2cSJim Jagielski {
247*b1cdbd2cSJim Jagielski return getImplementationName_static();
248*b1cdbd2cSJim Jagielski }
249*b1cdbd2cSJim Jagielski
250*b1cdbd2cSJim Jagielski //=========================================================================
251*b1cdbd2cSJim Jagielski // virtual
252*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL
supportsService(const rtl::OUString & ServiceName)253*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::supportsService( const rtl::OUString& ServiceName )
254*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
255*b1cdbd2cSJim Jagielski {
256*b1cdbd2cSJim Jagielski const uno::Sequence< rtl::OUString > & aNames
257*b1cdbd2cSJim Jagielski = getSupportedServiceNames();
258*b1cdbd2cSJim Jagielski const rtl::OUString * p = aNames.getConstArray();
259*b1cdbd2cSJim Jagielski for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); nPos++ )
260*b1cdbd2cSJim Jagielski {
261*b1cdbd2cSJim Jagielski if ( p[ nPos ].equals( ServiceName ) )
262*b1cdbd2cSJim Jagielski return sal_True;
263*b1cdbd2cSJim Jagielski }
264*b1cdbd2cSJim Jagielski return sal_False;
265*b1cdbd2cSJim Jagielski
266*b1cdbd2cSJim Jagielski }
267*b1cdbd2cSJim Jagielski
268*b1cdbd2cSJim Jagielski //=========================================================================
269*b1cdbd2cSJim Jagielski // virtual
270*b1cdbd2cSJim Jagielski uno::Sequence< ::rtl::OUString > SAL_CALL
getSupportedServiceNames()271*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getSupportedServiceNames()
272*b1cdbd2cSJim Jagielski throw ( uno::RuntimeException )
273*b1cdbd2cSJim Jagielski {
274*b1cdbd2cSJim Jagielski return getSupportedServiceNames_static();
275*b1cdbd2cSJim Jagielski }
276*b1cdbd2cSJim Jagielski
277*b1cdbd2cSJim Jagielski //=========================================================================
278*b1cdbd2cSJim Jagielski // static
279*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL
getImplementationName_static()280*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getImplementationName_static()
281*b1cdbd2cSJim Jagielski {
282*b1cdbd2cSJim Jagielski return rtl::OUString(
283*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
284*b1cdbd2cSJim Jagielski "com.sun.star.comp.util.OfficeInstallationDirectories" ) );
285*b1cdbd2cSJim Jagielski }
286*b1cdbd2cSJim Jagielski
287*b1cdbd2cSJim Jagielski //=========================================================================
288*b1cdbd2cSJim Jagielski // static
289*b1cdbd2cSJim Jagielski uno::Sequence< ::rtl::OUString > SAL_CALL
getSupportedServiceNames_static()290*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::getSupportedServiceNames_static()
291*b1cdbd2cSJim Jagielski {
292*b1cdbd2cSJim Jagielski const rtl::OUString aServiceName(
293*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
294*b1cdbd2cSJim Jagielski "com.sun.star.util.OfficeInstallationDirectories" ) );
295*b1cdbd2cSJim Jagielski return uno::Sequence< rtl::OUString >( &aServiceName, 1 );
296*b1cdbd2cSJim Jagielski }
297*b1cdbd2cSJim Jagielski
298*b1cdbd2cSJim Jagielski //=========================================================================
299*b1cdbd2cSJim Jagielski // static
getSingletonName_static()300*b1cdbd2cSJim Jagielski rtl::OUString SAL_CALL OfficeInstallationDirectories::getSingletonName_static()
301*b1cdbd2cSJim Jagielski {
302*b1cdbd2cSJim Jagielski return rtl::OUString(
303*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
304*b1cdbd2cSJim Jagielski "com.sun.star.util.theOfficeInstallationDirectories" ) );
305*b1cdbd2cSJim Jagielski }
306*b1cdbd2cSJim Jagielski
307*b1cdbd2cSJim Jagielski //=========================================================================
308*b1cdbd2cSJim Jagielski // static
309*b1cdbd2cSJim Jagielski uno::Reference< uno::XInterface > SAL_CALL
Create(const uno::Reference<uno::XComponentContext> & rxContext)310*b1cdbd2cSJim Jagielski OfficeInstallationDirectories::Create(
311*b1cdbd2cSJim Jagielski const uno::Reference< uno::XComponentContext > & rxContext )
312*b1cdbd2cSJim Jagielski {
313*b1cdbd2cSJim Jagielski return static_cast< cppu::OWeakObject * >(
314*b1cdbd2cSJim Jagielski new OfficeInstallationDirectories( rxContext ) );
315*b1cdbd2cSJim Jagielski }
316*b1cdbd2cSJim Jagielski
317*b1cdbd2cSJim Jagielski //=========================================================================
318*b1cdbd2cSJim Jagielski // non-UNO
319*b1cdbd2cSJim Jagielski //=========================================================================
320*b1cdbd2cSJim Jagielski
initDirs()321*b1cdbd2cSJim Jagielski void OfficeInstallationDirectories::initDirs()
322*b1cdbd2cSJim Jagielski {
323*b1cdbd2cSJim Jagielski if ( m_pOfficeBrandDir == 0 )
324*b1cdbd2cSJim Jagielski {
325*b1cdbd2cSJim Jagielski osl::MutexGuard aGuard( m_aMutex );
326*b1cdbd2cSJim Jagielski if ( m_pOfficeBrandDir == 0 )
327*b1cdbd2cSJim Jagielski {
328*b1cdbd2cSJim Jagielski m_pOfficeBrandDir = new rtl::OUString;
329*b1cdbd2cSJim Jagielski m_pOfficeBaseDir = new rtl::OUString;
330*b1cdbd2cSJim Jagielski m_pUserDir = new rtl::OUString;
331*b1cdbd2cSJim Jagielski
332*b1cdbd2cSJim Jagielski uno::Reference< util::XMacroExpander > xExpander;
333*b1cdbd2cSJim Jagielski
334*b1cdbd2cSJim Jagielski m_xCtx->getValueByName(
335*b1cdbd2cSJim Jagielski rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
336*b1cdbd2cSJim Jagielski "/singletons/com.sun.star.util.theMacroExpander" ) ) )
337*b1cdbd2cSJim Jagielski >>= xExpander;
338*b1cdbd2cSJim Jagielski
339*b1cdbd2cSJim Jagielski OSL_ENSURE( xExpander.is(),
340*b1cdbd2cSJim Jagielski "Unable to obtain macro expander singleton!" );
341*b1cdbd2cSJim Jagielski
342*b1cdbd2cSJim Jagielski if ( xExpander.is() )
343*b1cdbd2cSJim Jagielski {
344*b1cdbd2cSJim Jagielski *m_pOfficeBrandDir =
345*b1cdbd2cSJim Jagielski xExpander->expandMacros(
346*b1cdbd2cSJim Jagielski rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "$OOO_BASE_DIR" ) ) );
347*b1cdbd2cSJim Jagielski
348*b1cdbd2cSJim Jagielski OSL_ENSURE( !m_pOfficeBrandDir->isEmpty(),
349*b1cdbd2cSJim Jagielski "Unable to obtain office brand installation directory!" );
350*b1cdbd2cSJim Jagielski
351*b1cdbd2cSJim Jagielski makeCanonicalFileURL( *m_pOfficeBrandDir );
352*b1cdbd2cSJim Jagielski
353*b1cdbd2cSJim Jagielski *m_pOfficeBaseDir = *m_pOfficeBrandDir;
354*b1cdbd2cSJim Jagielski // xExpander->expandMacros(
355*b1cdbd2cSJim Jagielski // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
356*b1cdbd2cSJim Jagielski // "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":BaseInstallation}" ) ) );
357*b1cdbd2cSJim Jagielski
358*b1cdbd2cSJim Jagielski // OSL_ENSURE( m_pOfficeBaseDir->getLength() > 0,
359*b1cdbd2cSJim Jagielski // "Unable to obtain office base installation directory!" );
360*b1cdbd2cSJim Jagielski
361*b1cdbd2cSJim Jagielski makeCanonicalFileURL( *m_pOfficeBaseDir );
362*b1cdbd2cSJim Jagielski
363*b1cdbd2cSJim Jagielski *m_pUserDir =
364*b1cdbd2cSJim Jagielski xExpander->expandMacros(
365*b1cdbd2cSJim Jagielski rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
366*b1cdbd2cSJim Jagielski "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) ) );
367*b1cdbd2cSJim Jagielski
368*b1cdbd2cSJim Jagielski OSL_ENSURE( !m_pUserDir->isEmpty(),
369*b1cdbd2cSJim Jagielski "Unable to obtain office user data directory!" );
370*b1cdbd2cSJim Jagielski
371*b1cdbd2cSJim Jagielski makeCanonicalFileURL( *m_pUserDir );
372*b1cdbd2cSJim Jagielski }
373*b1cdbd2cSJim Jagielski }
374*b1cdbd2cSJim Jagielski }
375*b1cdbd2cSJim Jagielski }
376*b1cdbd2cSJim Jagielski
createRegistryInfo_OfficeInstallationDirectories()377*b1cdbd2cSJim Jagielski void createRegistryInfo_OfficeInstallationDirectories()
378*b1cdbd2cSJim Jagielski {
379*b1cdbd2cSJim Jagielski static ::comphelper::module::OSingletonRegistration< OfficeInstallationDirectories > aAutoRegistration;
380*b1cdbd2cSJim Jagielski }
381