1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_PROPERTYSTATECONTAINER_HXX
21 #define INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
23 #include <comphelper/propertycontainer.hxx>
24 #include <com/sun/star/beans/XPropertyState.hpp>
25 #include <cppuhelper/implbase1.hxx>
26 #include <comphelper/uno3.hxx>
27 #include <comphelper/comphelperdllapi.h>
34 //= OPropertyStateContainer
36 typedef ::cppu::ImplHelper1
< css::beans::XPropertyState
37 > OPropertyStateContainer_TBase
;
39 /** helper implementation for components which have properties with a default
41 <p>This class is not intended for direct use, you need to derive from it.</p>
43 @see com.sun.star.beans.XPropertyState
45 class COMPHELPER_DLLPUBLIC OPropertyStateContainer
46 :public OPropertyContainer
47 ,public OPropertyStateContainer_TBase
52 help to be used for broadcasting events
54 OPropertyStateContainer( ::cppu::OBroadcastHelper
& _rBHelper
);
58 virtual css::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) override
;
59 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
getPropertyStates( const css::uno::Sequence
< OUString
>& aPropertyName
) override
;
60 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) override
;
61 virtual css::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) override
;
65 // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
66 // but you may want to override them for whatever reasons (for instance, if your derived class
67 // supports the AMBIGUOUS state for properties)
69 /** get the PropertyState of the property denoted by the given handle
71 <p>Already implemented by this base class, no need to override</p>
72 @precond <arg>_nHandle</arg> is a valid property handle
74 css::beans::PropertyState
getPropertyStateByHandle( sal_Int32 _nHandle
) const;
76 /** set the property denoted by the given handle to its default value
78 <p>Already implemented by this base class, no need to override</p>
79 @precond <arg>_nHandle</arg> is a valid property handle
81 void setPropertyToDefaultByHandle( sal_Int32 _nHandle
);
83 /** get the default value for the property denoted by the given handle
86 <arg>_nHandle</arg> is a valid property handle
88 virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle
, css::uno::Any
& _rDefault
) const = 0;
92 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& _rType
) override
;
94 DECLARE_XTYPEPROVIDER( )
97 /** returns the handle for the given name
99 @throw UnknownPropertyException if the given name is not a registered property
101 sal_Int32
getHandleForName( const OUString
& _rPropertyName
);
105 } // namespace comphelper
108 #endif // INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */