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 <osl/diagnose.h>
28 #include <comphelper/comphelperdllapi.h>
37 //= OPropertyStateContainer
39 typedef ::cppu::ImplHelper1
< css::beans::XPropertyState
40 > OPropertyStateContainer_TBase
;
42 /** helper implementation for components which have properties with a default
44 <p>This class is not intended for direct use, you need to derive from it.</p>
46 @see com.sun.star.beans.XPropertyState
48 class COMPHELPER_DLLPUBLIC OPropertyStateContainer
49 :public OPropertyContainer
50 ,public OPropertyStateContainer_TBase
55 help to be used for broadcasting events
57 OPropertyStateContainer( ::cppu::OBroadcastHelper
& _rBHelper
);
61 virtual css::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) override
;
62 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
getPropertyStates( const css::uno::Sequence
< OUString
>& aPropertyName
) override
;
63 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) override
;
64 virtual css::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) override
;
68 // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
69 // but you may want to override them for whatever reasons (for instance, if your derived class
70 // supports the AMBIGUOUS state for properties)
72 /** get the PropertyState of the property denoted by the given handle
74 <p>Already implemented by this base class, no need to override</p>
75 @precond <arg>_nHandle</arg> is a valid property handle
77 css::beans::PropertyState
getPropertyStateByHandle( sal_Int32 _nHandle
);
79 /** set the property denoted by the given handle to its default value
81 <p>Already implemented by this base class, no need to override</p>
82 @precond <arg>_nHandle</arg> is a valid property handle
84 void setPropertyToDefaultByHandle( sal_Int32 _nHandle
);
86 /** get the default value for the property denoted by the given handle
89 <arg>_nHandle</arg> is a valid property handle
91 virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle
, css::uno::Any
& _rDefault
) const = 0;
95 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& _rType
) override
;
97 DECLARE_XTYPEPROVIDER( )
100 /** returns the handle for the given name
102 @throw UnknownPropertyException if the given name is not a registered property
104 sal_Int32
getHandleForName( const OUString
& _rPropertyName
);
108 } // namespace comphelper
111 #endif // INCLUDED_COMPHELPER_PROPERTYSTATECONTAINER_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */