Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / AView.cxx
blobdba3c8e894e27e2fed04d193bd8f7995132e7de4
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 "ado/AView.hxx"
21 #include <com/sun/star/lang/DisposedException.hpp>
22 #include "ado/adoimp.hxx"
23 #include <cppuhelper/typeprovider.hxx>
24 #include "ado/Awrapado.hxx"
25 #include <comphelper/sequence.hxx>
26 #include <comphelper/types.hxx>
27 #include "TConnection.hxx"
30 using namespace comphelper;
31 using namespace connectivity::ado;
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::lang;
34 using namespace com::sun::star::beans;
35 using namespace com::sun::star::sdbc;
37 // IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
39 OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
40 ,m_aView(_pView)
44 Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
46 static ::cppu::OImplementationId * pId = 0;
47 if (! pId)
49 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
50 if (! pId)
52 static ::cppu::OImplementationId aId;
53 pId = &aId;
56 return pId->getImplementationId();
59 // com::sun::star::lang::XUnoTunnel
61 sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
63 return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
64 ? reinterpret_cast< sal_Int64 >( this )
65 : OView_ADO::getSomething(rId);
69 void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
71 if(m_aView.IsValid())
73 switch(nHandle)
75 case PROPERTY_ID_NAME:
76 rValue <<= m_aView.get_Name();
77 break;
78 case PROPERTY_ID_CATALOGNAME:
79 break;
80 case PROPERTY_ID_SCHEMANAME:
81 // rValue <<= m_aView.get_Type();
82 break;
83 case PROPERTY_ID_COMMAND:
85 OLEVariant aVar;
86 m_aView.get_Command(aVar);
87 if(!aVar.isNull() && !aVar.isEmpty())
89 ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
90 OLEString aBSTR;
91 pCom->get_CommandText(&aBSTR);
92 rValue <<= (OUString) aBSTR;
95 break;
98 else
99 OView_ADO::getFastPropertyValue(rValue,nHandle);
102 void SAL_CALL OAdoView::acquire() throw()
104 OView_ADO::acquire();
107 void SAL_CALL OAdoView::release() throw()
109 OView_ADO::release();
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */