license: libvisio is MPLv2
[LibreOffice.git] / include / comphelper / propstate.hxx
blob3e3cea79e08226bad357972a747305a16b7e671b
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 #ifndef INCLUDED_COMPHELPER_PROPSTATE_HXX
21 #define INCLUDED_COMPHELPER_PROPSTATE_HXX
23 #include <com/sun/star/beans/XPropertyState.hpp>
24 #include <com/sun/star/uno/Sequence.h>
27 #include <cppuhelper/propshlp.hxx>
28 #include <cppuhelper/weak.hxx>
29 #include <comphelper/uno3.hxx>
30 #include <comphelper/broadcasthelper.hxx>
31 #include <com/sun/star/lang/XTypeProvider.hpp>
32 #include <comphelper/comphelperdllapi.h>
35 //= property helper classes
38 namespace comphelper
42 //= OPropertyStateHelper
44 /// helper class for implementing property states
45 class COMPHELPER_DLLPUBLIC OPropertyStateHelper :public ::cppu::OPropertySetHelper2
46 ,public css::beans::XPropertyState
48 public:
49 OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
50 OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
51 ::cppu::IEventNotificationHook *i_pFireEvents);
53 virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& aType) override;
55 // XPropertyState
56 virtual css::beans::PropertyState SAL_CALL
57 getPropertyState(const OUString& PropertyName) override;
58 virtual css::uno::Sequence< css::beans::PropertyState> SAL_CALL
59 getPropertyStates(const css::uno::Sequence< OUString >& aPropertyName) override;
60 virtual void SAL_CALL
61 setPropertyToDefault(const OUString& PropertyName) override;
62 virtual css::uno::Any SAL_CALL
63 getPropertyDefault(const OUString& aPropertyName) override;
65 // access via handle
66 virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
67 virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
68 virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
70 protected:
71 virtual ~OPropertyStateHelper() override;
73 void firePropertyChange(sal_Int32 nHandle, const css::uno::Any& aNewValue, const css::uno::Any& aOldValue);
75 static css::uno::Sequence<css::uno::Type> getTypes();
79 //= OPropertyStateHelper
81 class COMPHELPER_DLLPUBLIC OStatefulPropertySet :public ::cppu::OWeakObject
82 ,public css::lang::XTypeProvider
83 ,public OMutexAndBroadcastHelper // order matters: before OPropertyStateHelper/OPropertySetHelper
84 ,public OPropertyStateHelper
86 protected:
87 OStatefulPropertySet();
88 virtual ~OStatefulPropertySet() override;
90 protected:
91 DECLARE_XINTERFACE()
92 DECLARE_XTYPEPROVIDER()
96 } // namespace comphelper
99 #endif // INCLUDED_COMPHELPER_PROPSTATE_HXX
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */