Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / calc / CCatalog.cxx
blobb26beb6c5cf8a07a4456d67ef27b0e03e329a7e5
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: CCatalog.cxx,v $
10 * $Revision: 1.7 $
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"
35 #include "calc/CCatalog.hxx"
36 #include "calc/CConnection.hxx"
37 #include "calc/CTables.hxx"
38 #include <com/sun/star/sdbc/XRow.hpp>
39 #include <com/sun/star/sdbc/XResultSet.hpp>
40 #include <rtl/logfile.hxx>
42 using namespace ::com::sun::star::uno;
43 using namespace ::com::sun::star::beans;
44 using namespace ::com::sun::star::sdbcx;
45 using namespace ::com::sun::star::sdbc;
46 using namespace ::com::sun::star::container;
48 // -------------------------------------------------------------------------
49 using namespace connectivity::calc;
50 // -------------------------------------------------------------------------
51 OCalcCatalog::OCalcCatalog(OCalcConnection* _pCon) : file::OFileCatalog(_pCon)
53 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::OCalcCatalog" );
55 // -------------------------------------------------------------------------
56 void OCalcCatalog::refreshTables()
58 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcCatalog::refreshTables" );
59 TStringVector aVector;
60 Sequence< ::rtl::OUString > aTypes;
61 OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection));
62 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
63 ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes);
65 if(xResult.is())
67 Reference< XRow > xRow(xResult,UNO_QUERY);
68 while(xResult->next())
69 aVector.push_back(xRow->getString(3));
71 if(m_pTables)
72 m_pTables->reFill(aVector);
73 else
74 m_pTables = new OCalcTables(m_xMetaData,*this,m_aMutex,aVector);
76 // this avoids that the document will be loaded a 2nd time when one table will be accessed.
77 //if ( m_pTables && m_pTables->hasElements() )
78 // m_pTables->getByIndex(0);
80 // -----------------------------------------------------------------------------