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 _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ 25 #define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ 26 27 #include <comphelper/propertycontainer.hxx> 28 #include <com/sun/star/beans/PropertyAttribute.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <cppuhelper/typeprovider.hxx> 31 #include <com/sun/star/lang/XUnoTunnel.hpp> 32 #include <comphelper/stl_types.hxx> 33 #include "connectivity/dbtoolsdllapi.hxx" 34 35 namespace connectivity 36 { 37 namespace sdbcx 38 { 39 // ========================================================================= 40 // = ODescriptor 41 // ========================================================================= 42 typedef ::comphelper::OPropertyContainer ODescriptor_PBASE; 43 class OOO_DLLPUBLIC_DBTOOLS ODescriptor 44 :public ODescriptor_PBASE 45 ,public ::com::sun::star::lang::XUnoTunnel 46 { 47 protected: 48 ::rtl::OUString m_Name; 49 50 /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper 51 52 This method just calls describeProperties, and flags all properties as READONLY if and 53 only if we do *not* act as descriptor, but as final object. 54 55 @seealso isNew 56 */ 57 ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const; 58 59 private: 60 comphelper::UStringMixEqual m_aCase; 61 sal_Bool m_bNew; 62 63 public: 64 ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False); 65 66 virtual ~ODescriptor(); 67 isNew() const68 sal_Bool isNew() const { return m_bNew; } getNew() const69 sal_Bool getNew() const { return m_bNew; } 70 virtual void setNew(sal_Bool _bNew); 71 isCaseSensitive() const72 sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } 73 74 virtual void construct(); 75 76 // XInterface 77 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 78 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 79 80 // compare operator ==(const::rtl::OUString & _rRH)81 inline sal_Bool operator == ( const ::rtl::OUString & _rRH ) 82 { 83 return m_aCase(m_Name,_rRH); 84 } 85 86 // com::sun::star::lang::XUnoTunnel 87 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 88 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); 89 90 static ODescriptor* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSomeComp ); 91 // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag 92 static sal_Bool isNew( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDescriptor ); 93 }; 94 } 95 96 } 97 #endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ 98 99