Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
enum class LayoutManagerPropHandle
53
{
54
    MenuBarCloser,
55
    AutomaticToolbars,
56
    RefreshVisibility,
57
    HideCurrentUI,
58
    LockCount,
59
    PreserveContentSize,
60
    RefreshToolTip,
61
    LAST = RefreshToolTip
62
};
63
64
inline constexpr o3tl::enumarray<LayoutManagerPropHandle, OUString> LayoutManagerPropNames =
65
{
66
    u"MenuBarCloser"_ustr,
67
    u"AutomaticToolbars"_ustr,
68
    u"RefreshContextToolbarVisibility"_ustr,
69
    u"HideCurrentUI"_ustr,
70
    u"LockCount"_ustr,
71
    u"PreserveContentSize"_ustr,
72
    u"RefreshContextToolbarToolTip"_ustr
73
};
74
75
/** properties for "UICommandDescription" class */
76
inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST = u"private:resource/image/commandimagelist"_ustr;
77
inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST = u"private:resource/image/commandrotateimagelist"_ustr;
78
inline constexpr OUString UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST = u"private:resource/image/commandmirrorimagelist"_ustr;
79
80
81
0
#define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON            8
82
83
/** properties for "AutoRecovery" class */
84
enum class AutoRecoveryPropHandle
85
{
86
    ExistsRecoveryData,
87
    ExistsSessionData,
88
    Crashed,
89
    LAST = Crashed
90
};
91
92
inline constexpr o3tl::enumarray<AutoRecoveryPropHandle, OUString> AutoRecoveryPropNames =
93
{
94
    u"ExistsRecoveryData"_ustr,
95
    u"ExistsSessionData"_ustr,
96
    u"Crashed"_ustr
97
};
98
99
/** properties for Filter config */
100
101
inline constexpr OUString FILTER_PROPNAME_ASCII_DOCUMENTSERVICE = u"DocumentService"_ustr;
102
103
/** properties for office module config (Setup.xcu) */
104
105
inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_UINAME = u"ooSetupFactoryUIName"_ustr;
106
inline constexpr OUString OFFICEFACTORY_PROPNAME_ASCII_ICON = u"ooSetupFactoryIcon"_ustr;
107
108
/** provides some helper methods to implement property sets. */
109
110
class PropHelper
111
{
112
    public:
113
114
    /** checks if given property will be changed by this settings.
115
     *  We compare the content of the given any values. If they are different we return sal_True - sal_False otherwise.
116
     *
117
     *  @param  aCurrentValue   contains the current value for this property
118
     *  @param  aNewValue       contains the new value for this property
119
     *  @param  aOldValue       returns the current value, in case something will be changed
120
     *  @param  aChangedValue   returns the new value, in case something will be changed
121
     *
122
     *  @return <True/> if value of this property will be changed; <False/> otherwise.
123
     */
124
125
    static bool willPropertyBeChanged( const css::uno::Any& aCurrentValue ,
126
                                           const css::uno::Any& aNewValue     ,
127
                                                 css::uno::Any& aOldValue     ,
128
                                                 css::uno::Any& aChangedValue )
129
0
    {
130
0
        bool bChanged = false;
131
132
        // clear return parameter to be sure, to put out only valid values ...
133
0
        aOldValue.clear();
134
0
        aChangedValue.clear();
135
136
        // if value change ...
137
0
        bChanged = aCurrentValue != aNewValue;
138
0
        if (bChanged)
139
0
        {
140
            // ... set information of change.
141
0
            aOldValue     = aCurrentValue;
142
0
            aChangedValue = aNewValue;
143
0
        }
144
145
0
        return bChanged;
146
0
    }
147
};
148
149
} // namespace framework
150
151
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */