/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// search the entry of the given type with the given name for (sal_Int32 nLookup = 0; nLookup < m_xTable->n_children(); ++nLookup)
{ if (sCommand == m_xTable->get_text(nLookup))
{ if (m_xTable->get_id(nLookup).toInt32() == nCommandType)
{
m_xTable->select( nLookup ); break;
}
}
}
} catch(const Exception&)
{
TOOLS_WARN_EXCEPTION("extensions.abpilot", "OTableSelectionPage::initializePage");
}
}
bool OTableSelectionPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason )
{ if (!OControlWizardPage::commitPage(_eReason)) returnfalse;
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName(u"StarOffice XML (Base)"_ustr);
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); if ( pFilter )
{
aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
}
// will be the table tables of the selected data source
Sequence< OUString > aTableNames;
Sequence< OUString > aQueryNames;
// connect to the data source
Any aSQLException;
Reference< XConnection > xConn = _rxConn; if ( !xConn.is() )
{ if (!m_xDSContext.is()) return; // connect to the data source try
{
OUString sCurrentDatasource = m_xDatasource->get_selected_text(); if (!sCurrentDatasource.isEmpty())
{ // obtain the DS object
Reference< XCompletedConnection > xDatasource; // check if I know this one otherwise transform it into a file URL if ( !m_xDSContext->hasByName(sCurrentDatasource) )
{
::svt::OFileNotation aFileNotation(sCurrentDatasource);
sCurrentDatasource = aFileNotation.get(::svt::OFileNotation::N_URL);
}
if (m_xDSContext->getByName(sCurrentDatasource) >>= xDatasource)
{ // connect // get the default SDB interaction handler
Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(getDialog()->getDialog()); if (!xHandler.is() ) return;
xConn = xDatasource->connectWithCompletion(xHandler);
setFormConnection( xConn );
} else
{
OSL_FAIL("OTableSelectionPage::implFillTables: invalid data source object returned by the context");
}
}
} catch(const SQLContext& e) { aSQLException <<= e; } catch(const SQLWarning& e) { aSQLException <<= e; } catch(const SQLException& e) { aSQLException <<= e; } catch (const Exception&)
{
OSL_FAIL("OTableSelectionPage::implFillTables: could not fill the table list!");
}
}
// will be the table tables of the selected data source if ( xConn.is() )
{ try
{ // get the tables
Reference< XTablesSupplier > xSupplTables(xConn, UNO_QUERY); if ( xSupplTables.is() )
{
Reference< XNameAccess > xTables = xSupplTables->getTables(); if (xTables.is())
aTableNames = xTables->getElementNames();
}
// and the queries
Reference< XQueriesSupplier > xSuppQueries( xConn, UNO_QUERY ); if ( xSuppQueries.is() )
{
Reference< XNameAccess > xQueries = xSuppQueries->getQueries(); if ( xQueries.is() )
aQueryNames = xQueries->getElementNames();
}
} catch(const SQLContext& e) { aSQLException <<= e; } catch(const SQLWarning& e) { aSQLException <<= e; } catch(const SQLException& e) { aSQLException <<= e; } catch (const Exception&)
{
OSL_FAIL("OTableSelectionPage::implFillTables: could not fill the table list!");
}
}
if ( aSQLException.hasValue() )
{ // an SQLException (or derivee) was thrown ...
Reference< XInteractionRequest > xRequest = new OInteractionRequest(aSQLException); try
{ // get the default SDB interaction handler
Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(getDialog()->getDialog()); if ( xHandler.is() )
xHandler->handle(xRequest);
} catch(const Exception&) { } return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.