xref: /AOO41X/main/svtools/inc/svtools/menuoptions.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
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_SVTOOLS_MENUOPTIONS_HXX
24 #define INCLUDED_SVTOOLS_MENUOPTIONS_HXX
25 
26 //_________________________________________________________________________________________________________________
27 //  includes
28 //_________________________________________________________________________________________________________________
29 
30 #include "svtools/svtdllapi.h"
31 #include <sal/types.h>
32 #include <osl/mutex.hxx>
33 #include <unotools/options.hxx>
34 
35 //_________________________________________________________________________________________________________________
36 //  forward declarations
37 //_________________________________________________________________________________________________________________
38 
39 /*-************************************************************************************************************//**
40     @short          forward declaration to our private date container implementation
41     @descr          We use these class as internal member to support small memory requirements.
42                     You can create the container if it is neccessary. The class which use these mechanism
43                     is faster and smaller then a complete implementation!
44 *//*-*************************************************************************************************************/
45 
46 class Link;
47 class SvtMenuOptions_Impl;
48 
49 //_________________________________________________________________________________________________________________
50 //  declarations
51 //_________________________________________________________________________________________________________________
52 
53 /*-************************************************************************************************************//**
54     @short          collect informations about menu features
55     @descr          -
56 
57     @implements     -
58     @base           -
59 
60     @devstatus      ready to use
61 *//*-*************************************************************************************************************/
62 
63 class SVT_DLLPUBLIC SvtMenuOptions: 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          SvtMenuOptions();
92         virtual ~SvtMenuOptions();
93 
94         void AddListenerLink( const Link& rLink );
95         void RemoveListenerLink( const Link& rLink );
96         //---------------------------------------------------------------------------------------------------------
97         //  interface
98         //---------------------------------------------------------------------------------------------------------
99 
100         /*-****************************************************************************************************//**
101             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/View/Menu/..."
102             @descr      These options describe internal states to enable/disable features of installed office.
103 
104                         IsEntryHidingEnabled()
105                         SetEntryHidingState()   =>  Activate this field for viewing all deactivated menu entries.
106                                                     Menu commands that are normally not necessary are hidden by default.
107                                                     Default=false
108 
109                         IsFollowMouseEnabled()
110                         SetFollowMouseState()   =>  Automatic selection while moving the mouse on a menu.
111                                                     Default=true
112 
113             @seealso    configuration package "org.openoffice.Office.Common/View/Menu"
114         *//*-*****************************************************************************************************/
115 
116         sal_Bool IsEntryHidingEnabled() const;
117         sal_Bool IsFollowMouseEnabled() const;
118         sal_Int16 GetMenuIconsState() const;
119 
120         void SetEntryHidingState( sal_Bool bState );
121         void SetFollowMouseState( sal_Bool bState );
122         void SetMenuIconsState( sal_Int16 bState );
123 
124     //-------------------------------------------------------------------------------------------------------------
125     //  private methods
126     //-------------------------------------------------------------------------------------------------------------
127 
128     private:
129 
130         /*-****************************************************************************************************//**
131             @short      return a reference to a static mutex
132             @descr      These class is partially threadsafe (for de-/initialization only).
133                         All access methods are'nt safe!
134                         We create a static mutex only for one ime and use at different times.
135 
136             @seealso    -
137 
138             @param      -
139             @return     A reference to a static mutex member.
140 
141             @onerror    -
142         *//*-*****************************************************************************************************/
143 
144         SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
145 
146     //-------------------------------------------------------------------------------------------------------------
147     //  private member
148     //-------------------------------------------------------------------------------------------------------------
149 
150     private:
151 
152         /*Attention
153 
154             Don't initialize these static member in these header!
155             a) Double dfined symbols will be detected ...
156             b) and unresolved externals exist at linking time.
157             Do it in your source only.
158          */
159 
160         static SvtMenuOptions_Impl* m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
161         static sal_Int32            m_nRefCount         ;   /// internal ref count mechanism
162 
163 };      // class SvtMenuOptions
164 
165 #endif  // #ifndef INCLUDED_SVTOOLS_MENUOPTIONS_HXX
166