Branch data Line data Source code
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 COMPHELPER_PROPERTYSTATECONTAINER_HXX
21 : : #define COMPHELPER_PROPERTYSTATECONTAINER_HXX
22 : :
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"
29 : :
30 : : #include <map>
31 : :
32 : : //.........................................................................
33 : : namespace comphelper
34 : : {
35 : : //.........................................................................
36 : :
37 : : //=====================================================================
38 : : //= OPropertyStateContainer
39 : : //=====================================================================
40 : : typedef ::cppu::ImplHelper1 < ::com::sun::star::beans::XPropertyState
41 : : > OPropertyStateContainer_TBase;
42 : :
43 : : /** helper implementation for components which have properties with a default
44 : :
45 : : <p>This class is not intended for direct use, you need to derive from it.</p>
46 : :
47 : : @see com.sun.star.beans.XPropertyState
48 : : */
49 [ - + ]: 731 : class COMPHELPER_DLLPUBLIC OPropertyStateContainer
50 : : :public OPropertyContainer
51 : : ,public OPropertyStateContainer_TBase
52 : : {
53 : : protected:
54 : : /** ctor
55 : : @param _rBHelper
56 : : help to be used for broadcasting events
57 : : */
58 : : OPropertyStateContainer( ::cppu::OBroadcastHelper& _rBHelper );
59 : :
60 : : // ................................................................
61 : : // XPropertyState
62 : : virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::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< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
64 : : virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
65 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
66 : :
67 : : // ................................................................
68 : : // own overridables
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)
72 : :
73 : : /** get the PropertyState of the property denoted by the given handle
74 : :
75 : : <p>Already implemented by this base class, no need to override</p>
76 : : @precond <arg>_nHandle</arg> is a valid property handle
77 : : */
78 : : virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle( sal_Int32 _nHandle );
79 : :
80 : : /** set the property denoted by the given handle to it's default value
81 : :
82 : : <p>Already implemented by this base class, no need to override</p>
83 : : @precond <arg>_nHandle</arg> is a valid property handle
84 : : */
85 : : virtual void setPropertyToDefaultByHandle( sal_Int32 _nHandle );
86 : :
87 : : /** get the default value for the property denoted by the given handle
88 : :
89 : : @precond
90 : : <arg>_nHandle</arg> is a valid property handle
91 : : */
92 : : virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const = 0;
93 : :
94 : : protected:
95 : : // XInterface
96 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
97 : : // XTypeProvider
98 : : DECLARE_XTYPEPROVIDER( )
99 : :
100 : : protected:
101 : : /** returns the handle for the given name
102 : :
103 : : @throw UnknownPropertyException if the given name is not a registered property
104 : : */
105 : : sal_Int32 getHandleForName( const ::rtl::OUString& _rPropertyName ) SAL_THROW( ( ::com::sun::star::beans::UnknownPropertyException ) );
106 : : };
107 : :
108 : : //.........................................................................
109 : : } // namespace comphelper
110 : : //.........................................................................
111 : :
112 : : #endif // COMPHELPER_PROPERTYSTATECONTAINER_HXX
113 : :
114 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|