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: viewoptions.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_VIEWOPTIONS_HXX
31 #define INCLUDED_SVTOOLS_VIEWOPTIONS_HXX
33 //_________________________________________________________________________________________________________________
35 //_________________________________________________________________________________________________________________
37 #ifndef INCLUDED_SVLDLLAPI_H
41 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
42 #include <com/sun/star/uno/Sequence.hxx>
45 #ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
46 #include <com/sun/star/beans/NamedValue.hpp>
49 #ifndef _UTL_CONFIGMGR_HXX_
50 #include <unotools/configmgr.hxx>
53 #ifndef _UTL_CONFIGITEM_HXX_
54 #include <unotools/configitem.hxx>
58 #include <sal/types.h>
61 #ifndef _OSL_MUTEX_HXX_
62 #include <osl/mutex.hxx>
65 #ifndef _RTL_USTRING_HXX_
66 #include <rtl/ustring.hxx>
69 #ifndef INCLUDED_SVTOOLS_OPTIONS_HXX
70 #include <bf_svtools/options.hxx>
76 //_________________________________________________________________________________________________________________
77 // forward declarations
78 //_________________________________________________________________________________________________________________
80 class SvtViewOptionsBase_Impl
;
82 //_________________________________________________________________________________________________________________
84 //_________________________________________________________________________________________________________________
86 /*-************************************************************************************************************//**
87 @descr Use these enum values to specify right list in configuration in which your view data are saved.
88 *//*-*************************************************************************************************************/
98 /*-************************************************************************************************************//**
99 @short collect informations about view features
100 @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows.
101 You must specify your basetype by using right enum value and must give us a valid name for your
102 subkey in registry! We support some fix features for some bastypes and user data as string for all!
103 see also configuration package "org.openoffice.Office.Views/..." for further informations.
105 template of configuration:
107 /WindowState [string]
108 /UserData [set of any scalar types]
110 /WindowState [string]
111 /UserData [set of any scalar types]
114 /WindowState [string]
115 /UserData [set of any scalar types]
117 /WindowState [string]
118 /UserData [set of any scalar types]
121 structure of configuration:
123 org.openoffice.Office.Views [package]
125 /Dialog_FileOpen [DialogType]
126 /Dialog_ImportGraphics [DialogType]
128 /Dialog_<YourName> [DialogType]
131 /TabDialog_001 [TabDialogType]
132 /TabDialog_Blubber [TabDialogType]
134 /TabDialog_<YourName> [TabDialogType]
137 /TabPage_XXX [TabPageType]
138 /TabPage_Date [TabPageType]
140 /TabPage_<YourName> [TabPageType]
143 /Window_User [WindowType]
144 /Window_Options [WindowType]
146 /Window_<YourName> [WindowType]
151 @devstatus ready to use
152 *//*-*************************************************************************************************************/
154 class SvtViewOptions
: public Options
159 void GetPosition ( sal_Int32& nX ,
160 sal_Int32& nY ) const;
161 void SetPosition ( sal_Int32 nX ,
163 void GetSize ( sal_Int32& nWidth ,
164 sal_Int32& nHeight ) const;
165 void SetSize ( sal_Int32 nWidth ,
167 ::rtl::OUString GetUserData ( ) const;
168 void SetUserData ( const ::rtl::OUString& sData );
169 static ::com::sun::star::uno::Sequence< ::rtl::OUString > SeperateUserData( const ::rtl::OUString& sData ,
170 sal_Unicode cSeperator=';' );
171 static ::rtl::OUString GenerateUserData( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqData ,
172 sal_Unicode cSeperator=';' );
173 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetAnyData ( ) const;
174 void SetAnyData ( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lData );
178 //-------------------------------------------------------------------------------------------------------------
180 //-------------------------------------------------------------------------------------------------------------
184 //---------------------------------------------------------------------------------------------------------
185 // constructor / destructor
186 //---------------------------------------------------------------------------------------------------------
188 /*-****************************************************************************************************//**
189 @short standard constructor and destructor
190 @descr This will de-/initialize an instance with default values.
191 You must give us the basic type of your view and a name which specify right entry
192 in dynamical configuration list. If entry not exist, we create a new one!
194 @seealso enum EViewType
196 @param "eType" specify type of your view and is used to use right data container!
197 @param "sViewName" specify the name of your view and is the key name in data list too.
200 @onerror An assertion is thrown in debug version. Otherwise we do nothing!
201 *//*-*****************************************************************************************************/
203 SvtViewOptions( EViewType eType
,
204 const ::rtl::OUString
& sViewName
);
205 virtual ~SvtViewOptions();
207 //-------------------------------------------------------------------------------------------------------------
209 //-------------------------------------------------------------------------------------------------------------
213 /*-****************************************************************************************************//**
214 @short return a reference to a static mutex
215 @descr These class is threadsafe.
216 We create a static mutex only for one time and use it to protect our refcount and container
222 @return A reference to a static mutex member.
225 *//*-*****************************************************************************************************/
227 static ::osl::Mutex
& GetOwnStaticMutex();
229 //-------------------------------------------------------------------------------------------------------------
231 //-------------------------------------------------------------------------------------------------------------
235 /// specify which list of views in configuration is used! This can't be a static value!!!
236 /// ... because we need this value to work with right static data container.
237 EViewType m_eViewType
;
238 ::rtl::OUString m_sViewName
;
240 /// - impl. data container as dynamic pointer for smaller memory requirements!
241 /// - internal ref count mechanism
245 Don't initialize these static member in these header!
246 a) Double defined symbols will be detected ...
247 b) and unresolved externals exist at linking time.
248 Do it in your source only.
251 static SvtViewOptionsBase_Impl
* m_pDataContainer_Dialogs
; /// hold data for all dialogs
252 static sal_Int32 m_nRefCount_Dialogs
;
253 static SvtViewOptionsBase_Impl
* m_pDataContainer_TabDialogs
; /// hold data for all tab-dialogs
254 static sal_Int32 m_nRefCount_TabDialogs
;
255 static SvtViewOptionsBase_Impl
* m_pDataContainer_TabPages
; /// hold data for all tab-pages
256 static sal_Int32 m_nRefCount_TabPages
;
257 static SvtViewOptionsBase_Impl
* m_pDataContainer_Windows
; /// hold data for all windows
258 static sal_Int32 m_nRefCount_Windows
;
260 }; // class SvtViewOptions
264 #endif // #ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX