cid#1608301 silence Overflowed constant
[LibreOffice.git] / framework / inc / properties.h
blobc4eef829af0f39643881ed725f9ff8fe17330bb2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/uno/Any.hxx>
24 namespace framework{
26 /** properties for "Frame" class */
28 inline constexpr OUString FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER = u"DispatchRecorderSupplier"_ustr;
29 inline constexpr OUString FRAME_PROPNAME_ASCII_ISHIDDEN = u"IsHidden"_ustr;
30 inline constexpr OUString FRAME_PROPNAME_ASCII_LAYOUTMANAGER = u"LayoutManager"_ustr;
31 inline constexpr OUString FRAME_PROPNAME_ASCII_TITLE = u"Title"_ustr;
32 inline constexpr OUString FRAME_PROPNAME_ASCII_INDICATORINTERCEPTION = u"IndicatorInterception"_ustr;
33 inline constexpr OUString FRAME_PROPNAME_ASCII_URL = u"URL"_ustr;
35 // Please add new entries alphabetical sorted and correct all other handles!
36 // Start counting with 0, so it can be used as direct index into an array too.
37 #define FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER 0
38 #define FRAME_PROPHANDLE_ISHIDDEN 1
39 #define FRAME_PROPHANDLE_LAYOUTMANAGER 2
40 #define FRAME_PROPHANDLE_TITLE 3
41 #define FRAME_PROPHANDLE_INDICATORINTERCEPTION 4
42 #define FRAME_PROPHANDLE_URL 5
44 /** properties for "LayoutManager" class */
46 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER = u"MenuBarCloser"_ustr;
47 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS = u"AutomaticToolbars"_ustr;
48 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY = u"RefreshContextToolbarVisibility"_ustr;
49 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI = u"HideCurrentUI"_ustr;
50 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT = u"LockCount"_ustr;
51 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE = u"PreserveContentSize"_ustr;
52 inline constexpr OUString LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP = u"RefreshContextToolbarToolTip"_ustr;
54 #define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER
56 #define LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER 0
57 #define LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS 1
58 #define LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY 2
59 #define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI 3
60 #define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT 4
61 #define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE 5
62 #define LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP 6
64 /** properties for "UICommandDescription" class */
65 inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST = u"private:resource/image/commandimagelist"_ustr;
66 inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST = u"private:resource/image/commandrotateimagelist"_ustr;
67 inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST = u"private:resource/image/commandmirrorimagelist"_ustr;
70 #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
72 /** properties for "AutoRecovery" class */
74 inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA = u"ExistsRecoveryData"_ustr;
75 inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA = u"ExistsSessionData"_ustr;
76 inline constexpr OUString AUTORECOVERY_PROPNAME_ASCII_CRASHED = u"Crashed"_ustr;
78 #define AUTORECOVERY_PROPNAME_EXISTS_RECOVERYDATA AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA
79 #define AUTORECOVERY_PROPNAME_EXISTS_SESSIONDATA AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA
80 #define AUTORECOVERY_PROPNAME_CRASHED AUTORECOVERY_PROPNAME_ASCII_CRASHED
82 #define AUTORECOVERY_PROPHANDLE_EXISTS_RECOVERYDATA 0
83 #define AUTORECOVERY_PROPHANDLE_EXISTS_SESSIONDATA 1
84 #define AUTORECOVERY_PROPHANDLE_CRASHED 2
86 /** properties for Filter config */
88 inline constexpr OUString FILTER_PROPNAME_ASCII_DOCUMENTSERVICE = u"DocumentService"_ustr;
90 /** properties for office module config (Setup.xcu) */
92 inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_UINAME = u"ooSetupFactoryUIName"_ustr;
93 inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_ICON = u"ooSetupFactoryIcon"_ustr;
95 /** provides some helper methods to implement property sets. */
97 class PropHelper
99 public:
101 /** checks if given property will be changed by this settings.
102 * We compare the content of the given any values. If they are different we return sal_True - sal_False otherwise.
104 * @param aCurrentValue contains the current value for this property
105 * @param aNewValue contains the new value for this property
106 * @param aOldValue returns the current value, in case something will be changed
107 * @param aChangedValue returns the new value, in case something will be changed
109 * @return <True/> if value of this property will be changed; <False/> otherwise.
112 static bool willPropertyBeChanged( const css::uno::Any& aCurrentValue ,
113 const css::uno::Any& aNewValue ,
114 css::uno::Any& aOldValue ,
115 css::uno::Any& aChangedValue )
117 bool bChanged = false;
119 // clear return parameter to be sure, to put out only valid values ...
120 aOldValue.clear();
121 aChangedValue.clear();
123 // if value change ...
124 bChanged = aCurrentValue != aNewValue;
125 if (bChanged)
127 // ... set information of change.
128 aOldValue = aCurrentValue;
129 aChangedValue = aNewValue;
132 return bChanged;
136 } // namespace framework
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */