1*6998d047SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6998d047SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6998d047SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6998d047SAndrew Rist  * distributed with this work for additional information
6*6998d047SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6998d047SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6998d047SAndrew Rist  * "License"); you may not use this file except in compliance
9*6998d047SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6998d047SAndrew Rist  *
11*6998d047SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6998d047SAndrew Rist  *
13*6998d047SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6998d047SAndrew Rist  * software distributed under the License is distributed on an
15*6998d047SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6998d047SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6998d047SAndrew Rist  * specific language governing permissions and limitations
18*6998d047SAndrew Rist  * under the License.
19*6998d047SAndrew Rist  *
20*6998d047SAndrew Rist  *************************************************************/
21*6998d047SAndrew Rist 
22*6998d047SAndrew Rist 
23cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
24cdf0e10cSrcweir #define _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir namespace scripting_constants
27cdf0e10cSrcweir {
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class ScriptingConstantsPool
30cdf0e10cSrcweir {
31cdf0e10cSrcweir public:
32cdf0e10cSrcweir     const ::rtl::OUString DOC_REF;
33cdf0e10cSrcweir     const ::rtl::OUString DOC_STORAGE_ID;
34cdf0e10cSrcweir     const ::rtl::OUString DOC_URI;
35cdf0e10cSrcweir     const ::rtl::OUString RESOLVED_STORAGE_ID;
36cdf0e10cSrcweir     const ::rtl::OUString SCRIPT_INFO;
37cdf0e10cSrcweir     const ::rtl::OUString SCRIPTSTORAGEMANAGER_SERVICE;
38cdf0e10cSrcweir     const sal_Int32 SHARED_STORAGE_ID;
39cdf0e10cSrcweir     const sal_Int32 USER_STORAGE_ID;
40cdf0e10cSrcweir     const sal_Int32 DOC_STORAGE_ID_NOT_SET;
41cdf0e10cSrcweir 
instance()42cdf0e10cSrcweir     static ScriptingConstantsPool& instance()
43cdf0e10cSrcweir     {
44cdf0e10cSrcweir         static ScriptingConstantsPool *pPool = 0;
45cdf0e10cSrcweir         if( ! pPool )
46cdf0e10cSrcweir         {
47cdf0e10cSrcweir             ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
48cdf0e10cSrcweir             if( ! pPool )
49cdf0e10cSrcweir             {
50cdf0e10cSrcweir                 static ScriptingConstantsPool pool;
51cdf0e10cSrcweir                 pPool = &pool;
52cdf0e10cSrcweir             }
53cdf0e10cSrcweir         }
54cdf0e10cSrcweir         return *pPool;
55cdf0e10cSrcweir     }
56cdf0e10cSrcweir private:
57cdf0e10cSrcweir     ScriptingConstantsPool( const ScriptingConstantsPool & );
58cdf0e10cSrcweir     ScriptingConstantsPool& operator = ( const ScriptingConstantsPool & );
ScriptingConstantsPool()59cdf0e10cSrcweir     ScriptingConstantsPool()
60cdf0e10cSrcweir         : DOC_REF( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_REF" ) ),
61cdf0e10cSrcweir         DOC_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
62cdf0e10cSrcweir             "SCRIPTING_DOC_STORAGE_ID" ) ),
63cdf0e10cSrcweir         DOC_URI( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_URI" ) ),
64cdf0e10cSrcweir         RESOLVED_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
65cdf0e10cSrcweir             "SCRIPTING_RESOLVED_STORAGE_ID" ) ),
66cdf0e10cSrcweir         SCRIPT_INFO( RTL_CONSTASCII_USTRINGPARAM( "SCRIPT_INFO" ) ),
67cdf0e10cSrcweir         SCRIPTSTORAGEMANAGER_SERVICE( RTL_CONSTASCII_USTRINGPARAM(
68cdf0e10cSrcweir             "/singletons/com.sun.star.script.framework.storage.theScriptStorageManager" ) ),
69cdf0e10cSrcweir         SHARED_STORAGE_ID( 0 ), USER_STORAGE_ID( 1 ),
70cdf0e10cSrcweir         DOC_STORAGE_ID_NOT_SET( -1 )
71cdf0e10cSrcweir     {}
72cdf0e10cSrcweir };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir }
75cdf0e10cSrcweir #endif
76