Branch data Line data Source code
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/lang/DisposedException.hpp>
22 : : #include <comphelper/sequence.hxx>
23 : : #include "connectivity/dbtools.hxx"
24 : : #include "TConnection.hxx"
25 : :
26 : : // -------------------------------------------------------------------------
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;
34 : :
35 [ # # ][ # # ]: 0 : IMPLEMENT_SERVICE_INFO(OView,"com.sun.star.sdbcx.VView","com.sun.star.sdbcx.View");
[ # # ][ # # ]
[ # # ][ # # ]
36 : : // -------------------------------------------------------------------------
37 : 0 : OView::OView(sal_Bool _bCase,
38 : : const ::rtl::OUString& _Name,
39 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData,
40 : : sal_Int32 _CheckOption,
41 : : const ::rtl::OUString& _Command,
42 : : const ::rtl::OUString& _SchemaName,
43 : : const ::rtl::OUString& _CatalogName) : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase)
44 : : ,m_CatalogName(_CatalogName)
45 : : ,m_SchemaName(_SchemaName)
46 : : ,m_Command(_Command)
47 : : ,m_CheckOption(_CheckOption)
48 [ # # ][ # # ]: 0 : ,m_xMetaData(_xMetaData)
[ # # ]
49 : :
50 : : {
51 : 0 : m_Name = _Name;
52 [ # # ]: 0 : construct();
53 : 0 : }
54 : : // -------------------------------------------------------------------------
55 : 0 : OView::OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData)
56 : : : ODescriptor(::comphelper::OMutexAndBroadcastHelper::m_aBHelper,_bCase,sal_True)
57 [ # # ][ # # ]: 0 : ,m_xMetaData(_xMetaData)
[ # # ]
58 : : {
59 [ # # ]: 0 : construct();
60 : 0 : }
61 : : // -------------------------------------------------------------------------
62 [ # # ][ # # ]: 0 : OView::~OView()
[ # # ]
63 : : {
64 [ # # ]: 0 : }
65 : : // -------------------------------------------------------------------------
66 : 0 : void OView::construct()
67 : : {
68 : 0 : ODescriptor::construct();
69 : :
70 [ # # ]: 0 : sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
71 : :
72 [ # # ]: 0 : registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(static_cast< ::rtl::OUString*>(0)));
73 [ # # ]: 0 : registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(static_cast< ::rtl::OUString*>(0)));
74 [ # # ]: 0 : registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND), PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::getCppuType(static_cast< ::rtl::OUString*>(0)));
75 [ # # ]: 0 : registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CHECKOPTION), PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::getCppuType(static_cast< sal_Int32*>(0)));
76 : 0 : }
77 : : // -------------------------------------------------------------------------
78 : 0 : void OView::disposing(void)
79 : : {
80 [ # # ]: 0 : OPropertySetHelper::disposing();
81 : :
82 [ # # ][ # # ]: 0 : ::osl::MutexGuard aGuard(m_aMutex);
83 : 0 : }
84 : : // -------------------------------------------------------------------------
85 : 0 : Sequence< Type > SAL_CALL OView::getTypes( ) throw(RuntimeException)
86 : : {
87 [ # # ][ # # ]: 0 : return ::comphelper::concatSequences(ODescriptor::getTypes(),OView_BASE::getTypes());
[ # # ]
88 : : }
89 : : // -------------------------------------------------------------------------
90 : 0 : Any SAL_CALL OView::queryInterface( const Type & rType ) throw(RuntimeException)
91 : : {
92 [ # # ]: 0 : Any aRet = OView_BASE::queryInterface( rType);
93 [ # # ][ # # ]: 0 : return aRet.hasValue() ? aRet : ODescriptor::queryInterface( rType);
94 : : }
95 : : // -------------------------------------------------------------------------
96 : 0 : ::cppu::IPropertyArrayHelper* OView::createArrayHelper( sal_Int32 /*_nId*/ ) const
97 : : {
98 : 0 : return doCreateArrayHelper();
99 : : }
100 : : // -------------------------------------------------------------------------
101 : 0 : ::cppu::IPropertyArrayHelper & OView::getInfoHelper()
102 : : {
103 [ # # ]: 0 : return *const_cast<OView*>(this)->getArrayHelper(isNew() ? 1 : 0);
104 : : }
105 : : // -----------------------------------------------------------------------------
106 : 0 : ::rtl::OUString SAL_CALL OView::getName() throw(::com::sun::star::uno::RuntimeException)
107 : : {
108 : 0 : ::rtl::OUString sComposedName;
109 [ # # ]: 0 : if(m_xMetaData.is())
110 [ # # ]: 0 : sComposedName = ::dbtools::composeTableName( m_xMetaData, m_CatalogName, m_SchemaName, m_Name, sal_False, ::dbtools::eInDataManipulation );
111 : : else
112 : : {
113 : 0 : Any aValue;
114 [ # # ]: 0 : getFastPropertyValue(aValue,PROPERTY_ID_NAME);
115 : 0 : aValue >>= sComposedName;
116 : : }
117 : 0 : return sComposedName;
118 : : }
119 : : // -----------------------------------------------------------------------------
120 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OView::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
121 : : {
122 : 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
123 : : }
124 : : // -----------------------------------------------------------------------------
125 : 0 : void SAL_CALL OView::setName( const ::rtl::OUString& ) throw(::com::sun::star::uno::RuntimeException)
126 : : {
127 : 0 : }
128 : : // -----------------------------------------------------------------------------
129 : 0 : void SAL_CALL OView::acquire() throw()
130 : : {
131 : 0 : OView_BASE::acquire();
132 : 0 : }
133 : : // -----------------------------------------------------------------------------
134 : 0 : void SAL_CALL OView::release() throw()
135 : : {
136 : 0 : OView_BASE::release();
137 : 0 : }
138 : : // -----------------------------------------------------------------------------
139 : :
140 : :
141 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|