1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
25 #define EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/uno/Reference.hxx>
29 /** === end UNO includes === **/
30 #include <rtl/ref.hxx>
31 
32 namespace com { namespace sun { namespace star {
33     namespace xsd {
34         class XDataType;
35     }
36     namespace beans {
37         class XPropertySet;
38         class XPropertySetInfo;
39     }
40 } } }
41 
42 //........................................................................
43 namespace pcr
44 {
45 //........................................................................
46 
47 	//====================================================================
48 	//= XSDDataType
49 	//====================================================================
50     class XSDDataType : public ::rtl::IReference
51 	{
52     private:
53         ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >
54                             m_xDataType;
55         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
56                             m_xFacetInfo;
57 
58     protected:
59         oslInterlockedCount m_refCount;
60 
61     protected:
getDataTypeInterface() const62         inline ::com::sun::star::xsd::XDataType* getDataTypeInterface() const { return m_xDataType.get(); }
63 
64     public:
65         XSDDataType(
66             const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >& _rxDataType
67         );
68 
69         // IReference
70         virtual oslInterlockedCount SAL_CALL acquire();
71         virtual oslInterlockedCount SAL_CALL release();
72 
73         /// retrieves the underlying UNO component
74         inline const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >&
getUnoDataType() const75                 getUnoDataType() const { return m_xDataType; }
76 
77         /// classifies the data typ
78         sal_Int16 classify() const SAL_THROW(());
79 
80         // attribute access
81         ::rtl::OUString     getName() const SAL_THROW(());
82         bool                isBasicType() const SAL_THROW(());
83 
84         /// determines whether a given facet exists at the type
85         bool                hasFacet( const ::rtl::OUString& _rFacetName ) const SAL_THROW(());
86         /// retrieves a facet value
87         ::com::sun::star::uno::Any
88                             getFacet( const ::rtl::OUString& _rFacetName ) SAL_THROW(());
89         /// sets a facet value
90         void                setFacet( const ::rtl::OUString& _rFacetName, const ::com::sun::star::uno::Any& _rFacetValue ) SAL_THROW(());
91 
92        /** copies as much facets (values, respectively) from a give data type instance
93        */
94        void             copyFacetsFrom( const ::rtl::Reference< XSDDataType >& _pSourceType );
95 
96     protected:
97         virtual ~XSDDataType();
98 
99     private:
100         XSDDataType();                                  // never implemented
101         XSDDataType( const XSDDataType& );              // never implemented
102         XSDDataType& operator=( const XSDDataType& );   // never implemented
103 	};
104 
105 //........................................................................
106 } // namespace pcr
107 //........................................................................
108 
109 #endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX
110 
111