Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / framework / inc / properties.h
blobb11a5b2e9d7107f4868420cd67f87526802c4dad
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 OUStringLiteral FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER = u"DispatchRecorderSupplier";
29 inline constexpr OUStringLiteral FRAME_PROPNAME_ASCII_ISHIDDEN = u"IsHidden";
30 inline constexpr OUStringLiteral FRAME_PROPNAME_ASCII_LAYOUTMANAGER = u"LayoutManager";
31 inline constexpr OUStringLiteral FRAME_PROPNAME_ASCII_TITLE = u"Title";
32 inline constexpr OUStringLiteral FRAME_PROPNAME_ASCII_INDICATORINTERCEPTION = u"IndicatorInterception";
33 inline constexpr OUStringLiteral FRAME_PROPNAME_ASCII_URL = u"URL";
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 OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER = u"MenuBarCloser";
47 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS = u"AutomaticToolbars";
48 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY = u"RefreshContextToolbarVisibility";
49 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI = u"HideCurrentUI";
50 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT = u"LockCount";
51 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE = u"PreserveContentSize";
52 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP = u"RefreshContextToolbarToolTip";
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 OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST = u"private:resource/image/commandimagelist";
66 inline constexpr OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST = u"private:resource/image/commandrotateimagelist";
67 inline constexpr OUStringLiteral UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST = u"private:resource/image/commandmirrorimagelist";
70 #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
72 /** properties for "AutoRecovery" class */
74 inline constexpr OUStringLiteral AUTORECOVERY_PROPNAME_ASCII_EXISTS_RECOVERYDATA = u"ExistsRecoveryData";
75 inline constexpr OUStringLiteral AUTORECOVERY_PROPNAME_ASCII_EXISTS_SESSIONDATA = u"ExistsSessionData";
76 inline constexpr OUStringLiteral AUTORECOVERY_PROPNAME_ASCII_CRASHED = u"Crashed";
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 OUStringLiteral FILTER_PROPNAME_ASCII_DOCUMENTSERVICE = u"DocumentService";
90 /** properties for office module config (Setup.xcu) */
92 inline constexpr OUStringLiteral OFFICEFACTORY_PROPNAME_ASCII_UINAME = u"ooSetupFactoryUIName";
93 inline constexpr OUStringLiteral OFFICEFACTORY_PROPNAME_ASCII_ICON = u"ooSetupFactoryIcon";
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: */