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 #ifndef _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
24*b1cdbd2cSJim Jagielski #define _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
25*b1cdbd2cSJim Jagielski 
26*b1cdbd2cSJim Jagielski namespace scripting_constants
27*b1cdbd2cSJim Jagielski {
28*b1cdbd2cSJim Jagielski 
29*b1cdbd2cSJim Jagielski class ScriptingConstantsPool
30*b1cdbd2cSJim Jagielski {
31*b1cdbd2cSJim Jagielski public:
32*b1cdbd2cSJim Jagielski     const ::rtl::OUString DOC_REF;
33*b1cdbd2cSJim Jagielski     const ::rtl::OUString DOC_STORAGE_ID;
34*b1cdbd2cSJim Jagielski     const ::rtl::OUString DOC_URI;
35*b1cdbd2cSJim Jagielski     const ::rtl::OUString RESOLVED_STORAGE_ID;
36*b1cdbd2cSJim Jagielski     const ::rtl::OUString SCRIPT_INFO;
37*b1cdbd2cSJim Jagielski     const ::rtl::OUString SCRIPTSTORAGEMANAGER_SERVICE;
38*b1cdbd2cSJim Jagielski     const sal_Int32 SHARED_STORAGE_ID;
39*b1cdbd2cSJim Jagielski     const sal_Int32 USER_STORAGE_ID;
40*b1cdbd2cSJim Jagielski     const sal_Int32 DOC_STORAGE_ID_NOT_SET;
41*b1cdbd2cSJim Jagielski 
instance()42*b1cdbd2cSJim Jagielski     static ScriptingConstantsPool& instance()
43*b1cdbd2cSJim Jagielski     {
44*b1cdbd2cSJim Jagielski         static ScriptingConstantsPool *pPool = 0;
45*b1cdbd2cSJim Jagielski         if( ! pPool )
46*b1cdbd2cSJim Jagielski         {
47*b1cdbd2cSJim Jagielski             ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
48*b1cdbd2cSJim Jagielski             if( ! pPool )
49*b1cdbd2cSJim Jagielski             {
50*b1cdbd2cSJim Jagielski                 static ScriptingConstantsPool pool;
51*b1cdbd2cSJim Jagielski                 pPool = &pool;
52*b1cdbd2cSJim Jagielski             }
53*b1cdbd2cSJim Jagielski         }
54*b1cdbd2cSJim Jagielski         return *pPool;
55*b1cdbd2cSJim Jagielski     }
56*b1cdbd2cSJim Jagielski private:
57*b1cdbd2cSJim Jagielski     ScriptingConstantsPool( const ScriptingConstantsPool & );
58*b1cdbd2cSJim Jagielski     ScriptingConstantsPool& operator = ( const ScriptingConstantsPool & );
ScriptingConstantsPool()59*b1cdbd2cSJim Jagielski     ScriptingConstantsPool()
60*b1cdbd2cSJim Jagielski         : DOC_REF( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_REF" ) ),
61*b1cdbd2cSJim Jagielski         DOC_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
62*b1cdbd2cSJim Jagielski             "SCRIPTING_DOC_STORAGE_ID" ) ),
63*b1cdbd2cSJim Jagielski         DOC_URI( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_URI" ) ),
64*b1cdbd2cSJim Jagielski         RESOLVED_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
65*b1cdbd2cSJim Jagielski             "SCRIPTING_RESOLVED_STORAGE_ID" ) ),
66*b1cdbd2cSJim Jagielski         SCRIPT_INFO( RTL_CONSTASCII_USTRINGPARAM( "SCRIPT_INFO" ) ),
67*b1cdbd2cSJim Jagielski         SCRIPTSTORAGEMANAGER_SERVICE( RTL_CONSTASCII_USTRINGPARAM(
68*b1cdbd2cSJim Jagielski             "/singletons/com.sun.star.script.framework.storage.theScriptStorageManager" ) ),
69*b1cdbd2cSJim Jagielski         SHARED_STORAGE_ID( 0 ), USER_STORAGE_ID( 1 ),
70*b1cdbd2cSJim Jagielski         DOC_STORAGE_ID_NOT_SET( -1 )
71*b1cdbd2cSJim Jagielski     {}
72*b1cdbd2cSJim Jagielski };
73*b1cdbd2cSJim Jagielski 
74*b1cdbd2cSJim Jagielski }
75*b1cdbd2cSJim Jagielski #endif
76