/src/libreoffice/connectivity/source/sdbcx/VView.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #include <connectivity/sdbcx/VView.hxx> |
21 | | #include <com/sun/star/beans/PropertyAttribute.hpp> |
22 | | #include <comphelper/sequence.hxx> |
23 | | #include <connectivity/dbtools.hxx> |
24 | | #include <TConnection.hxx> |
25 | | #include <utility> |
26 | | |
27 | | |
28 | | using namespace connectivity; |
29 | | using namespace connectivity::sdbcx; |
30 | | using namespace ::com::sun::star::beans; |
31 | | using namespace ::com::sun::star::uno; |
32 | | using namespace ::com::sun::star::container; |
33 | | using namespace ::com::sun::star::lang; |
34 | | |
35 | | IMPLEMENT_SERVICE_INFO(OView,u"com.sun.star.sdbcx.VView"_ustr,u"com.sun.star.sdbcx.View"_ustr); |
36 | | |
37 | | OView::OView(bool _bCase, |
38 | | const OUString& Name, |
39 | | css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData, |
40 | | OUString Command, |
41 | | OUString SchemaName, |
42 | 0 | OUString CatalogName) : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase) |
43 | 0 | ,m_CatalogName(std::move(CatalogName)) |
44 | 0 | ,m_SchemaName(std::move(SchemaName)) |
45 | 0 | ,m_Command(std::move(Command)) |
46 | 0 | ,m_CheckOption(0) |
47 | 0 | ,m_xMetaData(std::move(_xMetaData)) |
48 | | |
49 | 0 | { |
50 | 0 | m_Name = Name; |
51 | 0 | construct(); |
52 | 0 | } |
53 | | |
54 | | OView::OView(bool _bCase, css::uno::Reference< css::sdbc::XDatabaseMetaData > _xMetaData) |
55 | 0 | : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper, _bCase, true) |
56 | 0 | ,m_xMetaData(std::move(_xMetaData)) |
57 | 0 | { |
58 | 0 | construct(); |
59 | 0 | } |
60 | | |
61 | | OView::~OView() |
62 | 0 | { |
63 | 0 | } |
64 | | |
65 | | void OView::construct() |
66 | 0 | { |
67 | 0 | ODescriptor::construct(); |
68 | |
|
69 | 0 | sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; |
70 | |
|
71 | 0 | registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::cppu::UnoType<OUString>::get()); |
72 | 0 | registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::cppu::UnoType<OUString>::get()); |
73 | 0 | registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::cppu::UnoType<OUString>::get()); |
74 | 0 | registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CHECKOPTION), PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::cppu::UnoType<sal_Int32>::get()); |
75 | 0 | } |
76 | | |
77 | | Sequence< Type > SAL_CALL OView::getTypes( ) |
78 | 0 | { |
79 | 0 | return ::comphelper::concatSequences(ODescriptor::getTypes(),OView_BASE::getTypes()); |
80 | 0 | } |
81 | | |
82 | | Any SAL_CALL OView::queryInterface( const Type & rType ) |
83 | 0 | { |
84 | 0 | Any aRet = OView_BASE::queryInterface( rType); |
85 | 0 | return aRet.hasValue() ? aRet : ODescriptor::queryInterface( rType); |
86 | 0 | } |
87 | | |
88 | | ::cppu::IPropertyArrayHelper* OView::createArrayHelper( sal_Int32 /*_nId*/ ) const |
89 | 0 | { |
90 | 0 | return doCreateArrayHelper(); |
91 | 0 | } |
92 | | |
93 | | ::cppu::IPropertyArrayHelper & OView::getInfoHelper() |
94 | 0 | { |
95 | 0 | return *getArrayHelper(isNew() ? 1 : 0); |
96 | 0 | } |
97 | | |
98 | | OUString SAL_CALL OView::getName() |
99 | 0 | { |
100 | 0 | OUString sComposedName; |
101 | 0 | if(m_xMetaData.is()) |
102 | 0 | sComposedName = ::dbtools::composeTableName( m_xMetaData, m_CatalogName, m_SchemaName, m_Name, false, ::dbtools::EComposeRule::InDataManipulation ); |
103 | 0 | else |
104 | 0 | { |
105 | 0 | Any aValue; |
106 | 0 | getFastPropertyValue(aValue,PROPERTY_ID_NAME); |
107 | 0 | aValue >>= sComposedName; |
108 | 0 | } |
109 | 0 | return sComposedName; |
110 | 0 | } |
111 | | |
112 | | css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OView::getPropertySetInfo( ) |
113 | 0 | { |
114 | 0 | return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); |
115 | 0 | } |
116 | | |
117 | | void SAL_CALL OView::setName( const OUString& ) |
118 | 0 | { |
119 | 0 | } |
120 | | |
121 | | void SAL_CALL OView::acquire() noexcept |
122 | 0 | { |
123 | 0 | OView_BASE::acquire(); |
124 | 0 | } |
125 | | |
126 | | void SAL_CALL OView::release() noexcept |
127 | 0 | { |
128 | 0 | OView_BASE::release(); |
129 | 0 | } |
130 | | |
131 | | |
132 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |