LibreOffice Module comphelper (master) 1
propstate.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
20#ifndef INCLUDED_COMPHELPER_PROPSTATE_HXX
21#define INCLUDED_COMPHELPER_PROPSTATE_HXX
22
23#include <config_options.h>
24#include <com/sun/star/beans/XPropertyState.hpp>
25#include <com/sun/star/uno/Sequence.h>
26
27
29#include <cppuhelper/weak.hxx>
30#include <comphelper/uno3.hxx>
32#include <com/sun/star/lang/XTypeProvider.hpp>
34
35
36//= property helper classes
37
38
39namespace comphelper
40{
41
42
43 //= OPropertyStateHelper
44
46 class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OPropertyStateHelper :public ::cppu::OPropertySetHelper2
47 ,public css::beans::XPropertyState
48 {
49 public:
50 OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
51 OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
52 ::cppu::IEventNotificationHook *i_pFireEvents);
53
54 virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
55
56 // XPropertyState
57 virtual css::beans::PropertyState SAL_CALL
58 getPropertyState(const OUString& PropertyName) override;
59 virtual css::uno::Sequence< css::beans::PropertyState> SAL_CALL
60 getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) override;
61 virtual void SAL_CALL
62 setPropertyToDefault(const OUString& PropertyName) override;
63 virtual css::uno::Any SAL_CALL
64 getPropertyDefault(const OUString& aPropertyName) override;
65
66 // access via handle
67 virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
68 virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
69 virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
70
71 protected:
72 virtual ~OPropertyStateHelper() override;
73
74 void firePropertyChange(sal_Int32 nHandle, const css::uno::Any& aNewValue, const css::uno::Any& aOldValue);
75
76 static css::uno::Sequence<css::uno::Type> getTypes();
77 };
78
79
80 //= OPropertyStateHelper
81
82 class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OStatefulPropertySet :public ::cppu::OWeakObject
83 ,public css::lang::XTypeProvider
84 ,public OMutexAndBroadcastHelper // order matters: before OPropertyStateHelper/OPropertySetHelper
85 ,public OPropertyStateHelper
86 {
87 protected:
88 OStatefulPropertySet();
89 virtual ~OStatefulPropertySet() override;
90
91 protected:
94 };
95
96
97} // namespace comphelper
98
99
100#endif // INCLUDED_COMPHELPER_PROPSTATE_HXX
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
#define DECLARE_XTYPEPROVIDER()
Definition: uno3.hxx:126
#define DECLARE_XINTERFACE()
Definition: uno3.hxx:90