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 COMPHELPER_PROPERTYSTATECONTAINER_HXX
21 #define 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"
32 //.........................................................................
35 //.........................................................................
37 //=====================================================================
38 //= OPropertyStateContainer
39 //=====================================================================
40 typedef ::cppu::ImplHelper1
< ::com::sun::star::beans::XPropertyState
41 > OPropertyStateContainer_TBase
;
43 /** helper implementation for components which have properties with a default
45 <p>This class is not intended for direct use, you need to derive from it.</p>
47 @see com.sun.star.beans.XPropertyState
49 class COMPHELPER_DLLPUBLIC OPropertyStateContainer
50 :public OPropertyContainer
51 ,public OPropertyStateContainer_TBase
56 help to be used for broadcasting events
58 OPropertyStateContainer( ::cppu::OBroadcastHelper
& _rBHelper
);
60 // ................................................................
62 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
63 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
getPropertyStates( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
64 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
65 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
67 // ................................................................
69 // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
70 // but you may want to override them for whatever reasons (for instance, if your derived class
71 // supports the AMBIGUOUS state for properties)
73 /** get the PropertyState of the property denoted by the given handle
75 <p>Already implemented by this base class, no need to override</p>
76 @precond <arg>_nHandle</arg> is a valid property handle
78 virtual ::com::sun::star::beans::PropertyState
getPropertyStateByHandle( sal_Int32 _nHandle
);
80 /** set the property denoted by the given handle to it's default value
82 <p>Already implemented by this base class, no need to override</p>
83 @precond <arg>_nHandle</arg> is a valid property handle
85 virtual void setPropertyToDefaultByHandle( sal_Int32 _nHandle
);
87 /** get the default value for the property denoted by the given handle
90 <arg>_nHandle</arg> is a valid property handle
92 virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle
, ::com::sun::star::uno::Any
& _rDefault
) const = 0;
96 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& _rType
) throw (::com::sun::star::uno::RuntimeException
);
98 DECLARE_XTYPEPROVIDER( )
101 /** returns the handle for the given name
103 @throw UnknownPropertyException if the given name is not a registered property
105 sal_Int32
getHandleForName( const OUString
& _rPropertyName
) SAL_THROW( ( ::com::sun::star::beans::UnknownPropertyException
) );
108 //.........................................................................
109 } // namespace comphelper
110 //.........................................................................
112 #endif // COMPHELPER_PROPERTYSTATECONTAINER_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */