diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/connectivity/sdbcx | |
parent | move global headers script (diff) | |
download | core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.tar.gz core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.zip |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/connectivity/sdbcx')
-rw-r--r-- | include/connectivity/sdbcx/IRefreshable.hxx | 59 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VCatalog.hxx | 125 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VCollection.hxx | 237 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VColumn.hxx | 118 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VDescriptor.hxx | 95 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VGroup.hxx | 103 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VIndex.hxx | 106 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VIndexColumn.hxx | 65 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VKey.hxx | 121 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VKeyColumn.hxx | 67 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VTable.hxx | 141 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VTypeDef.hxx | 40 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VUser.hxx | 100 | ||||
-rw-r--r-- | include/connectivity/sdbcx/VView.hxx | 101 |
14 files changed, 1478 insertions, 0 deletions
diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx new file mode 100644 index 000000000000..629b2b3137b5 --- /dev/null +++ b/include/connectivity/sdbcx/IRefreshable.hxx @@ -0,0 +1,59 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#define _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ + +#include "connectivity/CommonTools.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 //_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VCatalog.hxx b/include/connectivity/sdbcx/VCatalog.hxx new file mode 100644 index 000000000000..14840400b385 --- /dev/null +++ b/include/connectivity/sdbcx/VCatalog.hxx @@ -0,0 +1,125 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#define _CONNECTIVITY_SDBCX_CATALOG_HXX_ + +#include <osl/diagnose.h> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/sdbcx/XViewsSupplier.hpp> +#include <com/sun/star/sdbcx/XUsersSupplier.hpp> +#include <com/sun/star/sdbcx/XGroupsSupplier.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <cppuhelper/compbase5.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include "connectivity/CommonTools.hxx" +#include "connectivity/OSubComponent.hxx" +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "connectivity/StdTypeDefs.hxx" +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + namespace sdbcx + { + + class OCollection; + // OCatalog is a general catalog class + // other drivers can be derived their catalog from this class when they want to support sdbcx + // it holds already tables, views, groups and users + + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier, + ::com::sun::star::sdbcx::XViewsSupplier, + ::com::sun::star::sdbcx::XUsersSupplier, + ::com::sun::star::sdbcx::XGroupsSupplier, + ::com::sun::star::lang::XServiceInfo> OCatalog_BASE; + + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog : + public OCatalog_BASE, + public IRefreshableGroups, + public IRefreshableUsers, + public connectivity::OSubComponent<OCatalog, OCatalog_BASE> + { + friend class connectivity::OSubComponent<OCatalog, OCatalog_BASE>; + protected: + + ::osl::Mutex m_aMutex; + + // this members are deleted when the dtor is called + // they are hold weak + OCollection* m_pTables; + OCollection* m_pViews; + OCollection* m_pGroups; + OCollection* m_pUsers; + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier + + /** builds the name which should be used to access the object later on in the collection. + Will only be called in fillNames. + @param _xRow + The current row from the resultset given to fillNames. + */ + virtual OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow); + + /** fills a vector with the necessary names which can be used in combination with the collections. + For each row buildName will be called. + @param _xResult + The resultset which should be used to fill the names. Will be disposed after return and set to NULL. + @param _rNames + The vector who will be filled. + */ + void fillNames(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResult,TStringVector& _rNames); + + public: + OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection); + virtual ~OCatalog(); + + DECLARE_SERVICE_INFO(); + + // refreshTables is called when the method getTables had been called + // the member m_pTables has to be created + virtual void refreshTables() = 0; + // refreshViews is called when the method getViews had been called + virtual void refreshViews() = 0; + + // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + void SAL_CALL acquire() throw(); + void SAL_CALL release() throw(); + // XTablesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException); + // XViewsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException); + // XUsersSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException); + // XGroupsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException); + + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_CATALOG_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 000000000000..e30075f009e9 --- /dev/null +++ b/include/connectivity/sdbcx/VCollection.hxx @@ -0,0 +1,237 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#define _CONNECTIVITY_SDBCX_COLLECTION_HXX_ + +#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/container/XEnumeration.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/lang/XComponent.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/stl_types.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include "connectivity/CommonTools.hxx" +#include <com/sun/star/container/XContainer.hpp> +#include "connectivity/StdTypeDefs.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <memory> + + +namespace connectivity +{ + namespace sdbcx + { + + // the class OCollection is base class for collections :-) + typedef ::cppu::ImplHelper10< ::com::sun::star::container::XNameAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XContainer, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::util::XRefreshable, + ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::sdbcx::XAppend, + ::com::sun::star::sdbcx::XDrop, + ::com::sun::star::lang::XServiceInfo> OCollectionBase; + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > ObjectType; + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection + { + public: + virtual ~IObjectCollection(); + virtual void reserve(size_t nLength) = 0; + 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 TStringVector &_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 ::com::sun::star::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 OUString findColumnAtIndex( sal_Int32 _nIndex) = 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 sal_Bool isCaseSensitive() const = 0; + }; + //************************************************************ + // OCollection + //************************************************************ + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection : + public OCollectionBase + { + protected: + ::std::auto_ptr<IObjectCollection> m_pElements; + + ::cppu::OInterfaceContainerHelper m_aContainerListeners; + ::cppu::OInterfaceContainerHelper m_aRefreshListeners; + + protected: + ::cppu::OWeakObject& m_rParent; // parent of the collection + ::osl::Mutex& m_rMutex; // mutex of the parent + sal_Bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed + + // the implementing class should refresh their elements + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) = 0; + + // will be called when a 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 ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::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 overloaded. + @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, + sal_Bool _bCase, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + sal_Bool _bUseIndexOnly = sal_False, + sal_Bool _bUseHardRef = sal_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 name of element at index _nIndex + */ + inline OUString getElementName(sal_Int32 _nIndex) + { + return m_pElements->findColumnAtIndex(_nIndex); + } + + + /** 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 TStringVector &_rVector); + inline sal_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 SAL_CALL disposing(void); + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::util::XRefreshable + virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException); + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // ::com::sun::star::container::XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + private: + void notifyElementRemoved(const OUString& _sName); + void disposeElements(); + void dropImpl(sal_Int32 _nIndex,sal_Bool _bReallyDrop = sal_True); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_COLLECTION_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 000000000000..42cddc51c041 --- /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 _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_COLUMN_HXX_ + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/implbase1.hxx> +#include "connectivity/CommonTools.hxx" +#include <comphelper/broadcasthelper.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::WeakComponentImplHelper2< ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OColumnDescriptor_BASE; + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OColumn_BASE; + + + class OOO_DLLPUBLIC_DBTOOLS OColumn : + public comphelper::OBaseMutex, + 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; + + sal_Bool m_IsAutoIncrement; + sal_Bool m_IsRowVersion; + sal_Bool m_IsCurrency; + + OUString m_CatalogName; + OUString m_SchemaName; + OUString m_TableName; + + using OColumnDescriptor_BASE::rBHelper; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual ~OColumn(); + public: + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + OColumn( sal_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, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase, + const OUString& _CatalogName, + const OUString& _SchemaName, + const OUString& _TableName); + + DECLARE_SERVICE_INFO(); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_COLUMN_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 000000000000..aa04b5229ac9 --- /dev/null +++ b/include/connectivity/sdbcx/VDescriptor.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 _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ + +#include <comphelper/propertycontainer.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/typeprovider.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 ::com::sun::star::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; + sal_Bool m_bNew; + + public: + ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False); + + virtual ~ODescriptor(); + + sal_Bool isNew() const { return m_bNew; } + sal_Bool getNew() const { return m_bNew; } + virtual void setNew(sal_Bool _bNew); + + sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } + + virtual void construct(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // compare + inline sal_Bool operator == ( const OUString & _rRH ) + { + return m_aCase(m_Name,_rRH); + } + + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + static ODescriptor* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSomeComp ); + // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag + static sal_Bool isNew( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDescriptor ); + }; + } + +} +#endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VGroup.hxx b/include/connectivity/sdbcx/VGroup.hxx new file mode 100644 index 000000000000..6e4ba2355d62 --- /dev/null +++ b/include/connectivity/sdbcx/VGroup.hxx @@ -0,0 +1,103 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_GROUP_HXX_ +#define _CONNECTIVITY_SDBCX_GROUP_HXX_ + +#include <osl/diagnose.h> + + +#include <com/sun/star/sdbcx/XUsersSupplier.hpp> +#include <com/sun/star/sdbcx/XAuthorizable.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase4.hxx> +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/sdbcx/VCollection.hxx" +#include <comphelper/propertycontainer.hxx> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "connectivity/sdbcx/VDescriptor.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace sdbcx + { + typedef OCollection OUsers; + + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUsersSupplier, + ::com::sun::star::sdbcx::XAuthorizable, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OGroup_BASE; + + class OOO_DLLPUBLIC_DBTOOLS OGroup : + public comphelper::OBaseMutex, + public OGroup_BASE, + public IRefreshableUsers, + public ::comphelper::OPropertyArrayUsageHelper<OGroup>, + public ODescriptor + { + protected: + OUsers* m_pUsers; + + using OGroup_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OGroup(sal_Bool _bCase); + OGroup( const OUString& _Name,sal_Bool _bCase); + virtual ~OGroup(); + DECLARE_SERVICE_INFO(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XUsersSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_GROUP_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VIndex.hxx b/include/connectivity/sdbcx/VIndex.hxx new file mode 100644 index 000000000000..3e50ddf9459c --- /dev/null +++ b/include/connectivity/sdbcx/VIndex.hxx @@ -0,0 +1,106 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_INDEX_HXX_ +#define _CONNECTIVITY_SDBCX_INDEX_HXX_ + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/compbase2.hxx> +#include "connectivity/CommonTools.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/sdbcx/VTypeDef.hxx" +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "connectivity/sdbcx/VDescriptor.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + namespace sdbcx + { + class OCollection; + class OIndex; + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OIndex_BASE; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP; + + class OOO_DLLPUBLIC_DBTOOLS OIndex : + public comphelper::OBaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public OIndex_PROP, + public ODescriptor, + public OIndex_BASE + { + protected: + OUString m_Catalog; + sal_Bool m_IsUnique; + sal_Bool m_IsPrimaryKeyIndex; + sal_Bool m_IsClustered; + + OCollection* m_pColumns; + + using ODescriptor_BASE::rBHelper; + virtual void refreshColumns(); + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + public: + OIndex(sal_Bool _bCase); + OIndex( const OUString& _Name, + const OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered, + sal_Bool _bCase); + + virtual ~OIndex( ); + + DECLARE_SERVICE_INFO(); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_INDEX_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VIndexColumn.hxx b/include/connectivity/sdbcx/VIndexColumn.hxx new file mode 100644 index 000000000000..a4de9e6bf5bd --- /dev/null +++ b/include/connectivity/sdbcx/VIndexColumn.hxx @@ -0,0 +1,65 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ + +#include "connectivity/dbtoolsdllapi.hxx" +#include "connectivity/sdbcx/VColumn.hxx" + +namespace connectivity +{ + namespace sdbcx + { + class OIndexColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP; + + class OOO_DLLPUBLIC_DBTOOLS OIndexColumn : + public OColumn, public OIndexColumn_PROP + { + protected: + sal_Bool m_IsAscending; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + public: + OIndexColumn( sal_Bool _bCase); + OIndexColumn( sal_Bool _IsAscending, + const OUString& _Name, + const OUString& _TypeName, + const OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase, + const OUString& _CatalogName, + const OUString& _SchemaName, + const OUString& _TableName); + + virtual void construct(); + DECLARE_SERVICE_INFO(); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VKey.hxx b/include/connectivity/sdbcx/VKey.hxx new file mode 100644 index 000000000000..24d85dfb2614 --- /dev/null +++ b/include/connectivity/sdbcx/VKey.hxx @@ -0,0 +1,121 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_KEY_HXX_ +#define _CONNECTIVITY_SDBCX_KEY_HXX_ + + +#include <comphelper/IdPropArrayHelper.hxx> +#include "connectivity/CommonTools.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/sdbcx/VTypeDef.hxx" +#include <com/sun/star/container/XNamed.hpp> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "connectivity/sdbcx/VDescriptor.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <boost/shared_ptr.hpp> + +namespace connectivity +{ + namespace sdbcx + { + + struct OOO_DLLPUBLIC_DBTOOLS KeyProperties + { + ::std::vector< OUString> m_aKeyColumnNames; + OUString m_ReferencedTable; + sal_Int32 m_Type; + sal_Int32 m_UpdateRule; + sal_Int32 m_DeleteRule; + KeyProperties(const OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule) + :m_ReferencedTable(_ReferencedTable), + m_Type(_Type), + m_UpdateRule(_UpdateRule), + m_DeleteRule(_DeleteRule) + {} + KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){} + }; + typedef ::boost::shared_ptr< KeyProperties > TKeyProperties; + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OKey_BASE; + class OCollection; + + class OOO_DLLPUBLIC_DBTOOLS OKey : + public comphelper::OBaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, + public ODescriptor, + public OKey_BASE + { + protected: + TKeyProperties m_aProps; + OCollection* m_pColumns; + + using ODescriptor_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OKey(sal_Bool _bCase); + OKey(const OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase); + /*OKey( const OUString& _Name, + const OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule, + sal_Bool _bCase);*/ + + virtual ~OKey( ); + + DECLARE_SERVICE_INFO(); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_KEY_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VKeyColumn.hxx b/include/connectivity/sdbcx/VKeyColumn.hxx new file mode 100644 index 000000000000..b22ea3247941 --- /dev/null +++ b/include/connectivity/sdbcx/VKeyColumn.hxx @@ -0,0 +1,67 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ + +#include "connectivity/dbtoolsdllapi.hxx" +#include "connectivity/sdbcx/VColumn.hxx" + +namespace connectivity +{ + namespace sdbcx + { + class OKeyColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP; + + class OOO_DLLPUBLIC_DBTOOLS OKeyColumn : + public OColumn, public OKeyColumn_PROP + { + protected: + OUString m_ReferencedColumn; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + public: + OKeyColumn(sal_Bool _bCase); + OKeyColumn( const OUString& _ReferencedColumn, + const OUString& _Name, + const OUString& _TypeName, + const OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase, + const OUString& _CatalogName, + const OUString& _SchemaName, + const OUString& _TableName); + // just to make it not inline + virtual ~OKeyColumn(); + + virtual void construct(); + DECLARE_SERVICE_INFO(); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_KEYCOLUMN_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 000000000000..0be41a9cd22f --- /dev/null +++ b/include/connectivity/sdbcx/VTable.hxx @@ -0,0 +1,141 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_TABLE_HXX_ +#define _CONNECTIVITY_SDBCX_TABLE_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 <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/implbase4.hxx> +#include <comphelper/broadcasthelper.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" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> + +namespace connectivity +{ + namespace sdbcx + { + + class OTable; + class OCollection; + + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XColumnsSupplier, + ::com::sun::star::sdbcx::XKeysSupplier, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OTableDescriptor_BASE; + + typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::sdbcx::XIndexesSupplier, + ::com::sun::star::sdbcx::XRename, + ::com::sun::star::sdbcx::XAlterTable > OTable_BASE; + + typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP; + + + class OOO_DLLPUBLIC_DBTOOLS OTable : + public comphelper::OBaseMutex, + 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; + + OCollection* m_pKeys; + OCollection* m_pColumns; + OCollection* m_pIndexes; + 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; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OTable( OCollection* _pTables, + sal_Bool _bCase); + OTable( OCollection* _pTables, + sal_Bool _bCase, + const OUString& _Name, + const OUString& _Type, + const OUString& _Description = OUString(), + const OUString& _SchemaName = OUString(), + const OUString& _CatalogName = OUString()); + + virtual ~OTable(); + + DECLARE_SERVICE_INFO(); + //XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // ODescriptor + virtual void construct(); + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + // XKeysSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException); + // XNamed + virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException); + // XIndexesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException); + // XRename + virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XAlterTable + virtual void SAL_CALL alterColumnByName( const OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // helper method + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const; + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_TABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VTypeDef.hxx b/include/connectivity/sdbcx/VTypeDef.hxx new file mode 100644 index 000000000000..08019f9174da --- /dev/null +++ b/include/connectivity/sdbcx/VTypeDef.hxx @@ -0,0 +1,40 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ +#define _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ + +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <cppuhelper/compbase3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> + +namespace connectivity +{ + namespace sdbcx + { + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbcx::XColumnsSupplier, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> ODescriptor_BASE; + } +} + +#endif // _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/connectivity/sdbcx/VUser.hxx b/include/connectivity/sdbcx/VUser.hxx new file mode 100644 index 000000000000..01bafc0d177c --- /dev/null +++ b/include/connectivity/sdbcx/VUser.hxx @@ -0,0 +1,100 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_USER_HXX_ +#define _CONNECTIVITY_SDBCX_USER_HXX_ + +#include <osl/diagnose.h> +#include <com/sun/star/sdbcx/XUser.hpp> +#include <com/sun/star/sdbcx/XGroupsSupplier.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase4.hxx> +#include "connectivity/CommonTools.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/container/XNamed.hpp> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "connectivity/sdbcx/VDescriptor.hxx" +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + namespace sdbcx + { + typedef OCollection OGroups; + + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser, + ::com::sun::star::sdbcx::XGroupsSupplier, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OUser_BASE; + + class OOO_DLLPUBLIC_DBTOOLS OUser : + public comphelper::OBaseMutex, + public OUser_BASE, + public IRefreshableGroups, + public ::comphelper::OPropertyArrayUsageHelper<OUser>, + public ODescriptor + { + protected: + OGroups* m_pGroups; + + using OUser_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OUser(sal_Bool _bCase); + OUser(const OUString& _Name,sal_Bool _bCase); + + virtual ~OUser( ); + + DECLARE_SERVICE_INFO(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XGroupsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_USER_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 000000000000..6134ddc4bb69 --- /dev/null +++ b/include/connectivity/sdbcx/VView.hxx @@ -0,0 +1,101 @@ +/* -*- 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 _CONNECTIVITY_SDBCX_VIEW_HXX_ +#define _CONNECTIVITY_SDBCX_VIEW_HXX_ + +#include <osl/diagnose.h> +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase1.hxx> +#include "connectivity/CommonTools.hxx" +#include <cppuhelper/interfacecontainer.h> +#include <com/sun/star/container/XNamed.hpp> +#include "connectivity/sdbcx/VDescriptor.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/implbase2.hxx> + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::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 + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + DECLARE_SERVICE_INFO(); + + OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData); + OView( sal_Bool _bCase, + const OUString& _rName, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData, + sal_Int32 _nCheckOption = 0, + const OUString& _rCommand = OUString(), + const OUString& _rSchemaName = OUString(), + const OUString& _rCatalogName = OUString()); + virtual ~OView(); + + // ODescriptor + virtual void construct(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XNamed + virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_VIEW_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |