diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /include/connectivity/sdbcx | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/connectivity/sdbcx')
-rw-r--r-- | include/connectivity/sdbcx/IRefreshable.hxx | 58 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VCollection.hxx | 227 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VColumn.hxx | 118 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VDescriptor.hxx | 85 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VTable.hxx | 143 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VView.hxx | 95 |
6 files changed, 726 insertions, 0 deletions
diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx new file mode 100644 index 000000000..3a9bd9a8c --- /dev/null +++ b/include/connectivity/sdbcx/IRefreshable.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX + +#include <connectivity/dbtoolsdllapi.hxx> + +namespace connectivity +{ + namespace sdbcx + { + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups + { + public: + virtual void refreshGroups() = 0; + + protected: + ~IRefreshableGroups() {} + }; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers + { + public: + virtual void refreshUsers() = 0; + + protected: + ~IRefreshableUsers() {} + }; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns + { + public: + virtual void refreshColumns() = 0; + + protected: + ~IRefreshableColumns() {} + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx new file mode 100644 index 000000000..525066876 --- /dev/null +++ b/include/connectivity/sdbcx/VCollection.hxx @@ -0,0 +1,227 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX + +#include <config_options.h> +#include <cppuhelper/implbase10.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/sdbcx/XAppend.hpp> +#include <com/sun/star/sdbcx/XDrop.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <comphelper/interfacecontainer2.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <connectivity/CommonTools.hxx> +#include <com/sun/star/container/XContainer.hpp> +#include <connectivity/dbtoolsdllapi.hxx> +#include <memory> + +namespace com::sun::star::container { class XEnumeration; } + + +namespace connectivity +{ + namespace sdbcx + { + + // the class OCollection is base class for collections :-) + typedef ::cppu::ImplHelper10< css::container::XNameAccess, + css::container::XIndexAccess, + css::container::XEnumerationAccess, + css::container::XContainer, + css::sdbc::XColumnLocate, + css::util::XRefreshable, + css::sdbcx::XDataDescriptorFactory, + css::sdbcx::XAppend, + css::sdbcx::XDrop, + css::lang::XServiceInfo> OCollectionBase; + + typedef css::uno::Reference< css::beans::XPropertySet > ObjectType; + + class UNLESS_MERGELIBS(OOO_DLLPUBLIC_DBTOOLS) SAL_NO_VTABLE IObjectCollection + { + public: + virtual ~IObjectCollection(); + virtual bool exists(const OUString& _sName ) = 0; + virtual bool empty() = 0; + virtual void swapAll() = 0; + virtual void swap() = 0; + virtual void clear() = 0; + virtual void reFill(const ::std::vector< OUString> &_rVector) = 0; + virtual void insert(const OUString& _sName, const ObjectType& _xObject) = 0; + virtual bool rename(const OUString& _sOldName, const OUString& _sNewName) = 0; + virtual sal_Int32 size() = 0; + virtual css::uno::Sequence< OUString > getElementNames() = 0; + virtual OUString getName(sal_Int32 _nIndex) = 0; + virtual void disposeAndErase(sal_Int32 _nIndex) = 0; + virtual void disposeElements() = 0; + virtual sal_Int32 findColumn( const OUString& columnName ) = 0; + virtual ObjectType getObject(sal_Int32 _nIndex) = 0; + virtual ObjectType getObject(const OUString& columnName) = 0; + virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) = 0; + virtual bool isCaseSensitive() const = 0; + }; + + // OCollection + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection : + public OCollectionBase + { + protected: + ::std::unique_ptr<IObjectCollection> m_pElements; + + ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; + ::comphelper::OInterfaceContainerHelper2 m_aRefreshListeners; + + protected: + ::cppu::OWeakObject& m_rParent; // parent of the collection + ::osl::Mutex& m_rMutex; // mutex of the parent + bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed + + // the implementing class should refresh their elements + /// @throws css::uno::RuntimeException + virtual void impl_refresh() = 0; + + // will be called when an object was requested by one of the accessing methods like getByIndex + virtual ObjectType createObject(const OUString& _rName) = 0; + + // will be called when a new object should be generated by a call of createDataDescriptor + // the returned object is empty will be filled outside and added to the collection + virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor(); + + /** appends an object described by a descriptor, under a given name + @param _rForName + is the name under which the object should be appended. Guaranteed to not be empty. + This is passed for convenience only, since it's the result of a call of + getNameForObject for the given descriptor + @param descriptor + describes the object to append + @return + the new object which is to be inserted into the collection. This might be the result + of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor. + */ + virtual ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ); + + // called when XDrop was called + virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName); + + /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overridden. + @param _xObject The object where the name should be extracted. + @return The name of the object. + */ + virtual OUString getNameForObject(const ObjectType& _xObject); + + /** clones the given descriptor + + The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from + _descriptor to the new object, which is returned. + + This method might come handy in derived classes for implementing appendObject, when the object + is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself, + where there is not yet a database backend to append the column to). + */ + ObjectType cloneDescriptor( const ObjectType& _descriptor ); + + OCollection(::cppu::OWeakObject& _rParent, + bool _bCase, + ::osl::Mutex& _rMutex, + const ::std::vector< OUString> &_rVector, + bool _bUseIndexOnly = false, + bool _bUseHardRef = true); + + /** clear the name map + <p>Does <em>not</em> dispose the objects hold by the collection.</p> + */ + void clear_NoDispose(); + + /** insert a new element into the collection + */ + void insertElement(const OUString& _sElementName,const ObjectType& _xElement); + + /** return the object, if not existent it creates it. + @param _nIndex + The index of the object to create. + @return ObjectType + */ + ObjectType getObject(sal_Int32 _nIndex); + + public: + virtual ~OCollection(); + DECLARE_SERVICE_INFO(); + + void reFill(const ::std::vector< OUString> &_rVector); + bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); } + void renameObject(const OUString& _sOldName, const OUString& _sNewName); + + // only the name is identical to ::cppu::OComponentHelper + virtual void disposing(); + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + // css::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // css::container::XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + // css::util::XRefreshable + virtual void SAL_CALL refresh( ) override; + virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; + virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + // XAppend + virtual void SAL_CALL appendByDescriptor( const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + // XDrop + virtual void SAL_CALL dropByName( const OUString& elementName ) override; + virtual void SAL_CALL dropByIndex( sal_Int32 index ) override; + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override; + // css::container::XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + private: + void notifyElementRemoved(const OUString& _sName); + void disposeElements(); + void dropImpl(sal_Int32 _nIndex, bool _bReallyDrop = true); + }; + } +} +#endif // INCLUDED_CONNECTIVITY_SDBCX_VCOLLECTION_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VColumn.hxx b/include/connectivity/sdbcx/VColumn.hxx new file mode 100644 index 000000000..68ad450c7 --- /dev/null +++ b/include/connectivity/sdbcx/VColumn.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/implbase1.hxx> +#include <connectivity/CommonTools.hxx> +#include <cppuhelper/basemutex.hxx> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace sdbcx + { + class OColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP; + + typedef ::cppu::WeakComponentImplHelper< css::container::XNamed, + css::lang::XServiceInfo> OColumnDescriptor_BASE; + typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OColumn_BASE; + + + class OOO_DLLPUBLIC_DBTOOLS OColumn : + public cppu::BaseMutex, + public OColumn_BASE, + public OColumnDescriptor_BASE, + public OColumn_PROP, + public ODescriptor + { + protected: + OUString m_TypeName; + OUString m_Description; + OUString m_DefaultValue; + + sal_Int32 m_IsNullable; + sal_Int32 m_Precision; + sal_Int32 m_Scale; + sal_Int32 m_Type; + + bool m_IsAutoIncrement; + bool m_IsRowVersion; + bool m_IsCurrency; + + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_TableName; + + using OColumnDescriptor_BASE::rBHelper; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + virtual ~OColumn() override; + public: + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + + OColumn( bool _bCase); + OColumn( const OUString& Name, + const OUString& TypeName, + const OUString& DefaultValue, + const OUString& Description, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool IsAutoIncrement, + bool IsRowVersion, + bool IsCurrency, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); + + DECLARE_SERVICE_INFO(); + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // ODescriptor + virtual void construct() override; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor( ) override; + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SDBCX_VCOLUMN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VDescriptor.hxx b/include/connectivity/sdbcx/VDescriptor.hxx new file mode 100644 index 000000000..51737e190 --- /dev/null +++ b/include/connectivity/sdbcx/VDescriptor.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX + +#include <comphelper/propertycontainer.hxx> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <comphelper/stl_types.hxx> +#include <connectivity/dbtoolsdllapi.hxx> + +namespace connectivity +{ + namespace sdbcx + { + + // = ODescriptor + + typedef ::comphelper::OPropertyContainer ODescriptor_PBASE; + class OOO_DLLPUBLIC_DBTOOLS ODescriptor + :public ODescriptor_PBASE + ,public css::lang::XUnoTunnel + { + protected: + OUString m_Name; + + /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper + + This method just calls describeProperties, and flags all properties as READONLY if and + only if we do *not* act as descriptor, but as final object. + + @seealso isNew + */ + ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const; + + private: + comphelper::UStringMixEqual m_aCase; + bool m_bNew; + + public: + ODescriptor(::cppu::OBroadcastHelper& _rBHelper, bool _bCase, bool _bNew = false); + + virtual ~ODescriptor() override; + + bool isNew() const { return m_bNew; } + void setNew(bool _bNew); + + bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } + + virtual void construct(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + /// @throws css::uno::RuntimeException + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ); + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); + + // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag + static bool isNew( const css::uno::Reference< css::uno::XInterface >& _rxDescriptor ); + }; + } + +} +#endif // INCLUDED_CONNECTIVITY_SDBCX_VDESCRIPTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VTable.hxx b/include/connectivity/sdbcx/VTable.hxx new file mode 100644 index 000000000..706700f87 --- /dev/null +++ b/include/connectivity/sdbcx/VTable.hxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/sdbcx/XIndexesSupplier.hpp> +#include <com/sun/star/sdbcx/XRename.hpp> +#include <com/sun/star/sdbcx/XAlterTable.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/sdbcx/XKeysSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/container/XNamed.hpp> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/CommonTools.hxx> +#include <connectivity/dbtoolsdllapi.hxx> + +namespace com::sun::star::sdbc { class XDatabaseMetaData; } + +namespace connectivity +{ + namespace sdbcx + { + + class OTable; + class OCollection; + + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier, + css::sdbcx::XKeysSupplier, + css::container::XNamed, + css::lang::XServiceInfo> OTableDescriptor_BASE; + + typedef ::cppu::ImplHelper4< css::sdbcx::XDataDescriptorFactory, + css::sdbcx::XIndexesSupplier, + css::sdbcx::XRename, + css::sdbcx::XAlterTable > OTable_BASE; + + typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP; + + + class OOO_DLLPUBLIC_DBTOOLS OTable : + public cppu::BaseMutex, + public OTable_BASE, + public OTableDescriptor_BASE, + public IRefreshableColumns, + public OTable_PROP, + public ODescriptor + { + protected: + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_Description; + OUString m_Type; + + rtl::Reference<OCollection> m_xKeys; + rtl::Reference<OCollection> m_xColumns; + rtl::Reference<OCollection> m_xIndexes; + OCollection* m_pTables; // must hold his own container to notify him when renaming + + using OTableDescriptor_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OTable( OCollection* _pTables, + bool _bCase); + OTable( OCollection* _pTables, + bool _bCase, + const OUString& Name, + const OUString& Type, + const OUString& Description = OUString(), + const OUString& SchemaName = OUString(), + const OUString& CatalogName = OUString()); + + virtual ~OTable() override; + + DECLARE_SERVICE_INFO(); + //XInterface + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // ODescriptor + virtual void construct() override; + virtual void refreshColumns() override; + virtual void refreshKeys(); + virtual void refreshIndexes(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XColumnsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; + // XKeysSupplier + virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getKeys( ) override; + // XNamed + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName( const OUString& aName ) override; + // XDataDescriptorFactory + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override; + // XIndexesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getIndexes( ) override; + // XRename + virtual void SAL_CALL rename( const OUString& newName ) override; + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; + + // helper method + virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() const; + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SDBCX_VTABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VView.hxx b/include/connectivity/sdbcx/VView.hxx new file mode 100644 index 000000000..e1a56a9fe --- /dev/null +++ b/include/connectivity/sdbcx/VView.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX +#define INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/broadcasthelper.hxx> +#include <connectivity/CommonTools.hxx> +#include <com/sun/star/container/XNamed.hpp> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::sdbc { class XDatabaseMetaData; } + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, + css::container::XNamed> OView_BASE; + + + class OOO_DLLPUBLIC_DBTOOLS OView : + public ::comphelper::OMutexAndBroadcastHelper, + public OView_BASE, + public ::comphelper::OIdPropertyArrayUsageHelper<OView>, + public ODescriptor + { + protected: + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_Command; + sal_Int32 m_CheckOption; + // need for the getName method + css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + public: + DECLARE_SERVICE_INFO(); + + OView(bool _bCase,const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData); + OView( bool _bCase, + const OUString& _rName, + const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData, + const OUString& _rCommand = OUString(), + const OUString& _rSchemaName = OUString(), + const OUString& _rCatalogName = OUString()); + virtual ~OView() override; + + // ODescriptor + virtual void construct() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() throw() override; + virtual void SAL_CALL release() throw() override; + //XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& ) override; + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SDBCX_VVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |