1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cmdoptions.hxx,v $
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
34 #include <sal/types.h>
37 #ifndef _OSL_MUTEX_HXX_
38 #include <osl/mutex.hxx>
41 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
42 #include <com/sun/star/uno/Sequence.h>
45 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
46 #include <com/sun/star/frame/XFrame.hpp>
49 #ifndef _RTL_USTRING_HXX_
50 #include <rtl/ustring.hxx>
53 #ifndef INCLUDED_SVTOOLS_OPTIONS_HXX
54 #include <bf_svtools/options.hxx>
59 //_________________________________________________________________________________________________________________
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 //_________________________________________________________________________________________________________________
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".
93 @devstatus ready to use
94 *//*-*************************************************************************************************************/
96 class SvtCommandOptions
: public Options
98 friend class SvtCommandOptions_Impl
;
100 //-------------------------------------------------------------------------------------------------------------
102 //-------------------------------------------------------------------------------------------------------------
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
130 *//*-*****************************************************************************************************/
133 virtual ~SvtCommandOptions();
135 //---------------------------------------------------------------------------------------------------------
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().
146 @param "eMenu" select right menu to clear.
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
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"
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.
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
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
207 @param "xFrame" points to the frame, which wish to be
208 notified, if configuration was changed.
212 *//*-*****************************************************************************************************/
214 void EstablisFrameCallback(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& xFrame
);
216 //-------------------------------------------------------------------------------------------------------------
218 //-------------------------------------------------------------------------------------------------------------
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.
231 @return A reference to a static mutex member.
234 *//*-*****************************************************************************************************/
236 static ::osl::Mutex
& GetOwnStaticMutex();
238 //-------------------------------------------------------------------------------------------------------------
240 //-------------------------------------------------------------------------------------------------------------
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