summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMatthew Nicholls <matthew.nicholls95@hotmail.co.uk>2015-04-01 15:43:32 +0100
committerDavid Tardon <dtardon@redhat.com>2015-04-14 14:29:02 +0000
commitb7bb34d74c5c764844f5b87483d09a61d3088695 (patch)
treec2e0827ed5ffe194ef51a8204b67d298c6741b50 /svx
parent7b68534ab0d322522ee5f64250526050187b6a9c (diff)
tdf#88710 Kill svx dbtoolsclient
Removes dynamic loading logic described in tdf#84315, similar thing removed in swdbtoolsclient. Change-Id: I8762102a7263e6933354c2ff6f9978929b760f6e Reviewed-on: https://gerrit.libreoffice.org/15147 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/Library_svx.mk2
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx7
-rw-r--r--svx/source/fmcomp/gridcell.cxx5
-rw-r--r--svx/source/fmcomp/gridctrl.cxx1
-rw-r--r--svx/source/form/dbcharsethelper.cxx13
-rw-r--r--svx/source/form/dbtoolsclient.cxx310
-rw-r--r--svx/source/form/filtnav.cxx7
-rw-r--r--svx/source/form/fmdocumentclassification.cxx1
-rw-r--r--svx/source/form/fmpgeimp.cxx5
-rw-r--r--svx/source/form/fmshimp.cxx11
-rw-r--r--svx/source/form/fmtools.cxx2
-rw-r--r--svx/source/form/fmundo.cxx10
-rw-r--r--svx/source/form/fmvwimp.cxx13
-rw-r--r--svx/source/form/formcontrolfactory.cxx7
-rw-r--r--svx/source/form/formcontroller.cxx26
-rw-r--r--svx/source/form/sqlparserclient.cxx14
-rw-r--r--svx/source/form/tabwin.cxx5
-rw-r--r--svx/source/inc/fmshimp.hxx2
-rw-r--r--svx/source/inc/sqlparserclient.hxx15
-rw-r--r--svx/source/inc/tabwin.hxx7
21 files changed, 67 insertions, 397 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index f1c0c2ba54fe..db5ab90c463e 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -46,6 +46,8 @@ $(eval $(call gb_Library_use_libraries,svx,\
comphelper \
cppuhelper \
cppu \
+ $(call gb_Helper_optional,DBCONNECTIVITY, \
+ dbtools) \
drawinglayer \
editeng \
fwe \
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 1586bd5d9cb7..1c619c6e3ca3 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -418,7 +418,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/form/dataaccessdescriptor \
svx/source/form/datalistener \
svx/source/form/datanavi \
- svx/source/form/dbtoolsclient \
svx/source/form/delayedevent \
svx/source/form/fmcontrolbordermanager \
svx/source/form/fmcontrollayout \
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index f905336585ac..a7af35a61b03 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -86,6 +86,7 @@ using namespace ::com::sun::star::container;
using namespace ::cppu;
using namespace ::svxform;
using namespace ::svx;
+using namespace ::dbtools;
OUString FieldServiceFromId(sal_Int32 nID)
{
@@ -274,7 +275,7 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
try
{
OUString sSignificantSource( sDatasource.isEmpty() ? sDatabaseLocation : sDatasource );
- xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, OUString(), OUString(),
+ xConnection = getConnection_withFeedback(sSignificantSource, OUString(), OUString(),
static_cast<FmGridControl*>(GetParent())->getContext() );
}
catch(NoSuchElementException&)
@@ -386,7 +387,7 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
try
{
// need number formats
- Reference< XNumberFormatsSupplier > xSupplier = OStaticDataAccessTools().getNumberFormats(xConnection, true);
+ Reference< XNumberFormatsSupplier > xSupplier = getNumberFormats(xConnection, true);
Reference< XNumberFormats > xNumberFormats;
if (xSupplier.is())
xNumberFormats = xSupplier->getNumberFormats();
@@ -912,7 +913,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
// ein paar Properties hinueberretten
Reference< XPropertySet > xReplaced( xCols->getByIndex( nPos ), UNO_QUERY );
- OStaticDataAccessTools().TransferFormComponentProperties(
+ TransferFormComponentProperties(
xReplaced, xNewCol, Application::GetSettings().GetUILanguageTag().getLocale() );
xCols->replaceByIndex( nPos, makeAny( xNewCol ) );
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 7e194f6bc5ca..b5bda2378e40 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1803,9 +1803,8 @@ OUString DbPatternField::GetFormatText(const Reference< ::com::sun::star::sdb::X
if ( !rpFormatter.get() )
{
- DBToolsObjectFactory aFactory;
- rpFormatter = aFactory.createFormattedColumnValue(
- m_xContext, getCursor(), Reference< XPropertySet >( _rxField, UNO_QUERY ) );
+ rpFormatter = ::std::unique_ptr< FormattedColumnValue> (
+ new FormattedColumnValue(m_xContext, getCursor(), Reference< XPropertySet >( _rxField, UNO_QUERY ) ) );
OSL_ENSURE( rpFormatter.get(), "DbPatternField::Init: no value formatter!" );
}
else
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 84a3bde94af9..0960111ef01a 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -21,7 +21,6 @@
#include "fmhelp.hrc"
#include <svx/gridctrl.hxx>
#include "gridcell.hxx"
-#include "svx/dbtoolsclient.hxx"
#include "svx/fmtools.hxx"
#include <svtools/stringtransfer.hxx>
#include <connectivity/dbtools.hxx>
diff --git a/svx/source/form/dbcharsethelper.cxx b/svx/source/form/dbcharsethelper.cxx
index f401592e9644..326f955e3003 100644
--- a/svx/source/form/dbcharsethelper.cxx
+++ b/svx/source/form/dbcharsethelper.cxx
@@ -19,21 +19,16 @@
#include "svx/dbcharsethelper.hxx"
+#include <connectivity/dbtools.hxx>
+
+using namespace ::dbtools;
namespace svxform
{
ODataAccessCharsetHelper::ODataAccessCharsetHelper( )
{
- }
-
-
- bool ODataAccessCharsetHelper::ensureLoaded() const
- {
- if ( !ODbtoolsClient::ensureLoaded() )
- return false;
- m_xCharsetHelper = getFactory()->createCharsetHelper( );
- return m_xCharsetHelper.is();
+ m_xCharsetHelper = createCharsetHelper();
}
diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx
deleted file mode 100644
index 7306e62b4330..000000000000
--- a/svx/source/form/dbtoolsclient.cxx
+++ /dev/null
@@ -1,310 +0,0 @@
-/* -*- 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 .
- */
-
-#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include "svx/dbtoolsclient.hxx"
-#include <osl/diagnose.h>
-#include <rtl/instance.hxx>
-#include <connectivity/formattedcolumnvalue.hxx>
-
-
-namespace svxform
-{
-
-
- using namespace ::connectivity::simple;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::util;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::container;
-
-
- //= ODbtoolsClient
-
-
- namespace
- {
- struct theODbtoolsClientMutex : public rtl::Static< osl::Mutex, theODbtoolsClientMutex> {};
- }
-
- sal_Int32 ODbtoolsClient::s_nClients = 0;
- oslModule ODbtoolsClient::s_hDbtoolsModule = NULL;
- createDataAccessToolsFactoryFunction
- ODbtoolsClient::s_pFactoryCreationFunc = NULL;
-
-
- ODbtoolsClient::ODbtoolsClient()
- {
- m_bCreateAlready = false;
- }
-
-
- bool ODbtoolsClient::ensureLoaded() const
- {
- if ( !m_bCreateAlready )
- {
- m_bCreateAlready = true;
-
- registerClient();
- if ( s_pFactoryCreationFunc )
- { // loading the lib succeeded
- void* pUntypedFactory = (*s_pFactoryCreationFunc)();
- IDataAccessToolsFactory* pDBTFactory = static_cast< IDataAccessToolsFactory* >( pUntypedFactory );
- OSL_ENSURE( pDBTFactory, "ODbtoolsClient::ODbtoolsClient: no factory returned!" );
- if ( pDBTFactory )
- {
- m_xDataAccessFactory = pDBTFactory;
- // by definition, the factory was acquired once
- m_xDataAccessFactory->release();
- }
- }
- }
- return m_xDataAccessFactory.is();
- }
-
-
- ODbtoolsClient::~ODbtoolsClient()
- {
- // clear the factory _before_ revoking the client
- // (the revocation may unload the DBT lib)
- m_xDataAccessFactory = NULL;
- // revoke the client
- if ( m_bCreateAlready )
- revokeClient();
- }
-
-#if HAVE_FEATURE_DESKTOP
-#ifndef DISABLE_DYNLOADING
- extern "C" { static void SAL_CALL thisModule() {} }
-#else
- extern "C" void * createDataAccessToolsFactory();
-#endif
-#endif
-
- void ODbtoolsClient::registerClient()
- {
- ::osl::MutexGuard aGuard(theODbtoolsClientMutex::get());
- if (1 == ++s_nClients)
- {
- OSL_ENSURE(NULL == s_hDbtoolsModule, "ODbtoolsClient::registerClient: inconsistence: already have a module!");
- OSL_ENSURE(NULL == s_pFactoryCreationFunc, "ODbtoolsClient::registerClient: inconsistence: already have a factory function!");
-
-#if HAVE_FEATURE_DESKTOP
-#ifndef DISABLE_DYNLOADING
-
- // load the dbtools library
- s_hDbtoolsModule = osl_loadModuleRelative(
- &thisModule, OUString(DBTOOLS_DLL_NAME).pData, 0);
- OSL_ENSURE(NULL != s_hDbtoolsModule, "ODbtoolsClient::registerClient: could not load the dbtools library!");
- if (NULL != s_hDbtoolsModule)
- {
- // get the symbol for the method creating the factory
- const OUString sFactoryCreationFunc( "createDataAccessToolsFactory" );
- // reinterpret_cast<createDataAccessToolsFactoryFunction>
- s_pFactoryCreationFunc = reinterpret_cast<createDataAccessToolsFactoryFunction>(
- osl_getFunctionSymbol(s_hDbtoolsModule, sFactoryCreationFunc.pData));
-
- if (NULL == s_pFactoryCreationFunc)
- { // did not find the symbol
- OSL_FAIL("ODbtoolsClient::registerClient: could not find the symbol for creating the factory!");
- osl_unloadModule(s_hDbtoolsModule);
- s_hDbtoolsModule = NULL;
- }
- }
-#else
- s_pFactoryCreationFunc = createDataAccessToolsFactory;
-#endif
-#endif
- }
- }
-
-
- void ODbtoolsClient::revokeClient()
- {
- ::osl::MutexGuard aGuard(theODbtoolsClientMutex::get());
- if (0 == --s_nClients)
- {
-#ifndef DISABLE_DYNLOADING
- s_pFactoryCreationFunc = NULL;
- if (s_hDbtoolsModule)
- osl_unloadModule(s_hDbtoolsModule);
-#endif
- s_hDbtoolsModule = NULL;
- }
-
- OSL_ENSURE(s_nClients >= 0,"Illegall call of revokeClient()");
- }
-
- OStaticDataAccessTools::OStaticDataAccessTools()
- {
- }
-
-
-
- bool OStaticDataAccessTools::ensureLoaded() const
- {
- if ( !ODbtoolsClient::ensureLoaded() )
- return false;
- m_xDataAccessTools = getFactory()->getDataAccessTools();
- return m_xDataAccessTools.is();
- }
-
-
- Reference< XNumberFormatsSupplier > OStaticDataAccessTools::getNumberFormats(const Reference< XConnection>& _rxConn, bool _bAllowDefault) const
- {
- Reference< XNumberFormatsSupplier > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xDataAccessTools->getNumberFormats(_rxConn, _bAllowDefault);
- return xReturn;
- }
-
-
- sal_Int32 OStaticDataAccessTools::getDefaultNumberFormat( const Reference< XPropertySet >& _xColumn, const Reference< XNumberFormatTypes >& _xTypes, const css::lang::Locale& _rLocale )
- {
- sal_Int32 nReturn = 0;
- if ( ensureLoaded() )
- nReturn = m_xDataAccessTools->getDefaultNumberFormat( _xColumn, _xTypes, _rLocale );
- return nReturn;
- }
-
-
- Reference< XConnection> OStaticDataAccessTools::getConnection_withFeedback(const OUString& _rDataSourceName,
- const OUString& _rUser, const OUString& _rPwd, const Reference<XComponentContext>& _rxContext) const
- {
- Reference< XConnection > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xDataAccessTools->getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxContext);
- return xReturn;
- }
-
-
- Reference< XConnection > OStaticDataAccessTools::connectRowset( const Reference< XRowSet >& _rxRowSet,
- const Reference< XComponentContext >& _rxContext, bool _bSetAsActiveConnection ) const
- {
- Reference< XConnection > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xDataAccessTools->connectRowset( _rxRowSet, _rxContext, _bSetAsActiveConnection );
- return xReturn;
- }
-
-
- Reference< XConnection > OStaticDataAccessTools::getRowSetConnection(const Reference< XRowSet >& _rxRowSet) const
- {
- Reference< XConnection > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xDataAccessTools->getRowSetConnection(_rxRowSet);
- return xReturn;
- }
-
- void OStaticDataAccessTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld,
- const Reference< XPropertySet>& _rxNew, const css::lang::Locale& _rLocale) const
- {
- if ( ensureLoaded() )
- m_xDataAccessTools->TransferFormComponentProperties(_rxOld, _rxNew, _rLocale);
- }
-
- Reference< XDataSource > OStaticDataAccessTools::getDataSource( const OUString& _rsRegisteredName, const Reference< XComponentContext>& _rxContext ) const
- {
- Reference< XDataSource > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xDataAccessTools->getDataSource(_rsRegisteredName,_rxContext);
- return xReturn;
- }
-
- bool OStaticDataAccessTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const
- {
- bool bRet = false;
- if ( ensureLoaded() )
- bRet = m_xDataAccessTools->canInsert( _rxCursorSet );
- return bRet;
- }
-
- bool OStaticDataAccessTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const
- {
- bool bRet = false;
- if ( ensureLoaded() )
- bRet = m_xDataAccessTools->canUpdate( _rxCursorSet );
- return bRet;
- }
-
-
- Reference< XNameAccess > OStaticDataAccessTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection,
- const sal_Int32 _nCommandType, const OUString& _rCommand,
- Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo )
- {
- Reference< XNameAccess > aFields;
- if ( ensureLoaded() )
- aFields = m_xDataAccessTools->getFieldsByCommandDescriptor( _rxConnection, _nCommandType,
- _rCommand, _rxKeepFieldsAlive, _pErrorInfo );
-
- return aFields;
- }
-
-
- bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection )
- {
- bool bReturn = false;
- if ( ensureLoaded() )
- bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, _rxActualConnection );
- return bReturn;
- }
-
-
- bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent )
- {
- bool bReturn = false;
- if ( ensureLoaded() )
- {
- Reference< XConnection > xDummy;
- bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, xDummy );
- }
- return bReturn;
- }
-
- DBToolsObjectFactory::DBToolsObjectFactory()
- {
- }
-
-
- DBToolsObjectFactory::~DBToolsObjectFactory()
- {
- }
-
-
- ::std::unique_ptr< ::dbtools::FormattedColumnValue > DBToolsObjectFactory::createFormattedColumnValue(
- const Reference<XComponentContext>& _rContext, const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn )
- {
- ::std::unique_ptr< ::dbtools::FormattedColumnValue > pValue;
- if ( ensureLoaded() )
- pValue = getFactory()->createFormattedColumnValue( _rContext, _rxRowSet, _rxColumn );
- return pValue;
- }
-
-
-} // namespace svxform
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 03132a72c56b..45a926f4bdb0 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -68,7 +68,7 @@
using namespace ::svxform;
using namespace ::connectivity::simple;
using namespace ::connectivity;
-
+using namespace ::dbtools;
namespace svxform
@@ -865,13 +865,12 @@ bool FmFilterModel::ValidateText(FmFilterItem* pItem, OUString& rText, OUString&
{
Reference< XFormController > xFormController( pFormItem->GetController() );
// obtain the connection of the form belonging to the controller
- OStaticDataAccessTools aStaticTools;
Reference< XRowSet > xRowSet( xFormController->getModel(), UNO_QUERY_THROW );
- Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( xRowSet ) );
+ Reference< XConnection > xConnection( getConnection( xRowSet ) );
// obtain a number formatter for this connection
// TODO: shouldn't this be cached?
- Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats( xConnection, true );
+ Reference< XNumberFormatsSupplier > xFormatSupplier = getNumberFormats( xConnection, true );
Reference< XNumberFormatter > xFormatter( NumberFormatter::create( comphelper::getProcessComponentContext() ), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier( xFormatSupplier );
diff --git a/svx/source/form/fmdocumentclassification.cxx b/svx/source/form/fmdocumentclassification.cxx
index cc8440aeb50f..ade7433a9217 100644
--- a/svx/source/form/fmdocumentclassification.cxx
+++ b/svx/source/form/fmdocumentclassification.cxx
@@ -19,7 +19,6 @@
#include "fmdocumentclassification.hxx"
-#include "svx/dbtoolsclient.hxx"
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index 7c7edd7a3111..71c246ca35c4 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -28,7 +28,6 @@
#include "formcontrolfactory.hxx"
#include "svx/svditer.hxx"
#include "svx/fmresids.hrc"
-#include "svx/dbtoolsclient.hxx"
#include "treevisitor.hxx"
#include <com/sun/star/sdb/CommandType.hpp>
@@ -49,6 +48,7 @@
#include <comphelper/uno3.hxx>
#include <comphelper/types.hxx>
#include <unotools/streamwrap.hxx>
+#include <connectivity/dbtools.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -63,6 +63,7 @@ using ::com::sun::star::container::XMap;
using ::com::sun::star::container::EnumerableMap;
using ::com::sun::star::drawing::XControlShape;
using namespace ::svxform;
+using namespace ::dbtools;
FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage )
@@ -575,7 +576,7 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource(
Reference< XConnection > xFormConnection;
xFormProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ) >>= xFormConnection;
if ( !xFormConnection.is() )
- OStaticDataAccessTools().isEmbeddedInDatabase( xFormProps, xFormConnection );
+ isEmbeddedInDatabase( xFormProps, xFormConnection );
if (xFormConnection.is())
{
Reference< XChild > xConnAsChild(xFormConnection, UNO_QUERY);
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 120bfb174e75..e03d9a076051 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -268,6 +268,7 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::script;
using namespace ::svxform;
using namespace ::svx;
+using namespace ::dbtools;
//= helper
@@ -1627,7 +1628,7 @@ bool FmXFormShell::GetY2KState(sal_uInt16& n)
Reference< XRowSet> xDB(xForm, UNO_QUERY);
DBG_ASSERT(xDB.is(), "FmXFormShell::GetY2KState : current form has no dbform-interface !");
- Reference< XNumberFormatsSupplier> xSupplier( getNumberFormats(OStaticDataAccessTools().getRowSetConnection(xDB), false));
+ Reference< XNumberFormatsSupplier> xSupplier( getNumberFormats(getConnection(xDB), false));
if (xSupplier.is())
{
Reference< XPropertySet> xSet(xSupplier->getNumberFormatSettings());
@@ -1658,7 +1659,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n)
Reference< XRowSet > xActiveRowSet( xActiveForm, UNO_QUERY );
if ( xActiveRowSet.is() )
{
- Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getRowSetConnection( xActiveRowSet ), false ) );
+ Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getConnection( xActiveRowSet ), false ) );
if (xSupplier.is())
{
Reference< XPropertySet> xSet(xSupplier->getNumberFormatSettings());
@@ -1698,7 +1699,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n)
Reference< XRowSet> xElementAsRowSet( xCurrentElement, UNO_QUERY );
if ( xElementAsRowSet.is() )
{
- Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getRowSetConnection( xElementAsRowSet ), false ) );
+ Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getConnection( xElementAsRowSet ), false ) );
if (!xSupplier.is())
continue;
@@ -2106,7 +2107,7 @@ void FmXFormShell::startListening()
return;
Reference< XRowSet> xDatabaseForm(m_xActiveForm, UNO_QUERY);
- if (xDatabaseForm.is() && getRowSetConnection(xDatabaseForm).is())
+ if (xDatabaseForm.is() && getConnection(xDatabaseForm).is())
{
Reference< XPropertySet> xActiveFormSet(m_xActiveForm, UNO_QUERY);
if (xActiveFormSet.is())
@@ -3826,7 +3827,7 @@ namespace
try
{
Reference< XConnection > xConn;
- if ( OStaticDataAccessTools().isEmbeddedInDatabase( _rxLoadable.get(), xConn ) )
+ if ( isEmbeddedInDatabase( _rxLoadable.get(), xConn ) )
return true;
// is there already a active connection
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index 4b7bfadd3b4c..40217b7a71e4 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -21,7 +21,6 @@
#include "fmprop.hrc"
#include "fmservs.hxx"
#include "svx/fmtools.hxx"
-#include "svx/dbtoolsclient.hxx"
#include "svx/fmglob.hxx"
#include <com/sun/star/awt/LineEndFormat.hpp>
@@ -96,7 +95,6 @@ using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::form;
using namespace ::svxform;
-using namespace ::connectivity::simple;
namespace
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 131481633058..f692c5038652 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -24,7 +24,6 @@
#include <sal/macros.h>
#include "fmundo.hxx"
#include "fmpgeimp.hxx"
-#include "svx/dbtoolsclient.hxx"
#include "svx/svditer.hxx"
#include "fmobj.hxx"
#include "fmprop.hrc"
@@ -42,6 +41,7 @@
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/form/binding/XListEntrySink.hpp>
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
#include "svx/fmtools.hxx"
#include <svl/macitem.hxx>
@@ -54,6 +54,7 @@
#include <osl/mutex.hxx>
#include <comphelper/property.hxx>
#include <comphelper/uno3.hxx>
+#include <connectivity/dbtools.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
@@ -65,7 +66,9 @@ using namespace ::com::sun::star::form;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::reflection;
using namespace ::com::sun::star::form::binding;
+using namespace ::com::sun::star::sdbc;
using namespace ::svxform;
+using namespace ::dbtools;
#include <com/sun/star/script/XScriptListener.hpp>
@@ -945,11 +948,14 @@ void FmXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement
Reference< XForm > xForm( _rxElement, UNO_QUERY );
Reference< XPropertySet > xFormProperties( xForm, UNO_QUERY );
if ( xFormProperties.is() )
- if ( !::svxform::OStaticDataAccessTools().isEmbeddedInDatabase( _rxElement ) )
+ {
+ Reference< XConnection > xDummy;
+ if ( !isEmbeddedInDatabase( _rxElement, xDummy ) )
// (if there is a connection in the context of the component, setting
// a new connection would be vetoed, anyway)
// #i34196#
xFormProperties->setPropertyValue( FM_PROP_ACTIVE_CONNECTION, Any() );
+ }
}
Reference< XIndexContainer > xContainer( _rxElement, UNO_QUERY );
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index c90075277c2f..af8af5cf1436 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -84,12 +84,14 @@
#include <vcl/msgbox.hxx>
#include <vcl/stdtext.hxx>
#include <osl/mutex.hxx>
+#include <connectivity/dbtools.hxx>
#include <algorithm>
using namespace ::comphelper;
using namespace ::svx;
using namespace ::svxform;
+using namespace ::dbtools;
using namespace ::com::sun::star;
using ::com::sun::star::uno::Exception;
@@ -692,7 +694,7 @@ IMPL_LINK(FmXFormView, OnActivate, void*, /*EMPTYTAG*/)
// only database forms are to be activated
Reference< XRowSet > xForm(xController->getModel(), UNO_QUERY);
- if ( !xForm.is() || !OStaticDataAccessTools().getRowSetConnection( xForm ).is() )
+ if ( !xForm.is() || !getConnection( xForm ).is() )
continue;
Reference< XPropertySet > xFormSet( xForm, UNO_QUERY );
@@ -1152,11 +1154,11 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
// obtain the data source
if ( !xDataSource.is() )
- xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, comphelper::getProcessComponentContext() );
+ xDataSource = getDataSource( sDataSource, comphelper::getProcessComponentContext() );
// and the connection, if necessary
if ( !xConnection.is() )
- xConnection.reset( OStaticDataAccessTools().getConnection_withFeedback(
+ xConnection.reset( getConnection_withFeedback(
sDataSource,
OUString(),
OUString(),
@@ -1184,7 +1186,6 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
return NULL;
}
- OStaticDataAccessTools aDBATools;
Reference< XComponent > xKeepFieldsAlive;
// go
try
@@ -1192,7 +1193,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
// determine the table/query field which we should create a control for
Reference< XPropertySet > xField;
- Reference< XNameAccess > xFields = aDBATools.getFieldsByCommandDescriptor(
+ Reference< XNameAccess > xFields = getFieldsByCommandDescriptor(
xConnection, nCommandType, sCommand, xKeepFieldsAlive );
if (xFields.is() && xFields->hasByName(sFieldName))
@@ -1200,7 +1201,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
if ( !xField.is() )
return NULL;
- Reference< XNumberFormatsSupplier > xSupplier( aDBATools.getNumberFormats( xConnection, false ), UNO_SET_THROW );
+ Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, false ), UNO_SET_THROW );
Reference< XNumberFormats > xNumberFormats( xSupplier->getNumberFormats(), UNO_SET_THROW );
OUString sLabelPostfix;
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index 17b7613ea000..5827999cfc39 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -18,7 +18,6 @@
*/
-#include "svx/dbtoolsclient.hxx"
#include "formcontrolfactory.hxx"
#include "fmcontrollayout.hxx"
#include "fmprop.hrc"
@@ -46,9 +45,11 @@
#include <unotools/syslocale.hxx>
#include <tools/gen.hxx>
#include <tools/diagnose_ex.h>
+#include <connectivity/dbtools.hxx>
#include <set>
+using namespace ::dbtools;
namespace svxform
{
@@ -212,7 +213,7 @@ namespace svxform
Reference< XPropertySet > xDsProperties;
if ( !sDataSourceName.isEmpty() )
- xDsProperties.set(OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext ), css::uno::UNO_QUERY);
+ xDsProperties.set(getDataSource( sDataSourceName, _rContext ), css::uno::UNO_QUERY);
if ( xDsProperties.is() )
xDsProperties->getPropertyValue("Info") >>= aInfo;
}
@@ -573,7 +574,7 @@ namespace svxform
}
else
{
- nFormatKey = OStaticDataAccessTools().getDefaultNumberFormat(
+ nFormatKey = getDefaultNumberFormat(
_rxDatabaseField,
Reference< XNumberFormatTypes >( _rxNumberFormats, UNO_QUERY ),
SvtSysLocale().GetLanguageTag().getLocale()
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 94dd18139c27..3497bd05de1e 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -77,6 +77,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <connectivity/IParseContext.hxx>
+#include <connectivity/dbtools.hxx>
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
@@ -94,6 +95,7 @@ using namespace ::com::sun::star;
using namespace ::comphelper;
using namespace ::connectivity;
using namespace ::connectivity::simple;
+using namespace ::dbtools;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
@@ -788,12 +790,11 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
case FM_ATTR_FILTER:
{
OUStringBuffer aFilter;
- OStaticDataAccessTools aStaticTools;
- Reference<XConnection> xConnection(aStaticTools.getRowSetConnection(Reference< XRowSet>(m_xModelAsIndex, UNO_QUERY)));
+ Reference<XConnection> xConnection(getConnection(Reference< XRowSet>(m_xModelAsIndex, UNO_QUERY)));
if (xConnection.is())
{
Reference< XDatabaseMetaData> xMetaData(xConnection->getMetaData());
- Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats( xConnection, true ) );
+ Reference< XNumberFormatsSupplier> xFormatSupplier( getNumberFormats( xConnection, true ) );
Reference< XNumberFormatter> xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
@@ -2557,8 +2558,7 @@ void FormController::loaded(const EventObject& rEvent) throw( RuntimeException,
::osl::MutexGuard aGuard( m_aMutex );
Reference< XRowSet > xForm(rEvent.Source, UNO_QUERY);
// do we have a connected data source
- OStaticDataAccessTools aStaticTools;
- if (xForm.is() && aStaticTools.getRowSetConnection(xForm).is())
+ if (xForm.is() && getConnection(xForm).is())
{
Reference< XPropertySet > xSet(xForm, UNO_QUERY);
if (xSet.is())
@@ -2567,8 +2567,8 @@ void FormController::loaded(const EventObject& rEvent) throw( RuntimeException,
sal_Int32 aVal2 = 0;
::cppu::enum2int(aVal2,aVal);
m_bCycle = !aVal.hasValue() || aVal2 == TabulatorCycle_RECORDS;
- m_bCanUpdate = aStaticTools.canUpdate(xSet);
- m_bCanInsert = aStaticTools.canInsert(xSet);
+ m_bCanUpdate = canUpdate(xSet);
+ m_bCanInsert = canInsert(xSet);
m_bCurrentRecordModified = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISMODIFIED));
m_bCurrentRecordNew = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW));
@@ -3054,7 +3054,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
// create the composer
Reference< XRowSet > xForm(m_xModelAsIndex, UNO_QUERY);
- Reference< XConnection > xConnection(OStaticDataAccessTools().getRowSetConnection(xForm));
+ Reference< XConnection > xConnection(getConnection(xForm));
if (xForm.is())
{
try
@@ -3103,8 +3103,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
::comphelper::UStringMixEqual aCompare(xMetaData->storesMixedCaseQuotedIdentifiers());
// need to parse criteria localized
- OStaticDataAccessTools aStaticTools;
- Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats(xConnection, true));
+ Reference< XNumberFormatsSupplier> xFormatSupplier( getNumberFormats(xConnection, true));
Reference< XNumberFormatter> xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Locale aAppLocale = Application::GetSettings().GetUILanguageTag().getLocale();
@@ -3233,8 +3232,7 @@ void FormController::startFiltering()
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
- OStaticDataAccessTools aStaticTools;
- Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
+ Reference< XConnection > xConnection( getConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
if ( !xConnection.is() )
// nothing to do - can't filter a form which is not connected
return;
@@ -3256,7 +3254,7 @@ void FormController::startFiltering()
// the control we have to activate after replacement
Reference< XDatabaseMetaData > xMetaData(xConnection->getMetaData());
- Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats(xConnection, true);
+ Reference< XNumberFormatsSupplier > xFormatSupplier = getNumberFormats(xConnection, true);
Reference< XNumberFormatter > xFormatter = NumberFormatter::create(m_xComponentContext);
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
@@ -3911,7 +3909,7 @@ sal_Bool SAL_CALL FormController::approveParameter(const DatabaseParameterEvent&
// the request
ParametersRequest aRequest;
aRequest.Parameters = aEvent.Parameters;
- aRequest.Connection = OStaticDataAccessTools().getRowSetConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
+ aRequest.Connection = getConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
OInteractionRequest* pParamRequest = new OInteractionRequest(makeAny(aRequest));
Reference< XInteractionRequest > xParamRequest(pParamRequest);
// some knittings
diff --git a/svx/source/form/sqlparserclient.cxx b/svx/source/form/sqlparserclient.cxx
index f9c40e850f49..b374c8eaf876 100644
--- a/svx/source/form/sqlparserclient.cxx
+++ b/svx/source/form/sqlparserclient.cxx
@@ -20,25 +20,19 @@
#include "sqlparserclient.hxx"
#include "svx/ParseContext.hxx"
+#include <connectivity/dbtools.hxx>
+
+using namespace ::dbtools;
namespace svxform
{
-
-
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
OSQLParserClient::OSQLParserClient(const Reference< XComponentContext >& rxContext)
{
m_xContext = rxContext;
- }
-
- bool OSQLParserClient::ensureLoaded() const
- {
- if ( !ODbtoolsClient::ensureLoaded() )
- return false;
- m_xParser = getFactory()->createSQLParser(m_xContext,getParseContext());
- return m_xParser.is();
+ m_xParser = createSQLParser(m_xContext, getParseContext());
}
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 6328a455c68c..6ef3e8537f21 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -36,7 +36,6 @@
#include "fmhelp.hrc"
#include <svx/fmshell.hxx>
#include "fmshimp.hxx"
-#include "svx/dbtoolsclient.hxx"
#include <svx/fmpage.hxx>
#include "fmpgeimp.hxx"
@@ -70,6 +69,7 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star;
using namespace ::svxform;
using namespace ::svx;
+using namespace ::dbtools;
namespace {
@@ -322,9 +322,8 @@ void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::su
m_nObjectType = ::comphelper::getINT32(xSet->getPropertyValue(FM_PROP_COMMANDTYPE));
// get the connection of the form
- OStaticDataAccessTools aTools;
m_aConnection.reset(
- aTools.connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessComponentContext(), true ),
+ connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessComponentContext(), true ),
SharedConnection::NoTakeOwnership
);
// TODO: When incompatible changes (such as extending the "virtualdbtools" interface by ensureRowSetConnection)
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index b274ae4cce8f..f687c791d440 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -55,7 +55,6 @@
#include <cppuhelper/compbase4.hxx>
#include <cppuhelper/compbase6.hxx>
#include <unotools/configitem.hxx>
-#include "svx/dbtoolsclient.hxx"
#include "formcontrolling.hxx"
#include "fmdocumentclassification.hxx"
@@ -146,7 +145,6 @@ class FmFormView;
class FmFormObj;
class SVX_DLLPUBLIC FmXFormShell : public FmXFormShell_BASE
,public FmXFormShell_CFGBASE
- ,public ::svxform::OStaticDataAccessTools
,public ::svx::IControllerFeatureInvalidation
{
friend class FmFormView;
diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx
index 635c6797d21f..fc5152a1c523 100644
--- a/svx/source/inc/sqlparserclient.hxx
+++ b/svx/source/inc/sqlparserclient.hxx
@@ -20,20 +20,15 @@
#ifndef INCLUDED_SVX_SOURCE_INC_SQLPARSERCLIENT_HXX
#define INCLUDED_SVX_SOURCE_INC_SQLPARSERCLIENT_HXX
-#include "svx/dbtoolsclient.hxx"
#include "svx/ParseContext.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
+#include <connectivity/virtualdbtools.hxx>
namespace svxform
{
-
-
-
//= OSQLParserClient
- class SVX_DLLPUBLIC OSQLParserClient : public ODbtoolsClient
- ,public ::svxform::OParseContextClient
+ class SVX_DLLPUBLIC OSQLParserClient : public ::svxform::OParseContextClient
{
private:
@@ -45,7 +40,6 @@ namespace svxform
protected:
OSQLParserClient(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
- virtual bool ensureLoaded() const SAL_OVERRIDE;
protected:
inline ::rtl::Reference< ::connectivity::simple::ISQLParseNode > predicateTree(
@@ -55,10 +49,7 @@ namespace svxform
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
) const
{
- ::rtl::Reference< ::connectivity::simple::ISQLParseNode > xReturn;
- if ( ensureLoaded() )
- xReturn = m_xParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField);
- return xReturn;
+ return m_xParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField);
}
};
diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx
index 368da9823251..c059544ea0db 100644
--- a/svx/source/inc/tabwin.hxx
+++ b/svx/source/inc/tabwin.hxx
@@ -28,7 +28,7 @@
#include <comphelper/propmultiplex.hxx>
#include <svtools/transfer.hxx>
-#include "svx/dbtoolsclient.hxx"
+#include <connectivity/dbtools.hxx>
class FmFieldWin;
@@ -70,12 +70,11 @@ public:
class FmFieldWin :public SfxFloatingWindow
,public SfxControllerItem
,public ::comphelper::OPropertyChangeListener
- ,public ::svxform::OStaticDataAccessTools
{
::osl::Mutex m_aMutex;
FmFieldWinListBox* pListBox;
FmFieldWinData* pData;
- ::svxform::SharedConnection
+ ::dbtools::SharedConnection
m_aConnection;
OUString m_aDatabaseName,
m_aObjectName;
@@ -102,7 +101,7 @@ public:
void FillInfo( SfxChildWinInfo& rInfo ) const SAL_OVERRIDE;
const OUString& GetDatabaseName() const { return m_aDatabaseName; }
- ::svxform::SharedConnection GetConnection() const { return m_aConnection; }
+ ::dbtools::SharedConnection GetConnection() const { return m_aConnection; }
const OUString& GetObjectName() const { return m_aObjectName; }
sal_Int32 GetObjectType() const { return m_nObjectType; }