/src/libreoffice/framework/inc/properties.h
Line | Count | Source |
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 | | |
20 | | #pragma once |
21 | | |
22 | | #include <o3tl/enumarray.hxx> |
23 | | #include <com/sun/star/uno/Any.hxx> |
24 | | |
25 | | namespace framework{ |
26 | | |
27 | | // Please add new entries alphabetical sorted and correct all other handles! |
28 | | // Start counting with 0, so it can be used as direct index into an array too. |
29 | | enum class FramePropHandle : sal_Int32 |
30 | | { |
31 | | DispatchRecorderSupplier = 0, |
32 | | IsHidden = 1, |
33 | | LayoutManager = 2, |
34 | | Title = 3, |
35 | | IndicatorInterception = 4, |
36 | | Url = 5, |
37 | | LAST = Url |
38 | | }; |
39 | | |
40 | | /** properties for "Frame" class */ |
41 | | inline constexpr o3tl::enumarray<FramePropHandle, OUString> FramePropNames = |
42 | | { |
43 | | u"DispatchRecorderSupplier"_ustr, |
44 | | u"IsHidden"_ustr, |
45 | | u"LayoutManager"_ustr, |
46 | | u"Title"_ustr, |
47 | | u"IndicatorInterception"_ustr, |
48 | | u"URL"_ustr |
49 | | }; |
50 | | |
51 | | /** properties for "LayoutManager" class */ |
52 | | |
53 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER = u"MenuBarCloser"_ustr; |
54 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS = u"AutomaticToolbars"_ustr; |
55 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY = u"RefreshContextToolbarVisibility"_ustr; |
56 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI = u"HideCurrentUI"_ustr; |
57 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT = u"LockCount"_ustr; |
58 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE = u"PreserveContentSize"_ustr; |
59 | | inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP = u"RefreshContextToolbarToolTip"_ustr; |
60 | | |
61 | 7.14k | #define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER |
62 | | |
63 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER 0 |
64 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS 1 |
65 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY 2 |
66 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI 3 |
67 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT 4 |
68 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE 5 |
69 | 7.14k | #define LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP 6 |
70 | | |
71 | | /** properties for "UICommandDescription" class */ |
72 | | inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST = u"private:resource/image/commandimagelist"_ustr; |
73 | | inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST = u"private:resource/image/commandrotateimagelist"_ustr; |
74 | | inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST = u"private:resource/image/commandmirrorimagelist"_ustr; |
75 | | |
76 | | |
77 | 0 | #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 |
78 | | |
79 | | /** properties for "AutoRecovery" class */ |
80 | | |
81 | | inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA = u"ExistsRecoveryData"_ustr; |
82 | | inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA = u"ExistsSessionData"_ustr; |
83 | | inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_CRASHED = u"Crashed"_ustr; |
84 | | |
85 | 0 | #define AUTORECOVERY_PROPNAME_EXISTS_RECOVERYDATA AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA |
86 | 0 | #define AUTORECOVERY_PROPNAME_EXISTS_SESSIONDATA AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA |
87 | 0 | #define AUTORECOVERY_PROPNAME_CRASHED AUTORECOVERY_PROPNAME_ASCII_CRASHED |
88 | | |
89 | 0 | #define AUTORECOVERY_PROPHANDLE_EXISTS_RECOVERYDATA 0 |
90 | 0 | #define AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA 1 |
91 | 0 | #define AUTORECOVERY_PROPHANDLE_CRASHED 2 |
92 | | |
93 | | /** properties for Filter config */ |
94 | | |
95 | | inline constexpr OUString FILTER_PROPNAME_ASCII_DOCUMENTSERVICE = u"DocumentService"_ustr; |
96 | | |
97 | | /** properties for office module config (Setup.xcu) */ |
98 | | |
99 | | inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_UINAME = u"ooSetupFactoryUIName"_ustr; |
100 | | inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_ICON = u"ooSetupFactoryIcon"_ustr; |
101 | | |
102 | | /** provides some helper methods to implement property sets. */ |
103 | | |
104 | | class PropHelper |
105 | | { |
106 | | public: |
107 | | |
108 | | /** checks if given property will be changed by this settings. |
109 | | * We compare the content of the given any values. If they are different we return sal_True - sal_False otherwise. |
110 | | * |
111 | | * @param aCurrentValue contains the current value for this property |
112 | | * @param aNewValue contains the new value for this property |
113 | | * @param aOldValue returns the current value, in case something will be changed |
114 | | * @param aChangedValue returns the new value, in case something will be changed |
115 | | * |
116 | | * @return <True/> if value of this property will be changed; <False/> otherwise. |
117 | | */ |
118 | | |
119 | | static bool willPropertyBeChanged( const css::uno::Any& aCurrentValue , |
120 | | const css::uno::Any& aNewValue , |
121 | | css::uno::Any& aOldValue , |
122 | | css::uno::Any& aChangedValue ) |
123 | 0 | { |
124 | 0 | bool bChanged = false; |
125 | | |
126 | | // clear return parameter to be sure, to put out only valid values ... |
127 | 0 | aOldValue.clear(); |
128 | 0 | aChangedValue.clear(); |
129 | | |
130 | | // if value change ... |
131 | 0 | bChanged = aCurrentValue != aNewValue; |
132 | 0 | if (bChanged) |
133 | 0 | { |
134 | | // ... set information of change. |
135 | 0 | aOldValue = aCurrentValue; |
136 | 0 | aChangedValue = aNewValue; |
137 | 0 | } |
138 | |
|
139 | 0 | return bChanged; |
140 | 0 | } |
141 | | }; |
142 | | |
143 | | } // namespace framework |
144 | | |
145 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |