1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
29 #define EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/uno/Reference.hxx>
33 /** === end UNO includes === **/
34 #include <rtl/ref.hxx>
35 
36 namespace com { namespace sun { namespace star {
37     namespace xsd {
38         class XDataType;
39     }
40     namespace beans {
41         class XPropertySet;
42         class XPropertySetInfo;
43     }
44 } } }
45 
46 //........................................................................
47 namespace pcr
48 {
49 //........................................................................
50 
51 	//====================================================================
52 	//= XSDDataType
53 	//====================================================================
54     class XSDDataType : public ::rtl::IReference
55 	{
56     private:
57         ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >
58                             m_xDataType;
59         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
60                             m_xFacetInfo;
61 
62     protected:
63         oslInterlockedCount m_refCount;
64 
65     protected:
66         inline ::com::sun::star::xsd::XDataType* getDataTypeInterface() const { return m_xDataType.get(); }
67 
68     public:
69         XSDDataType(
70             const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >& _rxDataType
71         );
72 
73         // IReference
74         virtual oslInterlockedCount SAL_CALL acquire();
75         virtual oslInterlockedCount SAL_CALL release();
76 
77         /// retrieves the underlying UNO component
78         inline const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >&
79                 getUnoDataType() const { return m_xDataType; }
80 
81         /// classifies the data typ
82         sal_Int16 classify() const SAL_THROW(());
83 
84         // attribute access
85         ::rtl::OUString     getName() const SAL_THROW(());
86         bool                isBasicType() const SAL_THROW(());
87 
88         /// determines whether a given facet exists at the type
89         bool                hasFacet( const ::rtl::OUString& _rFacetName ) const SAL_THROW(());
90         /// retrieves a facet value
91         ::com::sun::star::uno::Any
92                             getFacet( const ::rtl::OUString& _rFacetName ) SAL_THROW(());
93         /// sets a facet value
94         void                setFacet( const ::rtl::OUString& _rFacetName, const ::com::sun::star::uno::Any& _rFacetValue ) SAL_THROW(());
95 
96        /** copies as much facets (values, respectively) from a give data type instance
97        */
98        void             copyFacetsFrom( const ::rtl::Reference< XSDDataType >& _pSourceType );
99 
100     protected:
101         virtual ~XSDDataType();
102 
103     private:
104         XSDDataType();                                  // never implemented
105         XSDDataType( const XSDDataType& );              // never implemented
106         XSDDataType& operator=( const XSDDataType& );   // never implemented
107 	};
108 
109 //........................................................................
110 } // namespace pcr
111 //........................................................................
112 
113 #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
114 
115