24#include <core_resource.hxx>
28#include <com/sun/star/beans/PropertyAttribute.hpp>
29#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
38#include <osl/diagnose.h>
53using namespace ::
cppu;
57OColumn::OColumn(
const bool _bNameIsReadOnly )
71Sequence< Type > OColumn::getTypes()
73 return ::comphelper::concatSequences(
74 OColumnBase::getTypes(),
85 return "com.sun.star.sdb.OColumn";
88sal_Bool OColumn::supportsService(
const OUString& _rServiceName )
93Sequence< OUString > OColumn::getSupportedServiceNames( )
99void OColumn::disposing()
101 OPropertyContainer::disposing();
105Reference< XPropertySetInfo > OColumn::getPropertySetInfo()
107 return createPropertySetInfo( getInfoHelper() ) ;
110OUString SAL_CALL OColumn::getName( )
115void SAL_CALL OColumn::setName(
const OUString& _rName )
120void OColumn::registerProperty(
const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
void* _pPointerToMember,
const Type& _rMemberType )
125void OColumn::registerMayBeVoidProperty(
const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, Any* _pPointerToMember,
const Type& _rExpectedType )
133 ::osl::Mutex& _rMutex,
134 bool _bCaseSensitive,
const std::vector< OUString> &_rVector,
140 :
OColumns_BASE(_rParent,_bCaseSensitive,_rMutex,_rVector,_bUseHardRef)
141 ,m_pMediator(nullptr)
142 ,m_pColFactoryImpl(_pColFactory)
143 ,m_pRefreshColumns(_pRefresh)
144 ,m_bInitialized(false)
145 ,m_bAddColumn(_bAddColumn)
146 ,m_bDropColumn(_bDropColumn)
151 css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
152 bool _bCaseSensitive,
const std::vector< OUString> &_rVector,
158 :
OColumns_BASE(_rParent,_bCaseSensitive,_rMutex,_rVector,_bUseHardRef)
159 ,m_pMediator(nullptr)
160 ,m_xDrvColumns(
std::move(_xDrvColumns))
161 ,m_pColFactoryImpl(_pColFactory)
162 ,m_pRefreshColumns(_pRefresh)
163 ,m_bInitialized(false)
164 ,m_bAddColumn(_bAddColumn)
165 ,m_bDropColumn(_bDropColumn)
176 return "com.sun.star.sdb.OColumns";
193 OSL_ENSURE( _pColumn,
"OColumns::append: invalid column!" );
194 OSL_ENSURE( !
m_pElements->exists( _rName ),
"OColumns::append: Column already exists");
196 _pColumn->m_sName = _rName;
231 Reference<XChild> xChild(xRet,UNO_QUERY);
233 xChild->setParent(
static_cast<XChild*
>(
static_cast<TXChild*
>(
this)));
236 Reference<XPropertySet> xDest(xRet,UNO_QUERY);
248 Reference<XChild> xChild(xRet,UNO_QUERY);
250 xChild->setParent(
static_cast<XChild*
>(
static_cast<TXChild*
>(
this)));
254 return Reference< XPropertySet >();
263 if ( aRet.hasValue() )
265 if ( !aRet.hasValue() )
278 if ( !aRet.hasValue() )
285 bool bAppendFound =
false,bDropFound =
false;
293 Sequence< Type >
aTypes(xTypes->getTypes());
296 const Type* pEnd = pBegin +
aTypes.getLength();
297 for (;pBegin != pEnd ; ++pBegin)
299 if(aAppendType == *pBegin)
301 else if(aDropType == *pBegin)
304 nSize = (bDropFound ? (bAppendFound ? 0 : 1) : (bAppendFound ? 1 : 2));
318 Sequence< Type > aRet(
aTypes.getLength() - nSize);
321 const Type* pEnd = pBegin +
aTypes.getLength();
322 for(sal_Int32
i=0;pBegin != pEnd ;++pBegin)
324 if(*pBegin != aAppendType && *pBegin != aDropType)
325 aRet.getArray()[
i++] = *pBegin;
326 else if(bDropFound && *pBegin == aDropType)
327 aRet.getArray()[
i++] = *pBegin;
328 else if(bAppendFound && *pBegin == aAppendType)
329 aRet.getArray()[
i++] = *pBegin;
342 xAppend->appendByDescriptor(descriptor);
350 if ( xAlterService.is() )
352 xAlterService->addColumn(
m_pTable,descriptor);
359 ::dbtools::throwGenericSQLException(
DBA_RES( RID_STR_NO_COLUMN_ADD ),
static_cast<XChild*
>(
static_cast<TXChild*
>(
this)) );
378 xDrop->dropByName( _sElementName );
385 if ( xAlterService.is() )
386 xAlterService->dropColumn(
m_pTable,_sElementName);
391 ::dbtools::throwGenericSQLException(
DBA_RES( RID_STR_NO_COLUMN_DROP ),
static_cast<XChild*
>(
static_cast<TXChild*
>(
this)) );
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
void registerMayBeVoidProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any *_pPointerToMember, const css::uno::Type &_rExpectedType)
virtual sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
css::uno::Reference< css::sdb::tools::XTableAlteration > const & getAlterService() const
virtual void refreshColumns()=0
void insertElement(const OUString &_sElementName, const ObjectType &_xElement)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
::std::unique_ptr< IObjectCollection > m_pElements
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
ObjectType cloneDescriptor(const ObjectType &_descriptor)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
css::uno::Type const & get()
virtual void columnAppended(const css::uno::Reference< css::beans::XPropertySet > &_rxSourceDescriptor)=0
notifies that a column, created from a column descriptor, has been appended
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor()=0
creates a column descriptor object.
virtual rtl::Reference< OColumn > createColumn(const OUString &_rName) const =0
creates an OColumn object which should represent the column with a given name
virtual void columnDropped(const OUString &_sName)=0
notifies that a column with a given name has been dropped
virtual void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType) override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
OContainerMediator * m_pMediator
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
IColumnFactory * m_pColFactoryImpl
void append(const OUString &rName, OColumn *)
virtual connectivity::sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual connectivity::sdbcx::ObjectType createObject(const OUString &_rName) override
::connectivity::sdbcx::IRefreshableColumns * m_pRefreshColumns
virtual void disposing() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
OColumns(::cppu::OWeakObject &_rParent, ::osl::Mutex &_rMutex, bool _bCaseSensitive, const std::vector< OUString > &_rVector, IColumnFactory *_pColFactory, ::connectivity::sdbcx::IRefreshableColumns *_pRefresh, bool _bAddColumn=false, bool _bDropColumn=false, bool _bUseHardRef=true)
constructs an empty container without configuration location.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::WeakReference< css::uno::XInterface > m_xParent
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
css::uno::Reference< css::container::XNameAccess > m_xDrvColumns
virtual ~OColumns() override
virtual OUString SAL_CALL getImplementationName() override
virtual void impl_refresh() override
css::uno::Reference< css::beans::XPropertySet > ObjectType
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, css::container::XNamed > OColumnBase
void notifyDataSourceModified(const css::uno::Reference< css::uno::XInterface > &_rxObject)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
constexpr OUStringLiteral SERVICE_SDBCX_CONTAINER
constexpr OUStringLiteral SERVICE_SDBCX_COLUMN
constexpr OUStringLiteral PROPERTY_NAME(u"Name")