diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /connectivity/inc/sdbcx | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'connectivity/inc/sdbcx')
-rw-r--r-- | connectivity/inc/sdbcx/VCatalog.hxx | 116 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VGroup.hxx | 95 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VIndex.hxx | 98 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VIndexColumn.hxx | 58 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VKey.hxx | 108 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VKeyColumn.hxx | 59 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VTypeDef.hxx | 34 | ||||
-rw-r--r-- | connectivity/inc/sdbcx/VUser.hxx | 96 |
8 files changed, 664 insertions, 0 deletions
diff --git a/connectivity/inc/sdbcx/VCatalog.hxx b/connectivity/inc/sdbcx/VCatalog.hxx new file mode 100644 index 000000000..3c87a0870 --- /dev/null +++ b/connectivity/inc/sdbcx/VCatalog.hxx @@ -0,0 +1,116 @@ +/* -*- 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 . + */ + +#pragma once + +#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 <cppuhelper/compbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <connectivity/CommonTools.hxx> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <memory> + +namespace com::sun::star::sdbc { class XConnection; } +namespace com::sun::star::sdbc { class XDatabaseMetaData; } +namespace com::sun::star::sdbc { class XResultSet; } +namespace com::sun::star::sdbc { class XRow; } + +namespace connectivity::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::WeakComponentImplHelper< css::sdbcx::XTablesSupplier, + css::sdbcx::XViewsSupplier, + css::sdbcx::XUsersSupplier, + css::sdbcx::XGroupsSupplier, + css::lang::XServiceInfo> OCatalog_BASE; + + + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog : + public OCatalog_BASE, + public IRefreshableGroups, + public IRefreshableUsers + { + protected: + + ::osl::Mutex m_aMutex; + + // this members are deleted when the dtor is called + // they are hold weak + std::unique_ptr<OCollection> m_pTables; + std::unique_ptr<OCollection> m_pViews; + std::unique_ptr<OCollection> m_pGroups; + std::unique_ptr<OCollection> m_pUsers; + + css::uno::Reference< css::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 css::uno::Reference< css::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(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames); + + public: + OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection); + virtual ~OCatalog() override; + + 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() override; + // XTablesSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override; + // XViewsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews( ) override; + // XUsersSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; + // XGroupsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; + + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VGroup.hxx b/connectivity/inc/sdbcx/VGroup.hxx new file mode 100644 index 000000000..9c292adc6 --- /dev/null +++ b/connectivity/inc/sdbcx/VGroup.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 . + */ + +#pragma once + +#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/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <connectivity/sdbcx/VCollection.hxx> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity::sdbcx + { + typedef OCollection OUsers; + + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUsersSupplier, + css::sdbcx::XAuthorizable, + css::container::XNamed, + css::lang::XServiceInfo> OGroup_BASE; + + class OOO_DLLPUBLIC_DBTOOLS OGroup : + public cppu::BaseMutex, + public OGroup_BASE, + public IRefreshableUsers, + public ::comphelper::OPropertyArrayUsageHelper<OGroup>, + public ODescriptor + { + protected: + // no Reference! see OCollection::acquire + std::unique_ptr<OUsers> m_pUsers; + + using OGroup_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OGroup(bool _bCase); + OGroup( const OUString& Name, bool _bCase); + virtual ~OGroup() override; + DECLARE_SERVICE_INFO(); + + // XInterface + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + //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; + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XUsersSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + }; + +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VIndex.hxx b/connectivity/inc/sdbcx/VIndex.hxx new file mode 100644 index 000000000..c31bf5c4e --- /dev/null +++ b/connectivity/inc/sdbcx/VIndex.hxx @@ -0,0 +1,98 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <cppuhelper/basemutex.hxx> +#include <connectivity/CommonTools.hxx> +#include <sdbcx/VTypeDef.hxx> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity::sdbcx + { + class OCollection; + class OIndex; + typedef ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OIndex_BASE; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP; + + class OOO_DLLPUBLIC_DBTOOLS OIndex : + public cppu::BaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public OIndex_PROP, + public ODescriptor, + public OIndex_BASE + { + protected: + OUString m_Catalog; + bool m_IsUnique; + bool m_IsPrimaryKeyIndex; + bool m_IsClustered; + + // no Reference! see OCollection::acquire + std::unique_ptr<OCollection> m_pColumns; + + using ODescriptor_BASE::rBHelper; + virtual void refreshColumns() override; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OIndex(bool _bCase); + OIndex( const OUString& Name, + const OUString& Catalog, + bool _isUnique, + bool _isPrimaryKeyIndex, + bool _isClustered, + bool _bCase); + + virtual ~OIndex( ) override; + + DECLARE_SERVICE_INFO(); + + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept 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; + // XColumnsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) 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; + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VIndexColumn.hxx b/connectivity/inc/sdbcx/VIndexColumn.hxx new file mode 100644 index 000000000..056b82394 --- /dev/null +++ b/connectivity/inc/sdbcx/VIndexColumn.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 . + */ + +#pragma once + +#include <connectivity/dbtoolsdllapi.hxx> +#include <connectivity/sdbcx/VColumn.hxx> + +namespace connectivity::sdbcx + { + class OIndexColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP; + + class OOO_DLLPUBLIC_DBTOOLS OIndexColumn : + public OColumn, public OIndexColumn_PROP + { + bool m_IsAscending; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OIndexColumn( bool _bCase); + OIndexColumn( bool IsAscending, + const OUString& Name, + const OUString& TypeName, + const OUString& DefaultValue, + sal_Int32 IsNullable, + sal_Int32 Precision, + sal_Int32 Scale, + sal_Int32 Type, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); + + virtual void construct() override; + DECLARE_SERVICE_INFO(); + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VKey.hxx b/connectivity/inc/sdbcx/VKey.hxx new file mode 100644 index 000000000..1c4e51dc7 --- /dev/null +++ b/connectivity/inc/sdbcx/VKey.hxx @@ -0,0 +1,108 @@ +/* -*- 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 . + */ + +#pragma once + + +#include <comphelper/IdPropArrayHelper.hxx> +#include <connectivity/CommonTools.hxx> +#include <sdbcx/VTypeDef.hxx> +#include <connectivity/sdbcx/IRefreshable.hxx> +#include <connectivity/sdbcx/VDescriptor.hxx> +#include <connectivity/dbtoolsdllapi.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <memory> + +namespace connectivity::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 ::cppu::ImplHelper1< css::sdbcx::XDataDescriptorFactory > OKey_BASE; + class OCollection; + + class OOO_DLLPUBLIC_DBTOOLS OKey : + public cppu::BaseMutex, + public ODescriptor_BASE, + public IRefreshableColumns, + public ::comphelper::OIdPropertyArrayUsageHelper<OKey>, + public ODescriptor, + public OKey_BASE + { + protected: + std::shared_ptr<KeyProperties> m_aProps; + // no Reference! see OCollection::acquire + std::unique_ptr<OCollection> m_pColumns; + + using ODescriptor_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OKey(bool _bCase); + OKey(const OUString& Name,const std::shared_ptr<KeyProperties>& _rProps,bool _bCase); + + virtual ~OKey( ) override; + + DECLARE_SERVICE_INFO(); + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept 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; + // XColumnsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) 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; + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VKeyColumn.hxx b/connectivity/inc/sdbcx/VKeyColumn.hxx new file mode 100644 index 000000000..5adf3e0aa --- /dev/null +++ b/connectivity/inc/sdbcx/VKeyColumn.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 . + */ + +#pragma once + +#include <connectivity/sdbcx/VColumn.hxx> + +namespace connectivity::sdbcx + { + class OKeyColumn; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP; + + class OKeyColumn : + public OColumn, public OKeyColumn_PROP + { + OUString m_ReferencedColumn; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + public: + OKeyColumn(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, + bool _bCase, + const OUString& CatalogName, + const OUString& SchemaName, + const OUString& TableName); + // just to make it not inline + virtual ~OKeyColumn() override; + + virtual void construct() override; + DECLARE_SERVICE_INFO(); + }; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VTypeDef.hxx b/connectivity/inc/sdbcx/VTypeDef.hxx new file mode 100644 index 000000000..92a1f3c9c --- /dev/null +++ b/connectivity/inc/sdbcx/VTypeDef.hxx @@ -0,0 +1,34 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> + +namespace connectivity::sdbcx +{ + typedef cppu::WeakComponentImplHelper< css::sdbcx::XColumnsSupplier, + css::container::XNamed, + css::lang::XServiceInfo> ODescriptor_BASE; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/inc/sdbcx/VUser.hxx b/connectivity/inc/sdbcx/VUser.hxx new file mode 100644 index 000000000..7086cb04f --- /dev/null +++ b/connectivity/inc/sdbcx/VUser.hxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/sdbcx/XUser.hpp> +#include <com/sun/star/sdbcx/XGroupsSupplier.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <connectivity/CommonTools.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::sdbcx +{ + typedef OCollection OGroups; + + typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUser, + css::sdbcx::XGroupsSupplier, + css::container::XNamed, + css::lang::XServiceInfo> OUser_BASE; + + class OOO_DLLPUBLIC_DBTOOLS OUser : + public cppu::BaseMutex, + public OUser_BASE, + public IRefreshableGroups, + public ::comphelper::OPropertyArrayUsageHelper<OUser>, + public ODescriptor + { + protected: + // no Reference! see OCollection::acquire + std::unique_ptr<OGroups> m_pGroups; + + using OUser_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + public: + OUser(bool _bCase); + OUser(const OUString& Name,bool _bCase); + + virtual ~OUser( ) override; + + DECLARE_SERVICE_INFO(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing() override; + //XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept 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; + // XUser + virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override; + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override; + virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override; + // XGroupsSupplier + virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override; + + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + }; + +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |