1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
33 * The contents of this file are subject to the Mozilla Public License Version
34 * 1.1 (the "License"); you may not use this file except in compliance with
35 * the License or as specified alternatively below. You may obtain a copy of
36 * the License at http://www.mozilla.org/MPL/
38 * Software distributed under the License is distributed on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
40 * for the specific language governing rights and limitations under the
43 * Major Contributor(s):
44 * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
46 * All Rights Reserved.
48 * For minor contributions see the git repository.
50 * Alternatively, the contents of this file may be used under the terms of
51 * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
52 * the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
53 * in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
54 * instead of those above.
56 ************************************************************************/
58 #ifndef _PQ_REFL_BASE_HXX_
59 #define _PQ_REFL_BASE_HXX_
60 #include <cppuhelper/propshlp.hxx>
61 #include <cppuhelper/component.hxx>
63 #include <com/sun/star/lang/XServiceInfo.hpp>
64 #include <com/sun/star/container/XNamed.hpp>
66 #include "pq_xcontainer.hxx"
68 namespace pq_sdbc_driver
71 class ReflectionBase
:
72 public cppu::OComponentHelper
,
73 public cppu::OPropertySetHelper
,
74 public com::sun::star::lang::XServiceInfo
,
75 public com::sun::star::sdbcx::XDataDescriptorFactory
,
76 public com::sun::star::container::XNamed
79 const rtl::OUString m_implName
;
80 const ::com::sun::star::uno::Sequence
< rtl::OUString
> m_supportedServices
;
81 ::rtl::Reference
< RefCountedMutex
> m_refMutex
;
82 ::com::sun::star::uno::Reference
< com::sun::star::sdbc::XConnection
> m_conn
;
83 ConnectionSettings
*m_pSettings
;
84 cppu::IPropertyArrayHelper
& m_propsDesc
;
85 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> m_values
;
88 const ::rtl::OUString
&implName
,
89 const ::com::sun::star::uno::Sequence
< rtl::OUString
> &supportedServices
,
90 const ::rtl::Reference
< RefCountedMutex
> refMutex
,
91 const ::com::sun::star::uno::Reference
< com::sun::star::sdbc::XConnection
> &conn
,
92 ConnectionSettings
*pSettings
,
93 cppu::IPropertyArrayHelper
& props
/* must survive this object !*/ );
96 void copyValuesFrom( const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySet
> &set
);
98 public: // for initialization purposes only, not exported via an interface !
99 void setPropertyValue_NoBroadcast_public(
100 const rtl::OUString
& name
, const com::sun::star::uno::Any
& value
);
103 virtual void SAL_CALL
acquire() throw() { OComponentHelper::acquire(); }
104 virtual void SAL_CALL
release() throw() { OComponentHelper::release(); }
105 virtual com::sun::star::uno::Any SAL_CALL
queryInterface(
106 const com::sun::star::uno::Type
& reqType
)
107 throw (com::sun::star::uno::RuntimeException
);
109 public: // OPropertySetHelper
110 virtual cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
112 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
113 ::com::sun::star::uno::Any
& rConvertedValue
,
114 ::com::sun::star::uno::Any
& rOldValue
,
116 const ::com::sun::star::uno::Any
& rValue
)
117 throw (::com::sun::star::lang::IllegalArgumentException
);
119 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
121 const ::com::sun::star::uno::Any
& rValue
)
122 throw (::com::sun::star::uno::Exception
);
124 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
126 void SAL_CALL
getFastPropertyValue(
127 ::com::sun::star::uno::Any
& rValue
,
128 sal_Int32 nHandle
) const;
131 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
132 throw(com::sun::star::uno::RuntimeException
);
134 public: // XServiceInfo
135 virtual rtl::OUString SAL_CALL
getImplementationName()
136 throw(::com::sun::star::uno::RuntimeException
);
137 virtual sal_Bool SAL_CALL
supportsService(const rtl::OUString
& ServiceName
)
138 throw(::com::sun::star::uno::RuntimeException
);
139 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames(void)
140 throw(::com::sun::star::uno::RuntimeException
);
142 public: // XTypeProvider, first implemented by OPropertySetHelper
143 virtual com::sun::star::uno::Sequence
< com::sun::star::uno::Type
> SAL_CALL
getTypes()
144 throw( com::sun::star::uno::RuntimeException
);
145 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
146 throw( com::sun::star::uno::RuntimeException
);
148 public: // XDataDescriptorFactory
149 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
150 createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException
) = 0;
153 virtual ::rtl::OUString SAL_CALL
getName( ) throw (::com::sun::star::uno::RuntimeException
);
154 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);