Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / ado / AView.cxx
blob98c5d5a333743dd0a09a4b98aadf3e78c4fa5e30
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AView.cxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "ado/AView.hxx"
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include "ado/adoimp.hxx"
36 #include <cppuhelper/typeprovider.hxx>
37 #include "ado/Awrapado.hxx"
38 #include <comphelper/sequence.hxx>
39 #include <comphelper/types.hxx>
40 #include "TConnection.hxx"
42 // -------------------------------------------------------------------------
43 using namespace comphelper;
44 using namespace connectivity::ado;
45 using namespace com::sun::star::uno;
46 using namespace com::sun::star::lang;
47 using namespace com::sun::star::beans;
48 using namespace com::sun::star::sdbc;
50 // IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
51 // -------------------------------------------------------------------------
52 OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
53 ,m_aView(_pView)
56 //--------------------------------------------------------------------------
57 Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
59 static ::cppu::OImplementationId * pId = 0;
60 if (! pId)
62 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
63 if (! pId)
65 static ::cppu::OImplementationId aId;
66 pId = &aId;
69 return pId->getImplementationId();
72 // com::sun::star::lang::XUnoTunnel
73 //------------------------------------------------------------------
74 sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
76 return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
77 ? reinterpret_cast< sal_Int64 >( this )
78 : OView_ADO::getSomething(rId);
81 // -------------------------------------------------------------------------
82 void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
84 if(m_aView.IsValid())
86 switch(nHandle)
88 case PROPERTY_ID_NAME:
89 rValue <<= m_aView.get_Name();
90 break;
91 case PROPERTY_ID_CATALOGNAME:
92 break;
93 case PROPERTY_ID_SCHEMANAME:
94 // rValue <<= m_aView.get_Type();
95 break;
96 case PROPERTY_ID_COMMAND:
98 OLEVariant aVar;
99 m_aView.get_Command(aVar);
100 if(!aVar.isNull() && !aVar.isEmpty())
102 ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
103 OLEString aBSTR;
104 pCom->get_CommandText(&aBSTR);
105 rValue <<= (::rtl::OUString) aBSTR;
108 break;
111 else
112 OView_ADO::getFastPropertyValue(rValue,nHandle);
114 // -----------------------------------------------------------------------------
115 void SAL_CALL OAdoView::acquire() throw()
117 OView_ADO::acquire();
119 // -----------------------------------------------------------------------------
120 void SAL_CALL OAdoView::release() throw()
122 OView_ADO::release();
124 // -----------------------------------------------------------------------------