1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef INCLUDED_unotools_STARTOPTIONS_HXX
24 #define INCLUDED_unotools_STARTOPTIONS_HXX
25 
26 //_________________________________________________________________________________________________________________
27 //  includes
28 //_________________________________________________________________________________________________________________
29 
30 #include "unotools/unotoolsdllapi.h"
31 #include <sal/types.h>
32 #include <osl/mutex.hxx>
33 #include <rtl/ustring.hxx>
34 #include <unotools/options.hxx>
35 
36 //_________________________________________________________________________________________________________________
37 //  forward declarations
38 //_________________________________________________________________________________________________________________
39 
40 /*-************************************************************************************************************//**
41     @short          forward declaration to our private date container implementation
42     @descr          We use these class as internal member to support small memory requirements.
43                     You can create the container if it is neccessary. The class which use these mechanism
44                     is faster and smaller then a complete implementation!
45 *//*-*************************************************************************************************************/
46 
47 class SvtStartOptions_Impl;
48 
49 //_________________________________________________________________________________________________________________
50 //  declarations
51 //_________________________________________________________________________________________________________________
52 
53 /*-************************************************************************************************************//**
54     @short          collect informations about startup features
55     @descr          -
56 
57     @implements     -
58     @base           -
59 
60     @devstatus      ready to use
61 *//*-*************************************************************************************************************/
62 
63 class UNOTOOLS_DLLPUBLIC SvtStartOptions: public utl::detail::Options
64 {
65     //-------------------------------------------------------------------------------------------------------------
66     //  public methods
67     //-------------------------------------------------------------------------------------------------------------
68 
69     public:
70 
71         //---------------------------------------------------------------------------------------------------------
72         //  constructor / destructor
73         //---------------------------------------------------------------------------------------------------------
74 
75         /*-****************************************************************************************************//**
76             @short      standard constructor and destructor
77             @descr      This will initialize an instance with default values.
78                         We implement these class with a refcount mechanism! Every instance of this class increase it
79                         at create and decrease it at delete time - but all instances use the same data container!
80                         He is implemented as a static member ...
81 
82             @seealso    member m_nRefCount
83             @seealso    member m_pDataContainer
84 
85             @param      -
86             @return     -
87 
88             @onerror    -
89         *//*-*****************************************************************************************************/
90 
91          SvtStartOptions();
92         virtual ~SvtStartOptions();
93 
94         //---------------------------------------------------------------------------------------------------------
95         //  interface
96         //---------------------------------------------------------------------------------------------------------
97 
98         /*-****************************************************************************************************//**
99             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/Start/..."
100             @descr      These options describe internal states to enable/disable features of installed office.
101                         The values are fixed at runtime - and implemented as readonly!
102 
103                         IsIntroEnabled()    :   Setting, if the StarOffice Logo is displayed when starting StarOffice.
104                                                 Default = true
105 
106                         EnableIntro()       :   Use it to enable/disable the logo at startup.
107 
108             @seealso    configuration package "org.openoffice.Office.Common/Start"
109         *//*-*****************************************************************************************************/
110 
111         sal_Bool    IsIntroEnabled  (                   ) const ;
112         void        EnableIntro     ( sal_Bool bState   )       ;
113 
114         /*-****************************************************************************************************//**
115             @short      returns or set the connection URL of an office
116             @descr      Specifies the URL for an UNO connection.
117                         No default is given, the URL has to be entered manually by the admin/user.
118                         zB.: "socket,host=pc1.test.de,port=6001;iiop;"
119 
120             @seealso    configuration package "org.openoffice.Office.Common/Start"
121         *//*-*****************************************************************************************************/
122 
123         ::rtl::OUString GetConnectionURL(                               ) const ;
124         void            SetConnectionURL( const ::rtl::OUString& sURL   )       ;
125 
126     //-------------------------------------------------------------------------------------------------------------
127     //  private methods
128     //-------------------------------------------------------------------------------------------------------------
129 
130     private:
131 
132         /*-****************************************************************************************************//**
133             @short      return a reference to a static mutex
134             @descr      These class use his own static mutex to be threadsafe.
135                         We create a static mutex only for one ime and use at different times.
136 
137             @seealso    -
138 
139             @param      -
140             @return     A reference to a static mutex member.
141 
142             @onerror    -
143         *//*-*****************************************************************************************************/
144 
145         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
146 
147     //-------------------------------------------------------------------------------------------------------------
148     //  private member
149     //-------------------------------------------------------------------------------------------------------------
150 
151     private:
152 
153         /*Attention
154 
155             Don't initialize these static member in these header!
156             a) Double dfined symbols will be detected ...
157             b) and unresolved externals exist at linking time.
158             Do it in your source only.
159          */
160 
161         static SvtStartOptions_Impl*    m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
162         static sal_Int32                m_nRefCount         ;   /// internal ref count mechanism
163 
164 };      // class SvtStartOptions
165 
166 #endif  // #ifndef INCLUDED_unotools_STARTOPTIONS_HXX
167