LibreOffice Module unotools (master) 1
viewoptions.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
20#define INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
21
23#include <com/sun/star/uno/Sequence.hxx>
24#include <sal/types.h>
25#include <rtl/ustring.hxx>
26
27namespace com::sun::star::beans { struct NamedValue; }
28namespace com::sun::star::container { class XNameAccess; }
29
30/*-************************************************************************************************************
31 @descr Use these enum values to specify right list in configuration in which your view data are saved.
32*//*-*************************************************************************************************************/
33
34enum class EViewType
35{
36 Dialog = 0,
37 TabDialog = 1,
38 TabPage = 2,
39 Window = 3
40};
41
42/*-************************************************************************************************************
43 @short collect information about view features
44 @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows.
45 You must specify your basetype by using right enum value and must give us a valid name for your
46 subkey in registry! We support some fix features for some bastypes and user data as string for all!
47 see also configuration package "org.openoffice.Office.Views/..." for further information.
48
49 template of configuration:
50 DialogType
51 /WindowState [string]
52 /UserData [set of any scalar types]
53 TabDialogType
54 /WindowState [string]
55 /UserData [set of any scalar types]
56 /PageID [int]
57 TabPageType
58 /WindowState [string]
59 /UserData [set of any scalar types]
60 WindowType
61 /WindowState [string]
62 /UserData [set of any scalar types]
63 /Visible [boolean]
64
65 structure of configuration:
66
67 org.openoffice.Office.Views [package]
68 /Dialogs [set]
69 /Dialog_FileOpen [DialogType]
70 /Dialog_ImportGraphics [DialogType]
71 ...
72 /Dialog_<YourName> [DialogType]
73
74 /TabDialogs [set]
75 /TabDialog_001 [TabDialogType]
76 /TabDialog_Blubber [TabDialogType]
77 ...
78 /TabDialog_<YourName> [TabDialogType]
79
80 /TabPages [set]
81 /TabPage_XXX [TabPageType]
82 /TabPage_Date [TabPageType]
83 ...
84 /TabPage_<YourName> [TabPageType]
85
86 /Windows [set]
87 /Window_User [WindowType]
88 /Window_Options [WindowType]
89 ...
90 /Window_<YourName> [WindowType]
91 @devstatus ready to use
92*//*-*************************************************************************************************************/
93
95{
96
97 // public methods
98
99 public:
100
101 // constructor / destructor
102
103 /*-****************************************************************************************************
104 @short standard constructor and destructor
105 @descr This will de-/initialize an instance with default values.
106 You must give us the basic type of your view and a name which specify right entry
107 in dynamical configuration list. If entry not exist, we create a new one!
108
109 @seealso enum EViewType
110
111 @param "eType" specify type of your view and is used to use right data container!
112 @param "sViewName" specify the name of your view and is the key name in data list too.
113 @onerror An assertion is thrown in debug version. Otherwise we do nothing!
114 *//*-*****************************************************************************************************/
115
116 SvtViewOptions( EViewType eType, OUString sViewName );
117
118 // interface
119
120 /*-****************************************************************************************************
121 @short use it to get information about existing entries in configuration
122 @descr The methods to set/get the position or size will create a new entry automatically if
123 it not already exist and work with default values!
124 If this a problem for you - you MUST call these method before and
125 you must make up your own mind about that.
126 @onerror No error should occur.
127 *//*-*****************************************************************************************************/
128
129 bool Exists() const;
130
131 /*-****************************************************************************************************
132 @short use it to delete an entry of dynamic view set
133 @descr You can use this method to delete an existing node in configuration.
134 But if you call a Set- or Get- method again on this instance
135 the item is created again! If you do nothing after this call
136 your view will die relay in configuration...
137
138 @seealso method Exist()
139 *//*-*****************************************************************************************************/
140
141 void Delete();
142
143 /*-****************************************************************************************************
144 @short use it to set/get the window state of your view
145 @descr These value describe position/size and some other states of a window.
146 Use it with right vcl methods directly. Normally it's not necessary to
147 parse given string!
148
149 @seealso vcl methods
150 *//*-*****************************************************************************************************/
151
152 OUString GetWindowState( ) const;
153 void SetWindowState( const OUString& sState );
154
155 /*-****************************************************************************************************
156 @short use it to set/get the page number which was the last active one
157 @descr It's only supported for: - tab-dialogs
158 If you call it for other ones you will get an assertion in debug version.
159 In a product version we do nothing!
160 @onerror An assertion is thrown in debug version. Otherwise we do nothing!
161 *//*-*****************************************************************************************************/
162
163 OUString GetPageID() const;
164 void SetPageID(const OUString& rID);
165
166 /*-****************************************************************************************************
167 @short use it to set/get the visual state of a window
168 @descr It's only supported for: - windows
169 If you call it for other ones you will get an assertion in debug version.
170 In a product version we do nothing!
171 @onerror An assertion is thrown in debug version. Otherwise we do nothing!
172 *//*-*****************************************************************************************************/
173
174 bool IsVisible ( ) const;
175 void SetVisible( bool bState );
176
182 bool HasVisible() const;
183
184 /*-****************************************************************************************************
185 @short use it to set/get the extended user data (consisting of a set of named scalar values)
186 @descr It's supported for ALL types!
187 Every view can handle its own user defined data set.
188 @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
189 *//*-*****************************************************************************************************/
190 css::uno::Sequence< css::beans::NamedValue > GetUserData( ) const;
191 void SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData );
192
193 /*-****************************************************************************************************
194 @short use it to set/get ONE special user data item directly
195 @descr Normally you can work on full user data list by using "Set/GetUserData()".
196 With this function you have an access on special list entries directly without any
197 @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored.
198 *//*-*****************************************************************************************************/
199
200 css::uno::Any GetUserItem( const OUString& sName ) const;
201 void SetUserItem( const OUString& sName ,
202 const css::uno::Any& aValue );
203
204 private:
205 enum State { STATE_NONE, STATE_FALSE, STATE_TRUE };
206
207 css::uno::Reference< css::uno::XInterface > impl_getSetNode( const OUString& sNode ,
208 bool bCreateIfMissing) const;
209 State GetVisible() const;
210
214 OUString m_sViewName;
215
216 OUString m_sListName;
217 css::uno::Reference< css::container::XNameAccess > m_xRoot;
218 css::uno::Reference< css::container::XNameAccess > m_xSet;
219}; // class SvtViewOptions
220
221#endif // INCLUDED_UNOTOOLS_VIEWOPTIONS_HXX
222
223/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString m_sViewName
css::uno::Reference< css::container::XNameAccess > m_xRoot
EViewType m_eViewType
specify which list of views in configuration is used! This can't be a static value!...
css::uno::Reference< css::container::XNameAccess > m_xSet
OUString m_sListName
DocumentType eType
OUString sName
UNOTOOLS_DLLPUBLIC bool Exists(OUString const &url)
Definition: ucbhelper.cxx:290
State
#define SAL_WARN_UNUSED
#define UNOTOOLS_DLLPUBLIC
EViewType
Definition: viewoptions.hxx:35