build fix
[LibreOffice.git] / connectivity / source / sdbcx / VView.cxx
blob673b11d11f0861858941fee90577237b6b6bb2f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <connectivity/sdbcx/VView.hxx>
21 #include <com/sun/star/lang/DisposedException.hpp>
22 #include <comphelper/sequence.hxx>
23 #include <connectivity/dbtools.hxx>
24 #include "TConnection.hxx"
27 using namespace connectivity;
28 using namespace connectivity::sdbcx;
29 using namespace ::com::sun::star::beans;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::sdbcx;
32 using namespace ::com::sun::star::container;
33 using namespace ::com::sun::star::lang;
35 IMPLEMENT_SERVICE_INFO(OView,"com.sun.star.sdbcx.VView","com.sun.star.sdbcx.View");
37 OView::OView(bool _bCase,
38 const OUString& Name,
39 const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData,
40 const OUString& Command,
41 const OUString& SchemaName,
42 const OUString& CatalogName) : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase)
43 ,m_CatalogName(CatalogName)
44 ,m_SchemaName(SchemaName)
45 ,m_Command(Command)
46 ,m_CheckOption(0)
47 ,m_xMetaData(_xMetaData)
50 m_Name = Name;
51 construct();
54 OView::OView(bool _bCase, const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _xMetaData)
55 : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper, _bCase, true)
56 ,m_xMetaData(_xMetaData)
58 construct();
61 OView::~OView()
65 void OView::construct()
67 ODescriptor::construct();
69 sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
71 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::cppu::UnoType<OUString>::get());
72 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::cppu::UnoType<OUString>::get());
73 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::cppu::UnoType<OUString>::get());
74 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CHECKOPTION), PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::cppu::UnoType<sal_Int32>::get());
77 Sequence< Type > SAL_CALL OView::getTypes( ) throw(RuntimeException, std::exception)
79 return ::comphelper::concatSequences(ODescriptor::getTypes(),OView_BASE::getTypes());
82 Any SAL_CALL OView::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
84 Any aRet = OView_BASE::queryInterface( rType);
85 return aRet.hasValue() ? aRet : ODescriptor::queryInterface( rType);
88 ::cppu::IPropertyArrayHelper* OView::createArrayHelper( sal_Int32 /*_nId*/ ) const
90 return doCreateArrayHelper();
93 ::cppu::IPropertyArrayHelper & OView::getInfoHelper()
95 return *getArrayHelper(isNew() ? 1 : 0);
98 OUString SAL_CALL OView::getName() throw(css::uno::RuntimeException, std::exception)
100 OUString sComposedName;
101 if(m_xMetaData.is())
102 sComposedName = ::dbtools::composeTableName( m_xMetaData, m_CatalogName, m_SchemaName, m_Name, false, ::dbtools::EComposeRule::InDataManipulation );
103 else
105 Any aValue;
106 getFastPropertyValue(aValue,PROPERTY_ID_NAME);
107 aValue >>= sComposedName;
109 return sComposedName;
112 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OView::getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception)
114 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
117 void SAL_CALL OView::setName( const OUString& ) throw(css::uno::RuntimeException, std::exception)
121 void SAL_CALL OView::acquire() throw()
123 OView_BASE::acquire();
126 void SAL_CALL OView::release() throw()
128 OView_BASE::release();
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */