1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
28 #define _COM_SUN_STAR_SCRIPTING_UTIL_SCRIPTINGCONSTANTS_HXX_
29 
30 namespace scripting_constants
31 {
32 
33 class ScriptingConstantsPool
34 {
35 public:
36     const ::rtl::OUString DOC_REF;
37     const ::rtl::OUString DOC_STORAGE_ID;
38     const ::rtl::OUString DOC_URI;
39     const ::rtl::OUString RESOLVED_STORAGE_ID;
40     const ::rtl::OUString SCRIPT_INFO;
41     const ::rtl::OUString SCRIPTSTORAGEMANAGER_SERVICE;
42     const sal_Int32 SHARED_STORAGE_ID;
43     const sal_Int32 USER_STORAGE_ID;
44     const sal_Int32 DOC_STORAGE_ID_NOT_SET;
45 
46     static ScriptingConstantsPool& instance()
47     {
48         static ScriptingConstantsPool *pPool = 0;
49         if( ! pPool )
50         {
51             ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
52             if( ! pPool )
53             {
54                 static ScriptingConstantsPool pool;
55                 pPool = &pool;
56             }
57         }
58         return *pPool;
59     }
60 private:
61     ScriptingConstantsPool( const ScriptingConstantsPool & );
62     ScriptingConstantsPool& operator = ( const ScriptingConstantsPool & );
63     ScriptingConstantsPool()
64         : DOC_REF( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_REF" ) ),
65         DOC_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
66             "SCRIPTING_DOC_STORAGE_ID" ) ),
67         DOC_URI( RTL_CONSTASCII_USTRINGPARAM( "SCRIPTING_DOC_URI" ) ),
68         RESOLVED_STORAGE_ID( RTL_CONSTASCII_USTRINGPARAM(
69             "SCRIPTING_RESOLVED_STORAGE_ID" ) ),
70         SCRIPT_INFO( RTL_CONSTASCII_USTRINGPARAM( "SCRIPT_INFO" ) ),
71         SCRIPTSTORAGEMANAGER_SERVICE( RTL_CONSTASCII_USTRINGPARAM(
72             "/singletons/com.sun.star.script.framework.storage.theScriptStorageManager" ) ),
73         SHARED_STORAGE_ID( 0 ), USER_STORAGE_ID( 1 ),
74         DOC_STORAGE_ID_NOT_SET( -1 )
75     {}
76 };
77 
78 }
79 #endif
80