Bump for 3.6-28
[LibreOffice.git] / connectivity / source / drivers / ado / AView.cxx
blob358b3c908329a12ef38b13c9ecc54b40ed893072
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "ado/AView.hxx"
30 #include <com/sun/star/lang/DisposedException.hpp>
31 #include "ado/adoimp.hxx"
32 #include <cppuhelper/typeprovider.hxx>
33 #include "ado/Awrapado.hxx"
34 #include <comphelper/sequence.hxx>
35 #include <comphelper/types.hxx>
36 #include "TConnection.hxx"
38 // -------------------------------------------------------------------------
39 using namespace comphelper;
40 using namespace connectivity::ado;
41 using namespace com::sun::star::uno;
42 using namespace com::sun::star::lang;
43 using namespace com::sun::star::beans;
44 using namespace com::sun::star::sdbc;
46 // IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
47 // -------------------------------------------------------------------------
48 OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
49 ,m_aView(_pView)
52 //--------------------------------------------------------------------------
53 Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
55 static ::cppu::OImplementationId * pId = 0;
56 if (! pId)
58 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
59 if (! pId)
61 static ::cppu::OImplementationId aId;
62 pId = &aId;
65 return pId->getImplementationId();
68 // com::sun::star::lang::XUnoTunnel
69 //------------------------------------------------------------------
70 sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
72 return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
73 ? reinterpret_cast< sal_Int64 >( this )
74 : OView_ADO::getSomething(rId);
77 // -------------------------------------------------------------------------
78 void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
80 if(m_aView.IsValid())
82 switch(nHandle)
84 case PROPERTY_ID_NAME:
85 rValue <<= m_aView.get_Name();
86 break;
87 case PROPERTY_ID_CATALOGNAME:
88 break;
89 case PROPERTY_ID_SCHEMANAME:
90 // rValue <<= m_aView.get_Type();
91 break;
92 case PROPERTY_ID_COMMAND:
94 OLEVariant aVar;
95 m_aView.get_Command(aVar);
96 if(!aVar.isNull() && !aVar.isEmpty())
98 ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
99 OLEString aBSTR;
100 pCom->get_CommandText(&aBSTR);
101 rValue <<= (::rtl::OUString) aBSTR;
104 break;
107 else
108 OView_ADO::getFastPropertyValue(rValue,nHandle);
110 // -----------------------------------------------------------------------------
111 void SAL_CALL OAdoView::acquire() throw()
113 OView_ADO::acquire();
115 // -----------------------------------------------------------------------------
116 void SAL_CALL OAdoView::release() throw()
118 OView_ADO::release();
120 // -----------------------------------------------------------------------------
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */