sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / cmdoptions.hxx
blob4dd80305c257c83aef4ceff589db2b017486067d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cmdoptions.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX
31 #define INCLUDED_SVTOOLS_CMDOPTIONS_HXX
33 #ifndef _SAL_TYPES_H_
34 #include <sal/types.h>
35 #endif
37 #ifndef _OSL_MUTEX_HXX_
38 #include <osl/mutex.hxx>
39 #endif
41 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
42 #include <com/sun/star/uno/Sequence.h>
43 #endif
45 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
46 #include <com/sun/star/frame/XFrame.hpp>
47 #endif
49 #ifndef _RTL_USTRING_HXX_
50 #include <rtl/ustring.hxx>
51 #endif
53 #ifndef INCLUDED_SVTOOLS_OPTIONS_HXX
54 #include <bf_svtools/options.hxx>
55 #endif
57 namespace binfilter {
59 //_________________________________________________________________________________________________________________
60 // types, enums, ...
61 //_________________________________________________________________________________________________________________
63 /*-************************************************************************************************************//**
64 @descr The method GetList() returns a list of property values.
65 Use follow defines to seperate values by names.
66 *//*-*************************************************************************************************************/
67 #define CMDOPTIONS_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ))
69 //_________________________________________________________________________________________________________________
70 // forward declarations
71 //_________________________________________________________________________________________________________________
73 /*-************************************************************************************************************//**
74 @short forward declaration to our private date container implementation
75 @descr We use these class as internal member to support small memory requirements.
76 You can create the container if it is neccessary. The class which use these mechanism
77 is faster and smaller then a complete implementation!
78 *//*-*************************************************************************************************************/
80 class SvtCommandOptions_Impl;
82 //_________________________________________________________________________________________________________________
83 // declarations
84 //_________________________________________________________________________________________________________________
86 /*-************************************************************************************************************//**
87 @short collect informations about dynamic menus
88 @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard".
90 @implements -
91 @base -
93 @devstatus ready to use
94 *//*-*************************************************************************************************************/
96 class SvtCommandOptions: public Options
98 friend class SvtCommandOptions_Impl;
100 //-------------------------------------------------------------------------------------------------------------
101 // public methods
102 //-------------------------------------------------------------------------------------------------------------
104 public:
106 enum CmdOption
108 CMDOPTION_DISABLED,
109 CMDOPTION_NONE
112 //---------------------------------------------------------------------------------------------------------
113 // constructor / destructor
114 //---------------------------------------------------------------------------------------------------------
116 /*-****************************************************************************************************//**
117 @short standard constructor and destructor
118 @descr This will initialize an instance with default values.
119 We implement these class with a refcount mechanism! Every instance of this class increase it
120 at create and decrease it at delete time - but all instances use the same data container!
121 He is implemented as a static member ...
123 @seealso member m_nRefCount
124 @seealso member m_pDataContainer
126 @param -
127 @return -
129 @onerror -
130 *//*-*****************************************************************************************************/
132 SvtCommandOptions();
133 virtual ~SvtCommandOptions();
135 //---------------------------------------------------------------------------------------------------------
136 // interface
137 //---------------------------------------------------------------------------------------------------------
139 /*-****************************************************************************************************//**
140 @short clear complete sepcified list
141 @descr Call this methods to clear the whole list.
142 To fill it again use AppendItem().
144 @seealso -
146 @param "eMenu" select right menu to clear.
147 @return -
149 @onerror -
150 *//*-*****************************************************************************************************/
152 void Clear( CmdOption eOption );
154 /*-****************************************************************************************************//**
155 @short Lookup if a command URL is inside a given list
156 @descr Lookup if a command URL is inside a given lst
158 @seealso -
160 @param "eOption" select right command list
161 @param "aCommandURL" a command URL that is used for the look up
162 @return "sal_True" if the command is inside the list otherwise "sal_False"
164 @onerror -
165 *//*-*****************************************************************************************************/
167 sal_Bool Lookup( CmdOption eOption, const ::rtl::OUString& aCommandURL ) const;
169 /*-****************************************************************************************************//**
170 @short return complete specified list
171 @descr Call it to get all entries of an dynamic menu.
172 We return a list of all nodes with his names and properties.
174 @seealso -
176 @param "eOption" select the list to retrieve.
177 @return A list of command strings is returned.
179 @onerror We return an empty list.
180 *//*-*****************************************************************************************************/
182 ::com::sun::star::uno::Sequence< ::rtl::OUString > GetList( CmdOption eOption ) const;
184 /*-****************************************************************************************************//**
185 @short adds a new command to specified options list
186 @descr You can add a command to specified options list!
188 @seealso method Clear()
190 @param "eOption" specifies the command list
191 @param "sURL" URL for dispatch
192 @return -
194 @onerror -
195 *//*-*****************************************************************************************************/
197 void AddCommand( CmdOption eOption, const ::rtl::OUString& sURL );
199 /*-****************************************************************************************************//**
200 @short register an office frame, which must update its dispatches if
201 the underlying configuration was changed.
203 @descr To avoid using of "dead" frame objects or implementing
204 deregistration mechanism too, we use weak references to
205 the given frames.
207 @param "xFrame" points to the frame, which wish to be
208 notified, if configuration was changed.
209 @return -
211 @onerror -
212 *//*-*****************************************************************************************************/
214 void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
216 //-------------------------------------------------------------------------------------------------------------
217 // private methods
218 //-------------------------------------------------------------------------------------------------------------
220 private:
222 /*-****************************************************************************************************//**
223 @short return a reference to a static mutex
224 @descr These class is partially threadsafe (for de-/initialization only).
225 All access methods are'nt safe!
226 We create a static mutex only for one ime and use at different times.
228 @seealso -
230 @param -
231 @return A reference to a static mutex member.
233 @onerror -
234 *//*-*****************************************************************************************************/
236 static ::osl::Mutex& GetOwnStaticMutex();
238 //-------------------------------------------------------------------------------------------------------------
239 // private member
240 //-------------------------------------------------------------------------------------------------------------
242 private:
244 /*Attention
246 Don't initialize these static member in these header!
247 a) Double dfined symbols will be detected ...
248 b) and unresolved externals exist at linking time.
249 Do it in your source only.
252 static SvtCommandOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
253 static sal_Int32 m_nRefCount ; /// internal ref count mechanism
255 }; // class SvtCmdOptions
259 #endif // #ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX