summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/mozab
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/mozab')
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.cxx128
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.hxx65
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.cxx195
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.hxx88
-rw-r--r--connectivity/source/drivers/mozab/MColumns.cxx101
-rw-r--r--connectivity/source/drivers/mozab/MColumns.hxx60
-rw-r--r--connectivity/source/drivers/mozab/MConfigAccess.cxx271
-rw-r--r--connectivity/source/drivers/mozab/MConfigAccess.hxx41
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx607
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx233
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx1033
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.hxx207
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx333
-rw-r--r--connectivity/source/drivers/mozab/MDriver.hxx113
-rw-r--r--connectivity/source/drivers/mozab/MExtConfigAccess.hxx48
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx546
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx170
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx1980
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx369
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx214
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.hxx101
-rw-r--r--connectivity/source/drivers/mozab/MServices.cxx160
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx564
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx214
-rw-r--r--connectivity/source/drivers/mozab/MTable.cxx97
-rw-r--r--connectivity/source/drivers/mozab/MTable.hxx72
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx104
-rw-r--r--connectivity/source/drivers/mozab/MTables.hxx57
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx283
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx104
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx156
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx43
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx141
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx87
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx347
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx47
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx635
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx76
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx243
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx85
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx422
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx125
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx116
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx74
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx100
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx69
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/makefile.mk95
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozbootstrap.component34
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h57
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h92
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h44
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h49
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h87
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/post_include_windows.h33
-rwxr-xr-xconnectivity/source/drivers/mozab/bootstrap/pre_include_windows.h34
-rwxr-xr-xconnectivity/source/drivers/mozab/exports.dxp1
-rwxr-xr-xconnectivity/source/drivers/mozab/makefile.mk194
-rwxr-xr-xconnectivity/source/drivers/mozab/makefile_mozab.mk127
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.component37
-rw-r--r--connectivity/source/drivers/mozab/mozab.xcu154
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.xml80
-rw-r--r--connectivity/source/drivers/mozab/mozab2.xcu118
-rwxr-xr-xconnectivity/source/drivers/mozab/mozabdrv.map8
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx805
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx80
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx453
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx54
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx84
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx407
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx116
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx88
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx60
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx143
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx86
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx826
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx282
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx637
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx137
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx134
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx68
-rwxr-xr-xconnectivity/source/drivers/mozab/mozillasrc/makefile.mk77
-rwxr-xr-xconnectivity/source/drivers/mozab/post_include_mozilla.h61
-rwxr-xr-xconnectivity/source/drivers/mozab/pre_include_mozilla.h65
85 files changed, 0 insertions, 17387 deletions
diff --git a/connectivity/source/drivers/mozab/MCatalog.cxx b/connectivity/source/drivers/mozab/MCatalog.cxx
deleted file mode 100644
index 4cf7492772..0000000000
--- a/connectivity/source/drivers/mozab/MCatalog.cxx
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MCatalog.hxx"
-#include "MConnection.hxx"
-#include "MTables.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <cppuhelper/interfacecontainer.h>
-
-// -------------------------------------------------------------------------
-using namespace connectivity::mozab;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::cppu;
-
-// -------------------------------------------------------------------------
-OCatalog::OCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
- ,m_pConnection(_pCon)
- ,m_xMetaData(m_pConnection->getMetaData( ))
-{
-// osl_incrementInterlockedCount( &m_refCount );
-// refreshTables();
-// refreshViews();
-// refreshGroups();
-// refreshUsers();
-// osl_decrementInterlockedCount( &m_refCount );
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshTables()
-{
- TStringVector aVector;
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),aTypes);
-
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- ::rtl::OUString aName;
- while(xResult->next())
- {
- aName = xRow->getString(3);
- aVector.push_back(aName);
- }
- }
- if(m_pTables)
- m_pTables->reFill(aVector);
- else
- m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshViews()
-{
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshGroups()
-{
-}
-// -------------------------------------------------------------------------
-void OCatalog::refreshUsers()
-{
-}
-// -------------------------------------------------------------------------
-const ::rtl::OUString& OCatalog::getDot()
-{
- static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("."));
- return sDot;
-}
-// -----------------------------------------------------------------------------
-
-// XTablesSupplier
-Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- checkDisposed(rBHelper.bDisposed);
-
- try
- {
- if(!m_pTables || m_pConnection->getForceLoadTables())
- refreshTables();
- }
- catch( const RuntimeException& )
- {
- // allowed to leave this method
- throw;
- }
- catch( const Exception& )
- {
- // allowed
- }
-
- return const_cast<OCatalog*>(this)->m_pTables;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MCatalog.hxx b/connectivity/source/drivers/mozab/MCatalog.hxx
deleted file mode 100644
index cc57748fe1..0000000000
--- a/connectivity/source/drivers/mozab/MCatalog.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
-#define _CONNECTIVITY_MOZAB_CATALOG_HXX_
-
-#include "connectivity/sdbcx/VCatalog.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- // please don't name the class the same name as in an other namespaces
- // some compilers have problems with this task as I noticed on windows
- class OConnection;
- class OCatalog : public connectivity::sdbcx::OCatalog
- {
- OConnection* m_pConnection; // used to get the metadata
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
-
- public:
- // implementation of the pure virtual methods
- virtual void refreshTables();
- virtual void refreshViews() ;
- virtual void refreshGroups();
- virtual void refreshUsers() ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException);
- public:
- OCatalog(OConnection* _pCon);
-
- OConnection* getConnection() const { return m_pConnection; }
- sdbcx::OCollection* getPrivateTables() const { return m_pTables;}
- sdbcx::OCollection* getPrivateViews() const { return m_pViews; }
-
- static const ::rtl::OUString& getDot();
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
deleted file mode 100644
index 7cbd66ae72..0000000000
--- a/connectivity/source/drivers/mozab/MColumnAlias.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "MColumnAlias.hxx"
-#include "MConnection.hxx"
-#include "MExtConfigAccess.hxx"
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-
-#include <tools/diagnose_ex.h>
-
-#include <algorithm>
-#include <functional>
-
-using namespace ::connectivity;
-using namespace ::connectivity::mozab;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-
-//------------------------------------------------------------------------------
-OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
-{
- static const sal_Char* s_pProgrammaticNames[] =
- {
- "FirstName",
- "LastName",
- "DisplayName",
- "NickName",
- "PrimaryEmail",
- "SecondEmail",
- "PreferMailFormat",
- "WorkPhone",
- "HomePhone",
- "FaxNumber",
- "PagerNumber",
- "CellularNumber",
- "HomeAddress",
- "HomeAddress2",
- "HomeCity",
- "HomeState",
- "HomeZipCode",
- "HomeCountry",
- "WorkAddress",
- "WorkAddress2",
- "WorkCity",
- "WorkState",
- "WorkZipCode",
- "WorkCountry",
- "JobTitle",
- "Department",
- "Company",
- "WebPage1",
- "WebPage2",
- "BirthYear",
- "BirthMonth",
- "BirthDay",
- "Custom1",
- "Custom2",
- "Custom3",
- "Custom4",
- "Notes",
- };
-
- for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i )
- m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
-
- initialize( _rxORB );
-}
-
-//------------------------------------------------------------------------------
-void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
-{
- // open our driver settings config node
-
- // the config path for our own driver's settings
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB );
- if ( xDriverNode.is() )
- {
- try
- {
- //.............................................................
- Reference< XNameAccess > xAliasesNode;
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xAliasesNode;
- OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
-
- // this is a set of string nodes
- Sequence< ::rtl::OUString > aProgrammaticNames;
- if ( xAliasesNode.is() )
- aProgrammaticNames = xAliasesNode->getElementNames();
-
- //.............................................................
- // travel through all the set elements
- const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
- const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
- ::rtl::OUString sAssignedAlias;
-
- for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
- {
- OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
-
- // normalize in case the config data is corrupted
- // (what we really don't need is an empty alias ...)
- if ( 0 == sAssignedAlias.getLength() )
- sAssignedAlias = *pProgrammaticNames;
-
- ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
- //.............................................................
- #if OSL_DEBUG_LEVEL > 0
- bool bFound = false;
- #endif
- for ( AliasMap::iterator search = m_aAliasMap.begin();
- ( search != m_aAliasMap.end() );
- ++search
- )
- {
- if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
- {
- AliasEntry entry( search->second );
- m_aAliasMap.erase( search );
- m_aAliasMap[ sAssignedAlias ] = entry;
-
- #if OSL_DEBUG_LEVEL > 0
- bFound = true;
- #endif
-
- break;
- }
- }
-
- OSL_ENSURE( bFound, "OColumnAlias::setAlias: did not find a programmatic name which exists in the configuration!" );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-//------------------------------------------------------------------
-::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
-{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
- if ( pos == m_aAliasMap.end() )
- {
- OSL_FAIL( "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
- return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
- }
- return pos->second.programmaticAsciiName;
-}
-
-//------------------------------------------------------------------
-bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
-{
- ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
-
- return ( !sProgrammatic.equals( "HomeCountry" )
- && !sProgrammatic.equals( "WorkCountry" )
- );
- // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
- // There might be more ...
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx
deleted file mode 100644
index 4aa9c07d7f..0000000000
--- a/connectivity/source/drivers/mozab/MColumnAlias.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-#define _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-
-#include <unotools/confignode.hxx>
-
-#include <osl/mutex.hxx>
-#include <vector>
-#include <boost/unordered_map.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class OColumnAlias
- {
- public:
- struct AliasEntry
- {
- ::rtl::OString programmaticAsciiName;
- sal_Int32 columnPosition;
-
- AliasEntry()
- :programmaticAsciiName()
- ,columnPosition( 0 )
- {
- }
- AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
- :programmaticAsciiName( _programmaticAsciiName )
- ,columnPosition( _columnPosition )
- {
- }
- };
- typedef ::boost::unordered_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
-
- private:
- AliasMap m_aAliasMap;
-
- public:
- OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
-
- inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
- {
- return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
- }
- ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
-
- inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
- inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
-
- bool isColumnSearchable( const ::rtl::OUString _alias ) const;
-
- private:
- void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
- };
- }
-}
-#endif // _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx
deleted file mode 100644
index 9e81cfdc0b..0000000000
--- a/connectivity/source/drivers/mozab/MColumns.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MColumns.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "connectivity/sdbcx/VColumn.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "MTable.hxx"
-#include "MTables.hxx"
-#include "MCatalog.hxx"
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-
-using namespace ::comphelper;
-
-
-using namespace connectivity::mozab;
-using namespace connectivity::sdbcx;
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName)
-{
- Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
- m_pTable->getSchema(),m_pTable->getTableName(),_rName);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- while(xResult->next())
- {
- if(xRow->getString(4) == _rName)
- {
- sal_Int32 nType = xRow->getInt(5);
- ::rtl::OUString sTypeName = xRow->getString(6);
- sal_Int32 nPrec = xRow->getInt(7);
-
- OColumn* pRet = new OColumn(_rName,
- sTypeName,
- xRow->getString(13),
- xRow->getString(12),
- xRow->getInt(11),
- nPrec,
- xRow->getInt(9),
- nType,
- sal_False,sal_False,sal_False,sal_True);
- xRet = pRet;
- break;
- }
- }
- }
-
- return xRet;
-}
-
-// -------------------------------------------------------------------------
-void OColumns::impl_refresh() throw(RuntimeException)
-{
- m_pTable->refreshColumns();
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MColumns.hxx b/connectivity/source/drivers/mozab/MColumns.hxx
deleted file mode 100644
index ffa11ed4af..0000000000
--- a/connectivity/source/drivers/mozab/MColumns.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-#define _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include "connectivity/sdbcx/IRefreshable.hxx"
-#include "MTable.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- class OColumns : public sdbcx::OCollection
- {
- protected:
- OTable* m_pTable;
-
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- public:
- OColumns( OTable* _pTable,
- ::osl::Mutex& _rMutex,
- const TStringVector &_rVector
- ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector)
- ,m_pTable(_pTable)
- {}
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_COLUMNS_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConfigAccess.cxx b/connectivity/source/drivers/mozab/MConfigAccess.cxx
deleted file mode 100644
index 4609b10985..0000000000
--- a/connectivity/source/drivers/mozab/MConfigAccess.cxx
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MConfigAccess.hxx"
-#include "MExtConfigAccess.hxx"
-#include "MConnection.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-
-//.........................................................................
-namespace connectivity
-{
- namespace mozab
- {
- //-----------------------------------------------------------------
- Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB )
- {
- Reference< XPropertySet > xNode;
- try
- {
- //=============================================================
- // create the config provider
- Reference< XMultiServiceFactory > xConfigProvider(
- _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider" )) ),
- UNO_QUERY
- );
- OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" );
-
- if ( xConfigProvider.is() )
- {
- ::rtl::OUString sCompleteNodePath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/" ));
- sCompleteNodePath += OConnection::getDriverImplementationName();
-
- //=========================================================
- // arguments for creating the config access
- Sequence< Any > aArguments(2);
- // the path to the node to open
- aArguments[0] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath")),
- 0,
- makeAny( sCompleteNodePath ),
- PropertyState_DIRECT_VALUE
- );
- // the depth: -1 means unlimited
- aArguments[1] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("depth")),
- 0,
- makeAny( (sal_Int32)-1 ),
- PropertyState_DIRECT_VALUE
- );
-
- //=========================================================
- // create the access
- Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess" )),
- aArguments
- );
- OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" );
-
- xNode = xNode.query( xAccess );
- }
- }
- catch( const Exception& )
- {
- OSL_FAIL( "createDriverConfigNode: caught an exception while accessing the driver's config node!" );
- }
-
- // outta here
- return xNode;
- }
-
- //-----------------------------------------------------------------
- namespace
- {
- // a private helper to accessing the point where we store the reference
- // to the factory
- Reference< XMultiServiceFactory >& accessFactoryStorage( )
- {
- static Reference< XMultiServiceFactory > xMozabServiceFactory;
- return xMozabServiceFactory;
- }
- }
-
- //-----------------------------------------------------------------
- void setMozabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory )
- {
- accessFactoryStorage( ) = _rxFactory;
- }
-
- //-----------------------------------------------------------------
- const Reference< XMultiServiceFactory >& getMozabServiceFactory( )
- {
- return accessFactoryStorage( );
- }
-
- //-----------------------------------------------------------------
- ::rtl::OUString getDescription(const sal_Char* sNode,const ::rtl::OUString & sDefault)
- {
- ::rtl::OUString sPreferredName;
- ::rtl::OUString sDescription;
-
- Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
- OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
- if ( xFactory.is() )
- {
- try
- {
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
- Reference< XPropertySet > xMozPrefsNode;
- if ( xDriverNode.is() )
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
- OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii(sNode) ) >>= sDescription;
- if (sDescription.getLength() == 0)
- sDescription = sDefault;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "getDescription: caught an exception!" );
- }
- }
- if (sDescription.getLength() == 0)
- sDescription = sDefault;
- return sDescription;
- }
- //-----------------------------------------------------------------
- ::rtl::OUString getPreferredProfileName( )
- {
- ::rtl::OUString sPreferredName;
-
- Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
- OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
- if ( xFactory.is() )
- {
- try
- {
- Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
- Reference< XPropertySet > xMozPrefsNode;
- if ( xDriverNode.is() )
- xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
- OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
- if ( xMozPrefsNode.is() )
- xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
- }
- catch( const Exception& )
- {
- OSL_FAIL( "getPreferredProfileName: caught an exception!" );
- }
- }
- return sPreferredName;
- }
- }
-}
-
-//.........................................................................
-
-//-------------------------------------------------------------------------
-extern "C" const sal_Unicode* SAL_CALL getUserProfile( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString sUserProfile;
- if ( !bReadConfig )
- {
- sUserProfile = ::connectivity::mozab::getPreferredProfileName( );
- bReadConfig = sal_True;
- }
-
- return sUserProfile.getStr();
-}
-//------------------------------------------------------------------------
-extern "C" const sal_Char* SAL_CALL getPabDescription( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString usPabDescription;
- static ::rtl::OString sPabDescription;
-
- if ( !bReadConfig )
- {
- usPabDescription = ::connectivity::mozab::getDescription(
- "PabDescription" ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Personal Address Book" )));
- sPabDescription = ::rtl::OUStringToOString( usPabDescription,
- RTL_TEXTENCODING_UTF8);
- bReadConfig = sal_True;
- }
-
- return sPabDescription.getStr();
-}
-
-//-------------------------------------------------------------------------
-extern "C" const sal_Char* SAL_CALL getHisDescription( void )
-{
- static sal_Bool bReadConfig = sal_False;
- static ::rtl::OUString usHisDescription;
- static ::rtl::OString sHisDescription;
-
- if ( !bReadConfig )
- {
- usHisDescription = ::connectivity::mozab::getDescription(
- "HisDescription" ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Collected Addresses" )));
- sHisDescription = ::rtl::OUStringToOString( usHisDescription,
- RTL_TEXTENCODING_UTF8);
- bReadConfig = sal_True;
- }
-
- return sHisDescription.getStr();
-}
-
-//-------------------------------------------------------------------------
-// MConfigAccess was invented to allow non-UNO parts access to the configuration.
-// Unfortunately, configuration access requires a XMultiServiceFactory - which the
-// mozilla side does not have.
-// So we create a "library-local" service factory here: Every need for a service
-// factory can be fullfilled by this factory (similar to the get/setProcessServiceFactory
-// in comphelper).
-// This is halfway valid, as usually, the mozabdrv library is invoked from the mozab library
-// only. The latter contains the driver class (and only this class and nothing more), and
-// the driver class is a singleton. The driver itself is created with a service factory,
-// which (by definition) can and should be used for all subsequent service requests.
-// And this is exactly what we're allowing with the following functions ....
-
-/** _pFactory must point to an XMultiServiceFactory, which must be aquired once
- for purpose of safely transfering it. The callee will release this interface
- when it has stored the pointer somewhere else.
-*/
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL setMozabServiceFactory(
- void* _pFactory )
-{
- Reference< XMultiServiceFactory > xFactory = static_cast< XMultiServiceFactory* >( _pFactory );
- ::connectivity::mozab::setMozabServiceFactory( xFactory );
-
- // by definition, the object behind the interface pointer has been acquired once for purpose
- // of safely transporting it
- xFactory->release();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConfigAccess.hxx b/connectivity/source/drivers/mozab/MConfigAccess.hxx
deleted file mode 100644
index 7b66797a1f..0000000000
--- a/connectivity/source/drivers/mozab/MConfigAccess.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
-
-#include <sal/types.h>
-
-extern "C" const sal_Unicode* SAL_CALL getUserProfile( void );
-
-extern "C" const sal_Char* SAL_CALL getPabDescription( void );
-
-extern "C" const sal_Char* SAL_CALL getHisDescription( void );
-
-#endif // CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
deleted file mode 100644
index f7bb24e053..0000000000
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ /dev/null
@@ -1,607 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "diagnose_ex.h"
-#include "MConnection.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "MDriver.hxx"
-#include "MColumnAlias.hxx"
-#include "MStatement.hxx"
-#include "MPreparedStatement.hxx"
-
-#include <connectivity/dbcharset.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/sqlerror.hxx>
-
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-
-#include <comphelper/officeresourcebundle.hxx>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozabConnection_CreateInstance(
- void* _pDriver)
-{
- return (new connectivity::mozab::OConnection( reinterpret_cast<connectivity::mozab::MozabDriver*>(_pDriver) ));
-}
-
-using namespace dbtools;
-
-//------------------------------------------------------------------------------
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-// --------------------------------------------------------------------------------
-
-namespace connectivity { namespace mozab {
-
-// =====================================================================
-// = ConnectionImplData
-// =====================================================================
-struct ConnectionImplData
-{
- ::boost::shared_ptr< ::comphelper::OfficeResourceBundle > pResourceBundle;
-};
-
-// -----------------------------------------------------------------------------
-#ifdef __MINGW32__
-extern "C"
-#endif
-const sal_Char* getSdbcScheme( SdbcScheme _eScheme )
-{
- switch ( _eScheme )
- {
- case SDBC_MOZILLA: return "mozilla";
- case SDBC_THUNDERBIRD: return "thunderbird";
- case SDBC_LDAP: return "ldap";
- case SDBC_OUTLOOK_MAPI: return "outlook";
- case SDBC_OUTLOOK_EXPRESS: return "outlookexp";
- }
- return NULL;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OConnection::getDriverImplementationName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME));
-}
-
-// -----------------------------------------------------------------------------
-const sal_Char* getSchemeURI( MozillaScheme _eScheme )
-{
- switch ( _eScheme )
- {
- case SCHEME_MOZILLA : return "moz-abdirectory://";
- case SCHEME_MOZILLA_MDB : return "moz-abmdbdirectory://";
- case SCHEME_LDAP : return "moz-abldapdirectory://";
- case SCHEME_OUTLOOK_MAPI : return "moz-aboutlookdirectory://op/";
- case SCHEME_OUTLOOK_EXPRESS : return "moz-aboutlookdirectory://oe/";
- }
- return NULL;
-}
-
-// -----------------------------------------------------------------------------
-
-OConnection::OConnection(MozabDriver* _pDriver)
- :OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- ,m_pDriver(_pDriver)
- ,m_pImplData( new ConnectionImplData )
- ,m_aColumnAlias( _pDriver->getMSFactory() )
- ,m_nMaxResultRecords( -1 )
- ,m_aNameMapper(NULL)
- ,m_eSDBCAddressType(SDBCAddress::Unknown)
- ,m_bForceLoadTable(false)
-{
- m_pDriver->acquire();
-
-}
-//-----------------------------------------------------------------------------
-OConnection::~OConnection()
-{
- acquire();
- if(!isClosed())
- close();
- m_pDriver->release();
- m_pDriver = NULL;
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OConnection::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
-{
- OSL_TRACE("IN OConnection::construct()\n" );
- // open file
- setURL(url);
- //
- // Skip 'sdbc:mozab: part of URL
- //
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- OSL_ENSURE( url.copy( 0, nLen ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:address" ) ), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" );
-
- ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
- // Get Scheme
- nLen = aAddrbookURI.indexOf(':');
- ::rtl::OUString aAddrbookScheme;
- ::rtl::OUString sAdditionalInfo;
- if ( nLen == -1 )
- {
- // There isn't any subschema: - but could be just subschema
- if ( aAddrbookURI.getLength() > 0 )
- {
- aAddrbookScheme= aAddrbookURI;
- }
- else
- {
- OSL_TRACE( "No subschema given!!!\n");
- throwSQLException( STR_URI_SYNTAX_ERROR, *this );
- }
- }
- else
- {
- aAddrbookScheme = aAddrbookURI.copy(0, nLen);
- sAdditionalInfo = aAddrbookURI.copy( nLen + 1 );
- }
-
- OSL_TRACE("URI = %s\n", ((OUtoCStr(aAddrbookURI)) ? (OUtoCStr(aAddrbookURI)):("NULL")) );
- OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ? (OUtoCStr(aAddrbookScheme)):("NULL")) );
-
- //
- // Now we have a URI convert it to a MozillaURI
- //
- // The Mapping being used is:
- //
- // * for Mozilla
- // "sdbc:address:mozilla:" -> abdirectory://
- // * for LDAP
- // "sdbc:address:ldap:" -> abldapdirectory://
- // * for Outlook (using MAPI API)
- // "sdbc:address:outlook:" -> aboutlookdirectory://op/
- // * for windows system address book
- // "sdbc:address:outlookexp:" -> aboutlookdirectory://oe/
- //
- m_sBindDN = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- m_sPassword = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- m_bUseSSL = sal_False;
-
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_MOZILLA ) ) == 0 ) {
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
- m_eSDBCAddressType = SDBCAddress::Mozilla;
- if(sAdditionalInfo.getLength())
- m_sMozillaProfile = sAdditionalInfo;
- }
- else
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_THUNDERBIRD ) ) == 0 ) {
- //Yes. I am sure it is SCHEME_MOZILLA
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
- m_eSDBCAddressType = SDBCAddress::ThunderBird;
- if(sAdditionalInfo.getLength())
- m_sMozillaProfile = sAdditionalInfo;
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_LDAP ) ) == 0 ) {
- rtl::OUString sBaseDN;
- sal_Int32 nPortNumber = -1;
-
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_LDAP ) );
- m_eSDBCAddressType = SDBCAddress::LDAP;
-
- if ( !m_sHostName.getLength() )
- {
- // see whether the URI contains a hostname/port
- if ( sAdditionalInfo.getLength() )
- {
- sal_Int32 nPortSeparator = sAdditionalInfo.indexOf( ':' );
- if ( nPortSeparator == -1 )
- m_sHostName = sAdditionalInfo;
- else
- {
- m_sHostName = sAdditionalInfo.copy( 0, nPortSeparator );
- nPortNumber = sAdditionalInfo.copy( nPortSeparator + 1 ).toInt32();
- OSL_ENSURE( nPortNumber != 0, "OConnection::construct: invalid LDAP port number in the URL!" );
- if ( nPortNumber == 0 )
- nPortNumber = -1;
- }
- }
- }
-
- const PropertyValue* pInfo = info.getConstArray();
- const PropertyValue* pInfoEnd = pInfo + info.getLength();
-
- for (; pInfo != pInfoEnd; ++pInfo)
- {
- OSL_TRACE( "info[%d].Name = %s\n", pInfo - info.getConstArray(), OUtoCStr( pInfo->Name ) );
-
- if ( 0 == pInfo->Name.compareToAscii("HostName") )
- {
- pInfo->Value >>= m_sHostName;
- }
- else if ( 0 == pInfo->Name.compareToAscii("BaseDN") )
- {
- pInfo->Value >>= sBaseDN;
- }
- else if ( 0 == pInfo->Name.compareToAscii("user") )
- {
- pInfo->Value >>= m_sBindDN;
- }
- else if ( 0 == pInfo->Name.compareToAscii("password") )
- {
- pInfo->Value >>= m_sPassword;
- }
- else if ( 0 == pInfo->Name.compareToAscii("UseSSL") )
- {
- pInfo->Value >>= m_bUseSSL;
- }
- else if ( 0 == pInfo->Name.compareToAscii("PortNumber") )
- {
- OSL_VERIFY( pInfo->Value >>= nPortNumber );
- }
- else if ( 0 == pInfo->Name.compareToAscii("MaxRowCount") )
- {
- pInfo->Value >>= m_nMaxResultRecords;
- }
- }
-
- if ( m_sHostName.getLength() != 0 ) {
- m_sMozillaURI += m_sHostName;
- }
- else
- throwSQLException( STR_NO_HOSTNAME, *this );
-
- if ( nPortNumber > 0 ) {
- m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(":") );
- m_sMozillaURI += rtl::OUString::valueOf( nPortNumber );
- }
-
- if ( sBaseDN.getLength() != 0 ) {
- m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") );
- m_sMozillaURI += sBaseDN;
- }
- else
- throwSQLException( STR_NO_BASEDN, *this );
-
- // Addition of a fake query to enable the Mozilla LDAP directory to work correctly.
- m_sMozillaURI += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?(or(DisplayName,=,DontDoThisAtHome)))"));
-
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_MAPI ) ) == 0 ) {
- m_sMozillaURI = ::rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_MAPI ) );
- m_eSDBCAddressType = SDBCAddress::Outlook;
- }
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_EXPRESS ) ) == 0 ) {
- m_sMozillaURI = rtl::OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_EXPRESS ) );
- m_eSDBCAddressType = SDBCAddress::OutlookExp;
- }
- else
- {
- OSL_TRACE("Invalid subschema given!!!\n");
- throwSQLException( STR_URI_SYNTAX_ERROR, *this );
- }
-
- OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")), usesFactory() ? "uses factory" : "no factory");
- OSL_TRACE( "\tOUT OConnection::construct()\n" );
-
- MDatabaseMetaDataHelper _aDbHelper;
-
- // The creation of the nsIAbDirectory i/f for LDAP doesn't actually test
- // the validity of the connection, it's normally delayed until the query
- // is executed, but it's a bit late then to fail...
- if ( isLDAP() )
- {
- if ( !_aDbHelper.testLDAPConnection( this ) )
- {
- OSL_TRACE("testLDAPConnection : FAILED\n" );
- throwSQLException( _aDbHelper.getError(), *this );
- }
- else
- {
- OSL_TRACE("testLDAPConnection : SUCCESS\n" );
- }
- }
-
- // Test connection by getting to get the Table Names
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !_aDbHelper.getTableStrings( this, tables, types ) )
- {
- throwSQLException( _aDbHelper.getError(), *this );
- }
-
-}
-// XServiceInfo
-// --------------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mozab.OConnection", "com.sun.star.sdbc.Connection")
-
-// --------------------------------------------------------------------------------
-Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- // create a statement
- // the statement can only be executed once
- Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- OSL_TRACE("OConnection::prepareStatement( %s )", OUtoCStr( _sSql ) );
- // the pre
- // create a statement
- // the statement can only be executed more than once
- OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql);
- Reference< XPreparedStatement > xReturn = pPrepared;
- pPrepared->lateInit();
-
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
- return xReturn;
-}
-// --------------------------------------------------------------------------------
-Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- OSL_UNUSED( _sSql );
- ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
- OSL_TRACE("OConnection::prepareCall( %s )", OUtoCStr( _sSql ) );
- return NULL;
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- // when you need to transform SQL92 to you driver specific you can do it here
- OSL_TRACE("OConnection::nativeSQL( %s )", OUtoCStr( _sSql ) );
-
- return _sSql;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setAutoCommit( sal_Bool /*autoCommit*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setAutoCommit", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
-{
- // you have to distinguish which if you are in autocommit mode or not
- // at normal case true should be fine here
-
- return sal_True;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
-{
- // when you database does support transactions you should commit here
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
-{
- // same as commit but for the other case
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent)
- return OConnection_BASE::rBHelper.bDisposed;
-}
-// --------------------------------------------------------------------------------
-Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- // here we have to create the class with biggest interface
- // The answer is 42 :-)
- Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
- if(!xMetaData.is())
- {
- xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it
- m_xMetaData = xMetaData;
- }
-
- return xMetaData;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setReadOnly( sal_Bool /*readOnly*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setReadOnly", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- // return if your connection to readonly
- return sal_False;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& /*catalog*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
-}
-// --------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
-{
- // return your current catalog
- return ::rtl::OUString();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTransactionIsolation", *this );
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- // please have a look at @see com.sun.star.sdbc.TransactionIsolation
- return TransactionIsolation::NONE;
-}
-// --------------------------------------------------------------------------------
-Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
-{
- // if your driver has special database types you can return it here
- return NULL;
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
-}
-// --------------------------------------------------------------------------------
-// XCloseable
-void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
-{
- // we just dispose us
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OConnection_BASE::rBHelper.bDisposed);
-
- }
- dispose();
-}
-// --------------------------------------------------------------------------------
-// XWarningsSupplier
-Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
-{
- // when you collected some warnings -> return it
- return Any();
-}
-// --------------------------------------------------------------------------------
-void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- // you should clear your collected warnings here
-}
-//------------------------------------------------------------------------------
-void OConnection::disposing()
-{
- // we noticed that we should be destroied in near future so we have to dispose our statements
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_pImplData->pResourceBundle.reset();
-
- OConnection_BASE::disposing();
- if ( m_aNameMapper ) {
- MQuery::FreeNameMapper( m_aNameMapper );
- m_aNameMapper = NULL;
- }
-
- dispose_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-
-Reference< XTablesSupplier > SAL_CALL OConnection::createCatalog()
-{
- OSL_TRACE("IN OConnection::createCatalog()\n" );
- ::osl::MutexGuard aGuard( m_aMutex );
- Reference< XTablesSupplier > xTab = m_xCatalog;
- if(!m_xCatalog.is())
- {
- OCatalog *pCat = new OCatalog(this);
- xTab = pCat;
- m_xCatalog = xTab;
- }
- OSL_TRACE( "\tOUT OConnection::createCatalog()\n" );
- return xTab;
-}
-// -----------------------------------------------------------------------------
-
-MNameMapper* OConnection::getNameMapper ()
-{
- if (m_aNameMapper==NULL)
- m_aNameMapper = MQuery::CreateNameMapper();
-
- return m_aNameMapper;
-}
-
-// -----------------------------------------------------------------------------
-void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext )
-{
- if ( _rError.getResId() != 0 )
- {
- OSL_ENSURE( ( _rError.getErrorCondition() == 0 ),
- "OConnection::throwSQLException: unsupported error code combination!" );
-
- ::rtl::OUString sParameter( _rError.getParameter() );
- if ( sParameter.getLength() )
- {
- const ::rtl::OUString sError( getResources().getResourceStringWithSubstitution(
- _rError.getResId(),
- "$1$", sParameter
- ) );
- ::dbtools::throwGenericSQLException( sError, _rxContext );
- OSL_FAIL( "OConnection::throwSQLException: unreachable (1)!" );
- }
-
- throwGenericSQLException( _rError.getResId(), _rxContext );
- OSL_FAIL( "OConnection::throwSQLException: unreachable (2)!" );
- }
-
- if ( _rError.getErrorCondition() != 0 )
- {
- SQLError aErrorHelper( getDriver()->getMSFactory() );
- ::rtl::OUString sParameter( _rError.getParameter() );
- if ( sParameter.getLength() )
- aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
- else
- aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext);
- OSL_FAIL( "OConnection::throwSQLException: unreachable (3)!" );
- }
-
- throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext );
-}
-
-// -----------------------------------------------------------------------------
-void OConnection::throwSQLException( const sal_uInt16 _nErrorResourceId, const Reference< XInterface >& _rxContext )
-{
- ErrorDescriptor aError;
- aError.setResId( _nErrorResourceId );
- throwSQLException( aError, _rxContext );
-}
-
-} } // namespace connectivity::mozab
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
deleted file mode 100644
index 4ec99a1294..0000000000
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SCONNECTION_HXX
-#define CONNECTIVITY_SCONNECTION_HXX
-
-#include "connectivity/CommonTools.hxx"
-
-#include "MCatalog.hxx"
-#include "MColumnAlias.hxx"
-#include "OSubComponent.hxx"
-#include "TConnection.hxx"
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-
-#include <cppuhelper/weakref.hxx>
-
-#include <memory>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class MozabDriver;
- class ODatabaseMetaData;
- class MNameMapper;
- class ErrorDescriptor;
-
- namespace SDBCAddress {
- typedef enum {
- Unknown = 0,
- Mozilla = 1,
- ThunderBird = 2,
- LDAP = 3,
- Outlook = 4,
- OutlookExp = 5
- } sdbc_address_type;
- }
-
- // For the moment, we will connect the Mozilla address book to the Mozilla
- // top-level address book which will display whatever is in the preferences
- // file of Mozilla.
- enum MozillaScheme
- {
- // This one is a base uri which will be completed with the connection data.
- SCHEME_MOZILLA,
- // This one is for mozilla native address book
- SCHEME_MOZILLA_MDB,
- // This one is for LDAP address book
- SCHEME_LDAP,
- // These two uris will be used to obtain directory factories to access all
- // address books of the given type.
- SCHEME_OUTLOOK_MAPI,
- SCHEME_OUTLOOK_EXPRESS
- };
- const sal_Char* getSchemeURI( MozillaScheme _eScheme );
-
- enum SdbcScheme
- {
- SDBC_MOZILLA,
- SDBC_THUNDERBIRD,
- SDBC_LDAP,
- SDBC_OUTLOOK_MAPI,
- SDBC_OUTLOOK_EXPRESS
- };
-#ifdef __MINGW32__
- extern "C"
-#endif
- const sal_Char* getSdbcScheme( SdbcScheme _eScheme );
-
- typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
-
- struct ConnectionImplData;
- class OConnection : public OConnection_BASE,
- public connectivity::OSubComponent<OConnection, OConnection_BASE>
- {
- friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
-
- protected:
- //====================================================================
- // Data attributes
- //====================================================================
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
- // an operation
- MozabDriver* m_pDriver; // Pointer to the owning
- // driver object
- ::std::auto_ptr< ConnectionImplData > m_pImplData;
- // This is to be able to hold a boost::shared_ptr. If we would hold it as member, it would
- // not compile the mozillasrc directory, since this directory is compiled without RTTI support
- // and boost seems to require RTTI on some platforms.
- // Store Catalog
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
- // Start of Additions from the land of mozilla
- OColumnAlias m_aColumnAlias;
- rtl::OUString m_sMozillaURI;
- rtl::OUString m_sMozillaProfile;
- sal_Int32 m_nMaxResultRecords;
- MNameMapper* m_aNameMapper;
- //LDAP only
- rtl::OUString m_sHostName;
- sal_Bool m_bUseSSL;
- rtl::OUString m_sBindDN;
- rtl::OUString m_sUser; // the user name
- rtl::OUString m_sPassword;
-
- SDBCAddress::sdbc_address_type m_eSDBCAddressType;
-
- sal_Bool m_bForceLoadTable;
-
- public:
- virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
- OConnection(MozabDriver* _pDriver);
- virtual ~OConnection();
-
- void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
-
- // XServiceInfo
- DECLARE_SERVICE_INFO();
- // XConnection
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- //
- MozabDriver* getDriver() const { return m_pDriver;}
-
- // Added to enable me to use SQLInterpreter which requires an
- // XNameAccess i/f to access tables.
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
-
-
- // Additions from the land of mozilla
- rtl::OUString getMozURI() const { return m_sMozillaURI; }
- rtl::OUString getMozProfile() const { return m_sMozillaProfile; }
- void setMozProfile(rtl::OUString &aNewProfile) { m_sMozillaProfile = aNewProfile; }
-
- ::com::sun::star::mozilla::MozillaProductType getProduct()
- {
- if (m_eSDBCAddressType == SDBCAddress::ThunderBird)
- return ::com::sun::star::mozilla::MozillaProductType_Thunderbird;
- return ::com::sun::star::mozilla::MozillaProductType_Mozilla;
- }
-
- // Get Ldap BindDN (user name)
- rtl::OUString getBindDN() const { return m_sBindDN; }
- // Get Ldap Password
- rtl::OUString getPassword() const { return m_sPassword; }
- // Get Ldap Host name
- rtl::OUString getHost() const { return m_sHostName; }
- // Get whether use ssl to connect to ldap
- sal_Bool getUseSSL() const {return m_bUseSSL;}
-
- sal_Bool usesFactory(void) const { return (m_eSDBCAddressType == SDBCAddress::Outlook) || (m_eSDBCAddressType == SDBCAddress::OutlookExp); }
- sal_Bool isLDAP(void) const { return m_eSDBCAddressType == SDBCAddress::LDAP; }
- sal_Bool isThunderbird(void) const { return m_eSDBCAddressType == SDBCAddress::ThunderBird; }
-
- sal_Bool isOutlookExpress() const { return m_eSDBCAddressType == SDBCAddress::OutlookExp;}
- sal_Int32 getMaxResultRecords() const { return m_nMaxResultRecords; }
-
- SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;}
-
- const OColumnAlias & getColumnAlias() const { return (m_aColumnAlias); }
-
- static ::rtl::OUString getDriverImplementationName();
-
- MNameMapper* getNameMapper();
- void setForceLoadTables(sal_Bool aForce){ m_bForceLoadTable = aForce;}
- sal_Bool getForceLoadTables() { return m_bForceLoadTable;}
-
- void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
- void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
-
- private:
- // make this private - clients should use throwSQLException instead
- using OConnection_BASE::throwGenericSQLException;
- };
- }
-}
-#endif // CONNECTIVITY_SCONNECTION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
deleted file mode 100644
index 161d0bced0..0000000000
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ /dev/null
@@ -1,1033 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/FValue.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/ColumnSearch.hpp>
-#include "resource/common_res.hrc"
-#include <vector>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace connectivity::mozab;
-using namespace connectivity;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-
-
-namespace connectivity
-{
- namespace mozab
- {
- static sal_Int32 const s_nCOLUMN_SIZE = 256;
- static sal_Int32 const s_nDECIMAL_DIGITS = 0;
- static sal_Int32 const s_nNULLABLE = 1;
- static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
- }
-}
-
-
-ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
- : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
- ,m_pConnection(_pCon)
-{
- OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
- m_pDbMetaDataHelper = new MDatabaseMetaDataHelper();
-}
-// -------------------------------------------------------------------------
-ODatabaseMetaData::~ODatabaseMetaData()
-{
- delete m_pDbMetaDataHelper;
-}
-
-// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
- const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException)
-{
- static ODatabaseMetaDataResultSet::ORows aRows;
- ODatabaseMetaDataResultSet::ORow aRow(19);
- aRows.clear();
-
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types) ) {
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
- }
-
- // ****************************************************
- // Some entries in a row never change, so set them now
- // ****************************************************
-
- // Catalog
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
- // Schema
- aRow[2] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")));
- // DATA_TYPE
- aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR));
- // TYPE_NAME, not used
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR")));
- // COLUMN_SIZE
- aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
- // BUFFER_LENGTH, not used
- aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
- // DECIMAL_DIGITS.
- aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
- // NUM_PREC_RADIX
- aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
- // NULLABLE
- aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
- // REMARKS
- aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
- // COULUMN_DEF, not used
- aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATA_TYPE, not used
- aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
- // SQL_DATETIME_SUB, not used
- aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
- // CHAR_OCTET_LENGTH, refer to [5]
- aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
- // IS_NULLABLE
- aRow[18] = new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("YES")));
-
- const OColumnAlias& colNames = m_pConnection->getColumnAlias();
-
- // Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0')) {
- // TABLE_NAME
- aRow[3] = new ORowSetValueDecorator( tables[j] );
-
- OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
-
- // Iterate over all collumns in the table.
- for ( OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
- compare != colNames.end();
- ++compare
- )
- {
- if ( match( columnNamePattern, compare->first, '\0' ) )
- {
- OSL_TRACE( "\t\t\tColumnName = %s;\n", OUtoCStr( compare->first ) );
- // COLUMN_NAME
- aRow[4] = new ORowSetValueDecorator( compare->first );
- // ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
- aRows.push_back(aRow);
- }
- }
- }
- }
- return( aRows );
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( )
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 65535; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 254; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 20; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( )
-{
- // We only support a single table
- return 1;
-}
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( )
-{
- // normally this is "
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\""));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aVal;
- return aVal;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( )
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
-{
- //We support create table
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_True; // should be supported at least
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( )
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
-{
- return 0;// 0 means no limit
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
-{
- // We allow you to select from any table.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
-{
- //we support insert/update/delete now
- //But we have to set this to return sal_True otherwise the UI will add create "table/edit table"
- //entry to the popup menu. We should avoid them.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
-{
- // Support added for this.
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( )
-{
- // Any case may be used
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- return m_pConnection->getURL();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
-{
- return 1;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
-{
- return TransactionIsolation::NONE;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString aValue;
- return aValue;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
-{
- sal_Int32 nValue = 0; // 0 means no limit
- return nValue;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException)
-{
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-// here follow all methods which return a resultset
-// the first methods is an example implementation how to use this resultset
-// of course you could implement it on your and you should do this because
-// the general way is more memory expensive
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
-{
- // there exists no possibility to get table types so we have to check
- static ::rtl::OUString sTableTypes[] =
- {
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW"))
- // Currently we only support a 'TABLE' and 'VIEW' nothing more complex
- //
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
- // ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
- };
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
-
- // here we fill the rows which should be visible when ask for data from the resultset returned here
- const sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
- ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
- // bound row
- aRows.push_back(aRow);
- }
- // here we set the rows at the resultset
- pResult->setRows(aRows);
- return xRef;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( )
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
- Reference< XResultSet > xResultSet = pResultSet;
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- if(aRows.empty())
- {
- ODatabaseMetaDataResultSet::ORow aRow;
- aRow.reserve(19);
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))));
- aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
- aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
- aRows.push_back(aRow);
-
- }
- pResultSet->setRows(aRows);
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns);
- Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern ));
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/,
- const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
-{
- // this returns an empty resultset where the column-names are already set
- // in special the metadata of the resultset already returns the right columns
- ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
- Reference< XResultSet > xResultSet = pResultSet;
-
- // ODatabaseMetaDataResultSet::ORows aRows;
- // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern );
- // pResultSet->setRows( aRows );
- ODatabaseMetaDataResultSet::ORows _rRows;
- if ( !m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern, types,_rRows ) ) {
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
- }
- pResultSet->setRows( _rRows );
-
- return xResultSet;
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
-{
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges);
- Reference< XResultSet > xRef = NULL;
-
- xRef = pResult;
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > types;
- if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types ) )
- getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
-
- ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
- aRows.reserve(8);
- aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue();
- aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName());
- aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NO")));
-
-
- // Iterate over all tables
- for(size_t j = 0; j < tables.size(); j++ ) {
- if(match(tableNamePattern, tables[j],'\0'))
- {
- // TABLE_NAME
- aRow[2] = new ORowSetValueDecorator( tables[j] );
-
- OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
-
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue();
- aRows.push_back(aRow);
- aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue();
- aRows.push_back(aRow);
- }
- }
- pResult->setRows(aRows);
- return xRef;
-
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
deleted file mode 100644
index 89f908367d..0000000000
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX
-#define CONNECTIVITY_SDATABASEMETADATA_HXX
-#include "MConnection.hxx"
-#include "mozillasrc/MDatabaseMetaDataHelper.hxx"
-#include "TDatabaseMetaDataBase.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- //**************************************************************
- //************ Class: ODatabaseMetaData
- //**************************************************************
-
- class ODatabaseMetaData : public ODatabaseMetaDataBase
- {
- OConnection* m_pConnection;
- MDatabaseMetaDataHelper* m_pDbMetaDataHelper;
-
- ODatabaseMetaDataResultSet::ORows& SAL_CALL getColumnRows( const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw( ::com::sun::star::sdbc::SQLException );
-
- protected:
- virtual ~ODatabaseMetaData();
- public:
-
- inline OConnection* getOwnConnection() const { return m_pConnection; }
-
- ODatabaseMetaData(OConnection* _pCon);
-
- private:
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
- // cached database information
- virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( );
- virtual sal_Bool impl_isCatalogAtStart_throw( );
- virtual ::rtl::OUString impl_getCatalogSeparator_throw( );
- virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( );
- virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ;
- virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( );
- virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ;
- virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) ;
- virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( );
- virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( );
- virtual sal_Int32 impl_getMaxStatements_throw( );
- virtual sal_Int32 impl_getMaxTablesInSelect_throw( );
- virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( );
-
- // as I mentioned before this interface is really BIG
- // XDatabaseMetaData
- virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // CONNECTIVITY_SDATABASEMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
deleted file mode 100644
index 37d0a74dda..0000000000
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ /dev/null
@@ -1,333 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <sal/macros.h>
-#include "MDriver.hxx"
-#include "MConnection.hxx"
-#include "connectivity/dbexception.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#include <tools/solar.h>
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace connectivity::mozab;
-
-namespace connectivity
-{
- namespace mozab
- {
- //------------------------------------------------------------------
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
- {
- return *(new MozabDriver( _rxFactory ));
- }
- }
-}
-// --------------------------------------------------------------------------------
-MozabDriver::MozabDriver(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : ODriver_BASE(m_aMutex), m_xMSFactory( _rxFactory )
- ,m_hModule(NULL)
- ,m_pCreationFunc(NULL)
-{
-}
-// -----------------------------------------------------------------------------
-MozabDriver::~MozabDriver()
-{
-}
-// --------------------------------------------------------------------------------
-void MozabDriver::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- // when driver will be destroied so all our connections have to be destroied as well
- for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
- {
- Reference< XComponent > xComp(i->get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- }
- m_xConnections.clear();
- connectivity::OWeakRefArray().swap(m_xConnections); // this really clears
-
- ODriver_BASE::disposing();
- if(m_hModule)
- {
- m_pCreationFunc = NULL;
- osl_unloadModule(m_hModule);
- m_hModule = NULL;
- }
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString MozabDriver::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME));
- // this name is referenced in the configuration and in the mozab.xml
- // Please take care when changing it.
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > MozabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.sdbc.Driver
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL MozabDriver::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL MozabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL MozabDriver::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-// --------------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return NULL;
-
- if ( ! acceptsURL( url ) )
- return NULL;
- // create a new connection with the given properties and append it to our vector
- Reference< XConnection > xCon;
- if (m_pCreationFunc)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
- //We must make sure we create an com.sun.star.mozilla.MozillaBootstrap brfore call any mozilla codes
- Reference<XInterface> xInstance = m_xMSFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
-
- OConnection* pCon = reinterpret_cast<OConnection*>((*m_pCreationFunc)(this));
- xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
- pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
-
- }
- else
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
- STR_COULD_NOT_LOAD_LIB,
- "$libname$", ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "mozabdrv" )) )
- ) );
-
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
- return xCon;
-}
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL MozabDriver::acceptsURL( const ::rtl::OUString& url )
- throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return sal_False;
-
- // here we have to look if we support this url format
- return impl_classifyURL(url) != Unknown;
-}
-// --------------------------------------------------------------------------------
-Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
-{
- if ( !ensureInit() )
- return Sequence< DriverPropertyInfo >();
-
- if ( acceptsURL(url) )
- {
- if ( impl_classifyURL(url) != LDAP )
- return Sequence< DriverPropertyInfo >();
-
- ::std::vector< DriverPropertyInfo > aDriverInfo;
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Base DN."))
- ,sal_False
- ,::rtl::OUString()
- ,Sequence< ::rtl::OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount"))
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Records (max.)"))
- ,sal_False
- ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100"))
- ,Sequence< ::rtl::OUString >())
- );
- return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size());
- }
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
- ::dbtools::throwGenericSQLException(sMessage ,*this);
- // if you have somthing special to say return it here :-)
- return Sequence< DriverPropertyInfo >();
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MozabDriver::getMajorVersion( ) throw(RuntimeException)
-{
- return 1; // depends on you
-}
-// --------------------------------------------------------------------------------
-sal_Int32 SAL_CALL MozabDriver::getMinorVersion( ) throw(RuntimeException)
-{
- return 0; // depends on you
-}
-// --------------------------------------------------------------------------------
-EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url )
-{
- // Skip 'sdbc:mozab: part of URL
- //
- sal_Int32 nLen = url.indexOf(':');
- nLen = url.indexOf(':',nLen+1);
- ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
- // Get Scheme
- nLen = aAddrbookURI.indexOf(':');
- ::rtl::OUString aAddrbookScheme;
- if ( nLen == -1 )
- {
- // There isn't any subschema: - but could be just subschema
- if ( aAddrbookURI.getLength() > 0 )
- aAddrbookScheme= aAddrbookURI;
- else if(url == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:")) )
- return Unknown; // TODO check
- else
- return Unknown;
- }
- else
- aAddrbookScheme = aAddrbookURI.copy(0, nLen);
-
- struct __scheme_map
- {
- EDriverType eType;
- const sal_Char* pScheme;
- } aSchemeMap[] =
- {
-#if defined(WNT)
- { Outlook, "outlook" },
- { OutlookExpress, "outlookexp" },
-#endif
- { Mozilla, "mozilla" },
- { ThunderBird, "thunderbird" },
- { LDAP, "ldap" }
- };
-
- for ( size_t i=0; i < SAL_N_ELEMENTS( aSchemeMap ); ++i )
- {
- if ( aAddrbookScheme.compareToAscii( aSchemeMap[i].pScheme ) == 0 )
- return aSchemeMap[i].eType;
- }
-
- return Unknown;
-}
-
-// --------------------------------------------------------------------------------
-namespace
-{
- template< typename FUNCTION >
- void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule, const sal_Char* _pAsciiSymbolName, FUNCTION& _rFunction )
- {
- _rFunction = NULL;
- if ( _rModule )
- {
- const ::rtl::OUString sSymbolName = ::rtl::OUString::createFromAscii( _pAsciiSymbolName );
- _rFunction = (FUNCTION)( osl_getFunctionSymbol( _rModule, sSymbolName.pData ) );
-
- if ( !_rFunction )
- { // did not find the symbol
- OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) );
- osl_unloadModule( _rModule );
- _rModule = NULL;
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-extern "C" { static void SAL_CALL thisModule() {} }
-
-bool MozabDriver::ensureInit()
-{
- if ( m_hModule )
- return true;
-
- OSL_ENSURE(NULL == m_pCreationFunc, "MozabDriver::ensureInit: inconsistence: already have a factory function!");
-
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" )));
-
- // load the mozabdrv library
- m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0);
- OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the mozabdrv library!");
- if ( !m_hModule )
- return false;
-
- OSetMozabServiceFactory pSetFactoryFunc( NULL );
-
- lcl_getFunctionFromModuleOrUnload( m_hModule, "setMozabServiceFactory", pSetFactoryFunc );
- lcl_getFunctionFromModuleOrUnload( m_hModule, "OMozabConnection_CreateInstance", m_pCreationFunc );
-
- if ( !m_hModule )
- // one of the symbols did not exist
- return false;
-
- if ( m_xMSFactory.is() )
- {
- // for purpose of transfer safety, the interface needs to be acuired once
- // (will be release by the callee)
- m_xMSFactory->acquire();
- ( *pSetFactoryFunc )( m_xMSFactory.get() );
- }
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MDriver.hxx b/connectivity/source/drivers/mozab/MDriver.hxx
deleted file mode 100644
index 5684486b39..0000000000
--- a/connectivity/source/drivers/mozab/MDriver.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SDRIVER_HXX
-#define CONNECTIVITY_SDRIVER_HXX
-
-#include <com/sun/star/sdbc/XDriver.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase2.hxx>
-#include "connectivity/CommonTools.hxx"
-#include <osl/module.h>
-
-
-#define MOZAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.MozabDriver"
-
-namespace connectivity
-{
- namespace mozab
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
-
- typedef void* (SAL_CALL * OMozabConnection_CreateInstanceFunction)(void* _pDriver );
- typedef void (SAL_CALL * OSetMozabServiceFactory)( void* _pFactory );
- typedef const void* (SAL_CALL * OGetSdbcScheme_Function)( short );
-
-
- typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
- ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
-
- enum EDriverType
- {
- Mozilla,
- ThunderBird,
- LDAP,
- Outlook,
- OutlookExpress,
- Unknown
- };
-
- class MozabDriver : public ODriver_BASE
- {
- protected:
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
-
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- connectivity::OWeakRefArray m_xConnections; // vector containing a list
- // of all the Connection objects
- // for this Driver
- oslModule m_hModule;
- OMozabConnection_CreateInstanceFunction m_pCreationFunc;
- OGetSdbcScheme_Function m_pSchemeFunction;
-
- bool ensureInit();
- virtual ~MozabDriver();
- public:
-
- MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XDriver
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- & getMSFactory(void) const { return m_xMSFactory; }
-
- private:
- EDriverType impl_classifyURL( const ::rtl::OUString& url );
- };
- }
-
-}
-
-#endif // CONNECTIVITY_SDRIVER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx b/connectivity/source/drivers/mozab/MExtConfigAccess.hxx
deleted file mode 100644
index 94f15db36b..0000000000
--- a/connectivity/source/drivers/mozab/MExtConfigAccess.hxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-
-// This is the extended version (for use on the SO side of the driver) of MConfigAccess
-// (which is for use on the mozilla side only)
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
- createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB );
- }
-}
-
-#endif // CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
deleted file mode 100644
index 6136507a0b..0000000000
--- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx
+++ /dev/null
@@ -1,546 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include "connectivity/sdbcx/VColumn.hxx"
-#include "MPreparedStatement.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include "MResultSetMetaData.hxx"
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include "diagnose_ex.h"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::mozab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::sdbcx;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-
-
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
- :OCommonStatement(_pConnection)
- ,m_nNumParams(0)
- ,m_sSqlStatement(sql)
- ,m_bPrepared(sal_False)
- ,m_pResultSet()
-{
-}
-// -----------------------------------------------------------------------------
-OPreparedStatement::~OPreparedStatement()
-{
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::lateInit()
-{
- if ( eSelect != parseSql( m_sSqlStatement ) )
- throw SQLException();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- OCommonStatement::disposing();
-
- m_xMetaData.clear();
- if(m_aParameterRow.is())
- {
- m_aParameterRow->get().clear();
- m_aParameterRow = NULL;
- }
- m_xParamColumns = NULL;
-}
-// -----------------------------------------------------------------------------
-
-OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted )
- throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
-{
- StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
- if ( eStatementType != eSelect )
- return eStatementType;
-
- m_xParamColumns = new OSQLColumns();
-
- // describe all parameters need for the resultset
- describeParameter();
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping );
-
- return eStatementType;
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
-{
- OCommonStatement::initializeResultSet( _pResult );
- _pResult->setParameterColumns( m_xParamColumns );
- _pResult->setParameterRow( m_aParameterRow );
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::clearCachedResultSet()
-{
- OCommonStatement::clearCachedResultSet();
- m_pResultSet.clear();
- m_xMetaData.clear();
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-{
- OCommonStatement::cacheResultSet( _pResult );
- OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
- m_pResultSet = _pResult;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::acquire() throw()
-{
- OCommonStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::release() throw()
-{
- OCommonStatement::release();
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPreparedStatement_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- sal_Bool bReadOnly = sal_True;
- if ( m_pResultSet.is() )
- bReadOnly = m_pResultSet->determineReadOnly();
- // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
- // okay, /me thinks.
-
- if ( !m_xMetaData.is() )
- m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
-
- return m_xMetaData;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xResult = executeQuery();
- return xResult.is();
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
- setParameter( parameterIndex, x );
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- OSL_TRACE("In: OPreparedStatement::executeQuery" );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
- // stuff again. Just execute.
- return impl_executeCurrentQuery();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBoolean", *this );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setByte", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setDate", *this );
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const Time& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setTime", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setTimestamp", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setDouble", *this );
-}
-
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setFloat", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setInt", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setLong", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- checkAndResizeParameters(parameterIndex);
-
- (m_aParameterRow->get())[parameterIndex].setNull();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setObjectWithInfo", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
-{
- setNull(parameterIndex,sqlType);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- ::dbtools::implSetObject(this,parameterIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setShort", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBytes", *this );
-}
-// -------------------------------------------------------------------------
-
-
-void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setCharacterStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XParameters::setBinaryStream", *this );
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- break;
- default:
- OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
-{
- if( !_parameterIndex || _parameterIndex > m_nNumParams)
- ::dbtools::throwInvalidIndexException(*this);
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
-{
- ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- if ( !m_aParameterRow.is() ) {
- m_aParameterRow = new OValueVector();
- m_aParameterRow->get().push_back(sal_Int32(0));
- }
-
- if ((sal_Int32)(m_aParameterRow->get()).size() <= parameterIndex)
- (m_aParameterRow->get()).resize(parameterIndex+1);
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const
-ORowSetValue& x)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkAndResizeParameters(parameterIndex);
-
- OSL_TRACE("setParameter( %d, '%s')", parameterIndex, OUtoCStr(x) );
- (m_aParameterRow->get())[parameterIndex] = x;
-}
-
-//------------------------------------------------------------------
-sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol)
-{
- OSL_UNUSED( pParameter );
- // Nr. of the new added Parameters
- sal_uInt32 nParameter = m_xParamColumns->get().size()+1;
-
- OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter");
- OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree");
-#if OSL_DEBUG_LEVEL > 0
- OSQLParseNode * pMark = pParameter->getChild(0);
- OSL_UNUSED( pMark );
-#endif
-
- ::rtl::OUString sParameterName;
-
- // set up Parameter-Column:
- sal_Int32 eType = DataType::VARCHAR;
- sal_uInt32 nPrecision = 255;
- sal_Int32 nScale = 0;
- sal_Int32 nNullable = ColumnValue::NULLABLE;
-
- if (_xCol.is())
- {
- // Type, Precision, Scale ... utilize the selected Columns,
- // then this Column will get the value assigned or with this
- // Column will the value be compared.
- eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
- nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
- nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
- nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
- _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName;
- }
-
- Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,::rtl::OUString()
- ,nNullable
- ,nPrecision
- ,nScale
- ,eType
- ,sal_False
- ,sal_False
- ,sal_False
- ,m_pSQLIterator->isCaseSensitive());
- m_xParamColumns->get().push_back(xParaColumn);
- return nParameter;
-}
-// -----------------------------------------------------------------------------
-void OPreparedStatement::describeColumn(OSQLParseNode*
-_pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable)
-{
- Reference<XPropertySet> xProp;
- if(SQL_ISRULE(_pNode,column_ref))
- {
- ::rtl::OUString sColumnName,sTableRange;
- m_pSQLIterator->getColumnRange(_pNode,sColumnName,sTableRange);
- if(sColumnName.getLength())
- {
- Reference<XNameAccess> xNameAccess = _xTable->getColumns();
- if(xNameAccess->hasByName(sColumnName))
- xNameAccess->getByName(sColumnName) >>= xProp;
- AddParameter(_pParameter,xProp);
- }
- }
- // else
- // AddParameter(_pParameter,xProp);
-}
-// -------------------------------------------------------------------------
-void OPreparedStatement::describeParameter()
-{
- ::std::vector< OSQLParseNode*> aParseNodes;
- scanParameter(m_pParseTree,aParseNodes);
- if(aParseNodes.size())
- {
- m_xParamColumns = new OSQLColumns();
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if(xTabs.size())
- {
- OSQLTable xTable = xTabs.begin()->second;
- ::std::vector< OSQLParseNode*>::const_iterator aIter =
-aParseNodes.begin();
- for (;aIter != aParseNodes.end();++aIter )
- {
- describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
-{
- OSL_ENSURE(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
-
- // Parameter Name-Row found?
- if (SQL_ISRULE(pParseNode,parameter))
- {
- OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
- OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
-
- _rParaNodes.push_back(pParseNode);
- // further search isn't necessary
- return;
- }
-
- // Search on in Parse Tree
- for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
- scanParameter(pParseNode->getChild(i),_rParaNodes);
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OPreparedStatement::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OPreparedStatement::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OPreparedStatement::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
deleted file mode 100644
index cf2dd1986e..0000000000
--- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-
-#include "MResultSet.hxx"
-#include "MStatement.hxx"
-#include <com/sun/star/sdbc/XPreparedStatement.hpp>
-#include <com/sun/star/sdbc/XParameters.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/sdbc/XMultipleResults.hpp>
-#include <cppuhelper/compbase5.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class OBoundParam;
- typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement,
- ::com::sun::star::sdbc::XParameters,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::sdbc::XMultipleResults,
- ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
-
- class OPreparedStatement : public OCommonStatement,
- public OPreparedStatement_BASE
- {
- protected:
- struct Parameter
- {
- ::com::sun::star::uno::Any aValue;
- sal_Int32 nDataType;
-
- Parameter(const ::com::sun::star::uno::Any& rValue,
- sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType)
- {
- }
-
- };
-
- ::std::vector< Parameter> m_aParameters;
- //====================================================================
- // Data attributes
- //====================================================================
- sal_Int32 m_nNumParams; // Number of parameter markers
- // for the prepared statement
-
- ::rtl::OUString m_sSqlStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
- sal_Bool m_bPrepared;
- ::rtl::Reference< OResultSet > m_pResultSet;
- ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
- OValueRow m_aParameterRow;
-
-
- void checkParameterIndex(sal_Int32 _parameterIndex);
-
- protected:
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception);
- virtual ~OPreparedStatement();
-
- virtual void SAL_CALL disposing();
-
- // OCommonStatement overridables
- virtual StatementType
- parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- virtual void initializeResultSet( OResultSet* _pResult );
- virtual void clearCachedResultSet();
- virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
-
-
- void checkAndResizeParameters(sal_Int32 parameterIndex);
- void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x);
-
- sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol);
- void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes);
- void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable);
- void describeParameter();
-
- public:
- DECLARE_SERVICE_INFO();
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql);
- void lateInit();
-
- //XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XMultipleResults
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- public:
- using OCommonStatement::executeQuery;
- using OCommonStatement::executeUpdate;
- using OCommonStatement::execute;
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
- }
-}
-#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
deleted file mode 100644
index 4552b9dc69..0000000000
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ /dev/null
@@ -1,1980 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-
-#include <TSortIndex.hxx>
-#include <rtl/string.hxx>
-#include <vector>
-#include <algorithm>
-#include "MResultSet.hxx"
-#include "MResultSetMetaData.hxx"
-#include "FDatabaseMetaDataResultSet.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::mozab;
-using namespace ::cppu;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-
-//------------------------------------------------------------------------------
-// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
-::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.mozab.ResultSet"));
-}
-// -------------------------------------------------------------------------
- Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);
- aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet"));
- aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet"));
- return aSupported;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-// -------------------------------------------------------------------------
-OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
- : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
- ,m_pStatement(pStmt)
- ,m_xStatement(*pStmt)
- ,m_xMetaData(NULL)
- ,m_nRowPos(0)
- ,m_nOldRowPos(0)
- ,m_nFetchSize(0)
- ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
- ,m_nFetchDirection(FetchDirection::FORWARD)
- ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
- ,m_pSQLIterator( _pSQLIterator )
- ,m_pParseTree( _pSQLIterator->getParseTree() )
- ,m_aQuery( pStmt->getOwnConnection()->getColumnAlias() )
- ,m_pTable(NULL)
- ,m_CurrentRowCount(0)
- ,m_nParamIndex(0)
- ,m_bIsAlwaysFalseQuery(sal_False)
- ,m_pKeySet(NULL)
- ,m_nNewRow(0)
- ,m_nUpdatedRow(0)
- ,m_RowStates(0)
- ,m_bIsReadOnly(-1)
-{
-
- m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords());
-}
-// -------------------------------------------------------------------------
-OResultSet::~OResultSet()
-{
-}
-
-// -------------------------------------------------------------------------
-void OResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_xStatement.clear();
- m_xMetaData.clear();
- m_pParseTree = NULL;
- m_xColumns = NULL;
- m_xParamColumns = NULL;
- m_pKeySet = NULL;
- if(m_pTable)
- {
- m_pTable->release();
- m_pTable = NULL;
- }
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
- Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
-{
- OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void OResultSet::methodEntry()
-{
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if ( !m_pTable )
- {
- OSL_FAIL( "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" );
- throw DisposedException( ::rtl::OUString(), *this );
- }
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // find the first column with the name columnName
- Reference< XResultSetMetaData > xMeta = getMetaData();
- sal_Int32 nLen = xMeta->getColumnCount();
- sal_Int32 i = 1;
- for(;i<=nLen;++i)
- if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
- columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
- break;
- return i;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- m_bWasNull = sal_True;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Sequence< sal_Int8 >();
-}
-// -------------------------------------------------------------------------
-
-Date SAL_CALL OResultSet::getDate( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Date();
-}
-// -------------------------------------------------------------------------
-
-double SAL_CALL OResultSet::getDouble( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0.0;
-}
-// -------------------------------------------------------------------------
-
-float SAL_CALL OResultSet::getFloat( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return 0;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::getRow, return = %u", m_nRowPos );
- return m_nRowPos;
-}
-// -------------------------------------------------------------------------
-
-sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return sal_Int64();
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- if(!m_xMetaData.is())
- m_xMetaData = new OResultSetMetaData(
- m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,determineReadOnly());
- return m_xMetaData;
-}
-// -------------------------------------------------------------------------
-Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-
-// -------------------------------------------------------------------------
-
-Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-Any SAL_CALL OResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
-{
- return Any();
-}
-// -------------------------------------------------------------------------
-
-sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- return 0;
-}
-// -------------------------------------------------------------------------
-
-void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
-{
- if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->get().size())
- ::dbtools::throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-sal_uInt32 OResultSet::currentRowCount()
-{
- if ( m_bIsAlwaysFalseQuery )
- return 0;
- return m_aQuery.getRealRowCount() - deletedCount();
-}
-
-// -------------------------------------------------------------------------
-
-sal_Bool OResultSet::fetchCurrentRow( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("fetchCurrentRow, m_nRowPos = %u", m_nRowPos );
- return fetchRow(getCurrentCardNumber());
-}
-
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, RuntimeException)
-{
- if (cardNumber == 0)
- return sal_True;
- // Check whether we are storing the updated row
- if ( (m_aRow->get())[0].isNull() || (sal_Int32)(m_aRow->get())[0] != (sal_Int32)cardNumber )
- return sal_False;
-
- sal_Int32 nCount = m_aColumnNames.getLength();
- m_aQuery.setRowStates(cardNumber,m_RowStates);
- for( sal_Int32 i = 1; i <= nCount; i++ )
- {
- if ( (m_aRow->get())[i].isBound() )
- {
- //
- // Everything in the addressbook is a string!
- //
- if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- }
- }
- return sal_True;
-
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("fetchRow, cardNumber = %u", cardNumber );
- if (!bForceReload)
- {
- // Check whether we've already fetched the row...
- if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == (sal_Int32)cardNumber )
- return sal_True;
- //Check whether the old row has been changed
- if (cardNumber == m_nUpdatedRow)
- {
- //write back the changes first
- if (!pushCard(cardNumber)) //error write back the changes
- throw SQLException();
- }
- }
- else
- m_aQuery.resyncRow(cardNumber);
-
- if ( validRow( cardNumber ) == sal_False )
- return sal_False;
-
- (m_aRow->get())[0] = (sal_Int32)cardNumber;
- sal_Int32 nCount = m_aColumnNames.getLength();
- m_RowStates = m_aQuery.getRowStates(cardNumber);
- for( sal_Int32 i = 1; i <= nCount; i++ )
- {
- if ( (m_aRow->get())[i].isBound() )
- {
- //
- // Everything in the addressbook is a string!
- //
- if ( !m_aQuery.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- }
- }
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-const ORowSetValue& OResultSet::getValue(sal_Int32 cardNumber, sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- if ( fetchRow( cardNumber ) == sal_False )
- {
- OSL_FAIL("fetchRow() returned False" );
- m_bWasNull = sal_True;
- return *ODatabaseMetaDataResultSet::getEmptyValue();
- }
-
- m_bWasNull = (m_aRow->get())[columnIndex].isNull();
- return (m_aRow->get())[columnIndex];
-
-}
-// -------------------------------------------------------------------------
-
-
-::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
- OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->get().size(), "Trying to access invalid columns number");
- checkIndex( columnIndex );
-
- // If this query was sorted then we should have a valid KeySet, so use it
- return getValue(getCurrentCardNumber(), mapColumn( columnIndex ) );
-
-}
-// -------------------------------------------------------------------------
-
-Time SAL_CALL OResultSet::getTime( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return Time();
-}
-// -------------------------------------------------------------------------
-
-
-DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- return DateTime();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // here you have to implement your movements
- // return true means there is no data
- OSL_TRACE("In/Out: OResultSet::isBeforeFirst" );
- return( m_nRowPos < 1 );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isAfterLast" );
- return m_nRowPos > currentRowCount() && m_aQuery.queryComplete();
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isFirst" );
- return m_nRowPos == 1;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::isLast" );
- return m_nRowPos == currentRowCount() && m_aQuery.queryComplete();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- // move before the first row so that isBeforeFirst returns false
- OSL_TRACE("In/Out: OResultSet::beforeFirst" );
- if ( first() )
- previous();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::afterLast" );
-
- if(last())
- next();
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::close" );
- dispose();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::first" );
- return seekRow( FIRST_POS );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::last" );
- return seekRow( LAST_POS );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::absolute" );
- return seekRow( ABSOLUTE_POS, row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::relative" );
- return seekRow( RELATIVE_POS, row );
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::previous" );
- return seekRow( PRIOR_POS );
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_TRACE("In/Out: OResultSet::getStatement" );
- return m_xStatement;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowDeleted, m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Deleted) == RowStates_Deleted) ;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowInserted,m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Inserted) == RowStates_Inserted);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::rowUpdated,m_RowStates=%u",m_RowStates );
- return ((m_RowStates & RowStates_Updated) == RowStates_Updated) ;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
-{
- return seekRow( NEXT_POS );
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- return m_bWasNull;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("In/Out: OResultSet::cancel" );
-
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::clearWarnings" );
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::getWarnings" );
- return Any();
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("In/Out: OResultSet::refreshRow" );
- if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
-{
- Sequence< Property > aProps(5);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
-}
-// -------------------------------------------------------------------------
-IPropertyArrayHelper & OResultSet::getInfoHelper()
-{
- return *const_cast<OResultSet*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OResultSet::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 nHandle,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- OSL_FAIL( "OResultSet::convertFastPropertyValue: not implemented!" );
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& /*rValue*/
- )
- throw (Exception)
-{
- OSL_FAIL( "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" );
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= (sal_Int32)m_nResultSetConcurrency;
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= m_nResultSetType;
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= m_nFetchDirection;
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= m_nFetchSize;
- break;
- case PROPERTY_ID_ISBOOKMARKABLE:
- const_cast< OResultSet* >( this )->determineReadOnly();
- rValue <<= !m_bIsReadOnly;
- break;
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::acquire() throw()
-{
- OResultSet_BASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::release() throw()
-{
- OResultSet_BASE::release();
-}
-// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount)
-{
- if(!_rRow.is())
- {
- _rRow = new OValueVector(_nColumnCount);
- (_rRow->get())[0].setBound(sal_True);
- ::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetBound(sal_False));
- }
-}
-
-// -------------------------------------------------------------------------
-void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString )
-{
- OSL_ENSURE(pNode->count() > 0,"Error parsing parameter in Parse Tree");
- OSQLParseNode *pMark = pNode->getChild(0);
-
- // Initialize to empty string
- rMatchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
-
- rtl::OUString aParameterName;
- if (SQL_ISPUNCTUATION(pMark,"?")) {
- aParameterName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?"));
- }
- else if (SQL_ISPUNCTUATION(pMark,":")) {
- aParameterName = pNode->getChild(1)->getTokenValue();
- }
- // XXX - Now we know name, what's value????
- m_nParamIndex ++;
- OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex,OUtoCStr(aParameterName) );
-
- if ( m_aParameterRow.is() ) {
- OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->get().size() + 1, "More parameters than values found" );
- rMatchString = (m_aParameterRow->get())[(sal_uInt16)m_nParamIndex];
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Prop Value : %s\n", OUtoCStr( rMatchString ) );
-#endif
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
- }
-#endif
-}
-
-void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree,
- MQueryExpression &queryExpression)
-{
- ::rtl::OUString columnName;
- MQueryOp::cond_type op( MQueryOp::Is );
- ::rtl::OUString matchString;
-
- if ( parseTree == NULL )
- return;
-
- if ( m_pSQLIterator->getParseTree() != NULL ) {
- ::rtl::Reference<OSQLColumns> xColumns = m_pSQLIterator->getParameters();
- if(xColumns.is())
- {
- ::rtl::OUString aTabName,aColName,aParameterName,aParameterValue;
- OSQLColumns::Vector::iterator aIter = xColumns->get().begin();
- sal_Int32 i = 1;
- for(;aIter != xColumns->get().end();++aIter)
- {
- (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
- OSL_TRACE("Prop Column Name : %s\n", OUtoCStr( aColName ) );
- if ( m_aParameterRow.is() ) {
- aParameterValue = (m_aParameterRow->get())[(sal_uInt16)i];
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Prop Value : %s\n", OUtoCStr( aParameterValue ) );
-#endif
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
- }
-#endif
- i++;
- }
- }
-
- }
-
- if ( SQL_ISRULE(parseTree,where_clause) )
- {
- OSL_TRACE("analyseSQL : Got WHERE clause\n");
- // Reset Parameter Counter
- resetParameters();
- analyseWhereClause( parseTree->getChild( 1 ), queryExpression );
- }
- else if ( parseTree->count() == 3 && // Handle ()'s
- SQL_ISPUNCTUATION(parseTree->getChild(0),"(") &&
- SQL_ISPUNCTUATION(parseTree->getChild(2),")"))
- {
-
- OSL_TRACE("analyseSQL : Got Punctuation ()\n");
- MQueryExpression *subExpression = new MQueryExpression();
- analyseWhereClause( parseTree->getChild( 1 ), *subExpression );
- queryExpression.getExpressions().push_back( subExpression );
- }
- else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term)))
- && parseTree->count() == 3) // Handle AND/OR
- {
-
- OSL_TRACE("analyseSQL : Got AND/OR clause\n");
-
- // TODO - Need to take care or AND, for now match is always OR
- analyseWhereClause( parseTree->getChild( 0 ), queryExpression );
- analyseWhereClause( parseTree->getChild( 2 ), queryExpression );
-
- if (SQL_ISTOKEN(parseTree->getChild(1),OR)) { // OR-Operator
- queryExpression.setExpressionCondition( MQueryExpression::OR );
- }
- else if (SQL_ISTOKEN(parseTree->getChild(1),AND)) { // AND-Operator
- queryExpression.setExpressionCondition( MQueryExpression::AND );
- }
- else {
- OSL_FAIL("analyseSQL: Error in Parse Tree");
- }
- }
- else if (SQL_ISRULE(parseTree,comparison_predicate))
- {
- OSL_ENSURE(parseTree->count() == 3, "Error parsing COMPARE predicate");
- if (!(SQL_ISRULE(parseTree->getChild(0),column_ref) ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_STRING ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
- parseTree->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
- SQL_ISTOKEN(parseTree->getChild(2),TRUE) ||
- SQL_ISTOKEN(parseTree->getChild(2),FALSE) ||
- SQL_ISRULE(parseTree->getChild(2),parameter) ||
- // odbc date
- (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{"))))
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- }
-
- OSQLParseNode *pPrec = parseTree->getChild(1);
- if (pPrec->getNodeType() == SQL_NODE_EQUAL)
- op = MQueryOp::Is;
- else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
- op = MQueryOp::IsNot;
-
- ::rtl::OUString sTableRange;
- if(SQL_ISRULE(parseTree->getChild(0),column_ref))
- m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
- else if(parseTree->getChild(0)->isToken())
- columnName = parseTree->getChild(0)->getTokenValue();
-
- if ( SQL_ISRULE(parseTree->getChild(2),parameter) ) {
- parseParameter( parseTree->getChild(2), matchString );
- }
- else {
- matchString = parseTree->getChild(2)->getTokenValue();
- }
-
- if ( columnName.compareToAscii("0") ==0 && op == MQueryOp::Is &&
- matchString.compareToAscii("1") == 0 ) {
- OSL_TRACE("Query always evaluates to FALSE");
- m_bIsAlwaysFalseQuery = sal_True;
- }
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
- }
- else if (SQL_ISRULE(parseTree,like_predicate))
- {
- OSL_ENSURE(parseTree->count() == 2, "Error parsing LIKE predicate");
-
- OSL_TRACE("analyseSQL : Got LIKE rule\n");
-
- if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) )
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_COLUMN, *this );
- }
-
-
- OSQLParseNode *pColumn;
- OSQLParseNode *pAtom;
- OSQLParseNode *pOptEscape;
- const OSQLParseNode* pPart2 = parseTree->getChild(1);
- pColumn = parseTree->getChild(0); // Match Item
- pAtom = pPart2->getChild(pPart2->count()-2); // Match String
- pOptEscape = pPart2->getChild(pPart2->count()-1); // Opt Escape Rule
- (void)pOptEscape;
- const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT);
-
- if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
- pAtom->getNodeType() == SQL_NODE_NAME ||
- SQL_ISRULE(pAtom,parameter) ||
- ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_NAME ) ||
- ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING )
- ) )
- {
- OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() );
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_STRING, *this );
- }
-
- const sal_Unicode WILDCARD = '%';
- const sal_Unicode ALT_WILDCARD = '*';
- const sal_Unicode MATCHCHAR = '_';
-
- ::rtl::OUString sTableRange;
- if(SQL_ISRULE(pColumn,column_ref))
- m_pSQLIterator->getColumnRange(pColumn,columnName,sTableRange);
-
- OSL_TRACE("ColumnName = %s\n", OUtoCStr( columnName ) );
-
- if ( SQL_ISRULE(pAtom,parameter) ) {
- parseParameter( pAtom, matchString );
- // Replace all '*' with '%' : UI Usually does this but not with
- // Parameters for some reason.
- matchString = matchString.replace( ALT_WILDCARD, WILDCARD );
- }
- else
- {
- matchString = pAtom->getTokenValue();
- }
-
- // Determine where '%' character is...
-
- if ( matchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
- {
- // String containing only a '%' and nothing else
- op = MQueryOp::Exists;
- // Will be ignored for Exists case, but clear anyway.
- matchString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(""));
- }
- else if ( matchString.indexOf ( WILDCARD ) == -1 &&
- matchString.indexOf ( MATCHCHAR ) == -1 )
- {
- // Simple string , eg. "to match"
- if ( bNot )
- op = MQueryOp::DoesNotContain;
- else
- op = MQueryOp::Contains;
- }
- else if ( matchString.indexOf ( WILDCARD ) == 0
- && matchString.lastIndexOf ( WILDCARD ) == matchString.getLength() -1
- && matchString.indexOf ( WILDCARD, 1 ) == matchString.lastIndexOf ( WILDCARD )
- && matchString.indexOf( MATCHCHAR ) == -1
- )
- {
- // Relatively simple "%string%" - ie, contains...
- // Cut '%' from front and rear
- matchString = matchString.replaceAt( 0, 1, rtl::OUString() );
- matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
-
- if (bNot)
- op = MQueryOp::DoesNotContain;
- else
- op = MQueryOp::Contains;
- }
- else if ( bNot )
- {
- // We currently can't handle a 'NOT LIKE' when there are '%' or
- // '_' dispersed throughout
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_NOT_LIKE_TOO_COMPLEX, *this );
- }
- else
- {
- if ( (matchString.indexOf ( WILDCARD ) == matchString.lastIndexOf ( WILDCARD ))
- && matchString.indexOf( MATCHCHAR ) == -1
- )
- {
- // One occurrence of '%' - no '_' matches...
- if ( matchString.indexOf ( WILDCARD ) == 0 )
- {
- op = MQueryOp::EndsWith;
- matchString = matchString.replaceAt( 0, 1, rtl::OUString());
- }
- else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 )
- {
- op = MQueryOp::BeginsWith;
- matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
- }
- else
- {
- sal_Int32 pos = matchString.indexOf ( WILDCARD );
- matchString = matchString.replaceAt( pos, 1,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) );
- op = MQueryOp::RegExp;
- }
-
- }
- else
- {
- // Most Complex, need to use an RE
- sal_Int32 pos = matchString.indexOf ( WILDCARD );
- while ( (pos = matchString.indexOf ( WILDCARD )) != -1 )
- {
- matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".*")) );
- }
-
- pos = matchString.indexOf ( MATCHCHAR );
- while ( (pos = matchString.indexOf( MATCHCHAR )) != -1 )
- {
- matchString = matchString.replaceAt( pos, 1, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".")) );
- }
-
- op = MQueryOp::RegExp;
- }
- }
-
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
- }
- else if (SQL_ISRULE(parseTree,test_for_null))
- {
- OSL_ENSURE(parseTree->count() == 2,"Error in ParseTree");
- const OSQLParseNode* pPart2 = parseTree->getChild(1);
- OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"Error in ParseTree");
-
- if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this );
- }
-
- if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
- {
- op = MQueryOp::Exists;
- }
- else
- op = MQueryOp::DoesNotExist;
-
- ::rtl::OUString sTableRange;
- m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
-
- queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op ));
- }
- else
- {
- OSL_TRACE( "Unexpected statement!!!" );
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- }
-}
-
-
-// -----------------------------------------------------------------------------
-
-void OResultSet::fillRowData()
- throw( ::com::sun::star::sdbc::SQLException )
-{
- OSL_ENSURE( m_pStatement, "Require a statement" );
-
- MQueryExpression queryExpression;
-
- OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
- m_xColumns = m_pSQLIterator->getSelectColumns();
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
-
- OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
- const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- ::rtl::OUString sName;
- m_aAttributeStrings.clear();
- m_aAttributeStrings.reserve(m_xColumns->get().size());
- for (sal_Int32 i = 1; aIter != m_xColumns->get().end();++aIter, i++)
- {
- (*aIter)->getPropertyValue(sProprtyName) >>= sName;
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Query Columns : (%d) %s\n", i, OUtoCStr(sName) );
-#endif
- m_aAttributeStrings.push_back( sName );
- }
-
-
- // Generate Match Conditions for Query
- const OSQLParseNode* pParseTree = m_pSQLIterator->getWhereTree();
-
- // const OSQLParseNode* pParseTree = NULL;
-
- m_bIsAlwaysFalseQuery = sal_False;
- if ( pParseTree != NULL )
- {
- // Extract required info
-
- OSL_TRACE("\tHave a Where Clause\n");
-
- analyseWhereClause( pParseTree, queryExpression );
- }
- else
- {
- OSL_TRACE("\tDon't have a Where Clause\n");
-
- MQueryExpression::ExprVector eVector;
-
- // LDAP does not allow a query without restriction, so we add a dummy
- // for PrimaryEmail
- // For other types we stick to the old behaviour of using
- // card:nsIAbCard.
- OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement");
- ::rtl::OUString aStr;
- if (xConnection->isLDAP())
- aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail"));
- else
- aStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("card:nsIAbCard"));
- eVector.push_back( new MQueryExpressionString(aStr, MQueryOp::Exists) );
-
- queryExpression.setExpressions( eVector );
- }
-
- // If the query is a 0=1 then set Row count to 0 and return
- if ( m_bIsAlwaysFalseQuery )
- {
- m_bIsReadOnly = 1;
- return;
- }
-
- m_aQuery.setExpression( queryExpression );
-
- rtl::OUString aStr( m_pTable->getName() );
- m_aQuery.setAddressbook( aStr );
-
- sal_Int32 rv = m_aQuery.executeQuery(xConnection);
- if ( rv == -1 ) {
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
- }
- //determine whether the address book is readonly
- determineReadOnly();
-
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "executeQuery returned %d\n", rv );
-
- OSL_TRACE( "\tOUT OResultSet::fillRowData()\n" );
-#endif
-}
-
-// -----------------------------------------------------------------------------
-static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 )
-{
- OValueVector::Vector::iterator row1Iter = row1->get().begin();
- OValueVector::Vector::iterator row2Iter = row2->get().begin();
- for ( ++row1Iter,++row2Iter; // the first column is the bookmark column
- row1Iter != row1->get().end(); ++row1Iter,++row2Iter)
- {
- if ( row1Iter->isBound())
- {
- // Compare values, if at anytime there's a mismatch return false
- if ( !( (*row1Iter) == (*row2Iter) ) )
- return sal_False;
- }
- }
-
- // If we get to here the rows match
- return sal_True;
-}
-sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
-{
- OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, nCardNum = %u", nCardNum );
-
- if ( m_pKeySet.is() )
- {
- sal_Int32 nPos;
- for(nPos=0;nPos < (sal_Int32)m_pKeySet->get().size();nPos++)
- {
- if (nCardNum == (m_pKeySet->get())[nPos])
- {
- OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, return = %u", nPos+1 );
- return nPos+1;
- }
- }
- }
-
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- OSL_ENSURE( m_pTable, "Need a Table object");
- if(!m_pTable)
- {
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
- m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
-
- m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
-
- }
-
- m_nRowPos = 0;
-
- fillRowData();
-
- OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
-
- // sal_Int32 nColumnCount = m_xColumns->size();
- // initializeRow(m_aRow,nColumnCount);
- // initializeRow(m_aEvaluateRow,nColumnCount);
-
- switch( m_pSQLIterator->getStatementType() )
- {
- case SQL_STATEMENT_SELECT:
- {
- if(m_bIsAlwaysFalseQuery) {
- break;
- }
- else if(isCount())
- {
- m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
- }
- else
- {
- sal_Bool bDistinct = sal_False;
- OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
- if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT)
- {
- if(!IsSorted())
- {
- m_aOrderbyColumnNumber.push_back(m_aColMapping[1]);
- m_aOrderbyAscending.push_back(SQL_DESC);
- }
- bDistinct = sal_True;
- }
-
- OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
- ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
- for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
- {
- OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
- switch ((m_aRow->get().begin()+*aOrderByIter)->getTypeKind())
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- eKeyType[i] = SQL_ORDERBYKEY_STRING;
- break;
-
- case DataType::OTHER:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
- case DataType::BIT:
- eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
- break;
-
- // Other types aren't implemented (so they are always FALSE)
- default:
- eKeyType[i] = SQL_ORDERBYKEY_NONE;
- OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented");
- break;
- }
- }
-
- if (IsSorted())
- {
- // Implement Sorting
-
- // So that we can sort we need to wait until the executed
- // query to the mozilla addressbooks has returned all
- // values.
-
- OSL_TRACE("Query is to be sorted");
- if( ! m_aQuery.queryComplete() )
- if ( !m_aQuery.waitForQueryComplete() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
-
- OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!");
-
- m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
-
- OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size());
-#if OSL_DEBUG_LEVEL > 0
- for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
- for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) {
-
- OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow));
-
- ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
- for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
- {
- const ORowSetValue& value = getValue(nRow, *aIter);
-
- OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value ));
-
- pKeyValue->pushKey(new ORowSetValueDecorator(value));
- }
-
- m_pSortIndex->AddKeyValue( pKeyValue );
- }
-
- m_pKeySet = m_pSortIndex->CreateKeySet();
- m_CurrentRowCount = m_pKeySet->get().size();
-#if OSL_DEBUG_LEVEL > 0
- for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
- OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] );
-#endif
-
- m_pSortIndex = NULL;
- beforeFirst(); // Go back to start
- }
- else //we always need m_pKeySet now
- m_pKeySet = new OKeySet();
-
- // Handle the DISTINCT case
- if ( bDistinct && m_pKeySet.is() )
- {
- OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
-
- for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
- {
- fetchRow( (m_pKeySet->get())[i] ); // Fills m_aRow
- if ( matchRow( m_aRow, aSearchRow ) )
- {
- (m_pKeySet->get())[i] = 0; // Marker for later to be removed
- }
- else
- {
- // They don't match, so it's not a duplicate.
- // Use the current Row as the next one to match against
- *aSearchRow = *m_aRow;
- }
- }
- // Now remove any keys marked with a 0
- m_pKeySet->get().erase(::std::remove_if(m_pKeySet->get().begin(),m_pKeySet->get().end()
- ,::std::bind2nd(::std::equal_to<sal_Int32>(),0))
- ,m_pKeySet->get().end());
-
- }
- }
- } break;
-
- case SQL_STATEMENT_UPDATE:
- case SQL_STATEMENT_DELETE:
- case SQL_STATEMENT_INSERT:
- break;
- default:
- m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
- break;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void OResultSet::setBoundedColumns(const OValueRow& _rRow,
- const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const Reference<XIndexAccess>& _xNames,
- sal_Bool _bSetColumnMapping,
- const Reference<XDatabaseMetaData>& _xMetaData,
- ::std::vector<sal_Int32>& _rColMapping)
-{
- ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
-
- Reference<XPropertySet> xTableColumn;
- ::rtl::OUString sTableColumnName, sSelectColumnRealName;
-
- const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
-
- ::std::vector< ::rtl::OUString> aColumnNames;
- aColumnNames.reserve(_rxColumns->get().size());
- OValueVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
- for (sal_Int32 i=0; // the first column is the bookmark column
- aRowIter != _rRow->get().end();
- ++i, ++aRowIter
- )
- {
- try
- {
- // get the table column and it's name
- _xNames->getByIndex(i) >>= xTableColumn;
- OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
- if (xTableColumn.is())
- xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
- else
- sTableColumnName = ::rtl::OUString();
-
- // look if we have such a select column
- // TODO: would like to have a O(log n) search here ...
- sal_Int32 nColumnPos = 0;
- for ( OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
- aIter != _rxColumns->get().end();
- ++aIter,++nColumnPos
- )
- {
- if ( nColumnPos < (sal_Int32)aColumnNames.size() )
- sSelectColumnRealName = aColumnNames[nColumnPos];
- else
- {
- if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
- (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
- else
- (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
- aColumnNames.push_back(sSelectColumnRealName);
- }
-
- if (aCase(sTableColumnName, sSelectColumnRealName))
- {
- if(_bSetColumnMapping)
- {
- sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
- // the getXXX methods are 1-based ...
- sal_Int32 nTableColumnPos = i + 1;
- // get first table column is the bookmark column
- // ...
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos );
-#endif
- _rColMapping[nSelectColumnPos] = nTableColumnPos;
- }
-
- aRowIter->setBound(sal_True);
- aRowIter->setTypeKind(DataType::VARCHAR);
- }
- }
- }
- catch (Exception&)
- {
- OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!");
- }
- }
-}
-
-
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::isCount() const
-{
- return (m_pParseTree &&
- m_pParseTree->count() > 2 &&
- SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column) &&
- SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
- m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
- );
-}
-
-// -----------------------------------------------------------------------------
-//
-// Check for valid row in m_aQuery
-//
-sal_Bool OResultSet::validRow( sal_uInt32 nRow )
-{
- sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
-
- while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) {
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("validRow: waiting...");
-#endif
- m_aQuery.checkRowAvailable( nRow );
- if ( m_aQuery.hadError() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- nNumberOfRecords = m_aQuery.getRealRowCount();
- }
-
- if (( nRow == 0 ) ||
- ( nRow > (sal_uInt32)nNumberOfRecords && m_aQuery.queryComplete()) ){
- OSL_TRACE("validRow(%u): return False", nRow);
- return sal_False;
- }
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("validRow(%u): return True", nRow);
-#endif
- return sal_True;
-}
-sal_Bool OResultSet::fillKeySet(sal_Int32 nMaxCardNumber)
-{
- impl_ensureKeySet();
- if (m_CurrentRowCount < nMaxCardNumber)
- {
- sal_Int32 nKeyValue;
- if ( (sal_Int32)m_pKeySet->get().capacity() < nMaxCardNumber )
- m_pKeySet->get().reserve(nMaxCardNumber + 20 );
-
- for (nKeyValue = m_CurrentRowCount+1; nKeyValue <= nMaxCardNumber; nKeyValue ++)
- m_pKeySet->get().push_back( nKeyValue );
- m_CurrentRowCount = nMaxCardNumber;
- }
- return sal_True;
-}
-
-sal_Int32 OResultSet::deletedCount()
-{
- impl_ensureKeySet();
- return m_CurrentRowCount - m_pKeySet->get().size();
-
-}
-// -----------------------------------------------------------------------------
-sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
-{
- ResultSetEntryGuard aGuard( *this );
- if ( !m_pKeySet.is() )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
-
- sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
- sal_Int32 nRetrivedRows = currentRowCount();
- sal_Int32 nCurPos = m_nRowPos;
-
- OSL_TRACE("seekRow: nCurPos = %d", nCurPos );
- switch( pos ) {
- case NEXT_POS:
- OSL_TRACE("seekRow: NEXT");
- nCurPos++;
- break;
- case PRIOR_POS:
- OSL_TRACE("seekRow: PRIOR");
- if ( nCurPos > 0 )
- nCurPos--;
- break;
-
- case FIRST_POS:
- OSL_TRACE("seekRow: FIRST");
- nCurPos = 1;
- break;
-
- case LAST_POS:
- OSL_TRACE("seekRow: LAST");
- nCurPos = nRetrivedRows;
- break;
- case ABSOLUTE_POS:
- OSL_TRACE("seekRow: ABSOLUTE : %d", nOffset);
- nCurPos = nOffset;
- break;
- case RELATIVE_POS:
- OSL_TRACE("seekRow: RELATIVE : %d", nOffset);
- nCurPos += sal_uInt32( nOffset );
- break;
- }
-
- if ( nCurPos <= 0 ) {
- m_nRowPos = 0;
- OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
- return sal_False;
- }
- sal_Int32 nCurCard = nCurPos;
- if ( nCurPos < (sal_Int32)m_pKeySet->get().size() ) //The requested row is exist in m_pKeySet, so we just use it
- {
- nCurCard = (m_pKeySet->get())[nCurPos-1];
- }
- else //The requested row has not been retrived until now. We should get the right card for it.
- nCurCard = nCurPos + deletedCount();
-
- while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) {
- m_aQuery.checkRowAvailable( nCurCard );
- if ( m_aQuery.hadError() )
- {
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
- nNumberOfRecords = m_aQuery.getRealRowCount();
- }
-
- if ( nCurCard > nNumberOfRecords && m_aQuery.queryComplete()) {
- fillKeySet(nNumberOfRecords);
- m_nRowPos = m_pKeySet->get().size() + 1;
- OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
- return sal_False;
- }
- //Insert new retrived items for later use
- fillKeySet(nNumberOfRecords);
- m_nRowPos = (sal_uInt32)nCurPos;
- OSL_TRACE("seekRow: return True, m_nRowPos = %u", m_nRowPos );
- fetchCurrentRow();
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping)
-{
- m_aColMapping = _aColumnMapping;
-#if OSL_DEBUG_LEVEL > 0
- for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-::com::sun::star::uno::Any OResultSet::getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row");
- return makeAny((sal_Int32)(m_aRow->get())[0]);
-}
-sal_Bool OResultSet::moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveToBookmark, bookmark = %u", comphelper::getINT32(bookmark) );
- sal_Int32 nCardNum = comphelper::getINT32(bookmark);
- m_nRowPos = getRowForCardNumber(nCardNum);
- fetchCurrentRow();
- return sal_True;
-}
-sal_Bool OResultSet::moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveRelativeToBookmark, bookmark = %u rows= %u", comphelper::getINT32(bookmark),rows );
- sal_Int32 nCardNum = comphelper::getINT32(bookmark);
- m_nRowPos = getRowForCardNumber(nCardNum);
- return seekRow(RELATIVE_POS,rows );
-}
-sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("compareBookmarks, m_nRowPos = %u", m_nRowPos );
- sal_Int32 nFirst=0;
- sal_Int32 nSecond=0;
- sal_Int32 nResult=0;
-
- if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
-
- if(nFirst < nSecond)
- nResult = -1;
- else if(nFirst > nSecond)
- nResult = 1;
- else
- nResult = 0;
-
- return nResult;
-}
-sal_Bool OResultSet::hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("hasOrderedBookmarks, m_nRowPos = %u", m_nRowPos );
- return sal_True;
-}
-sal_Int32 OResultSet::hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("hashBookmark, m_nRowPos = %u", m_nRowPos );
- return comphelper::getINT32(bookmark);
-}
-
-sal_Int32 OResultSet::getCurrentCardNumber()
-{
- if ( ( m_nRowPos == 0 ) || !m_pKeySet.is() )
- return 0;
- if (m_pKeySet->get().size() < m_nRowPos)
- return 0;
- return (m_pKeySet->get())[m_nRowPos-1];
-}
-void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException)
-{
- OSL_TRACE("checkPendingUpdate, m_nRowPos = %u", m_nRowPos );
- const sal_Int32 nCurrentRow = getCurrentCardNumber();
-
- if ((m_nNewRow && nCurrentRow != m_nNewRow)
- || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COMMIT_ROW,
- "$position$", ::rtl::OUString::valueOf(nCurrentRow)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-
-}
-void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
-
- checkPendingUpdate();
-
- checkIndex(columnIndex );
- columnIndex = mapColumn(columnIndex);
-
- (m_aRow->get())[columnIndex].setBound(sal_True);
- (m_aRow->get())[columnIndex] = x;
- m_nUpdatedRow = getCurrentCardNumber();
- m_RowStates = m_RowStates | RowStates_Updated;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
-{
- OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- checkPendingUpdate();
- checkIndex(columnIndex );
- columnIndex = mapColumn(columnIndex);
-
- (m_aRow->get())[columnIndex].setBound(sal_True);
- (m_aRow->get())[columnIndex].setNull();
- m_nUpdatedRow = getCurrentCardNumber();
- m_RowStates = m_RowStates | RowStates_Updated;
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
-}
-// -----------------------------------------------------------------------
-void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
-{
- updateValue(columnIndex,x);
-}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
-
- if(!x.is())
- ::dbtools::throwFunctionSequenceException(*this);
-
- Sequence<sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- updateValue(columnIndex,aSeq);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
-{
- updateBinaryStream(columnIndex,x,length);
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_UPDATEABLE,
- "$position$", ::rtl::OUString::valueOf(columnIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- } // if (!::dbtools::implUpdateObject(this, columnIndex, x))
- }
-// -------------------------------------------------------------------------
-
-void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
-{
- if (!::dbtools::implUpdateObject(this, columnIndex, x))
- {
- const ::rtl::OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_COLUMN_NOT_UPDATEABLE,
- "$position$", ::rtl::OUString::valueOf(columnIndex)
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
-}
-
-// XResultSetUpdate
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("insertRow in, m_nRowPos = %u", m_nRowPos );
- m_RowStates = RowStates_Inserted;
- updateRow();
- m_nOldRowPos = 0;
- m_nNewRow = 0;
- m_aQuery.setRowStates(getCurrentCardNumber(),m_RowStates);
- OSL_TRACE("insertRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("updateRow in, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- impl_ensureKeySet();
-
- if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos )
- m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
-
- const sal_Int32 nCurrentCard = getCurrentCardNumber();
-
- if (!pushCard(nCurrentCard))
- {
- m_RowStates = RowStates_Error;
- m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this );
- }
-
- if (!m_aQuery.commitRow(nCurrentCard))
- {
- m_RowStates = RowStates_Error;
- m_nUpdatedRow = 0;
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
- }
-
- m_nUpdatedRow = 0;
- fetchCurrentRow();
- OSL_TRACE("updateRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- if (rowDeleted())
- m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this );
-
- const sal_Int32 nCurrentRow = getCurrentCardNumber();
- //fetchRow(nCurrentRow);
- if (!nCurrentRow)
- m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
-
- sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 );
- if (!m_bRowDeleted)
- m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
-
- m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted);
- m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1);
- m_RowStates = RowStates_Deleted;
- OSL_TRACE("deleteRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos );
- if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CANCEL_ROW_UPDATE, *this );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- OSL_TRACE("moveToInsertRow in, m_nRowPos = %u", m_nRowPos );
- ResultSetEntryGuard aGuard( *this );
- m_nOldRowPos = m_nRowPos;
-
- if (!m_nNewRow) //no new row now, insert one
- {
- checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- checkPendingUpdate();
- if (rowUpdated())
- {
- if (m_nRowPos && !pushCard(getCurrentCardNumber()))
- throw SQLException();
- }
- m_nNewRow = m_aQuery.createNewCard();
- if (!m_nNewRow)
- m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this );
-
- m_RowStates = RowStates_Normal;
- fillKeySet(m_nNewRow);
- }
- else
- m_nUpdatedRow = 0;
-
- m_nRowPos = m_pKeySet->get().size();
- fetchCurrentRow();
- OSL_TRACE("moveToInsertRow out, m_nRowPos = %u", m_nRowPos );
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- ResultSetEntryGuard aGuard( *this );
- OSL_TRACE("moveToCurrentRow, m_nRowPos = %u", m_nRowPos );
- if (rowInserted())
- {
- m_nRowPos = m_nOldRowPos;
- fetchCurrentRow();
- }
-}
-
-sal_Bool OResultSet::determineReadOnly()
-{
- if (m_bIsReadOnly == -1)
- {
- OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
- m_bIsReadOnly = !m_aQuery.isWritable(xConnection) || m_bIsAlwaysFalseQuery;
- }
-
- return m_bIsReadOnly != 0;
-}
-
-void OResultSet::setTable(OTable* _rTable)
-{
- OSL_TRACE("In : setTable");
- m_pTable = _rTable;
- m_pTable->acquire();
- m_xTableColumns = m_pTable->getColumns();
- if(m_xTableColumns.is())
- m_aColumnNames = m_xTableColumns->getElementNames();
- OSL_TRACE("Out : setTable");
-}
-
-void OResultSet::setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy)
-{
- m_aOrderbyColumnNumber = _aColumnOrderBy;
-}
-
-void OResultSet::setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc)
-{
- m_aOrderbyAscending = _aOrderbyAsc;
-}
-Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this );
- return Sequence< sal_Int32 >();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx
deleted file mode 100644
index 7f0f93985d..0000000000
--- a/connectivity/source/drivers/mozab/MResultSet.hxx
+++ /dev/null
@@ -1,369 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SRESULTSET_HXX
-#define CONNECTIVITY_SRESULTSET_HXX
-
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/XColumnLocate.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#include <com/sun/star/sdbcx/XRowLocate.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#include <com/sun/star/sdbc/XRowUpdate.hpp>
-#include <cppuhelper/compbase12.hxx>
-#include <comphelper/proparrhlp.hxx>
-#include "MStatement.hxx"
-#include "connectivity/CommonTools.hxx"
-#include "connectivity/FValue.hxx"
-#include "connectivity/sqliterator.hxx"
-#include "TSortIndex.hxx"
-#include "mozillasrc/MQuery.hxx"
-
-
-namespace connectivity
-{
- namespace mozab
- {
-
- /*
- ** java_sql_ResultSet
- */
- typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
- ::com::sun::star::sdbc::XRow,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable,
- ::com::sun::star::sdbc::XColumnLocate,
- ::com::sun::star::sdbc::XResultSetUpdate,
- ::com::sun::star::sdbc::XRowUpdate,
- ::com::sun::star::sdbcx::XRowLocate,
- ::com::sun::star::sdbcx::XDeleteRows,
- ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
-
-
- typedef sal_Int64 TVoidPtr;
- typedef ::std::allocator< TVoidPtr > TVoidAlloc;
- typedef ::std::vector<TVoidPtr> TVoidVector;
-
- class OResultSet : public comphelper::OBaseMutex,
- public OResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
- {
- protected:
- OCommonStatement* m_pStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
- sal_uInt32 m_nRowPos;
- sal_uInt32 m_nOldRowPos;
- sal_Bool m_bWasNull;
- sal_Int32 m_nFetchSize;
- sal_Int32 m_nResultSetType;
- sal_Int32 m_nFetchDirection;
- sal_Int32 m_nResultSetConcurrency;
-
-
-
- ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >
- m_pSQLIterator;
- const connectivity::OSQLParseNode* m_pParseTree;
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
-
- // you can't delete objects of this type
- virtual ~OResultSet();
- public:
- DECLARE_SERVICE_INFO();
-
- OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
-
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
- {
- return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
- }
-
- // ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XResultSet
- virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCancellable
- virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XColumnLocate
- virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XResultSetUpdate
- virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowUpdate
- virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XRowLocate
- virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XDeleteRows
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
-protected:
- MQuery m_aQuery;
- OTable* m_pTable;
- sal_Int32 m_CurrentRowCount;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
- m_xTableColumns;
-
- ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
- ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
- ::std::vector<TAscendingOrder> m_aOrderbyAscending;
- ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aColumnNames;
- OValueRow m_aRow;
- OValueRow m_aParameterRow;
- ::std::vector< ::rtl::OUString> m_aAttributeStrings;
- sal_Int32 m_nParamIndex;
- sal_Bool m_bIsAlwaysFalseQuery;
- ::rtl::Reference<OKeySet> m_pKeySet;
- OSortIndex* m_pSortIndex;
- sal_Int32 m_nNewRow; //inserted row
- sal_Int32 m_nUpdatedRow; //updated row
- sal_Int32 m_RowStates;
- sal_Int32 m_bIsReadOnly;
- inline void resetParameters() { m_nParamIndex = 0; }
-
- ::rtl::Reference<connectivity::OSQLColumns> m_xColumns; // this are the select columns
- ::rtl::Reference<connectivity::OSQLColumns> m_xParamColumns;
-
- void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString );
- void fillRowData() throw( ::com::sun::star::sdbc::SQLException );
- void initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount);
- void analyseWhereClause( const OSQLParseNode* parseTree,
- MQueryExpression &queryExpression);
-
- sal_Bool isCount() const;
-
- // XXX sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != STRING_NOTFOUND ;}
- sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty(); }
-
- enum eRowPosition {
- NEXT_POS, PRIOR_POS, FIRST_POS, LAST_POS, ABSOLUTE_POS, RELATIVE_POS
- };
-
- sal_uInt32 currentRowCount();
-
- sal_Bool fetchRow(sal_Int32 rowIndex,sal_Bool bForceReload=sal_False) throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool fetchCurrentRow() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool pushCard(sal_uInt32 rowIndex) throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
- sal_Bool validRow( sal_uInt32 nRow );
- sal_Bool seekRow( eRowPosition pos, sal_Int32 nOffset = 0 );
- sal_Int32 deletedCount();
- sal_Bool fillKeySet(sal_Int32 nMaxCardNumber); //When we get new rows, fill the m_pKeySet items for them
- sal_Int32 getRowForCardNumber(sal_Int32 nCardNum);
- const ORowSetValue& getValue(sal_Int32 rowIndex, sal_Int32 columnIndex)
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- void checkPendingUpdate() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- sal_Int32 getCurrentCardNumber();
-
-public:
- sal_Bool determineReadOnly();
- // MozAddressbook Specific methods
- void SAL_CALL executeQuery() throw( ::com::sun::star::sdbc::SQLException,
- ::com::sun::star::uno::RuntimeException);
-
- void setTable(OTable* _rTable);
-
- void setParameterRow(const OValueRow& _rParaRow)
- { m_aParameterRow = _rParaRow; }
-
- void setParameterColumns(const ::rtl::Reference<connectivity::OSQLColumns>& _xParamColumns)
- { m_xParamColumns = _xParamColumns; }
-
- void setBindingRow(const OValueRow& _aRow)
- { m_aRow = _aRow; }
-
- void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping);
-
- void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy);
-
- void setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc);
-
- inline sal_Int32 mapColumn(sal_Int32 column);
-
- void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
-
- static void setBoundedColumns(
- const OValueRow& _rRow,
- const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames,
- sal_Bool _bSetColumnMapping,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
- ::std::vector<sal_Int32>& _rColMapping);
-
- ::osl::Mutex& getMutex() { return m_aMutex; }
- void methodEntry();
-
- private:
- inline void impl_ensureKeySet()
- {
- if ( !m_pKeySet.is() )
- m_pKeySet = new OKeySet();
- }
-
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
-
- inline sal_Int32 OResultSet::mapColumn(sal_Int32 column)
- {
- sal_Int32 map = column;
-
- OSL_ENSURE(column > 0, "OResultSet::mapColumn: invalid column index!");
- // the first column (index 0) is for convenience only. The
- // first real select column is no 1.
- if ((column > 0) && (column < (sal_Int32)m_aColMapping.size()))
- map = m_aColMapping[column];
-
- return map;
- }
-
- class ResultSetEntryGuard : public ::osl::MutexGuard
- {
- public:
- ResultSetEntryGuard( OResultSet& _rRS ) : ::osl::MutexGuard( _rRS.getMutex() )
- {
- _rRS.methodEntry();
- }
- };
-
- }
-}
-#endif // CONNECTIVITY_SRESULTSET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
deleted file mode 100644
index 3ca9036c33..0000000000
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "connectivity/dbexception.hxx"
-#include "connectivity/dbtools.hxx"
-#include <comphelper/types.hxx>
-#include <comphelper/extract.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <tools/diagnose_ex.h>
-#include "MResultSetMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-
-using namespace connectivity::mozab;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::beans;
-using namespace ::dbtools;
-using namespace ::comphelper;
-
-// -------------------------------------------------------------------------
-OResultSetMetaData::~OResultSetMetaData()
-{
- m_xColumns = NULL;
-}
-
-// -----------------------------------------------------------------------------
-void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException)
-{
- if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->get().size())
- throwInvalidIndexException(*this);
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getPrecision(column);
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return DataType::VARCHAR; // at the moment there exists only this type
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
-{
- return (m_xColumns->get()).size();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
-
- ::rtl::OUString sColumnName;
- try
- {
- Reference< XPropertySet > xColumnProps( (m_xColumns->get())[column-1], UNO_QUERY_THROW );
- OSL_VERIFY( xColumnProps->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= sColumnName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return sColumnName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return m_aTableName;
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getString((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)));
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return getColumnName(column);
-}
-// -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return ::rtl::OUString();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getBOOL((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 /*column*/ ) throw(SQLException, RuntimeException)
-{
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- return getINT32((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- ::rtl::OUString sColumnName( getColumnName( column ) );
-
- if ( !m_pTable || !m_pTable->getConnection() )
- {
- OSL_FAIL( "OResultSetMetaData::isSearchable: suspicious: called without table or connection!" );
- return sal_False;
- }
-
- if ( m_pTable->getConnection()->isLDAP() )
- {
- const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
- if ( !aAliases.isColumnSearchable( sColumnName ) )
- return sal_False;
- }
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- checkColumnIndex(column);
- sal_Bool bReadOnly = (m_xColumns->get())[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) &&
- ::cppu::any2bool((m_xColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)));
-
- return m_bReadOnly || bReadOnly || m_pTable->isReadOnly();
-}
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
-{
- return !isReadOnly(column);
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
deleted file mode 100644
index 134089fb40..0000000000
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
-#define CONNECTIVITY_SRESULSETMETADATA_HXX
-
-#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <vector>
-#include <rtl/ref.hxx>
-#include "MConnection.hxx"
-#include "MTable.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- //**************************************************************
- //************ Class: ResultSetMetaData
- //**************************************************************
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
-
- class OResultSetMetaData : public OResultSetMetaData_BASE
- {
- ::rtl::OUString m_aTableName;
- ::rtl::Reference<connectivity::OSQLColumns> m_xColumns;
- OTable* m_pTable;
- sal_Bool m_bReadOnly;
-
- protected:
- virtual ~OResultSetMetaData();
- public:
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- // OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){}
- OResultSetMetaData(const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
- const ::rtl::OUString& _aTableName,OTable* _pTable,sal_Bool aReadOnly
- )
- :m_aTableName(_aTableName)
- ,m_xColumns(_rxColumns)
- ,m_pTable(_pTable)
- ,m_bReadOnly(aReadOnly)
- {}
-
-
- /// Avoid ambigous cast error from the compiler.
- inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
- { return this; }
-
- void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
- }
-}
-
-#endif // CONNECTIVITY_SRESULSETMETADATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MServices.cxx b/connectivity/source/drivers/mozab/MServices.cxx
deleted file mode 100644
index 5e5fc0162a..0000000000
--- a/connectivity/source/drivers/mozab/MServices.cxx
+++ /dev/null
@@ -1,160 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MDriver.hxx"
-#include <cppuhelper/factory.hxx>
-#include <osl/diagnose.h>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include "bootstrap/MMozillaBootstrap.hxx"
-#include <tools/solar.h>
-
-using namespace connectivity::mozab;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::mozilla::XMozillaBootstrap;
-
-typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount* _pTemp
- );
-
-//---------------------------------------------------------------------------------------
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- sal_Char const* pImplementationName
- )
- : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- inline
- sal_Bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
- }
- catch(...)
- {
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-//---------------------------------------------------------------------------------------
-typedef void* (SAL_CALL * OMozillaBootstrap_CreateInstanceFunction)(const Reference< XMultiServiceFactory >& _rxFactory );
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createMozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
-{
- const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" )));
-
- // load the dbtools library
- oslModule s_hModule = osl_loadModuleRelative(
- reinterpret_cast< oslGenericFunction >(&createMozillaBootstrap),
- sModuleName.pData, 0);
- OSL_ENSURE(NULL != s_hModule, "MozabDriver::registerClient: could not load the dbtools library!");
- if (NULL != s_hModule)
- {
-
- // get the symbol for the method creating the factory
- const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OMozillaBootstrap_CreateInstance"));
- // reinterpret_cast<OMozabConnection_CreateInstanceFunction> removed GNU C
- OMozillaBootstrap_CreateInstanceFunction s_pCreationFunc = (OMozillaBootstrap_CreateInstanceFunction)osl_getFunctionSymbol(s_hModule, sFactoryCreationFunc.pData);
-
- if (NULL == s_pCreationFunc)
- { // did not find the symbol
- OSL_FAIL("MozabDriver::registerClient: could not find the symbol for creating the factory!");
- osl_unloadModule(s_hModule);
- s_hModule = NULL;
- }
- MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>((*s_pCreationFunc)(_rxFactory));
- return *pBootstrap;
- }
- return NULL;
-}
-//---------------------------------------------------------------------------------------
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
- if (pServiceManager)
- {
- OUString aImplName( OUString::createFromAscii( pImplementationName ) );
- ProviderRequest aReq(pServiceManager,pImplementationName);
- if (aImplName.equals( MozabDriver::getImplementationName_Static() ))
- {
- aReq.CREATE_PROVIDER(
- MozabDriver::getImplementationName_Static(),
- MozabDriver::getSupportedServiceNames_Static(),
- MozabDriver_CreateInstance, ::cppu::createSingleFactory);
- }
- else if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) ))
- {
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
- aReq.CREATE_PROVIDER(
- aImplName,
- aSNS,
- createMozillaBootstrap, ::cppu::createSingleFactory);
- }
- if(aReq.xRet.is())
- aReq.xRet->acquire();
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx
deleted file mode 100644
index d0428c744e..0000000000
--- a/connectivity/source/drivers/mozab/MStatement.cxx
+++ /dev/null
@@ -1,564 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <stdio.h>
-#include <osl/diagnose.h>
-#include <comphelper/property.hxx>
-#include <comphelper/uno3.hxx>
-#include <osl/thread.h>
-#include <tools/diagnose_ex.h>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <com/sun/star/container/XIndexAccess.hpp>
-
-#include <algorithm>
-
-#include "diagnose_ex.h"
-#include "MDriver.hxx"
-#include "MStatement.hxx"
-#include "MConnection.hxx"
-#include "MResultSet.hxx"
-#include "MDatabaseMetaData.hxx"
-#include "resource/mozab_res.hrc"
-#include "resource/common_res.hrc"
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-static ::osl::Mutex m_ThreadMutex;
-
-using namespace ::comphelper;
-using namespace connectivity::mozab;
-using namespace connectivity;
-//------------------------------------------------------------------------------
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::sdbc;
-using namespace com::sun::star::container;
-using namespace com::sun::star::io;
-using namespace com::sun::star::util;
-//------------------------------------------------------------------------------
-OCommonStatement::OCommonStatement(OConnection* _pConnection )
- :OCommonStatement_IBASE(m_aMutex)
- ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
- ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this)
- ,m_xDBMetaData(_pConnection->getMetaData())
- ,m_pTable(NULL)
- ,m_pConnection(_pConnection)
- ,m_aParser(_pConnection->getDriver()->getMSFactory())
- ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) )
- ,m_pParseTree(NULL)
- ,rBHelper(OCommonStatement_IBASE::rBHelper)
-{
- m_pConnection->acquire();
- OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" );
-}
-// -----------------------------------------------------------------------------
-OCommonStatement::~OCommonStatement()
-{
-}
-
-//------------------------------------------------------------------------------
-void OCommonStatement::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
-
- clearWarnings();
- clearCachedResultSet();
-
- if (m_pConnection)
- m_pConnection->release();
- m_pConnection = NULL;
-
- m_pSQLIterator->dispose();
-
- dispose_ChildImpl();
- OCommonStatement_IBASE::disposing();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OCommonStatement_IBASE::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
-{
- ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< XPropertySet > *)0 ));
-
- return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes());
-}
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- }
- dispose();
-}
-
-
-// -------------------------------------------------------------------------
-void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
-{
- if(m_pParseTree)
- {
- ::rtl::Reference<connectivity::OSQLColumns> xCreateColumn;
- if (m_pSQLIterator->getStatementType() == SQL_STATEMENT_CREATE_TABLE)
- {
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- OSL_ENSURE( !xTabs.empty(), "Need a Table");
- ::rtl::OUString ouTableName=xTabs.begin()->first;
- xCreateColumn = m_pSQLIterator->getCreateColumns();
- OSL_ENSURE(xCreateColumn.is(), "Need the Columns!!");
-
- const OColumnAlias& aColumnAlias = m_pConnection->getColumnAlias();
-
- OSQLColumns::Vector::const_iterator aIter = xCreateColumn->get().begin();
- const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
- ::rtl::OUString sName;
- for (sal_Int32 i = 1; aIter != xCreateColumn->get().end();++aIter, i++)
- {
- (*aIter)->getPropertyValue(sProprtyName) >>= sName;
- if ( !aColumnAlias.hasAlias( sName ) )
- {
-
- const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
- STR_INVALID_COLUMNNAME,
- "$columnname$", sName
- ) );
- ::dbtools::throwGenericSQLException(sError,*this);
- }
- }
- MDatabaseMetaDataHelper _aDbHelper;
- if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName))
- {
- getOwnConnection()->throwSQLException( _aDbHelper.getError(), *this );
- }
- m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator(
- m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) );
- }
-
- }
- else
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
-}
-// -------------------------------------------------------------------------
-OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
- throw ( SQLException, RuntimeException )
-{
- ::rtl::OUString aErr;
-
- m_pParseTree = m_aParser.parseTree(aErr,sql);
-
-#if OSL_DEBUG_LEVEL > 0
- {
- const char* str = OUtoCStr(sql);
- OSL_UNUSED( str );
- OSL_TRACE("ParseSQL: %s\n", OUtoCStr( sql ) );
- }
-#endif // OSL_DEBUG_LEVEL
-
- if(m_pParseTree)
- {
- m_pSQLIterator->setParseTree(m_pParseTree);
- m_pSQLIterator->traverseAll();
- const OSQLTables& xTabs = m_pSQLIterator->getTables();
- if(xTabs.empty())
- getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this );
-
-#if OSL_DEBUG_LEVEL > 0
- OSQLTables::const_iterator citer;
- for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) {
- OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) );
- }
-#endif
-
- Reference<XIndexAccess> xNames;
- switch(m_pSQLIterator->getStatementType())
- {
- case SQL_STATEMENT_SELECT:
-
- // at this moment we support only one table per select statement
-
- OSL_ENSURE( xTabs.begin() != xTabs.end(), "Need a Table");
-
- m_pTable = static_cast< OTable* > (xTabs.begin()->second.get());
- m_xColNames = m_pTable->getColumns();
- xNames = Reference<XIndexAccess>(m_xColNames,UNO_QUERY);
- // set the binding of the resultrow
- m_aRow = new OValueVector(xNames->getCount());
- (m_aRow->get())[0].setBound(sal_True);
- ::std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetBound(sal_False));
- // create the column mapping
- createColumnMapping();
-
- analyseSQL();
- return eSelect;
-
- case SQL_STATEMENT_CREATE_TABLE:
- createTable();
- return eCreateTable;
-
- default:
- break;
- }
- }
- else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo"
- // So we append ("E-mail" varchar) to the last of it to make it work
- {
- return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
- }
-
- getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- OSL_FAIL( "OCommonStatement::parseSql: unreachable!" );
- return eSelect;
-
-}
-// -------------------------------------------------------------------------
-Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery()
-{
- clearCachedResultSet();
-
- ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) );
- initializeResultSet( pResult.get() );
-
- pResult->executeQuery();
- cacheResultSet( pResult ); // only cache if we survived the execution
-
- return pResult.get();
-
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::initializeResultSet( OResultSet* _pResult )
-{
- ENSURE_OR_THROW( _pResult, "invalid result set" );
-
- _pResult->setColumnMapping(m_aColMapping);
- _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
- _pResult->setOrderByAscending(m_aOrderbyAscending);
- _pResult->setBindingRow(m_aRow);
- _pResult->setTable(m_pTable);
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::clearCachedResultSet()
-{
- Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY );
- if ( !xResultSet.is() )
- return;
-
- try
- {
- Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW );
- xCloseable->close();
- }
- catch( const DisposedException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- m_xResultSet = Reference< XResultSet >();
-}
-
-// -------------------------------------------------------------------------
-void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-{
- ENSURE_OR_THROW( _pResult.is(), "invalid result set" );
- m_xResultSet = Reference< XResultSet >( _pResult.get() );
-}
-
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
-
- Reference< XResultSet > xRS = executeQuery( sql );
- // returns true when a resultset is available
- return xRS.is();
-}
-// -------------------------------------------------------------------------
-
-Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_ThreadMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
-
- // parse the statement
- StatementType eStatementType = parseSql( sql );
- if ( eStatementType != eSelect )
- return NULL;
-
- return impl_executeCurrentQuery();
-}
-// -------------------------------------------------------------------------
-
-Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- // just return our connection here
- return (Reference< XConnection >)m_pConnection;
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
- if(!aRet.hasValue())
- aRet = OCommonStatement::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- return 0;
-
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- return makeAny(m_aLastWarning);
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
-
- m_aLastWarning = SQLWarning();
-}
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
-{
- // this properties are define by the service resultset
- // they must in alphabetic order
- Sequence< Property > aProps(9);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
-}
-
-// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
-{
- return *const_cast<OCommonStatement*>(this)->getArrayHelper();
-}
-// -------------------------------------------------------------------------
-sal_Bool OCommonStatement::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 /*nHandle*/,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- sal_Bool bConverted = sal_False;
- // here we have to try to convert
- return bConverted;
-}
-// -------------------------------------------------------------------------
-void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
-{
- // set the value to what ever is nescessary
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
-{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::acquire() throw()
-{
- OCommonStatement_IBASE::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OCommonStatement::release() throw()
-{
- relase_ChildImpl();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
-{
- OCommonStatement::acquire();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
-{
- OCommonStatement::release();
-}
-// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
-{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
-}
-// -----------------------------------------------------------------------------
-void OCommonStatement::createColumnMapping()
-{
- size_t i;
-
- // initialize the column index map (mapping select columns to table columns)
- ::rtl::Reference<connectivity::OSQLColumns> xColumns = m_pSQLIterator->getSelectColumns();
- m_aColMapping.resize(xColumns->get().size() + 1);
- for (i=0; i<m_aColMapping.size(); ++i)
- m_aColMapping[i] = i;
-
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
- // now check which columns are bound
-#if OSL_DEBUG_LEVEL > 0
- for ( i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("BEFORE Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
- OResultSet::setBoundedColumns(m_aRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping);
-#if OSL_DEBUG_LEVEL > 0
- for ( i = 0; i < m_aColMapping.size(); i++ )
- OSL_TRACE("AFTER Mapped: %d -> %d", i, m_aColMapping[i] );
-#endif
-}
-// -----------------------------------------------------------------------------
-
-void OCommonStatement::analyseSQL()
-{
- const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
- if(pOrderbyClause)
- {
- OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree");
-
- for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++)
- {
- OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
- OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree");
- OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree");
-
- OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
- if(!SQL_ISRULE(pColumnRef,column_ref))
- {
- throw SQLException();
- }
- OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
- setOrderbyColumn(pColumnRef,pAscendingDescending);
- }
- }
-}
-//------------------------------------------------------------------
-void OCommonStatement::setOrderbyColumn( OSQLParseNode* pColumnRef,
- OSQLParseNode* pAscendingDescending)
-{
- ::rtl::OUString aColumnName;
- if (pColumnRef->count() == 1)
- aColumnName = pColumnRef->getChild(0)->getTokenValue();
- else if (pColumnRef->count() == 3)
- {
- pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False );
- }
- else
- {
- throw SQLException();
- }
-
- Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY);
- if(!xColLocate.is())
- return;
-
- m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName));
-
- // Ascending or Descending?
- m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx
deleted file mode 100644
index 029615ba00..0000000000
--- a/connectivity/source/drivers/mozab/MStatement.hxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SSTATEMENT_HXX
-#define CONNECTIVITY_SSTATEMENT_HXX
-
-#include <com/sun/star/sdbc/XStatement.hpp>
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#include <com/sun/star/sdbc/XBatchExecution.hpp>
-#include <com/sun/star/sdbc/XCloseable.hpp>
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <comphelper/proparrhlp.hxx>
-#include <cppuhelper/compbase3.hxx>
-#include <comphelper/uno3.hxx>
-#include "connectivity/CommonTools.hxx"
-#ifndef INCLUDED_LIST
-#include <list>
-#define INCLUDED_LIST
-#endif
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <comphelper/broadcasthelper.hxx>
-#include "connectivity/sqliterator.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <connectivity/FValue.hxx>
-#include "TSortIndex.hxx"
-#include "MConnection.hxx"
-#include "MTable.hxx"
-
-#include <boost/shared_ptr.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class OResultSet;
-
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
-
- //**************************************************************
- //************ Class: OCommonStatement
- // is a base class for the normal statement and for the prepared statement
- //**************************************************************
- class OCommonStatement;
- typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE > OCommonStatement_SBASE;
-
- class OCommonStatement :public comphelper::OBaseMutex
- ,public OCommonStatement_IBASE
- ,public ::cppu::OPropertySetHelper
- ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
- ,public OCommonStatement_SBASE
- {
- friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
-
- private:
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
-
- protected:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet > m_xResultSet;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
-
- // for this Statement
-
- ::std::list< ::rtl::OUString> m_aBatchList;
-
- OTable* m_pTable;
- OConnection* m_pConnection; // The owning Connection object
-
- OValueRow m_aRow;
-
- connectivity::OSQLParser m_aParser;
- ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >
- m_pSQLIterator;
-
- connectivity::OSQLParseNode* m_pParseTree;
-
- ::std::vector<sal_Int32> m_aColMapping;
- ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
- ::std::vector<TAscendingOrder> m_aOrderbyAscending;
-
- ::cppu::OBroadcastHelper& rBHelper;
-
- protected:
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
- virtual ~OCommonStatement();
-
- protected:
- //
- // Driver Internal Methods
- //
- enum StatementType { eSelect, eCreateTable };
- /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
- */
- virtual StatementType
- parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- /** called to initialize a result set, according to a previously parsed SQL statement
- */
- virtual void initializeResultSet( OResultSet* _pResult );
- /** called when a possible cached instance of our last result set should be cleared
- */
- virtual void clearCachedResultSet();
- /** caches a result set which has just been created by an execution of an SQL statement
- */
- virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
-
-
- /** executes the current query (the one which has been passed to the last parseSql call)
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
- impl_executeCurrentQuery();
-
- void createColumnMapping();
- void analyseSQL();
- void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
- connectivity::OSQLParseNode* pAscendingDescending);
- virtual void createTable( ) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-
- public:
- // other methods
- OConnection* getOwnConnection() const { return m_pConnection;}
-
- OCommonStatement(OConnection* _pConnection );
- using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
-
- // XInterface
- virtual void SAL_CALL release() throw();
- virtual void SAL_CALL acquire() throw();
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- // XWarningsSupplier
- virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- protected:
- using OPropertySetHelper::getFastPropertyValue;
- };
-
- class OStatement : public OCommonStatement,
- public ::com::sun::star::lang::XServiceInfo
- {
- protected:
- ~OStatement(){}
- public:
- // a constructor, for when the object needs to be returned:
- OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){}
- DECLARE_SERVICE_INFO();
-
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- };
- }
-}
-#endif // CONNECTIVITY_SSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx
deleted file mode 100644
index d122794a64..0000000000
--- a/connectivity/source/drivers/mozab/MTable.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MTable.hxx"
-#include "MTables.hxx"
-#include "MColumns.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <comphelper/sequence.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/types.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/TKeys.hxx"
-#include "connectivity/TIndexes.hxx"
-#include "MCatalog.hxx"
-
-
-using namespace ::comphelper;
-using namespace connectivity::mozab;
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-
-OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection)
- :OTable_Base( _pTables, _pConnection, sal_True )
- ,m_pConnection( _pConnection )
-{
- construct();
-}
-// -------------------------------------------------------------------------
-OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection,
- const ::rtl::OUString& _Name, const ::rtl::OUString& _Type, const ::rtl::OUString& _Description )
- :OTable_Base(_pTables, _pConnection, sal_True, _Name, _Type, _Description )
- ,m_pConnection( _pConnection )
-{
- construct();
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createColumns( const TStringVector& _rNames )
-{
- return new OColumns( this, m_aMutex, _rNames );
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createKeys(const TStringVector& _rNames)
-{
- return new OKeysHelper( this, m_aMutex, _rNames );
-}
-
-//--------------------------------------------------------------------------
-sdbcx::OCollection* OTable::createIndexes(const TStringVector& _rNames)
-{
- return new OIndexesHelper( this, m_aMutex, _rNames );
-}
-
-// -----------------------------------------------------------------------------
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTable.hxx b/connectivity/source/drivers/mozab/MTable.hxx
deleted file mode 100644
index 7f1826257f..0000000000
--- a/connectivity/source/drivers/mozab/MTable.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
-#define _CONNECTIVITY_MOZAB_TABLE_HXX_
-
-#include "connectivity/TTableHelper.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include "MConnection.hxx"
-
-namespace connectivity
-{
- namespace mozab
- {
- typedef ::connectivity::OTableHelper OTable_Base;
-
- class OTable : public OTable_Base
- {
- OConnection* m_pConnection;
-
- public:
- OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection);
- OTable( sdbcx::OCollection* _pTables,
- OConnection* _pConnection,
- const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description );
-
- OConnection* getConnection() { return m_pConnection;}
-
- sal_Bool isReadOnly() const { return sal_False; }
-
- ::rtl::OUString getTableName() const { return m_Name; }
- ::rtl::OUString getSchema() const { return m_SchemaName; }
-
- // OTableHelper overridables
- virtual sdbcx::OCollection* createColumns( const TStringVector& _rNames );
- virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames);
- virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames);
- private:
- using OTable_Base::getConnection;
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_TABLE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx
deleted file mode 100644
index ebc913845e..0000000000
--- a/connectivity/source/drivers/mozab/MTables.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MTables.hxx"
-#include "MTable.hxx"
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/KeyRule.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#include "MCatalog.hxx"
-#include "MConnection.hxx"
-#include <comphelper/extract.hxx>
-#include "connectivity/dbtools.hxx"
-#include "connectivity/dbexception.hxx"
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/types.hxx>
-
-using namespace ::comphelper;
-using namespace connectivity;
-using namespace ::cppu;
-using namespace connectivity::mozab;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace dbtools;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
-sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName)
-{
- ::rtl::OUString aName,aSchema;
- // sal_Int32 nLen = _rName.indexOf('.');
- // aSchema = _rName.copy(0,nLen);
- // aName = _rName.copy(nLen+1);
- aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- aName = _rName;
-
- Sequence< ::rtl::OUString > aTypes(1);
- aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
- // aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE"));
- // aTypes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYSTEMTABLE"));
- ::rtl::OUString sEmpty;
-
- Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
-
- sdbcx::ObjectType xRet = NULL;
- if(xResult.is())
- {
- Reference< XRow > xRow(xResult,UNO_QUERY);
- if(xResult->next()) // there can be only one table with this name
- {
- OTable* pRet = new OTable( this, static_cast<OCatalog&>(m_rParent).getConnection(),
- aName,xRow->getString(4),xRow->getString(5));
- xRet = pRet;
- }
- }
- ::comphelper::disposeComponent(xResult);
-
- return xRet;
-}
-// -------------------------------------------------------------------------
-void OTables::impl_refresh( ) throw(RuntimeException)
-{
- static_cast<OCatalog&>(m_rParent).refreshTables();
-}
-// -------------------------------------------------------------------------
-void OTables::disposing(void)
-{
-m_xMetaData.clear();
- OCollection::disposing();
-}
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/MTables.hxx b/connectivity/source/drivers/mozab/MTables.hxx
deleted file mode 100644
index 437bbbe6c5..0000000000
--- a/connectivity/source/drivers/mozab/MTables.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
-#define _CONNECTIVITY_MOZAB_TABLES_HXX_
-
-#include "connectivity/sdbcx/VCollection.hxx"
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-namespace connectivity
-{
- namespace mozab
- {
- class OTables : public sdbcx::OCollection
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- // OCatalog* m_pParent;
- protected:
- virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- public:
- OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
- ,m_xMetaData(_rMetaData)
- {}
-
- // only the name is identical to ::cppu::OComponentHelper
- virtual void SAL_CALL disposing(void);
- };
- }
-}
-#endif // _CONNECTIVITY_MOZAB_TABLES_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
deleted file mode 100644
index c7e19eb0e8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
+++ /dev/null
@@ -1,283 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MMozillaBootstrap.hxx"
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-using namespace connectivity::mozab;
-#include <MNSFolders.hxx>
-#include "MNSProfileDiscover.hxx"
-#ifndef MINIMAL_PROFILEDISCOVER
-# include "MNSProfileManager.hxx"
-# include "MNSRunnable.hxx"
-#endif
-#include <MNSInit.hxx>
-
-static MozillaBootstrap *pMozillaBootstrap=NULL;
-static Reference<XMozillaBootstrap> xMozillaBootstrap;
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL OMozillaBootstrap_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
-{
- if (!pMozillaBootstrap)
- {
- pMozillaBootstrap=new connectivity::mozab::MozillaBootstrap( _rxFactory );
- pMozillaBootstrap->Init();
- xMozillaBootstrap = pMozillaBootstrap;
- }
- return pMozillaBootstrap;
-}
-
-// --------------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------------
-MozillaBootstrap::MozillaBootstrap(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
- : OMozillaBootstrap_BASE(m_aMutex), m_xMSFactory( _rxFactory )
-{
-}
-// -----------------------------------------------------------------------------
-MozillaBootstrap::~MozillaBootstrap()
-{
-}
-// -----------------------------------------------------------------------------
-void MozillaBootstrap::Init()
-{
- sal_Bool aProfileExists=sal_False;
-
-#ifndef MINIMAL_PROFILEDISCOVER
- //This must be call before any mozilla code
- MNS_Init(aProfileExists);
-
- m_ProfileManager = new ProfileManager();
-#else
- (void)aProfileExists; /* avoid warning about unused parameter */
-#endif
- m_ProfileAccess = new ProfileAccess();
- bootupProfile(::com::sun::star::mozilla::MozillaProductType_Mozilla,rtl::OUString());
-}
-
-// --------------------------------------------------------------------------------
-void MozillaBootstrap::disposing()
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- OMozillaBootstrap_BASE::disposing();
-}
-
-// static ServiceInfo
-//------------------------------------------------------------------------------
-rtl::OUString MozillaBootstrap::getImplementationName_Static( ) throw(RuntimeException)
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_MozillaBootstrap_IMPL_NAME));
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > MozillaBootstrap::getSupportedServiceNames_Static( ) throw (RuntimeException)
-{
- // which service is supported
- // for more information @see com.sun.star.mozilla.MozillaBootstrap
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
- return aSNS;
-}
-
-//------------------------------------------------------------------
-::rtl::OUString SAL_CALL MozillaBootstrap::getImplementationName( ) throw(RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------
-sal_Bool SAL_CALL MozillaBootstrap::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-
-// XProfileDiscover
-::sal_Int32 SAL_CALL MozillaBootstrap::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileCount(product);
-}
-::sal_Int32 SAL_CALL MozillaBootstrap::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileList(product,list);
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getDefaultProfile(product);
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfilePath(product,profileName);
-}
-::sal_Bool SAL_CALL MozillaBootstrap::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->isProfileLocked(product,profileName);
-}
-::sal_Bool SAL_CALL MozillaBootstrap::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_ProfileAccess->getProfileExists(product,profileName);
-}
-
-// XProfileManager
-::sal_Int32 SAL_CALL MozillaBootstrap::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->bootupProfile(product,profileName);
-#else
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return -1;
-#endif
-}
-::sal_Int32 SAL_CALL MozillaBootstrap::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->shutdownProfile();
-#else
- return -1;
-#endif
-}
-::com::sun::star::mozilla::MozillaProductType SAL_CALL MozillaBootstrap::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->getCurrentProduct();
-#else
- return ::com::sun::star::mozilla::MozillaProductType_Default;
-#endif
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->getCurrentProfile();
-#else
- return ::rtl::OUString();
-#endif
-}
-::sal_Bool SAL_CALL MozillaBootstrap::isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return isProfileLocked(getCurrentProduct(),m_ProfileManager->getCurrentProfile());
-#else
- return true;
-#endif
-}
-::rtl::OUString SAL_CALL MozillaBootstrap::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- return m_ProfileManager->setCurrentProfile(product,profileName);
-#else
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return ::rtl::OUString();
-#endif
-}
-
-// XProxyRunner
-::sal_Int32 SAL_CALL MozillaBootstrap::Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException)
-{
-#ifndef MINIMAL_PROFILEDISCOVER
- ::rtl::OUString profileName = aCode->getProfileName();
- ::rtl::OUString currProfileName = getCurrentProfile();
- ::com::sun::star::mozilla::MozillaProductType currProduct = getCurrentProduct();
-
- //if client provides a profileName, we will use it
- if (profileName.getLength()
- && ( aCode->getProductType() != currProduct || !profileName.equals(currProfileName)) )
- setCurrentProfile(aCode->getProductType(),profileName);
- MNSRunnable xRunnable;
-
- return xRunnable.StartProxy(aCode);;
-#else
- (void)aCode; /* avoid warning about unused parameter */
- return -1;
-#endif
-}
-
-#ifdef MINIMAL_PROFILEDISCOVER
-#include <cppuhelper/factory.hxx>
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
-{
- MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>(OMozillaBootstrap_CreateInstance(rServiceManager));
- return *pBootstrap;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
- const sal_Char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = 0;
-
- if (pServiceManager)
- {
- ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) );
- Reference< XSingleServiceFactory > xFactory;
- if (aImplName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")) ))
- {
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap"));
-
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< XMultiServiceFactory* > ( pServiceManager),
- aImplName, createInstance, aSNS );
- }
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx
deleted file mode 100644
index d605d4bb0a..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_SMOZILLABOOTSTRAP_HXX
-#define CONNECTIVITY_SMOZILLABOOTSTRAP_HXX
-
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase2.hxx>
-#include <osl/module.h>
-
-
-#define MOZAB_MozillaBootstrap_IMPL_NAME "com.sun.star.comp.mozilla.MozillaBootstrap"
-
-namespace connectivity
-{
- namespace mozab
- {
- typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::mozilla::XMozillaBootstrap,
- ::com::sun::star::lang::XServiceInfo > OMozillaBootstrap_BASE;
- class ProfileAccess;
- class ProfileManager;
- class MozillaBootstrap : public OMozillaBootstrap_BASE
- {
- protected:
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
-
- ::osl::Mutex m_aMutex; // mutex is need to control member access
- virtual ~MozillaBootstrap();
- protected:
- ProfileAccess * m_ProfileAccess;
- ProfileManager * m_ProfileManager;
- public:
-
- void Init();
- MozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
-
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XMozillaBootstrap
-
- // XProfileDiscover
- virtual ::sal_Int32 SAL_CALL getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
-
- // XProfileManager
- virtual ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isCurrentProfileLocked( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
-
- // XProxyRunner
- virtual ::sal_Int32 SAL_CALL Run( const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode ) throw (::com::sun::star::uno::RuntimeException);
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- & getMSFactory(void) const { return m_xMSFactory; }
-
- };
- }
-
-}
-
-#endif // CONNECTIVITY_SMozillaBootstrap_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
deleted file mode 100644
index 3dd647a9b4..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSFolders.hxx>
-
-#ifdef UNIX
-#include <sys/types.h>
-#include <strings.h>
-#include <string.h>
-#endif // End UNIX
-
-#ifdef WNT
-#include "pre_include_windows.h"
-#include <windows.h>
-#include <stdlib.h>
-#include <shlobj.h>
-#include <objidl.h>
-#include "post_include_windows.h"
-#endif // End WNT
-#include <osl/security.hxx>
-#include <osl/file.hxx>
-#include <osl/thread.h>
-
-using namespace ::com::sun::star::mozilla;
-
-namespace
-{
- // -------------------------------------------------------------------
- static ::rtl::OUString lcl_getUserDataDirectory()
- {
- ::osl::Security aSecurity;
- ::rtl::OUString aConfigPath;
-
- aSecurity.getConfigDir( aConfigPath );
- return aConfigPath + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- }
-
- // -------------------------------------------------------------------
- static const char* DefaultProductDir[3][3] =
- {
- #if defined(XP_WIN)
- { "Mozilla/SeaMonkey/", NULL, NULL },
- { "Mozilla/Firefox/", NULL, NULL },
- { "Thunderbird/", "Mozilla/Thunderbird/", NULL }
- #elif(MACOSX)
- { "../Mozilla/SeaMonkey/", NULL, NULL },
- { "Firefox/", NULL, NULL },
- { "../Thunderbird/", NULL, NULL }
- #else
- { ".mozilla/seamonkey/", NULL, NULL },
- { ".mozilla/firefox/", NULL, NULL },
- { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" }
- #endif
- };
-
- static const char* ProductRootEnvironmentVariable[3] =
- {
- "MOZILLA_PROFILE_ROOT",
- "MOZILLA_FIREFOX_PROFILE_ROOT",
- "MOZILLA_THUNDERBIRD_PROFILE_ROOT",
- };
-
- // -------------------------------------------------------------------
- static ::rtl::OUString lcl_guessProfileRoot( MozillaProductType _product )
- {
- size_t productIndex = _product - 1;
-
- static ::rtl::OUString s_productDirectories[3];
-
- if ( !s_productDirectories[ productIndex ].getLength() )
- {
- ::rtl::OUString sProductPath;
-
- // check whether we have an anevironment variable which helps us
- const char* pProfileByEnv = getenv( ProductRootEnvironmentVariable[ productIndex ] );
- if ( pProfileByEnv )
- {
- sProductPath = ::rtl::OUString( pProfileByEnv, rtl_str_getLength( pProfileByEnv ), osl_getThreadTextEncoding() );
- // asume that this is fine, no further checks
- }
- else
- {
- ::rtl::OUString sProductDirCandidate;
- const char* pProfileRegistry = "profiles.ini";
-
- // check all possible candidates
- for ( size_t i=0; i<3; ++i )
- {
- if ( NULL == DefaultProductDir[ productIndex ][ i ] )
- break;
-
- sProductDirCandidate = lcl_getUserDataDirectory() +
- ::rtl::OUString::createFromAscii( DefaultProductDir[ productIndex ][ i ] );
-
- // check existence
- ::osl::DirectoryItem aRegistryItem;
- ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + ::rtl::OUString::createFromAscii( pProfileRegistry ), aRegistryItem );
- if ( result == ::osl::FileBase::E_None )
- {
- ::osl::FileStatus aStatus( osl_FileStatus_Mask_Validate );
- result = aRegistryItem.getFileStatus( aStatus );
- if ( result == ::osl::FileBase::E_None )
- {
- // the registry file exists
- break;
- }
- }
- }
-
- ::osl::FileBase::getSystemPathFromFileURL( sProductDirCandidate, sProductPath );
- }
-
- s_productDirectories[ productIndex ] = sProductPath;
- }
-
- return s_productDirectories[ productIndex ];
- }
-}
-
-// -----------------------------------------------------------------------
-::rtl::OUString getRegistryDir(MozillaProductType product)
-{
- if (product == MozillaProductType_Default)
- return ::rtl::OUString();
-
- return lcl_guessProfileRoot( product );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
deleted file mode 100644
index a3a52f68e8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MNSFOLDERS_HXX_
-#define _MNSFOLDERS_HXX_
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-#include <rtl/ustring.hxx>
-
-::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product);
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
deleted file mode 100644
index b334bf6a85..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSINIParser.hxx>
-#include <rtl/byteseq.hxx>
-
-IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException )
-{
- OUString iniUrl;
- if (osl_File_E_None != osl_getFileURLFromSystemPath(rIniName.pData, &iniUrl.pData))
- return;
-
-
-#if OSL_DEBUG_LEVEL > 0
- OString sFile = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE(__FILE__" -- parser() - %s\n", sFile.getStr());
-#endif
- oslFileHandle handle=NULL;
- oslFileError fileError = osl_File_E_INVAL;
- try{
- if (iniUrl.getLength())
- fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read);
- }
- catch(::com::sun::star::io::IOException&)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() );
-#endif
- }
-
- if (osl_File_E_None == fileError)
- {
- rtl::ByteSequence seq;
- sal_uInt64 nSize = 0;
-
- osl_getFileSize(handle, &nSize);
- OUString sectionName( RTL_CONSTASCII_USTRINGPARAM( "no name section" ));
- while (true)
- {
- sal_uInt64 nPos;
- if (osl_File_E_None != osl_getFilePos(handle, &nPos) || nPos >= nSize)
- break;
- if (osl_File_E_None != osl_readLine(handle , (sal_Sequence **) &seq))
- break;
- OString line( (const sal_Char *) seq.getConstArray(), seq.getLength() );
- sal_Int32 nIndex = line.indexOf('=');
- if (nIndex >= 1)
- {
- ini_Section *aSection = &mAllSection[sectionName];
- struct ini_NameValue nameValue;
- nameValue.sName = OStringToOUString(
- line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US );
- nameValue.sValue = OStringToOUString(
- line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
-
- aSection->lList.push_back(nameValue);
-
- }
- else
- {
- sal_Int32 nIndexStart = line.indexOf('[');
- sal_Int32 nIndexEnd = line.indexOf(']');
- if ( nIndexEnd > nIndexStart && nIndexStart >=0)
- {
- sectionName = OStringToOUString(
- line.copy(nIndexStart + 1,nIndexEnd - nIndexStart -1).trim(), RTL_TEXTENCODING_ASCII_US );
- if (!sectionName.getLength())
- sectionName = OUString(RTL_CONSTASCII_USTRINGPARAM("no name section"));
-
- ini_Section *aSection = &mAllSection[sectionName];
- aSection->sName = sectionName;
- }
- }
- }
- osl_closeFile(handle);
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- {
- OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE( __FILE__" -- couldn't open file: %s", file_tmp.getStr() );
- }
-#endif
-}
-#if OSL_DEBUG_LEVEL > 0
-void IniParser::Dump()
-{
- IniSectionMap::iterator iBegin = mAllSection.begin();
- IniSectionMap::iterator iEnd = mAllSection.end();
- for(;iBegin != iEnd;iBegin++)
- {
- ini_Section *aSection = &(*iBegin).second;
- OString sec_name_tmp = OUStringToOString(aSection->sName, RTL_TEXTENCODING_ASCII_US);
- for(NameValueList::iterator itor=aSection->lList.begin();
- itor != aSection->lList.end();
- itor++)
- {
- struct ini_NameValue * aValue = &(*itor);
- OString name_tmp = OUStringToOString(aValue->sName, RTL_TEXTENCODING_ASCII_US);
- OString value_tmp = OUStringToOString(aValue->sValue, RTL_TEXTENCODING_UTF8);
- OSL_TRACE(
- " section=%s name=%s value=%s\n",
- sec_name_tmp.getStr(),
- name_tmp.getStr(),
- value_tmp.getStr() );
-
- }
- }
-
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
deleted file mode 100644
index 6cab8e3193..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef __MNSINIPARSER_HXX__
-#define __MNSINIPARSER_HXX__
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/io/IOException.hpp>
-#include <osl/process.h>
-
-#include <map>
-#include <list>
-
-#if OSL_DEBUG_LEVEL > 0
-#include <stdio.h>
-#endif
-
-using ::rtl::OUString;
-using ::rtl::OString;
-
-struct ini_NameValue
-{
- rtl::OUString sName;
- rtl::OUString sValue;
-
- inline ini_NameValue() SAL_THROW( () )
- {}
- inline ini_NameValue(
- OUString const & name, OUString const & value ) SAL_THROW( () )
- : sName( name ),
- sValue( value )
- {}
-};
-
-typedef std::list<
- ini_NameValue
-> NameValueList;
-
-struct ini_Section
-{
- rtl::OUString sName;
- NameValueList lList;
-};
-typedef std::map<rtl::OUString,
- ini_Section
- >IniSectionMap;
-
-
-class IniParser
-{
- IniSectionMap mAllSection;
-public:
- IniSectionMap * getAllSection(){return &mAllSection;};
- IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException );
-#if OSL_DEBUG_LEVEL > 0
- void Dump();
-#endif
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
deleted file mode 100644
index 1cffe198ba..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSInclude.hxx>
-
-#include "mozilla_nsinit.h"
-
-#include <MNSInit.hxx>
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <osl/file.hxx>
-#include <rtl/bootstrap.hxx>
-
-#include "MConfigAccess.hxx"
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-#include <MNSTerminateListener.hxx>
-
-static nsIServiceManager* sServiceManager = nsnull;
-static sal_Int32 sInitCounter = 0;
-static sal_Bool s_bProfilePresentAfterInitialized = sal_False;
-
-static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
-static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
-
-static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
-static oslThread m_Mozilla_UI_Thread;
-static PRBool aLive=1;
-static ::osl::Condition m_aUI_Thread_Condition;
-
-#define HACK_AROUND_THREADING_ISSUES
-#define HACK_AROUND_NONREENTRANT_INITXPCOM
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
-// XXX hack class to clean up XPCOM when this module is unloaded
-static PRBool sXPCOMInitializedFlag = PR_FALSE;
-#endif
-
-
-extern "C" void NS_SetupRegistry();
-
- const PRUnichar* determineProfile( PRUnichar const* const* _pValidProfiles, const PRUint32 _nValidProfiles )
-{
- // the fallback for the to-be-used user profile: the first profile
- const PRUnichar* pUsedProfile = *_pValidProfiles;
-
- // have a look what the configuration suggests as preferred profile
- // PRUnichar != sal_Unicode in mingw
- const PRUnichar* pPreferredProfile = reinterpret_cast_mingw_only< const PRUnichar* >( getUserProfile( ) );
- if ( pPreferredProfile && *pPreferredProfile )
- {
- PRUnichar const* const* pLoop = _pValidProfiles;
- PRUnichar const* const* pLoopEnd = pLoop + _nValidProfiles;
- for ( ; pLoop != pLoopEnd; ++pLoop )
- {
- // compare the current and the preferred profile
- // (by looping through the characters)
- const PRUnichar* pCurrent = *pLoop;
- const PRUnichar* pPref = pPreferredProfile;
- while ( *pCurrent && ( *pCurrent == *pPref ) ) // testing one of them against 0 is enough because of the second clause
- {
- ++pCurrent;
- ++pPref;
- }
- if ( *pCurrent == *pPref )
- // the are equal
- break;
- }
-
- if ( pLoop != pLoopEnd )
- pUsedProfile = *pLoop;
- return pUsedProfile;
- }
- else
- return NULL;
-}
-
-
-sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists)
-{
- nsresult rv;
- OSL_TRACE( "IN : MNS_InitXPCOM() \n" );
- // Reentrant calls to this method do nothing except increment a counter
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- // The first time, add another increment so that it'll be left until exit
- // for the final cleanup to happen
- sInitCounter++;
-#endif // HACK_AROUND_NONREENTRANT_INITXPCOM
-
- // Initialise XPCOM
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- // Can't call NS_InitXPCom more than once or things go boom!
- if (!sXPCOMInitializedFlag)
-#endif
- {
- nsCOMPtr<nsILocalFile> binDir;
- // Note: if path3 construction fails, mozilla will default to using MOZILLA_FIVE_HOME in the NS_InitXPCOM2()
- rtl::OUString path1(
-#if defined WNT
- RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")
-#else
- RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program")
-#endif
- );
- rtl::Bootstrap::expandMacros(path1);
- rtl::OString path2;
- if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
- osl::FileBase::E_None) &&
- path1.convertToString(
- &path2, osl_getThreadTextEncoding(),
- (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
- RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
- {
- nsDependentCString sPath(path2.getStr());
- rv = NS_NewNativeLocalFile(sPath, PR_TRUE, getter_AddRefs(binDir));
- if (NS_FAILED(rv))
- return sal_False;
- }
-
-
-
- // Initialise XPCOM
- NS_InitXPCOM2(&sServiceManager, binDir, NULL);
-
-// if (!sServiceManager)
-// return sal_False;
-
-#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
- sXPCOMInitializedFlag = PR_TRUE;
-#endif
- }
-
-
- // Create the Event Queue for the UI thread...
- //
- // If an event queue already exists for the thread, then
- // CreateThreadEventQueue(...) will fail...
- // CreateThread0ueue(...) will fail...
- nsCOMPtr<nsIEventQueueService> eventQService(
- do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID, &rv));
- if (NS_FAILED(rv))
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-
- eventQService->CreateThreadEventQueue();
-
-// nsCOMPtr<nsIObserver> mStartupNotifier = do_CreateInstance(NS_APPSTARTUPNOTIFIER_CONTRACTID, &rv);
-// if(NS_FAILED(rv))
-// return rv;
-// mStartupNotifier->Observe(nsnull, APPSTARTUP_TOPIC, nsnull);
-
-#ifdef HACK_AROUND_THREADING_ISSUES
- // XXX force certain objects to be created on the main thread
- nsCOMPtr<nsIStringBundleService> sBundleService;
- sBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
- if (NS_SUCCEEDED(rv))
- {
- nsCOMPtr<nsIStringBundle> stringBundle;
- const char* propertyURL = "chrome://necko/locale/necko.properties";
- rv = sBundleService->CreateBundle(propertyURL,
- getter_AddRefs(stringBundle));
- }
-#endif
-
- // Need to create a Pref Service
- nsCOMPtr< nsIPref > thePref = do_GetService( kPrefCID, &rv );
- if (NS_SUCCEEDED(rv) )
- {
- OSL_TRACE("Created an nsIPref i/f\n");
- thePref->ReadUserPrefs( nsnull );
- *aProfileExists = sal_True ;
- s_bProfilePresentAfterInitialized = sal_True;
- }
- OSL_TRACE( "OUT : MNS_InitXPCOM() - XPCOM Init\n" );
-
- return sal_True;
-}
-
-void MNS_XPCOM_EventLoop()
-{
- OSL_TRACE( "IN : MNS_XPCOM_EventLoop() \n" );
- nsresult rv;
- nsCOMPtr<nsIEventQueue> eventQ;
- nsCOMPtr<nsIEventQueueService> eventQService;
- rv=nsServiceManager::GetService(kEventQueueServiceCID,
- NS_GET_IID(nsIEventQueueService),
- getter_AddRefs(eventQService));
-
- if (NS_SUCCEEDED(rv))
- {
- rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD , getter_AddRefs(eventQ));
- if (NS_FAILED(rv))
- {
- rv = eventQService->CreateThreadEventQueue();
- if (NS_FAILED(rv))
- return ;
- else
- rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
- }
- }
-
- if (NS_FAILED(rv)) return ;
-
- PLEvent* event = nsnull;
- m_aUI_Thread_Condition.set(); //we are ready to recive event
- do
- {
- rv = eventQ->GetEvent(&event);
- if (NS_FAILED(rv))
- return ;
- if (event)
- eventQ->HandleEvent(event);
- }while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) && aLive );
-
- eventQ->ProcessPendingEvents();
- OSL_TRACE( "OUT : MNS_XPCOM_EventLoop() \n" );
-}
-
-extern "C" void MNS_Mozilla_UI_Thread( void *arg )
-{
- aLive=1;
- OSL_TRACE( "IN : MNS_Mozilla_UI_Thread() \n" );
- UI_Thread_ARGS * args = (UI_Thread_ARGS*) arg;
- sal_Bool* aProfileExists=args->bProfileExists;
- delete args;
- args=NULL;
-
- //Init xpcom
- if (!MNS_InitXPCOM(aProfileExists))
- {
- m_aUI_Thread_Condition.set(); // error happened
- return;
- }
-
- //do the mozilla event loop
- MNS_XPCOM_EventLoop();
- //we are interupted
-
- if (sServiceManager)
- {
- NS_RELEASE(sServiceManager);
-
- // Terminate XPCOM & cleanup
-#ifndef HACK_AROUND_NONREENTRANT_INITXPCOM
- NS_ShutdownXPCOM(sServiceManager);
-#endif
- }
-
- m_aUI_Thread_Condition.set(); //release all blocks
-
- OSL_TRACE( "OUT : MNS_Mozilla_UI_Thread() \n" );
-
-}
-
-
-sal_Bool MNS_Init(sal_Bool& aProfileExists)
-{
- aProfileExists = sal_False ;
-
- OSL_TRACE( "IN : MNS_Init() \n" );
- // Reentrant calls to this method do nothing except increment a counter
- sInitCounter++;
- if (sInitCounter > 1) {
- OSL_TRACE( "IN : MNS_Init() wait for xpcom to be initted \n" );
- //wait for xpcom to be initted
- m_aUI_Thread_Condition.wait();
-
- OSL_TRACE( "OUT : MNS_Init() : counter = %d\n", sInitCounter );
- aProfileExists = s_bProfilePresentAfterInitialized;
- return sal_True;
- }
-
- UI_Thread_ARGS * args = new UI_Thread_ARGS;
- args->bProfileExists = &aProfileExists;
-
- m_aUI_Thread_Condition.reset();
- m_Mozilla_UI_Thread=osl_createThread(MNS_Mozilla_UI_Thread,
- (void*)args);
- if (!m_Mozilla_UI_Thread)
- {
- return sal_False;
- }
-
- //wait for xpcom to be initted
- m_aUI_Thread_Condition.wait();
-
- //Add Terminate Listener to XDesktop to get application exit event
- MNSTerminateListener::addTerminateListener();
-
- OSL_TRACE( "OUT : MNS_Init() - First Init\n" );
-
- return sal_True;
-}
-
-sal_Bool MNS_Term(sal_Bool aForce)
-{
- // Reentrant calls to this method do nothing except decrement a counter
- OSL_TRACE( "IN : MNS_Term() \n" );
- if (!aForce && sInitCounter > 1)
- {
- --sInitCounter;
- OSL_TRACE( "OUT : MNS_Term() : counter = %d\n", sInitCounter );
- return sal_True;
- }
- sInitCounter = 0;
-
- aLive=0;
-
- //wait for xpcom to be finished
- TimeValue timeValue = { 1, 0 };
- m_aUI_Thread_Condition.wait(&timeValue);
-
-
- OSL_TRACE( "OUT : MNS_Term() - Final Term\n" );
- return sal_True;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx
deleted file mode 100644
index bfc141cc58..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NS_INIT_HXX_
-#define _CONNECTIVITY_MAB_NS_INIT_HXX_ 1
-#include "MNSDeclares.hxx"
-
-#include <sal/types.h>
-
-sal_Bool MNS_Init(sal_Bool& aProfileExists);
-sal_Bool MNS_Term(sal_Bool aForce=sal_False);
-
-sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists);
-typedef struct UI_Thread_ARGS
-{
- sal_Bool* bProfileExists;
-}UI_Thread_ARGS;
-void MNS_XPCOM_EventLoop();
-
-#endif // _CONNECTIVITY_MAB_NS_INIT_HXX_ 1
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
deleted file mode 100644
index a711b42230..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
+++ /dev/null
@@ -1,635 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfile.hxx"
-#include "MNSProfileDirServiceProvider.hxx"
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-
-using ::rtl::OUString;
-
-// Interfaces Needed
-
-static Reference<XMozillaBootstrap> xMozillaBootstrap;
-
-
-static PRInt32 gInstanceCount = 0;
-
-// Profile database to remember which profile has been
-// created with UILocale and contentLocale on profileManager
-static nsProfileDirServiceProvider *gDirServiceProvider = nsnull;
-
-
-
-
-/*
- * Constructor/Destructor
- */
-nsProfile::nsProfile()
-{
- mStartingUp = PR_FALSE;
- mCurrentProfileAvailable = PR_FALSE;
-
- mShutdownProfileToreDownNetwork = PR_FALSE;
-
- mProfileChangeVetoed = PR_FALSE;
- mProfileChangeFailed = PR_FALSE;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
-
-
-}
-
-nsProfile::~nsProfile()
-{
-}
-
-
-nsresult
-nsProfile::Init()
-{
- nsresult rv = NS_OK;
- RegisterProfileManager(this);
- if (gInstanceCount++ == 0) {
- rv = NS_NewProfileDirServiceProvider( &gDirServiceProvider);
- if (NS_SUCCEEDED(rv))
- rv = gDirServiceProvider->Register();
- }
- return rv;
-}
-
-/*
- * nsISupports Implementation
- */
-NS_IMPL_THREADSAFE_ADDREF(nsProfile)
-NS_IMPL_THREADSAFE_RELEASE(nsProfile)
-
-NS_INTERFACE_MAP_BEGIN(nsProfile)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProfile)
- NS_INTERFACE_MAP_ENTRY(nsIProfile)
- NS_INTERFACE_MAP_ENTRY(nsIProfileInternal)
- NS_INTERFACE_MAP_ENTRY(nsIProfileChangeStatus)
- NS_INTERFACE_MAP_ENTRY(nsIFactory)
-NS_INTERFACE_MAP_END
-
-/*
- * nsIProfileChangeStatus Implementation
- */
-
-NS_IMETHODIMP nsProfile::VetoChange()
-{
- mProfileChangeVetoed = PR_TRUE;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsProfile::ChangeFailed()
-{
- mProfileChangeFailed = PR_TRUE;
- return NS_OK;
-}
-/*
- * nsIProfile Implementation
- */
-
-NS_IMETHODIMP nsProfile::GetProfileCount(PRInt32 *numProfiles)
-{
- NS_ENSURE_ARG_POINTER(numProfiles);
-
- *numProfiles = 0;
-
- *numProfiles = xMozillaBootstrap->getProfileCount(xMozillaBootstrap->getCurrentProduct());
- return NS_OK;
-}
-NS_IMETHODIMP nsProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
-{
- NS_ENSURE_ARG_POINTER(length);
- NS_ENSURE_ARG_POINTER(profileNames);
- *profileNames = nsnull;
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > list;
-
- *length = xMozillaBootstrap->getProfileList(xMozillaBootstrap->getCurrentProduct(),list);
-
- const OUString * pArray = list.getConstArray();
-
- nsresult rv = NS_OK;
- PRInt32 count = list.getLength();
- PRUnichar **outArray, **next;
-
- next = outArray = (PRUnichar **)nsMemory::Alloc(count * sizeof(PRUnichar *));
- if (!outArray)
- return NS_ERROR_OUT_OF_MEMORY;
-
- for (PRInt32 index=0; index < count; index++)
- {
- *next = (PRUnichar *)nsMemory::Clone(pArray[index].getStr(),(pArray[index].getLength()+1) * sizeof(PRUnichar ));
- if (*next == nsnull)
- {
- rv = NS_ERROR_OUT_OF_MEMORY;
- break;
- }
- next++;
- }
- *profileNames = outArray;
- return rv;
-}
-NS_IMETHODIMP nsProfile::ProfileExists(const PRUnichar *profileName, PRBool *exists)
-{
- NS_ENSURE_ARG_POINTER(profileName);
- NS_ENSURE_ARG_POINTER(exists);
-
- // PRUnichar != sal_Unicode in mingw
- *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
- return NS_OK;
-}
-// Returns the name of the current profile i.e., the last used profile
-NS_IMETHODIMP
-nsProfile::GetCurrentProfile(PRUnichar **profileName)
-{
- NS_ENSURE_ARG_POINTER(profileName);
- *profileName = nsnull;
-
- if (mCurrentProfileName.Length())
- *profileName = (PRUnichar *)nsMemory::Clone(mCurrentProfileName.get(),(mCurrentProfileName.Length() + 1) * sizeof(PRUnichar ));
- else
- {
- rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(xMozillaBootstrap->getCurrentProduct());
- *profileName = (PRUnichar *)nsMemory::Clone(profile.getStr(),( profile.getLength() + 1) * sizeof(PRUnichar ));
- SetCurrentProfile(*profileName);
- }
-
- return (*profileName == nsnull) ? NS_ERROR_FAILURE : NS_OK;
-}
-
-NS_IMETHODIMP
-nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
-{
- NS_ENSURE_ARG(aCurrentProfile);
-
- nsresult rv;
- nsCOMPtr<nsIFile> profileDir;
- PRBool exists;
-
- // Ensure that the profile exists and its directory too.
- rv = GetProfileDir(aCurrentProfile, getter_AddRefs(profileDir));
- if (NS_FAILED(rv)) return rv;
- rv = profileDir->Exists(&exists);
- if (NS_FAILED(rv)) return rv;
- if (!exists) return NS_ERROR_FILE_NOT_FOUND;
-
- PRBool isSwitch = PRBool();
-
- if (mCurrentProfileAvailable)
- {
- nsXPIDLString currProfileName;
- rv = GetCurrentProfile(getter_Copies(currProfileName));
- if (NS_FAILED(rv)) return rv;
- if (nsCRT::strcmp(aCurrentProfile, currProfileName.get()) == 0)
- return NS_OK;
- else
- isSwitch = PR_TRUE;
- }
- else
- isSwitch = PR_FALSE;
-
-
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-
- nsISupports *subject = (nsISupports *)((nsIProfile *)this);
- NS_NAMED_LITERAL_STRING(switchString, "switch");
- NS_NAMED_LITERAL_STRING(startupString, "startup");
- const nsAFlatString& context = isSwitch ? switchString : startupString;
-
- if (isSwitch)
- {
- rv = ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);
- if (NS_FAILED(rv)) return NS_ERROR_ABORT;
-
- // Phase 1: See if anybody objects to the profile being changed.
- mProfileChangeVetoed = PR_FALSE;
- observerService->NotifyObservers(subject, "profile-approve-change", context.get());
- if (mProfileChangeVetoed)
- return NS_OK;
-
- // Phase 2a: Send the network teardown notification
- observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
- mShutdownProfileToreDownNetwork = PR_TRUE;
-
- // Phase 2b: Send the "teardown" notification
- observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
- if (mProfileChangeVetoed)
- {
- // Notify we will not proceed with changing the profile
- observerService->NotifyObservers(subject, "profile-change-teardown-veto", context.get());
-
- // Bring network back online and return
- observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
- return NS_OK;
- }
-
- // Phase 3: Notify observers of a profile change
- observerService->NotifyObservers(subject, "profile-before-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- }
-
-//
-// // Do the profile switch
- gDirServiceProvider->SetProfileDir(profileDir);
- mCurrentProfileName.Assign(aCurrentProfile);
-// gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
-
- if (NS_FAILED(rv)) return rv;
- mCurrentProfileAvailable = PR_TRUE;
-
- if (!isSwitch)
- {
- // Ensure that the prefs service exists so it can respond to
- // the notifications we're about to send around. It needs to.
- nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
- NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get prefs service");
- }
-
- if (mShutdownProfileToreDownNetwork)
- {
- // Bring network back online
- observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
- mShutdownProfileToreDownNetwork = PR_FALSE;
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
- }
-
- // Phase 4: Notify observers that the profile has changed - Here they respond to new profile
- observerService->NotifyObservers(subject, "profile-do-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- // Phase 5: Now observers can respond to something another observer did in phase 4
- observerService->NotifyObservers(subject, "profile-after-change", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- // Phase 6: One last notification after the new profile is established
- observerService->NotifyObservers(subject, "profile-initial-state", context.get());
- if (mProfileChangeFailed)
- return NS_ERROR_ABORT;
-
- return NS_OK;
-}
-/* void shutDownCurrentProfile (in unsigned long shutDownType); */
-NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType)
-{
- nsresult rv;
-
- // if shutDownType is not a well know value, skip the notifications
- // see DoOnShutdown() in nsAppRunner.cpp for where we use this behaviour to our benefit
- if (shutDownType == (PRUint32)SHUTDOWN_PERSIST || shutDownType == (PRUint32)SHUTDOWN_CLEANSE ) {
- nsCOMPtr<nsIObserverService> observerService =
- do_GetService("@mozilla.org/observer-service;1", &rv);
- NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
-
- nsISupports *subject = (nsISupports *)((nsIProfile *)this);
-
- NS_NAMED_LITERAL_STRING(cleanseString, "shutdown-cleanse");
- NS_NAMED_LITERAL_STRING(persistString, "shutdown-persist");
- const nsAFlatString& context = (shutDownType == (PRUint32)SHUTDOWN_CLEANSE) ? cleanseString : persistString;
-
- // Phase 1: See if anybody objects to the profile being changed.
- mProfileChangeVetoed = PR_FALSE;
- observerService->NotifyObservers(subject, "profile-approve-change", context.get());
- if (mProfileChangeVetoed)
- return NS_OK;
-
- // Phase 2a: Send the network teardown notification
- observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
- mShutdownProfileToreDownNetwork = PR_TRUE;
-
- // Phase 2b: Send the "teardown" notification
- observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
-
-
- // Phase 3: Notify observers of a profile change
- observerService->NotifyObservers(subject, "profile-before-change", context.get());
- }
-
-
- gDirServiceProvider->SetProfileDir(nsnull);
- mCurrentProfileAvailable = PR_FALSE;
- mCurrentProfileName.Truncate(0);
-
- return NS_OK;
-}
-/* void createNewProfile (in wstring profileName, in wstring nativeProfileDir, in wstring langcode, in boolean useExistingDir); */
-NS_IMETHODIMP nsProfile::CreateNewProfile(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*langcode*/, PRBool /*useExistingDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void renameProfile (in wstring oldName, in wstring newName); */
-NS_IMETHODIMP nsProfile::RenameProfile(const PRUnichar* /*oldName*/, const PRUnichar* /*newName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void deleteProfile (in wstring name, in boolean canDeleteFiles); */
-NS_IMETHODIMP nsProfile::DeleteProfile(const PRUnichar* /*name*/, PRBool /*canDeleteFiles*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void cloneProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-//nsIProfileInternal Implementation
-
-/* [noscript] void startupWithArgs (in nsICmdLineService cmdLine, in boolean canInteract); */
-class nsICmdLineService;
-
-NS_IMETHODIMP nsProfile::StartupWithArgs(nsICmdLineService* /*cmdLineArgs*/, PRBool /*canInteract*/)
-{
- Init();
- return NS_OK;
-}
-
-/* [noscript] readonly attribute boolean isStartingUp; */
-NS_IMETHODIMP nsProfile::GetIsStartingUp(PRBool *aIsStartingUp)
-{
- NS_ENSURE_ARG_POINTER(aIsStartingUp);
- *aIsStartingUp = mStartingUp;
- return NS_OK;
-}
-
-/* long get4xProfileCount (); */
-NS_IMETHODIMP nsProfile::Get4xProfileCount(PRInt32* /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void getProfileListX (in unsigned long which, out unsigned long length, [array, size_is (length), retval] out wstring profileNames); */
-NS_IMETHODIMP nsProfile::GetProfileListX(PRUint32 /*whichKind*/, PRUint32* /*length*/, PRUnichar*** /*profileNames*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateProfileInfo (); */
-NS_IMETHODIMP nsProfile::MigrateProfileInfo()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateAllProfiles (); */
-NS_IMETHODIMP nsProfile::MigrateAllProfiles()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void migrateProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::MigrateProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void remigrateProfile (in wstring profileName); */
-NS_IMETHODIMP nsProfile::RemigrateProfile(const PRUnichar* /*profileName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void forgetCurrentProfile (); */
-NS_IMETHODIMP nsProfile::ForgetCurrentProfile()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void createDefaultProfile (); */
-NS_IMETHODIMP nsProfile::CreateDefaultProfile()
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIFile getProfileDir (in wstring profileName); */
-// Gets the profiles directory for a given profile
-// Sets the given profile to be a current profile
-NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **profileDir)
-{
- NS_ENSURE_ARG(profileName);
- NS_ENSURE_ARG_POINTER(profileDir);
- *profileDir = nsnull;
-
- nsresult rv = NS_OK;
-
- // PRUnichar != sal_Unicode in mingw
- rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
-
- nsCOMPtr<nsILocalFile> localFile;
- // PRUnichar != sal_Unicode in mingw
- nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
-
- rv = NS_NewLocalFile(filePath, PR_TRUE,
- getter_AddRefs(localFile));
- if (localFile && NS_SUCCEEDED(rv))
- return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)profileDir);
- return rv;
-}
-
-/* wstring getProfilePath (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetProfilePath(const PRUnichar* /*profileName*/, PRUnichar** /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsILocalFile getOriginalProfileDir (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetOriginalProfileDir(const PRUnichar* /*profileName*/, nsILocalFile** /*originalDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* PRInt64 getProfileLastModTime (in wstring profileName); */
-NS_IMETHODIMP nsProfile::GetProfileLastModTime(const PRUnichar* /*profileName*/, PRInt64* /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute boolean automigrate; */
-NS_IMETHODIMP nsProfile::GetAutomigrate(PRBool* /*aAutomigrate*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP nsProfile::SetAutomigrate(PRBool /*aAutomigrate*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* readonly attribute nsIFile defaultProfileParentDir; */
-NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile** /*aDefaultProfileParentDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* readonly attribute wstring firstProfile; */
-NS_IMETHODIMP nsProfile::GetFirstProfile(PRUnichar **profileName)
-{
- NS_ENSURE_ARG_POINTER(profileName);
-
- return GetCurrentProfile(profileName);
-}
-
-/* attribute boolean startWithLastUsedProfile; */
-NS_IMETHODIMP nsProfile::GetStartWithLastUsedProfile(PRBool* /*aStartWithLastUsedProfile*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-NS_IMETHODIMP nsProfile::SetStartWithLastUsedProfile(PRBool /*aStartWithLastUsedProfile*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void updateRegistry (in nsIFile regName); */
-NS_IMETHODIMP nsProfile::UpdateRegistry(nsIFile* /*regName*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void getRegStrings (in wstring profileName, out wstring regString, out wstring regName, out wstring regEmail, out wstring regOption); */
-NS_IMETHODIMP nsProfile::GetRegStrings(const PRUnichar* /*profileName*/, PRUnichar** /*regString*/, PRUnichar** /*regName*/, PRUnichar** /*regEmail*/, PRUnichar** /*regOption*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void setRegStrings (in wstring profileName, in wstring regString, in wstring regName, in wstring regEmail, in wstring regOption); */
-NS_IMETHODIMP nsProfile::SetRegStrings(const PRUnichar* /*profileName*/, const PRUnichar* /*regString*/, const PRUnichar* /*regName*/, const PRUnichar* /*regEmail*/, const PRUnichar* /*regOption*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] string isRegStringSet (in wstring profileName); */
-NS_IMETHODIMP nsProfile::IsRegStringSet(const PRUnichar* /*profileName*/, char** /*_retval*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void createNewProfileWithLocales (in wstring profileName, in wstring nativeProfileDir, in wstring UILocale, in wstring contentLocale, in boolean useExistingDir); */
-NS_IMETHODIMP nsProfile::CreateNewProfileWithLocales(const PRUnichar* /*profileName*/, const PRUnichar* /*nativeProfileDir*/, const PRUnichar* /*UILocale*/, const PRUnichar* /*contentLocale*/, PRBool /*useExistingDir*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* boolean isCurrentProfileAvailable (); */
-NS_IMETHODIMP nsProfile::IsCurrentProfileAvailable(PRBool *available)
-{
- NS_ENSURE_ARG_POINTER(available);
-
- *available = mCurrentProfileAvailable;
- return NS_OK;
-}
-
-/* [noscript] void getCurrentProfileDir (out nsIFile profileDir); */
-// Returns the name of the current profile directory
-NS_IMETHODIMP nsProfile::GetCurrentProfileDir(nsIFile **profileDir)
-{
- NS_ENSURE_ARG_POINTER(profileDir);
- nsresult rv;
-
- nsXPIDLString profileName;
- rv = GetCurrentProfile(getter_Copies(profileName));
- if (NS_FAILED(rv)) return rv;
-
- rv = GetProfileDir(profileName, profileDir);
- if (NS_FAILED(rv)) return rv;
-
- return NS_OK;
-}
-
-//Implementation nsIFactory
-NS_IMETHODIMP
-nsProfile::LockFactory(PRBool /*aVal*/)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsProfile::CreateInstance(nsISupports* aOuter, const nsID& aIID,
- void** aResult)
-{
- if (aOuter)
- return NS_ERROR_NO_AGGREGATION;
- // return this object
- return QueryInterface(aIID, aResult);
-}
-
-//Register profile manager
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
-
-static const nsCID kProfileManagerCID = NS_PROFILE_CID;
-
-#define NS_PROFILE_CONTRACTID \
- "@mozilla.org/profile/manager;1"
-
-nsresult
-nsProfile::RegisterProfileManager(nsIProfile* aProfileService)
-{
- nsCOMPtr<nsIServiceManager> mgr;
- NS_GetServiceManager(getter_AddRefs(mgr));
-
- NS_ASSERTION(mgr, "Not initialized!");
-
- nsCOMPtr<nsIFactory> factory = do_QueryInterface(aProfileService);
- NS_ASSERTION(factory, "Supposed to be an nsIFactory!");
-
- nsCOMPtr<nsIComponentRegistrar> reg (do_QueryInterface(mgr));
- if (!reg)
- return NS_ERROR_NO_INTERFACE;
-
- return reg->RegisterFactory(kProfileManagerCID,
- "Profile Manager",
- NS_PROFILE_CONTRACTID,
- factory);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx
deleted file mode 100644
index 37939c4acc..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "mozilla_nsprofile.h"
-
-#define _MAX_LENGTH 256
-
-class nsProfile: public nsIProfileInternal,
- public nsIProfileChangeStatus,
- public nsIFactory
-{
- NS_DECL_ISUPPORTS
- NS_DECL_NSIPROFILE
- NS_DECL_NSIPROFILEINTERNAL
- NS_DECL_NSIPROFILECHANGESTATUS
- NS_DECL_NSIFACTORY
-
-private:
- PRBool mStartingUp;
- PRBool mProfileChangeVetoed;
- PRBool mProfileChangeFailed;
-
- nsString mCurrentProfileName;
- PRBool mCurrentProfileAvailable;
-
- PRBool mIsContentLocaleSpecified;
- nsCString mContentLocaleName;
-
- PRBool mShutdownProfileToreDownNetwork;
- nsresult Init();
-
-public:
- nsProfile();
- virtual ~nsProfile();
-
-public:
- //We register an factory for Mozilla profile service its CID and CONTRACTID are NS_PROFILE_CID and NS_PROFILE_CONTRACTID
- //After that, we does not need profile.dll/libprofile.so any more. Our profile service are diffrent from the orginal one in
- //these areas:
- //1. We do not lock Mozilla Profile,
- //2. We do not change Mozilla Profile settings. We do not change default profile, do not create new profiles and
- // do not write changes back to profile register
- //3. We support can load both Thunderbird profile and Mozilla profiles
- static nsresult RegisterProfileManager(nsIProfile* aProfileService);
-
-};
-
-extern nsresult ConvertStringToUnicode(nsCString& aCharset, const char* inString, nsAString& outString);
-extern nsresult GetPlatformCharset(nsCString& aCharset);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx
deleted file mode 100644
index ef6a88917b..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.cxx
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#if defined _MSC_VER
- #pragma warning(disable:4710)
-#endif
-
-#include "pre_include_mozilla.h"
-#include "MNSProfileDirServiceProvider.hxx"
-#include "nsIAtom.h"
-#include "nsStaticAtom.h"
-#include "nsILocalFile.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsISupportsUtils.h"
-#include "post_include_mozilla.h"
-
-
-
-#define PREFS_FILE_50_NAME NS_LITERAL_CSTRING("prefs.js")
-
-
-nsIAtom* nsProfileDirServiceProvider::sApp_PrefsDirectory50;
-nsIAtom* nsProfileDirServiceProvider::sApp_PreferencesFile50;
-nsIAtom* nsProfileDirServiceProvider::sApp_UserProfileDirectory50;
-
-
-//*****************************************************************************
-// nsProfileDirServiceProvider::nsProfileDirServiceProvider
-//*****************************************************************************
-
-nsProfileDirServiceProvider::nsProfileDirServiceProvider()
-{
-}
-
-
-nsProfileDirServiceProvider::~nsProfileDirServiceProvider()
-{
-}
-
-nsresult
-nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir)
-{
- if (mProfileDir) {
- PRBool isEqual;
- if (aProfileDir &&
- NS_SUCCEEDED(aProfileDir->Equals(mProfileDir, &isEqual)) && isEqual) {
- NS_WARNING("Setting profile dir to same as current");
- return NS_OK;
- }
- UndefineFileLocations();
- }
- mProfileDir = aProfileDir;
- if (!mProfileDir)
- return NS_OK;
-
- nsresult rv = EnsureProfileFileExists(mProfileDir);
- return rv;
-
-}
-
-nsresult
-nsProfileDirServiceProvider::Register()
-{
- nsCOMPtr<nsIDirectoryService> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!directoryService)
- return NS_ERROR_FAILURE;
- return directoryService->RegisterProvider(this);
-}
-
-nsresult
-nsProfileDirServiceProvider::Shutdown()
-{
- nsCOMPtr<nsIDirectoryService> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!directoryService)
- return NS_ERROR_FAILURE;
- return directoryService->UnregisterProvider(this);
-}
-
-// nsProfileDirServiceProvider::nsISupports
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsProfileDirServiceProvider,
- nsIDirectoryServiceProvider)
-
-// nsProfileDirServiceProvider::nsIDirectoryServiceProvider
-
-NS_IMETHODIMP
-nsProfileDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFile **_retval)
-{
- NS_ENSURE_ARG(prop);
- NS_ENSURE_ARG_POINTER(persistant);
- NS_ENSURE_ARG_POINTER(_retval);
-
- if (!mProfileDir)
- return NS_ERROR_FAILURE;
-
- *persistant = PR_TRUE;
- nsIFile* domainDir = mProfileDir;
-
-
- nsCOMPtr<nsIFile> localFile;
- nsresult rv = NS_ERROR_FAILURE;
-
- nsIAtom* inAtom = NS_NewAtom(prop);
- NS_ENSURE_TRUE(inAtom, NS_ERROR_OUT_OF_MEMORY);
-
- if (inAtom == sApp_PrefsDirectory50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- }
- else if (inAtom == sApp_PreferencesFile50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- if (NS_SUCCEEDED(rv))
- rv = localFile->AppendNative(PREFS_FILE_50_NAME);
- }
- else if (inAtom == sApp_UserProfileDirectory50) {
- rv = domainDir->Clone(getter_AddRefs(localFile));
- }
-
- NS_RELEASE(inAtom);
-
- if (localFile && NS_SUCCEEDED(rv))
- return CallQueryInterface(localFile, _retval);
-
- return rv;
-}
-
-//*****************************************************************************
-// Protected methods
-//*****************************************************************************
-
-nsresult
-nsProfileDirServiceProvider::Initialize()
-{
-
- static const nsStaticAtom provider_atoms[] = {
- { NS_APP_PREFS_50_DIR, &sApp_PrefsDirectory50 },
- { NS_APP_PREFS_50_FILE, &sApp_PreferencesFile50 },
- { NS_APP_USER_PROFILE_50_DIR, &sApp_UserProfileDirectory50 },
- { NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, nsnull },
- };
-
- // Register our directory atoms
- NS_RegisterStaticAtoms(provider_atoms, NS_ARRAY_LENGTH(provider_atoms));
-
- return NS_OK;
-}
-
-nsresult
-nsProfileDirServiceProvider::EnsureProfileFileExists(nsIFile *aFile)
-{
- nsresult rv;
- PRBool exists;
-
- rv = aFile->Exists(&exists);
- if (NS_FAILED(rv))
- return rv;
- if (exists)
- return NS_OK;
-
- nsCOMPtr<nsIFile> defaultsFile;
-
- // Attempt first to get the localized subdir of the defaults
- rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR, getter_AddRefs(defaultsFile));
- if (NS_FAILED(rv)) {
- // If that has not been defined, use the top level of the defaults
- rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(defaultsFile));
- if (NS_FAILED(rv))
- return rv;
- }
-
- mProfileDir = defaultsFile;
- return rv;
-}
-
-
-nsresult
-nsProfileDirServiceProvider::UndefineFileLocations()
-{
- nsresult rv;
-
- nsCOMPtr<nsIProperties> directoryService =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
- NS_ENSURE_TRUE(directoryService, NS_ERROR_FAILURE);
-
- (void) directoryService->Undefine(NS_APP_PREFS_50_DIR);
- (void) directoryService->Undefine(NS_APP_PREFS_50_FILE);
- (void) directoryService->Undefine(NS_APP_USER_PROFILE_50_DIR);
-
- return NS_OK;
-}
-
-//*****************************************************************************
-// Global creation function
-//*****************************************************************************
-
-nsresult NS_NewProfileDirServiceProvider(nsProfileDirServiceProvider** aProvider)
-{
- NS_ENSURE_ARG_POINTER(aProvider);
- *aProvider = nsnull;
-
- nsProfileDirServiceProvider *prov = new nsProfileDirServiceProvider();
- if (!prov)
- return NS_ERROR_OUT_OF_MEMORY;
- nsresult rv = prov->Initialize();
- if (NS_FAILED(rv)) {
- delete prov;
- return rv;
- }
- NS_ADDREF(*aProvider = prov);
- return NS_OK;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx
deleted file mode 100644
index 2efe916233..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDirServiceProvider.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "mozilla_nsprofiledirserviceprovider.h"
-
-// Forward Declarations
-class nsIAtom;
-
-// --------------------------------------------------------------------------------------
-// nsProfileDirServiceProvider - The nsIDirectoryServiceProvider implementation used for
-// profile-relative file locations.
-// --------------------------------------------------------------------------------------
-
-class nsProfileDirServiceProvider: public nsIDirectoryServiceProvider
-{
- NS_DECL_ISUPPORTS
- NS_DECL_NSIDIRECTORYSERVICEPROVIDER
-
- friend nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider**);
-
-public:
-
- virtual nsresult SetProfileDir(nsIFile* aProfileDir);
- virtual nsresult Register();
- virtual nsresult Shutdown();
-
-protected:
- nsProfileDirServiceProvider();
- virtual ~nsProfileDirServiceProvider();
-
- nsresult Initialize();
- nsresult EnsureProfileFileExists(nsIFile* profileDir);
- nsresult UndefineFileLocations();
-
-protected:
-
- // Atoms for file locations
- static nsIAtom* sApp_PrefsDirectory50;
- static nsIAtom* sApp_PreferencesFile50;
- static nsIAtom* sApp_UserProfileDirectory50;
-
- nsCOMPtr<nsIFile> mProfileDir;
-
-};
-
-
-// --------------------------------------------------------------------------------------
-
-/**
- * Global method to create an instance of nsProfileDirServiceProvider
- *
- * @param aNotifyObservers If true, will send out profile startup
- * notifications when the profile directory is set.
- * See nsIProfileChangeStatus.
- */
-
-nsresult NS_NewProfileDirServiceProvider( nsProfileDirServiceProvider** aProvider);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
deleted file mode 100644
index 2ae687fdc1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfileDiscover.hxx"
-#ifndef MINIMAL_PROFILEDISCOVER
-#include "MNSProfile.hxx"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIEnumerator.h"
-#include "prprf.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsEscape.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsILocalFile.h"
-#include "nsReadableUtils.h"
-
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#include <Processes.h>
-#include <CFBundle.h>
-#include "nsILocalFileMac.h"
-#endif
-
-#ifdef XP_UNIX
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include "prnetdb.h"
-#include "prsystem.h"
-#endif
-
-#ifdef VMS
-#include <rmsdef.h>
-#endif
-
-#include "nsICharsetConverterManager.h"
-#include "nsIPlatformCharset.h"
-
-
-#if defined (XP_UNIX)
-# define USER_ENVIRONMENT_VARIABLE "USER"
-# define LOGNAME_ENVIRONMENT_VARIABLE "LOGNAME"
-# define HOME_ENVIRONMENT_VARIABLE "HOME"
-# define PROFILE_NAME_ENVIRONMENT_VARIABLE "PROFILE_NAME"
-# define PROFILE_HOME_ENVIRONMENT_VARIABLE "PROFILE_HOME"
-# define DEFAULT_UNIX_PROFILE_NAME "default"
-# ifndef XP_MACOSX /* Don't use symlink-based locking on OS X */
-# define USE_SYMLINK_LOCKING
-# endif
-#endif
-
-// IID and CIDs of all the services needed
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
-#endif
-
-// Registry Keys
-
-static ::rtl::OUString szProfileSubtreeString( RTL_CONSTASCII_USTRINGPARAM( "Profiles" ));
-static ::rtl::OUString szCurrentProfileString( RTL_CONSTASCII_USTRINGPARAM( "CurrentProfile" ));
-static ::rtl::OUString szDirectoryString( RTL_CONSTASCII_USTRINGPARAM( "directory" ));
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-#include <MNSFolders.hxx>
-#include <MNSINIParser.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- ProfileStruct::ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- const ::rtl::OUString& aProfilePath
-#else
- nsILocalFile * aProfilePath
-#endif
- )
- {
- product=aProduct;
- profileName = aProfileName;
- profilePath = aProfilePath;
- }
- ::rtl::OUString ProfileStruct::getProfilePath()
- {
-#ifdef MINIMAL_PROFILEDISCOVER
- return profilePath;
-#else
- if (profilePath)
- {
- nsAutoString path;
- nsresult rv = profilePath->GetPath(path);
- NS_ENSURE_SUCCESS(rv, ::rtl::OUString());
- // PRUnichar != sal_Unicode in mingw
- return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(path.get()));
- }
- else
- return ::rtl::OUString();
-#endif
- }
-
- ProfileAccess::~ProfileAccess()
- {
- }
- ProfileAccess::ProfileAccess()
- {
- LoadProductsInfo();
- }
-
- sal_Int32 ProfileAccess::LoadProductsInfo()
- {
- //load SeaMonkey 2 profiles to m_ProductProfileList
- sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla);
-
- //load thunderbird profiles to m_ProductProfileList
- count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird);
-
- //load firefox profiles to m_ProductProfileList
- //firefox profile does not containt address book, but maybe others need them
- count += LoadXPToolkitProfiles(MozillaProductType_Firefox);
- return count;
- }
- //Thunderbird and firefox profiles are saved in profiles.ini
- sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
-
-#ifndef MINIMAL_PROFILEDISCOVER
- nsresult rv;
-#endif
- ::rtl::OUString regDir = getRegistryDir(product);
- ::rtl::OUString profilesIni( regDir );
- profilesIni += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("profiles.ini"));
- IniParser parser( profilesIni );
- IniSectionMap &mAllSection = *(parser.getAllSection());
-
- IniSectionMap::iterator iBegin = mAllSection.begin();
- IniSectionMap::iterator iEnd = mAllSection.end();
- for(;iBegin != iEnd;++iBegin)
- {
- ini_Section *aSection = &(*iBegin).second;
- ::rtl::OUString profileName;
- ::rtl::OUString profilePath;
- ::rtl::OUString sIsRelative;
- ::rtl::OUString sIsDefault;
-
- for(NameValueList::iterator itor=aSection->lList.begin();
- itor != aSection->lList.end();
- ++itor)
- {
- struct ini_NameValue * aValue = &(*itor);
- if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))))
- {
- profileName = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsRelative"))))
- {
- sIsRelative = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Path"))))
- {
- profilePath = aValue->sValue;
- }
- else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default"))))
- {
- sIsDefault = aValue->sValue;
- }
- }
- if (profileName.getLength() != 0 || profilePath.getLength() != 0)
- {
-#ifndef MINIMAL_PROFILEDISCOVER
- sal_Int32 isRelative = 0;
- if (sIsRelative.getLength() != 0)
- {
- isRelative = sIsRelative.toInt32();
- }
-
- nsCOMPtr<nsILocalFile> rootDir;
- rv = NS_NewLocalFile(EmptyString(), PR_TRUE,
- getter_AddRefs(rootDir));
- if (NS_FAILED(rv)) continue;
-
- OString sPath = OUStringToOString(profilePath, RTL_TEXTENCODING_UTF8);
- nsCAutoString filePath(sPath.getStr());
-
- if (isRelative) {
- // PRUnichar != sal_Unicode in mingw
- nsAutoString registryDir( reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()) );
- nsCOMPtr<nsILocalFile> mAppData;
- rv = NS_NewLocalFile(registryDir, PR_TRUE,
- getter_AddRefs(mAppData));
- if (NS_FAILED(rv)) continue;
- rv = rootDir->SetRelativeDescriptor(mAppData, filePath);
- } else {
- rv = rootDir->SetPersistentDescriptor(filePath);
- }
- if (NS_FAILED(rv)) continue;
-#endif
-
- ProfileStruct* profileItem = new ProfileStruct(product,profileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- regDir + profilePath
-#else
- rootDir
-#endif
- );
- m_Product.mProfileList[profileName] = profileItem;
-
- sal_Int32 isDefault = 0;
- if (sIsDefault.getLength() != 0)
- {
- isDefault = sIsDefault.toInt32();
- }
- if (isDefault)
- m_Product.mCurrentProfileName = profileName;
-
- }
-
- }
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
-
- ::rtl::OUString ProfileAccess::getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end())
- {
- //Profile not found
- return ::rtl::OUString();
- }
- else
- return m_Product.mProfileList[profileName]->getProfilePath();
- }
-
- ::sal_Int32 ProfileAccess::getProfileCount( ::com::sun::star::mozilla::MozillaProductType product) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
- ::sal_Int32 ProfileAccess::getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- list.realloc(static_cast<sal_Int32>(m_Product.mProfileList.size()));
- sal_Int32 i=0;
- for(ProfileList::iterator itor=m_Product.mProfileList.begin();
- itor != m_Product.mProfileList.end();
- itor++)
- {
- ProfileStruct * aProfile = (*itor).second;
- list[i] = aProfile->getProfileName();
- i++;
- }
-
- return static_cast< ::sal_Int32 >(m_Product.mProfileList.size());
- }
-
- ::rtl::OUString ProfileAccess::getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (m_Product.mCurrentProfileName.getLength() != 0)
- {
- //default profile setted in mozilla registry
- return m_Product.mCurrentProfileName;
- }
- if (m_Product.mProfileList.size() == 0)
- {
- //there are not any profiles
- return ::rtl::OUString();
- }
- ProfileStruct * aProfile = (*m_Product.mProfileList.begin()).second;
- return aProfile->getProfileName();
- }
-#ifndef MINIMAL_PROFILEDISCOVER
- nsresult ProfileAccess::isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist)
- {
- nsresult rv;
- nsAutoString path;
- aFile->GetPath(path);
- rv = aFile->Exists(bExist);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!*bExist)
- {
- rv = aFile->IsSymlink(bExist);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
- }
- nsresult ProfileAccess::isLockExist(nsILocalFile* aFile)
- {
-#if defined (XP_MACOSX)
- NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
- NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
-#elif defined (XP_UNIX)
- NS_ConvertASCIItoUTF16 OLD_LOCKFILE_NAME("lock");
- NS_ConvertASCIItoUTF16 LOCKFILE_NAME(".parentlock");
-#else
- NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
- NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, "parent.lock");
-#endif
-
- nsresult rv;
-
- PRBool isDir;
- rv = aFile->IsDirectory(&isDir);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!isDir)
- return NS_ERROR_FILE_NOT_DIRECTORY;
-
- nsCOMPtr<nsILocalFile> lockFile;
- rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(lockFile)));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = lockFile->Append(LOCKFILE_NAME);
- NS_ENSURE_SUCCESS(rv, rv);
- PRBool nExist=PR_FALSE;
- rv = isExistFileOrSymlink(lockFile,&nExist);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!nExist) // Check OLD_LOCKFILE_NAME
- {
- nsCOMPtr<nsILocalFile> oldlockFile;
- rv = aFile->Clone((nsIFile **)((void **)getter_AddRefs(oldlockFile)));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = oldlockFile->Append(OLD_LOCKFILE_NAME);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = isExistFileOrSymlink(oldlockFile,&nExist);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return nExist;
- }
-
-#endif
- ::sal_Bool ProfileAccess::isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
-#ifdef MINIMAL_PROFILEDISCOVER
- (void)product; /* avoid warning about unused parameter */
- (void)profileName; /* avoid warning about unused parameter */
- return sal_True;
-#else
- ::rtl::OUString path = getProfilePath(product,profileName);
- if (!path.getLength())
- return sal_True;
-
- // PRUnichar != sal_Unicode in mingw
- nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
-
- nsresult rv;
- nsCOMPtr<nsILocalFile> localFile;
- rv = NS_NewLocalFile(filePath, PR_TRUE,
- getter_AddRefs(localFile));
- NS_ENSURE_SUCCESS(rv,sal_True);
-
- PRBool exists = PR_FALSE;
- rv = localFile->Exists(&exists);
- NS_ENSURE_SUCCESS(rv, sal_True);
- if (!exists)
- return sal_True;
-
- // If the profile is locked, we return true
- rv = isLockExist(localFile);
- if (rv)
- return sal_True;
- return sal_False;
-#endif
- }
-
- ::sal_Bool ProfileAccess::getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- sal_Int32 index=product;
- ProductStruct &m_Product = m_ProductProfileList[index];
- if (!m_Product.mProfileList.size() || m_Product.mProfileList.find(profileName) == m_Product.mProfileList.end())
- {
- return sal_False;
- }
- else
- return sal_True;
- }
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
deleted file mode 100644
index a99f335479..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __MNSProfileDiscover_h___
-#define __MNSProfileDiscover_h___
-
-#ifndef MINIMAL_PROFILEDISCOVER
-#include "mozilla_profile_discover.h"
-#endif
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustring.hxx>
-
-#include <vector>
-#include <map>
-
-using namespace com::sun::star::mozilla;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileStruct;
- }
-}
-typedef ::std::map < ::rtl::OUString, ::connectivity::mozab::ProfileStruct* > ProfileList;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileStruct
- {
- public:
- ProfileStruct(MozillaProductType aProduct,::rtl::OUString aProfileName,
-#ifdef MINIMAL_PROFILEDISCOVER
- const ::rtl::OUString &aProfilePath
-#else
- nsILocalFile * aProfilePath
-#endif
- );
- MozillaProductType getProductType() { return product;}
- ::rtl::OUString getProfileName(){ return profileName;}
- ::rtl::OUString getProfilePath() ;
-#ifndef MINIMAL_PROFILEDISCOVER
- nsILocalFile *getProfileLocal(){ return profilePath;}
-#endif
- protected:
- MozillaProductType product;
- ::rtl::OUString profileName;
-#ifdef MINIMAL_PROFILEDISCOVER
- ::rtl::OUString profilePath;
-#else
- nsCOMPtr<nsILocalFile> profilePath;
-#endif
- };
-
- class ProductStruct
- {
- public:
- void setCurrentProfile(::rtl::OUString aProfileName){mCurrentProfileName = aProfileName;}
-
- ::rtl::OUString mCurrentProfileName;
-
- ProfileList mProfileList;
- };
-
- //Used to query profiles information
- class ProfileAccess
- {
- public:
-
- virtual ~ProfileAccess();
- ProfileAccess();
- ::rtl::OUString getProfilePath( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Int32 getProfileCount( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Int32 getProfileList( ::com::sun::star::mozilla::MozillaProductType product, ::com::sun::star::uno::Sequence< ::rtl::OUString >& list ) throw (::com::sun::star::uno::RuntimeException);
- ::rtl::OUString getDefaultProfile( ::com::sun::star::mozilla::MozillaProductType product ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Bool SAL_CALL isProfileLocked( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- ::sal_Bool SAL_CALL getProfileExists( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException);
- protected:
- ProductStruct m_ProductProfileList[4];
- sal_Int32 LoadProductsInfo();
- sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
-#ifndef MINIMAL_PROFILEDISCOVER
- //used by isProfileLocked
- nsresult isExistFileOrSymlink(nsILocalFile* aFile,PRBool *bExist);
- nsresult isLockExist(nsILocalFile* aFile);
-#endif
- };
-
- }
-}
-
-#endif // __MNSProfileDiscover_h___
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
deleted file mode 100644
index 2978c16fa1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MNSProfileManager.hxx"
-#include "MNSProfile.hxx"
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-#include <MNSFolders.hxx>
-#include <MNSINIParser.hxx>
-
-static ::sal_Int32 nInitCounter=0;
-namespace connectivity
-{
- namespace mozab
- {
-
- ProfileManager::~ProfileManager()
- {
- }
- ProfileManager::ProfileManager()
- :m_CurrentProduct(MozillaProductType_Mozilla)
- ,aProfile(NULL)
- {
- }
- ::sal_Int32 ProfileManager::bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- if (!aProfile)
- {
- aProfile=new nsProfile();
- aProfile->StartupWithArgs(NULL,sal_False);
- }
-
- setCurrentProfile(product,profileName);
- return ++nInitCounter;
- }
- ::sal_Int32 ProfileManager::shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return --nInitCounter;
- }
- ::com::sun::star::mozilla::MozillaProductType ProfileManager::getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return m_CurrentProduct;
- }
- ::rtl::OUString ProfileManager::getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException)
- {
- nsresult rv;
- nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
- if (NS_FAILED(rv)) return ::rtl::OUString();
- nsXPIDLString currentProfileStr;
- //call GetCurrentProfile before call SetCurrentProfile will get the default profile
- rv = theProfile->GetCurrentProfile(getter_Copies(currentProfileStr));
- if (NS_FAILED(rv) || currentProfileStr.get() == nsnull)
- return ::rtl::OUString();
- // PRUnichar != sal_Unicode in mingw
- return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(currentProfileStr.get()));
- }
- ::rtl::OUString ProfileManager::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
- {
- ::rtl::OUString currentProfile = getCurrentProfile();
- //if profileName not given, then skip and return curernt profile
- if (!profileName.getLength() && m_CurrentProduct == product)
- return currentProfile;
-
- if (m_CurrentProduct == product && profileName.equals(currentProfile))
- return currentProfile;
- //set current product
- m_CurrentProduct = product;
-
- //get profile mozilla profile service
- nsresult rv;
- nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
- if (NS_FAILED(rv)) return ::rtl::OUString();
-
- // PRUnichar != sal_Unicode in mingw
- const PRUnichar* pUsedProfile = reinterpret_cast_mingw_only<const PRUnichar *>(profileName.getStr());
- //set current profile
- rv = theProfile->SetCurrentProfile( pUsedProfile );
- if (NS_FAILED(rv)) return ::rtl::OUString();
- return currentProfile;
- }
-
-
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx
deleted file mode 100644
index f7ff7e69a1..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __MNSProfileManager_h___
-#define __MNSProfileManager_h___
-
-#include "mozilla_profilemanager.h"
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-#include <osl/conditn.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/ustring.hxx>
-#include <vector>
-#include <map>
-
-using namespace com::sun::star::mozilla;
-class nsProfile;
-namespace connectivity
-{
- namespace mozab
- {
- class ProfileManager
- {
- public:
-
- virtual ~ProfileManager();
- ProfileManager();
-
- ::sal_Int32 SAL_CALL bootupProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ;
- ::sal_Int32 SAL_CALL shutdownProfile( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::com::sun::star::mozilla::MozillaProductType SAL_CALL getCurrentProduct( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::rtl::OUString SAL_CALL getCurrentProfile( ) throw (::com::sun::star::uno::RuntimeException) ;
- ::rtl::OUString SAL_CALL setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException) ;
-
- protected:
- ::com::sun::star::mozilla::MozillaProductType m_CurrentProduct;
- nsProfile *aProfile;
- };
-
- }
-}
-
-#endif // __MNSProfileManager_h___
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx
deleted file mode 100644
index 6461215532..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.cxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MNSRunnable.hxx"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MQuery.hxx"
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include "pre_include_mozilla.h"
-#include <nsIProxyObjectManager.h>
-// More Mozilla includes for LDAP Connection Test
-#include "prprf.h"
-#include "nsILDAPURL.h"
-#include "nsILDAPMessage.h"
-#include "nsILDAPMessageListener.h"
-#include "nsILDAPErrors.h"
-#include "nsILDAPConnection.h"
-#include "nsILDAPOperation.h"
-#include "post_include_mozilla.h"
-
-using namespace connectivity::mozab;
-
-/* Implementation file */
-NS_IMPL_ISUPPORTS1(MNSRunnable, nsIRunnable)
-
-static ::osl::Mutex m_aThreadMutex;
-
-nsIRunnable * MNSRunnable::ProxiedObject()
-{
- if (!_ProxiedObject)
- {
-
- nsresult rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ,
- NS_GET_IID(nsIRunnable),
- this,
- PROXY_SYNC,
- (void**)&_ProxiedObject);
- (void)rv;
-
- _ProxiedObject->AddRef();
- }
- return _ProxiedObject;
-}
-
-MNSRunnable::MNSRunnable()
-{
- NS_INIT_ISUPPORTS();
- _ProxiedObject=NULL;
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
- AddRef();
-}
-
-MNSRunnable::~MNSRunnable()
-{
-}
-sal_Int32 MNSRunnable::StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode)
-{
- OSL_TRACE( "IN : MNSRunnable::StartProxy() \n" );
- ::osl::MutexGuard aGuard(m_aThreadMutex);
- xCode = aCode;
- return ProxiedObject()->Run();
-}
-
-
-NS_IMETHODIMP MNSRunnable::Run()
-{
- return static_cast<nsresult>(xCode->run());
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx
deleted file mode 100644
index 093e2d157c..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/MNSRunnable.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_
-#define _CONNECTIVITY_MAB_MOZAB_RUNNABLE_HXX_
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-
-#include <MNSInclude.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/mozilla/XCodeProxy.hpp>
-
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::mozilla;
-
-namespace connectivity
-{
- namespace mozab
- {
- class MNSRunnable : public nsIRunnable
- {
- public:
- nsIRunnable * ProxiedObject();
- MNSRunnable();
- virtual ~MNSRunnable();
- NS_DECL_ISUPPORTS
- NS_DECL_NSIRUNNABLE
-
- public:
- sal_Int32 StartProxy(const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy >& aCode); //Call this to start proxy
-
- private:
- nsIRunnable* _ProxiedObject;
- Reference<XCodeProxy> xCode;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
- };
- }
-}
-#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
deleted file mode 100755
index c4c1d21106..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-CALL_CDECL=TRUE
-
-PRJ=..$/..$/..$/..
-PRJINC=..$/..$/..
-PRJNAME=connectivity
-TARGET=mozbootstrap
-
-# --- Settings ----------------------------------
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-# --- begin of mozilla specific stuff
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-# --- end of mozilla specific stuff
-
-.INCLUDE : settings.mk
-
-.INCLUDE : $(PRJ)$/version.mk
-
-.INCLUDE : ../makefile_mozab.mk
-
-INCPRE += -I../mozillasrc
-
-# --- Files -------------------------------------
-
-SLOFILES += \
- $(SLO)$/MNSINIParser.obj \
- $(SLO)$/MNSProfileDiscover.obj \
- $(SLO)$/MMozillaBootstrap.obj \
- $(SLO)$/MNSFolders.obj
-
-.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES" ) || ( "$(WITH_MOZILLA)" == "NO" ) || ( "$(OS)" == "MACOSX" )
-CDEFS+=-DMINIMAL_PROFILEDISCOVER
-
-SHL1TARGET=$(TARGET)
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1OBJS=$(SLOFILES)
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(COMPHELPERLIB)
-
-ALLTAR : $(MISC)/mozbootstrap.component
-
-$(MISC)/mozbootstrap.component .ERRREMOVE : \
- $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component
-
-.ELSE
-SLOFILES += \
- $(SLO)$/MNSInit.obj \
- $(SLO)$/MNSProfileManager.obj \
- $(SLO)$/MNSRunnable.obj \
- $(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj
-.ENDIF
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
deleted file mode 100755
index 5da158924a..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap">
- <service name="com.sun.star.mozilla.MozillaBootstrap"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h
deleted file mode 100755
index e34bc21913..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsIServiceManager.h"
-#include "nsIEventQueueService.h"
-#include "nsIChromeRegistry.h"
-
-#include "nsIStringBundle.h"
-
-#include "nsIDirectoryService.h"
-#include "nsIProfile.h"
-#include "nsIProfileInternal.h"
-#include "nsIPref.h"
-#include "nsXPIDLString.h"
-
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsEmbedAPI.h"
-
-#include "nsDirectoryService.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h
deleted file mode 100755
index 4d65bc3cb5..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nscore.h"
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIFactory.h"
-#include "nsIComponentManager.h"
-#include "nsIEnumerator.h"
-#include "nsXPIDLString.h"
-#include "nsEscape.h"
-#include "nsIURL.h"
-
-#include "prprf.h"
-
-#include "nsIProfile.h"
-#include "nsIProfileInternal.h"
-#include "nsIProfileStartupListener.h"
-#include "nsIProfileChangeStatus.h"
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsIRegistry.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsIDirectoryService.h"
-#include "nsIFactory.h"
-
-#include "nsIIOService.h"
-#include "nsNetUtil.h"
-#include "nsFileStream.h"
-#include "nsIStreamListener.h"
-#include "nsIServiceManager.h"
-#include "nsCOMPtr.h"
-#include "nsIModule.h"
-#include "nsIGenericFactory.h"
-#include "nsICategoryManager.h"
-#include "nsXPCOM.h"
-#include "nsISupportsPrimitives.h"
-#include "nsIDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsIChromeRegistry.h" // chromeReg
-#include "nsIStringBundle.h"
-#include "nsIObserverService.h"
-#include "nsHashtable.h"
-#include "nsIAtom.h"
-#include "nsCRT.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h
deleted file mode 100755
index 4bb836ed13..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsIDirectoryService.h"
-#include "nsILocalFile.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h
deleted file mode 100755
index 03198dcab8..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIRegistry.h"
-#include "nsXPIDLString.h"
-#include "nsVoidArray.h"
-#include "nsIFile.h"
-#include "nsILocalFile.h"
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h
deleted file mode 100755
index 1579b16947..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include "nsCOMPtr.h"
-#include "nsISupports.h"
-#include "nsString.h"
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include "nsIRegistry.h"
-#include "nsXPIDLString.h"
-#include "nsVoidArray.h"
-#include "nsIFile.h"
-#include "nsILocalFile.h"
-
-#include "pratom.h"
-#include "prmem.h"
-#include "plstr.h"
-#include "prenv.h"
-
-#include "nsIEnumerator.h"
-#include "prprf.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsEscape.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsILocalFile.h"
-#include "nsReadableUtils.h"
-
-
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#include <Processes.h>
-#include <CFBundle.h>
-#include "nsILocalFileMac.h"
-#endif
-
-#ifdef XP_UNIX
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include "prnetdb.h"
-#include "prsystem.h"
-#endif
-
-#ifdef VMS
-#include <rmsdef.h>
-#endif
-
-#include "nsIPlatformCharset.h"
-#include <MNSInit.hxx>
-
-#include "post_include_mozilla.h"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h
deleted file mode 100755
index a33bd622ac..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
- #pragma warning(pop)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h
deleted file mode 100755
index 792e8a34f4..0000000000
--- a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
- #pragma warning(push,1)
- #pragma warning(disable:4668 4917)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/exports.dxp b/connectivity/source/drivers/mozab/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/connectivity/source/drivers/mozab/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
deleted file mode 100755
index cefb6f9fb9..0000000000
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ /dev/null
@@ -1,194 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-PRJINC=..$/..
-PRJNAME=connectivity
-TARGET=mozab
-TARGET2=$(TARGET)drv
-VISIBILITY_HIDDEN=TRUE
-
-.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" )
-all:
- @echo " Not building the mozilla address book driver"
- @echo " dependency to Mozilla developer snapshots not feasable at the moment"
- @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137"
- @echo " see http://www.mozilla.org/issues/show_bug.cgi?id=91209"
-.ENDIF
-
-# --- begin of mozilla specific stuff
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-
-.IF "$(OS)"=="WNT"
- MOZ_EMBED_LIB := $(shell @-test -f $(MOZ_LIB)$/embed_base_s.lib && echo $(MOZ_LIB)$/embed_base_s.lib )
- MOZ_REG_LIB := $(shell @-test -f $(MOZ_LIB)$/mozreg_s.lib && echo $(MOZ_LIB)$/mozreg_s.lib )
-
- MOZ_EMBED_LIB *:= $(MOZ_LIB)$/baseembed_s.lib
- MOZ_REG_LIB *:= $(MOZ_LIB)$/mozreg.lib
-
- .IF "$(COM)"=="GCC"
- MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core
- .ELSE
- LIB += $(MOZ_LIB)
- MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib
- .ENDIF
-
-.ELSE "$(OS)"=="WNT"
- MOZ_LIB_XPCOM = -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s
-.ENDIF
-# --- end of mozilla specific stuff
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-.IF "$(OS)"!="WNT"
-COMPONENT_CONFIG_DATA=$(TARGET)2.xcu
-COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs
-.ENDIF
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/makefile.pmk
-
-.INCLUDE : $(PRJ)$/version.mk
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/MDriver.obj \
- $(SLO)$/MServices.obj
-
-# --- MOZAB BASE Library -----------------------------------
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1OBJS=$(SLOFILES)
-SHL1STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(DBTOOLSLIB)
-
-SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)$(DLLPOSTFIX)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
- $(SLB)$/$(TARGET).lib
-DEFLIB1NAME=$(TARGET)
-
-
-# --- Files -------------------------------------
-MOZSLOFILES=\
- $(SLO)$/MNSInit.obj \
- $(SLO)$/MQueryHelper.obj \
- $(SLO)$/MDatabaseMetaDataHelper.obj \
- $(SLO)$/MQuery.obj \
- $(SLO)$/MTypeConverter.obj \
- $(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj \
- $(SLO)$/MMozillaBootstrap.obj \
- $(SLO)$/MNSFolders.obj \
- $(SLO)$/MNSProfileDiscover.obj \
- $(SLO)$/MNSProfileManager.obj \
- $(SLO)$/MNSINIParser.obj \
- $(SLO)$/MNSRunnable.obj \
- $(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj \
- $(SLO)$/MLdapAttributeMap.obj
-
-
-SLO2FILES=\
- $(SLO)$/MConfigAccess.obj \
- $(SLO)$/MCatalog.obj \
- $(SLO)$/MColumns.obj \
- $(SLO)$/MTable.obj \
- $(SLO)$/MTables.obj \
- $(SLO)$/MColumnAlias.obj \
- $(SLO)$/MPreparedStatement.obj \
- $(SLO)$/MStatement.obj \
- $(SLO)$/MResultSetMetaData.obj \
- $(SLO)$/MResultSet.obj \
- $(SLO)$/MDatabaseMetaData.obj \
- $(SLO)$/MConnection.obj \
- $(MOZSLOFILES)
-
-DEPOBJFILES=$(SLO2FILES)
-
-# --- MOZAB BASE Library -----------------------------------
-
-SHL2VERSIONMAP= $(TARGET2).map
-SHL2NOCHECK=TRUE
-SHL2TARGET= $(TARGET2)$(DLLPOSTFIX)
-SHL2OBJS=$(SLO2FILES)
-SHL2STDLIBS=\
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(DBTOOLSLIB) \
- $(COMPHELPERLIB) \
- $(MOZ_LIB_XPCOM)
-
-.IF "$(GUI)"=="WNT"
- SHL2STDLIBS += \
- $(SHELL32LIB)
-.ENDIF # "$(GUI)"=="WNT"
-
-SHL2DEPN=
-SHL2IMPLIB= i$(TARGET2)
-SHL2DEF= $(MISC)$/$(SHL2TARGET).def
-DEF2NAME= $(SHL2TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : $(PRJ)$/target.pmk
-
-# --- filter file ------------------------------
-
-$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo _TI >$@
- @echo _real >>$@
-
-$(MISC)$/$(SHL2TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo _TI >$@
- @echo _real >>$@
-
-
-ALLTAR : $(MISC)/mozab.component
-
-$(MISC)/mozab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- mozab.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt mozab.component
diff --git a/connectivity/source/drivers/mozab/makefile_mozab.mk b/connectivity/source/drivers/mozab/makefile_mozab.mk
deleted file mode 100755
index c984f121a2..0000000000
--- a/connectivity/source/drivers/mozab/makefile_mozab.mk
+++ /dev/null
@@ -1,127 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-CDEFS += -DMOZILLA_INTERNAL_API
-
-.IF "$(GUI)"=="UNX"
- .IF "$(COMNAME)"=="sunpro5"
- CFLAGS += -features=tmplife
- #This flag is needed to build mozilla 1.7 code
- .ENDIF # "$(COMNAME)"=="sunpro5"
-.ENDIF
-
-MOZINC = . \
- -I.. \
- -I$(MOZ_INC) \
- -I$(MOZ_INC)$/nspr \
- -I$(MOZ_INC)$/xpcom \
- -I$(MOZ_INC)$/string \
- -I$(MOZ_INC)$/rdf \
- -I$(MOZ_INC)$/msgbase \
- -I$(MOZ_INC)$/addrbook \
- -I$(MOZ_INC)$/mork \
- -I$(MOZ_INC)$/locale \
- -I$(MOZ_INC)$/pref \
- -I$(MOZ_INC)$/mime \
- -I$(MOZ_INC)$/chrome \
- -I$(MOZ_INC)$/necko \
- -I$(MOZ_INC)$/intl \
- -I$(MOZ_INC)$/profile \
- -I$(MOZ_INC)$/embed_base \
- -I$(MOZ_INC)$/mozldap \
- -I$(MOZ_INC)$/uconv \
- -I$(MOZ_INC)$/xpcom_obsolete \
- -I$(MOZ_INC)$/content
-
-.IF "$(GUI)" == "WNT"
- CDEFS += \
- -DMOZILLA_CLIENT \
- -DXP_PC \
- -DXP_WIN \
- -DXP_WIN32 \
- -DOJI \
- -DWIN32 \
- -D_WINDOWS \
- -DMOZ_XUL \
- -DMOZ_REFLOW_PERF \
- -DMOZ_REFLOW_PERF_DSP
- .IF "$(COM)" == "GCC"
- INCPOST += $(MOZINC)
- CFLAGSCXX += \
- -fno-rtti \
- -Wall \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long
- .ELSE # .IF "$(COM)" == "GCC"
- INCPRE += $(MOZINC)
- .IF "$(DBG_LEVEL)" != "0"
- .IF "$(CCNUMVER)" >= "001399999999"
- CDEFS += -D_STL_NOFORCE_MANIFEST
- .ENDIF # .IF "$(CCNUMVER)" >= "001399999999"
- .ENDIF # .IF "$(DBG_LEVEL)" != "0"
- .ENDIF # .IF "$(COM)" == "GCC"
-.ENDIF # .IF "$(GUI)" == "WNT"
-
-.IF "$(GUI)" == "UNX"
- INCPOST += $(MOZINC)
- CDEFS+= -DMOZILLA_CLIENT \
- -DXP_UNIX
- .IF "$(OS)" == "LINUX"
- CFLAGS += -fPIC -g
- CDEFS += -DOJI
- CFLAGSCXX += \
- -fno-rtti \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long \
- -pthread
- CDEFS += -DTRACING
- .ELIF "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX"
- CFLAGS += -fPIC
- CFLAGSCXX += \
- -fno-rtti \
- -Wconversion \
- -Wpointer-arith \
- -Wcast-align \
- -Woverloaded-virtual \
- -Wsynth \
- -Wno-long-long \
- -Wno-deprecated
- CDEFS += -DTRACING
- .ENDIF # "$(OS)" == "NETBSD" || "$(OS)" == "MACOSX"
-
- SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR)
-
-.ENDIF # "$(GUI)" == "UNX"
-
diff --git a/connectivity/source/drivers/mozab/mozab.component b/connectivity/source/drivers/mozab/mozab.component
deleted file mode 100755
index 70f5da3bfe..0000000000
--- a/connectivity/source/drivers/mozab/mozab.component
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap">
- <service name="com.sun.star.mozilla.MozillaBootstrap"/>
- </implementation>
- <implementation name="com.sun.star.comp.sdbc.MozabDriver">
- <service name="com.sun.star.sdbc.Driver"/>
- </implementation>
-</component>
diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu
deleted file mode 100644
index 638cbeb2c0..0000000000
--- a/connectivity/source/drivers/mozab/mozab.xcu
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:outlook" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Outlook Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:outlookexp" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Microsoft Windows Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:mozilla:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">SeaMonkey Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Thunderbird Address Book</value>
- </prop>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:ldap:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">LDAP Address Book</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="BaseDN" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="MaxRowCount" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>100</value>
- </prop>
- </node>
- <node oor:name="PortNumber" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>389</value>
- </prop>
- </node>
- <node oor:name="UseSSL" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="Features">
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml
deleted file mode 100755
index 33e9219a16..0000000000
--- a/connectivity/source/drivers/mozab/mozab.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
-<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
- <module-name> mozabdrv2 </module-name>
- <component-description>
- <Author>Your name</Author>
- <Name>com.sun.star.comp.sdbc.MozabDriver</Name>
- <Description>
- This is the implementation of the sdbc-mozab bridge.
- </Description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.sdbc.Driver </supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <component-description>
- <Author>Wind Li</Author>
- <Name>com.sun.star.comp.mozilla.MozillaBootstrap</Name>
- <Description>
- This is the implementation of the MozillaBootstrap for sdbc-mozab bridge and xmlsec.
- </Description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="final"/>
- <supported-service> com.sun.star.mozilla.MozillaBootstrap</supported-service>
- <service-dependency> ... </service-dependency>
- </component-description>
- <project-build-dependency> cppuhelper </project-build-dependency>
- <project-build-dependency> cppu </project-build-dependency>
- <project-build-dependency> sal </project-build-dependency>
-
- <runtime-module-dependency> cppuhelper </runtime-module-dependency>
- <runtime-module-dependency> cppu1 </runtime-module-dependency>
- <runtime-module-dependency> sal1 </runtime-module-dependency>
-
-
-
- <type> com.sun.star.util.XCancellable </type>
- <type> com.sun.star.util.XNumberFormatter </type>
- <type> com.sun.star.uno.TypeClass </type>
- <type> com.sun.star.uno.XWeak </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.beans.XPropertyState </type>
- <type> com.sun.star.beans.XPropertySet </type>
- <type> com.sun.star.beans.PropertyValue </type>
- <type> com.sun.star.beans.XMultiPropertySet </type>
- <type> com.sun.star.beans.XFastPropertySet </type>
- <type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.lang.EventObject </type>
- <type> com.sun.star.lang.XComponent </type>
- <type> com.sun.star.lang.IllegalArgumentException </type>
- <type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.java.XJavaThreadRegister_11 </type>
- <type> com.sun.star.java.XJavaVM </type>
- <type> com.sun.star.sdbc.XConnection </type>
- <type> com.sun.star.sdbc.XStatement </type>
- <type> com.sun.star.sdbc.XResultSet </type>
- <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
- <type> com.sun.star.sdbc.XColumnLocate </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XWarningsSupplier </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbc.XMultipleResults </type>
- <type> com.sun.star.sdbc.XBatchExecution </type>
- <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
- <type> com.sun.star.sdbc.XParameters </type>
- <type> com.sun.star.sdbc.XOutParameters </type>
- <type> com.sun.star.sdbc.DriverPropertyInfo </type>
- <type> com.sun.star.sdbc.XRow </type>
- <type> com.sun.star.sdb.XColumnUpdate </type>
- <type> com.sun.star.sdb.XColumn </type>
- <type> com.sun.star.sdbc.XResultSetUpdate </type>
- <type> com.sun.star.sdbc.XRowUpdate </type>
- <type> com.sun.star.sdbcx.XRowLocate </type>
- <type> com.sun.star.sdbcx.XDeleteRows </type>
-
-</module-description>
-
-
diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu
deleted file mode 100644
index 18cb3c1eaf..0000000000
--- a/connectivity/source/drivers/mozab/mozab2.xcu
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <node oor:name="Installed">
- <node oor:name="sdbc:address:mozilla:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">SeaMonkey Address Book</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">Thunderbird Address Book</value>
- </prop>
- <node oor:name="MetaData">
- <node oor:name="SupportsBrowsing" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="sdbc:address:ldap:*" oor:op="replace">
- <prop oor:name="Driver">
- <value>com.sun.star.comp.sdbc.MozabDriver</value>
- </prop>
- <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
- <value xml:lang="en-US">LDAP Address Book</value>
- </prop>
- <node oor:name="Properties">
- <node oor:name="BaseDN" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value></value>
- </prop>
- </node>
- <node oor:name="MaxRowCount" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>100</value>
- </prop>
- </node>
- <node oor:name="PortNumber" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:int">
- <value>389</value>
- </prop>
- </node>
- <node oor:name="UseSSL" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- </node>
- </node>
- <node oor:name="MetaData">
- <node oor:name="SupportsTableCreation" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- <node oor:name="Authentication" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:string">
- <value>UserPassword</value>
- </prop>
- </node>
- <node oor:name="EscapeDateTime" oor:op="replace">
- <prop oor:name="Value" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozabdrv.map b/connectivity/source/drivers/mozab/mozabdrv.map
deleted file mode 100755
index a431a07377..0000000000
--- a/connectivity/source/drivers/mozab/mozabdrv.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- OMozabConnection_CreateInstance;
- OMozillaBootstrap_CreateInstance;
- setMozabServiceFactory;
- local:
- *;
-};
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
deleted file mode 100644
index 2e08d7754b..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ /dev/null
@@ -1,805 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-// Mozilla includes.
-#include <MNSInclude.hxx>
-
-#include "resource/mozab_res.hrc"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MTypeConverter.hxx"
-#include "MConfigAccess.hxx"
-#include <connectivity/dbexception.hxx>
-#include <comphelper/uno3.hxx>
-#include <comphelper/sequence.hxx>
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include <nsIAbDirFactoryService.h>
-#include <MNSInit.hxx>
-#include <MNameMapper.hxx>
-#include "MNSMozabProxy.hxx"
-#include <MNSDeclares.hxx>
-
-static ::osl::Mutex m_aMetaMutex;
-
-#include <osl/diagnose.h>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kAbDirFactoryServiceCID, NS_ABDIRFACTORYSERVICE_CID);
-static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
-
-using namespace connectivity::mozab;
-using namespace connectivity;
-using namespace ::com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace com::sun::star::mozilla;
-using namespace com::sun::star::sdb;
-
-namespace connectivity
-{
- namespace mozab
- {
- static const char * const s_pADDRESSBOOKROOTDIR = "moz-abdirectory://";
- }
-}
-
-extern sal_Bool MNS_Init(sal_Bool& aProfileExists);
-
-// -------------------------------------------------------------------------
-MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()
- :m_bProfileExists(sal_False)
-{
- OSL_TRACE( "IN MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
-
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
-
-}
-// -------------------------------------------------------------------------
-MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()
-{
- m_aTableNames.clear();
- m_aTableTypes.clear();
-
- if (m_bProfileExists)
- {
- Reference<XMozillaBootstrap> xMozillaBootstrap;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
- m_bProfileExists = xMozillaBootstrap->shutdownProfile() > 0;
- }
-
- OSL_TRACE( "IN/OUT MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()\n" );
-}
-
-static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array);
-//enum all sub folders
-static nsresult enumSubs(nsIAbDirectory * parentDir,nsISupportsArray * array)
-{
- nsresult rv = NS_OK ;
- nsCOMPtr<nsISimpleEnumerator> subDirectories;
- rv = parentDir->GetChildNodes(getter_AddRefs(subDirectories));
- if (NS_FAILED(rv)) { return rv; }
-
- rv = enumSubs(subDirectories,array);
- return rv;
-}
-
-#include <prmem.h> //need for PR_FREEIF
-static nsresult insertPABDescription()
-{
- nsresult rv = NS_OK ;
- // mozilla loads the descriptions of pab and history from a file named addressbook.properties
- // we never deliver it with OOo,so mozab does not auot load personal addressbook and Collected addresses
- // If we want to deliver addressbook.properties with OOo,we have to deal with hole mozilla chrome mechanism.
- // So I insert the descriptiones as user prefes,they will cover the default value.
-
- //"Personal Address Book" "Collected Addresses" are loaded from officecfg
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString pabPrefName(NS_LITERAL_CSTRING("ldap_2.servers.pab.description"));
-
- sal_Bool bSetted=sal_False;
- char *value = nsnull;
- if (0 == prefs->CopyCharPref(pabPrefName.get(), &value))
- {
- if (!(value == nsnull || value[0] == 0))
- {
- bSetted = sal_True;
- }
- }
- PR_FREEIF (value);
- value=nsnull;
- if (bSetted == sal_True)
- {
- const char* pPabDescription = static_cast< const char* >( getPabDescription( ) );
- rv = prefs->SetCharPref (pabPrefName.get(), pPabDescription);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
- nsCAutoString hisPrefName(NS_LITERAL_CSTRING("ldap_2.servers.history.description"));
-
- bSetted=sal_False;
- if (0 == prefs->CopyCharPref(hisPrefName.get(), &value))
- {
- if (!(value == nsnull || value[0] == 0))
- {
- bSetted = sal_True;
- }
- }
- PR_FREEIF (value);
- value=nsnull;
- if (bSetted == sal_True)
- {
- const char* pHisDescription = static_cast< const char* >( getHisDescription( ) );
-
- rv = prefs->SetCharPref (hisPrefName.get(), pHisDescription);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
-}
-//
-// nsAbDirectoryDataSource
-//
-#define NS_RDF_CONTRACTID "@mozilla.org/rdf"
-#define NS_RDF_DATASOURCE_CONTRACTID NS_RDF_CONTRACTID "/datasource;1"
-#define NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_RDF_DATASOURCE_CONTRACTID "?name="
-#define NS_ABDIRECTORYDATASOURCE_CONTRACTID \
- NS_RDF_DATASOURCE_CONTRACTID_PREFIX "addressdirectory"
-#define database_uri "@mozilla.org/rdf/datasource;1?name=addressdirectory"
-#define NS_ABDIRECTORYDATASOURCE_CID \
-{ /* 0A79186D-F754-11d2-A2DA-001083003D0C */ \
- 0xa79186d, 0xf754, 0x11d2, \
- {0xa2, 0xda, 0x0, 0x10, 0x83, 0x0, 0x3d, 0xc} \
-}
-
-// -------------------------------------------------------------------------
-// Case where we get a parent uri, and need to list its children.
-static nsresult getSubsFromParent(const rtl::OString& aParent, nsIEnumerator **aSubs)
-{
-
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
-
- retCode = insertPABDescription();
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIRDFResource> rdfResource ;
-
- nsCOMPtr<nsIRDFDataSource> rdfDirectory ;
-
- rtl::OString dir("rdf:addressdirectory");
- retCode = rdfService->GetDataSource(dir.getStr(),getter_AddRefs(rdfDirectory)) ;
-
-
-
- OSL_TRACE("uri: %s\n", aParent.getStr()) ;
- retCode = rdfService->GetResource(nsDependentCString(aParent.getStr(),aParent.getLength()), getter_AddRefs(rdfResource)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
- nsCOMPtr<nsISimpleEnumerator> tempEnum ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- retCode = directory->GetChildNodes(getter_AddRefs(tempEnum)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- PRBool hasMore = PR_TRUE ;
- while (NS_SUCCEEDED(tempEnum->HasMoreElements(&hasMore)) && hasMore) {
- nsCOMPtr<nsIAbDirectory> element ;
- retCode = tempEnum->GetNext(getter_AddRefs(element)) ;
- if (NS_SUCCEEDED(retCode))
- {
- array->AppendElement(element) ;
- enumSubs(element,array);
- }
- }
-
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-static nsresult enumSubs(nsISimpleEnumerator * subDirs,nsISupportsArray * array)
-{
- PRBool hasMore = PR_TRUE ;
- nsresult rv = NS_OK ;
- while (NS_SUCCEEDED(subDirs->HasMoreElements(&hasMore)) && hasMore) {
- nsCOMPtr<nsISupports> newDirSupports ;
-
- rv = subDirs->GetNext(getter_AddRefs(newDirSupports)) ;
- NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &rv) ;
- NS_ENSURE_SUCCESS(rv, rv);
- array->AppendElement(childDir);
-
- rv = enumSubs(childDir,array);
- }
- return rv;
-}
-
-// Case where we get a factory uri and need to have it build the directories.
-static nsresult getSubsFromFactory(const rtl::OString& aFactory, nsIEnumerator **aSubs)
-{
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
-
- nsCOMPtr<nsIAbDirFactoryService> dirFactoryService = do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &retCode);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIAbDirFactory> dirFactory ;
-
- retCode = dirFactoryService->GetDirFactory(aFactory.getStr(), getter_AddRefs(dirFactory)) ;
- NS_ENSURE_SUCCESS (retCode, retCode) ;
- nsCOMPtr <nsIAbDirectoryProperties> properties;
- properties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &retCode);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- retCode = properties->SetURI(aFactory.getStr());
- NS_ENSURE_SUCCESS(retCode,retCode);
-
- nsCOMPtr<nsISimpleEnumerator> subDirs ;
- retCode = dirFactory->CreateDirectory(properties, getter_AddRefs(subDirs));
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
- retCode = enumSubs(subDirs,array);
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-// Case where the uri itself is the directory we're looking for.
-static nsresult getSubsFromURI(const rtl::OString& aUri, nsIEnumerator **aSubs)
-{
- if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
- *aSubs = nsnull ;
- nsresult retCode = NS_OK ;
-
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsCOMPtr<nsIRDFResource> rdfResource ;
-
- retCode = rdfService->GetResource(nsDependentCString(aUri.getStr(),aUri.getLength()), getter_AddRefs(rdfResource)) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- retCode = rdfService->UnregisterResource(rdfResource) ;
- NS_ENSURE_SUCCESS(retCode, retCode) ;
-
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
-
- NS_ENSURE_SUCCESS(retCode, retCode) ;
- nsAutoString nameAB ;
-
- nameAB.AssignWithConversion("LDAP Directory") ;
- directory->SetDirName(nameAB.get()) ;
- nsCOMPtr<nsISupportsArray> array ;
-
- NS_NewISupportsArray(getter_AddRefs(array)) ;
- array->AppendElement(directory) ;
- array->Enumerate(aSubs) ;
- return retCode ;
-}
-
-namespace
-{
- static void lcl_setNoAddressBookFoundError( ErrorDescriptor& _rError, OConnection& _rCon, MozillaProductType _eProductType,
- sal_Bool bGivenURI )
- {
- sal_uInt16 nAddressBookNameRes = 0;
- if ( !bGivenURI && _eProductType == MozillaProductType_Mozilla)
- {
- nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
- }
- else
- {
- if ( _eProductType == MozillaProductType_Thunderbird )
- {
- nAddressBookNameRes = STR_THUNDERBIRD_ADDRESSBOOKS;
- }
- else
- {
- if ( _rCon.usesFactory() )
- {
- if ( _rCon.isOutlookExpress() )
- {
- nAddressBookNameRes = STR_OE_ADDRESSBOOK;
- }
- else
- {
- nAddressBookNameRes = STR_OUTLOOK_MAPI_ADDRESSBOOK;
- }
- }
- else
- {
- OSL_ENSURE( !_rCon.isLDAP(), "lcl_setNoAddressBookFoundError: not to be called for LDAP connections!" );
- nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
- }
- }
- }
- _rError.set( 0, ErrorCondition::AB_ADDRESSBOOK_NOT_FOUND, _rCon.getResources().getResourceString( nAddressBookNameRes ) );
- }
-}
-
-nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap,
- ::std::vector< ::rtl::OUString >* _rStrings,
- ::std::vector< ::rtl::OUString >* _rTypes,
- sal_Int32* pErrorId )
-{
- if (!sAbURI || !nmap || !_rStrings || !_rTypes || !pErrorId)
- {
- return NS_ERROR_NULL_POINTER;
- }
- OSL_TRACE("Using URI %s to getTables()\n",sAbURI );
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
- nsCOMPtr<nsIEnumerator> subDirectories;
-
- switch(*nDirectoryType)
- {
- case SDBCAddress::Mozilla:
- rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- case SDBCAddress::Outlook:
- case SDBCAddress::OutlookExp:
- rv = getSubsFromFactory(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- case SDBCAddress::LDAP:
- rv = getSubsFromURI(sAbURI, getter_AddRefs(subDirectories)) ;
- break;
- default:
- rv = getSubsFromParent(sAbURI, getter_AddRefs(subDirectories));
- }
- NS_ENSURE_SUCCESS(rv, rv);
-
- // At this point we have a list containing the nsIAbDirectory we need to map as tables
- rv = subDirectories -> First();
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRUnichar *name = nsnull;
- PRBool bIsMailList = PR_FALSE;
-
- ::rtl::OUString aTableName;
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ;
- NS_ENSURE_SUCCESS(rv, rv) ;
-
- nmap->reset();
- do {
- nsCOMPtr<nsIAbDirectory> subDirectory;
-
- nsCOMPtr<nsISupports> item;
- rv = subDirectories -> CurrentItem(getter_AddRefs(item));
- if ( NS_FAILED( rv ) )
- {
- *pErrorId = STR_COULD_NOT_RETRIEVE_AB_ENTRY;
- return NS_ERROR_FAILURE;
- }
-
- subDirectory = do_QueryInterface(item, &rv);
-
- subDirectory -> GetIsMailList(&bIsMailList);
- // For now we're not interested in mailing lists.
- rv = subDirectory -> GetDirName(&name);
- if ( NS_FAILED( rv ) ) {
- *pErrorId = STR_COULD_NOT_GET_DIRECTORY_NAME;
- return NS_ERROR_FAILURE;
- }
- MTypeConverter::prUnicharToOUString(name, aTableName);
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
- ODatabaseMetaDataResultSet::ORow aRow(3);
-
- // Insert table into map
- if ( aTableName.getLength() == 0 )
- aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook"));
-
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
- rv = nmap->add( aTableName, subDirectory);
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface(subDirectory, &rv) ;
- if (!NS_FAILED(rv))
- rdfService->UnregisterResource(rdfResource);
-
- if (!NS_FAILED(rv)) //failed means we have added this directory
- {
- //map mailing lists as views
- _rStrings->push_back( aTableName ); // Table name
- if (!bIsMailList) {
- ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TABLE")));
- _rTypes->push_back( aTableType ); // Table type
- }
- else
- {
- ::rtl::OUString aTableType(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VIEW")));
- _rTypes->push_back( aTableType ); // Table type
- }
- }
- rv = subDirectories -> Next();
- } while ( rv == NS_OK);
-
- return( NS_OK );
-}
-sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon,
- ::std::vector< ::rtl::OUString >& _rStrings,
- ::std::vector< ::rtl::OUString >& _rTypes)
-{
- sal_Bool bGivenURI;
- ::rtl::OUString sAbURI;
- ::rtl::OString sAbURIString;
-
- OSL_TRACE( "IN MDatabaseMetaDataHelper::getTableStrings( 0x%08X, %s)\n", _pCon, _pCon->getForceLoadTables()?"True":"False" );
-
- ::osl::MutexGuard aGuard( m_aMetaMutex );
- // Only do the query if we have to - performance degrades otherwise
- if ( ! _pCon->getForceLoadTables() && m_aTableNames.size() > 0 ) {
- _rStrings = m_aTableNames;
- _rTypes = m_aTableTypes;
- return( sal_True );
- }
-
- m_aTableNames.clear();
- m_aTableTypes.clear();
-
- sAbURI = _pCon->getMozURI();
-
- OSL_TRACE("AbURI = %s\n", OUtoCStr( sAbURI ) );
- if ( sAbURI.getLength() == 0 )
- bGivenURI = sal_False;
- else {
- sAbURIString = ::rtl::OUStringToOString( sAbURI,
- RTL_TEXTENCODING_ASCII_US);
- bGivenURI = sal_True;
- }
-
- if ( bGivenURI )
- OSL_TRACE("Using URI %s to getTables()\n", sAbURIString.getStr() );
- else
- OSL_TRACE("Using URI of ROOTDIR to getTables()\n");
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
- nsCOMPtr<nsIEnumerator> subDirectories;
- sal_Int32 nDirectoryType=0;
- m_ProductType = MozillaProductType_Mozilla;
- m_ProfileName = _pCon->getMozProfile();
-
-
- if (_pCon->isThunderbird())
- {
- if (!bGivenURI)
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::ThunderBird;
- m_ProductType = MozillaProductType_Thunderbird;
- }
- else if (!bGivenURI)
- {
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::Mozilla;
- }
- else
- {
- if (_pCon->usesFactory())
- {
- nDirectoryType = SDBCAddress::Outlook;
- }
- else
- {
- if (_pCon->isLDAP())
- {
- nDirectoryType = SDBCAddress::LDAP;
- }
- else
- {
- sAbURIString = s_pADDRESSBOOKROOTDIR;
- nDirectoryType = SDBCAddress::Mozilla;
- }
- }
- }
-
- if ( !_pCon->isLDAP() && !m_bProfileExists )
- { // no need to boot up a Mozilla profile for an LDAP connection
- Reference<XMozillaBootstrap> xMozillaBootstrap;
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
- Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = Reference<XMozillaBootstrap>(xInstance,UNO_QUERY);
- m_bProfileExists = sal_False;
- //If there are no profiles for this product
- //Or the given profile name does not found
- //We will reaise a "No Addressbook Directories Exist" error
- if ( xMozillaBootstrap->getProfileCount(m_ProductType) == 0 ||
- ( m_ProfileName.getLength() && !(xMozillaBootstrap->getProfilePath(m_ProductType,m_ProfileName).getLength())))
- m_bProfileExists = sal_False;
- else
- if (xMozillaBootstrap->bootupProfile(m_ProductType,m_ProfileName) > 0)
- m_bProfileExists = sal_True;
-
- }
- if ( !m_bProfileExists
- && !_pCon->isLDAP()
- && ( ( nDirectoryType == SDBCAddress::Mozilla )
- || ( nDirectoryType == SDBCAddress::ThunderBird )
- )
- )
- {
- lcl_setNoAddressBookFoundError( m_aError, *_pCon, m_ProductType, bGivenURI );
- return sal_False;
- }
-
- MNameMapper *nmap = _pCon->getNameMapper();
- nmap->reset();
-
- sal_Int32 nErrorResourceId( 0 );
-
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_GET_TABLE_STRINGS;
- args.argCount = 6;
- args.arg1 = (void*)sAbURIString.getStr();
- args.arg2 = (void*)&nDirectoryType;
- args.arg3 = (void*)nmap;
- args.arg4 = (void*)&m_aTableNames;
- args.arg5 = (void*)&m_aTableTypes;
- args.arg6 = (void*)&nErrorResourceId;
- rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName);
- m_aError.setResId( static_cast<sal_uInt16>(nErrorResourceId) );
-
- if (NS_FAILED(rv))
- {
- if ( nErrorResourceId == 0 )
- m_aError.setResId( STR_UNSPECIFIED_ERROR );
- return sal_False;
- }
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTableStrings()\n" );
- _rStrings = m_aTableNames;
- _rTypes = m_aTableTypes;
-
- _pCon->setForceLoadTables(sal_False);
- return( sal_True );
-}
-
-sal_Bool MDatabaseMetaDataHelper::getTables( OConnection* _pCon,
- const ::rtl::OUString& tableNamePattern,
- const Sequence< ::rtl::OUString >& types,
- ODatabaseMetaDataResultSet::ORows& _rRows)
-{
-
- static ODatabaseMetaDataResultSet::ORows aRows;
-
- OSL_TRACE( "IN MDatabaseMetaDataHelper::getTables()\n" );
- ::osl::MutexGuard aGuard( m_aMetaMutex );
-
- ODatabaseMetaDataResultSet::ORows().swap(aRows); // this makes real clear where memory is freed as well
- aRows.clear();
-
- ::std::vector< ::rtl::OUString > tables;
- ::std::vector< ::rtl::OUString > tabletypes;
- ::rtl::OUString matchAny = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));;
-
- if ( !getTableStrings( _pCon, tables,tabletypes ) )
- return sal_False;
-
- for ( size_t i = 0; i < tables.size(); i++ ) {
- ODatabaseMetaDataResultSet::ORow aRow(3);
-
- ::rtl::OUString aTableName = tables[i];
- ::rtl::OUString aTableType = tabletypes[i];
- OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
-
-
- // return tables to caller
- if (match( tableNamePattern, aTableName, '\0' ) &&
- ( 0 == types.getLength() || //types is null or types include aTableType or types include "%"
- 0 != ::comphelper::findValue( types, aTableType, sal_True ).getLength() ||
- 0 != ::comphelper::findValue( types, matchAny, sal_True ).getLength())) {
- if ( aTableName.getLength() == 0 ) {
- aTableName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AddressBook"));
- }
-
- OSL_TRACE( "TableName = %s ; TableType = %s\n", OUtoCStr(aTableName), OUtoCStr(aTableType) );
-
- aRow.push_back( new ORowSetValueDecorator( aTableName ) ); // Table name
- aRow.push_back( new ORowSetValueDecorator( aTableType ) ); // Table type
- aRow.push_back( ODatabaseMetaDataResultSet::getEmptyValue() ); // Remarks
- aRows.push_back(aRow);
- }
- }
-
- OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTables()\n" );
- _rRows = aRows;
- return(sal_True);
-}
-
-
-sal_Bool
-MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon )
-{
- const sal_Unicode QUERY_CHAR = '?';
- const sal_Char* MOZ_SCHEMA = "moz-abldapdirectory://";
- const sal_Char* LDAP_SCHEMA = "ldap://";
-
- rtl::OString sAbURI;
- rtl::OUString sAbBindDN;
- rtl::OUString sAbPassword;
- sal_Bool useSSL = _pCon->getUseSSL();
-
- nsresult rv(0);
-
- sAbURI = OUStringToOString( _pCon->getMozURI(), RTL_TEXTENCODING_ASCII_US );
- sAbBindDN = _pCon->getBindDN();
- sAbPassword = _pCon->getPassword();
-
-
- sal_Int32 pos = sAbURI.indexOf( MOZ_SCHEMA );
- if ( pos != -1 ) {
- sAbURI = sAbURI.replaceAt (pos, rtl_str_getLength( MOZ_SCHEMA ), ::rtl::OString(LDAP_SCHEMA) );
- }
-
- pos = sAbURI.indexOf( QUERY_CHAR );
- if ( pos != -1 ) {
- sal_Int32 len = sAbURI.getLength();
- sAbURI = sAbURI.replaceAt( pos, len - pos, ::rtl::OString("") );
- }
- const sal_Unicode* bindDN=nsnull;
- if (sAbBindDN.getLength() != 0)
- {
- bindDN = sAbBindDN.getStr();
- }
-
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP;
- args.argCount = 4;
- args.arg1 = (void*)sAbURI.getStr();
- args.arg2 = (void*)bindDN;
- args.arg3 = (void*)sAbPassword.getStr();
- args.arg4 = (void*)&useSSL;
-
- MNSMozabProxy xMProxy;
- rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() );
- if ( NS_SUCCEEDED( rv ) ) //Init LDAP,pass OUString() to StarProxy to ignore profile switch
- {
- args.funcIndex = ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED;
- TimeValue timeValue = { 1, 0 }; // 1 * 30 Seconds timeout
- sal_Int32 times=0;
- while ( times++ < 30 )
- {
- rv = xMProxy.StartProxy( &args, m_ProductType, ::rtl::OUString() );
- if ( NS_SUCCEEDED( rv ) )
- // connected successfully
- break;
-
- if ( rv == (nsresult)PR_NOT_CONNECTED_ERROR )
- // connection failed
- break;
-
- // not yet decided - continue waiting
- osl_waitThread( &timeValue );
- }
- }
- m_aError.setResId( STR_COULD_NOT_CONNECT_LDAP );
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-}
-
-sal_Bool MDatabaseMetaDataHelper::NewAddressBook(OConnection* _pCon,const ::rtl::OUString & aTableName)
-{
- sal_Bool bIsMozillaAB;
-
- bIsMozillaAB = !_pCon->usesFactory() && ! _pCon->isLDAP();
-
- if ( !bIsMozillaAB )
- {
- m_aError.setResId( STR_NO_TABLE_CREATION_SUPPORT );
- return sal_False;
- }
- else
- OSL_TRACE("Create table\n");
-
- // Get the mozilla addressbooks from the base directory.
- nsresult rv = NS_OK;
-
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_NEW_ADDRESS_BOOK;
- args.argCount = 1;
- args.arg1 = (void*)&aTableName;
- rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName);
-
- _pCon->setForceLoadTables(sal_True); //force reload table next time
- if (rv == NS_ERROR_FILE_IS_LOCKED)
- {
- m_aError.setResId( STR_MOZILLA_IS_RUNNING );
- }
- else if (NS_FAILED(rv))
- {
- m_aError.set( STR_COULD_NOT_CREATE_ADDRESSBOOK, 0, ::rtl::OUString::valueOf( sal_Int32(rv), 16 ) );
- }
- OSL_TRACE( "OUT MDatabaseMetaDataHelper::NewAddressBook()\n" );
- return( NS_SUCCEEDED(rv) ? sal_True : sal_False );
-}
-nsresult NewAddressBook(const ::rtl::OUString * aName)
-{
- if (isProfileLocked(NULL))
- return NS_ERROR_FILE_IS_LOCKED;
- nsresult rv;
- nsCOMPtr<nsIAbDirectoryProperties> aProperties = do_CreateInstance(NS_ABDIRECTORYPROPERTIES_CONTRACTID, &rv);
- NS_ENSURE_ARG_POINTER(aProperties);
- const ::rtl::OUString& uName = *aName;
- nsString nsName;
- MTypeConverter::ouStringToNsString(uName,nsName);
- aProperties->SetDescription(nsName);
-
- nsCOMPtr<nsIRDFService> rdfService = do_GetService (kRDFServiceCID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIRDFResource> parentResource;
- rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot), getter_AddRefs(parentResource));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIAbDirectory> parentDir = do_QueryInterface(parentResource, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = parentDir->CreateNewDirectory(aProperties);
- return rv;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
deleted file mode 100644
index 103903ac36..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-#define _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-
-#include "MErrorResource.hxx"
-#include <comphelper/proparrhlp.hxx>
-#include <comphelper/propertycontainer.hxx>
-#include "FDatabaseMetaDataResultSet.hxx"
-
-#include <MConnection.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MDatabaseMetaDataHelper
- {
- private:
- sal_Bool m_bProfileExists ;
- ::std::vector< ::rtl::OUString > m_aTableNames;
- ::std::vector< ::rtl::OUString > m_aTableTypes;
- ::com::sun::star::mozilla::MozillaProductType m_ProductType;
- ::rtl::OUString m_ProfileName;
- ErrorDescriptor m_aError;
-
- public:
- MDatabaseMetaDataHelper();
- ~MDatabaseMetaDataHelper();
-
- //
- sal_Bool getTableStrings( OConnection* _pCon,
- ::std::vector< ::rtl::OUString >& _rStrings,
- ::std::vector< ::rtl::OUString >& _rTypes);
-
- sal_Bool getTables( OConnection* _pCon,
- const ::rtl::OUString& tableNamePattern,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types,
- ODatabaseMetaDataResultSet::ORows& _rRows);
- sal_Bool testLDAPConnection( OConnection* _pCon );
- sal_Bool NewAddressBook( OConnection* _pCon,const ::rtl::OUString & aTableName);
-
- inline const ErrorDescriptor& getError() const { return m_aError; }
- };
- }
-
-}
-#endif // _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
deleted file mode 100644
index d6bfe02b23..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-#define CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- class ErrorDescriptor
- {
- private:
- sal_uInt16 m_nErrorResourceId;
- sal_Int32 m_nErrorCondition;
- ::rtl::OUString m_sParameter;
-
- public:
- ErrorDescriptor()
- :m_nErrorResourceId(0)
- ,m_nErrorCondition(0)
- ,m_sParameter()
- {
- }
-
- inline void set( const sal_uInt16 _nErrorResourceId, const sal_Int32 _nErrorCondition, const ::rtl::OUString& _rParam )
- {
- m_nErrorResourceId = _nErrorResourceId;
- m_nErrorCondition = _nErrorCondition;
- m_sParameter = _rParam;
- }
- inline void setResId( const sal_uInt16 _nErrorResourceId )
- {
- m_nErrorResourceId = _nErrorResourceId;
- }
- inline void reset()
- {
- m_nErrorResourceId = 0;
- m_nErrorCondition = 0;
- }
-
- inline sal_uInt16 getResId() const { return m_nErrorResourceId; }
- inline sal_Int32 getErrorCondition() const { return m_nErrorCondition; }
- inline const ::rtl::OUString& getParameter() const { return m_sParameter; }
-
- inline bool is() const { return ( m_nErrorResourceId != 0 ) || ( m_nErrorCondition != 0 ); }
- };
- }
-}
-
-#endif // CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
deleted file mode 100644
index 02f580a0f2..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
+++ /dev/null
@@ -1,453 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <rtl/strbuf.hxx>
- // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
- // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
- // hiding objects "in an outer scope".
-
-#include "MLdapAttributeMap.hxx"
-#include "MTypeConverter.hxx"
-#include "MQueryHelper.hxx"
-
-#include <tools/diagnose_ex.h>
-
-#include <boost/unordered_map.hpp>
-
-//........................................................................
-namespace connectivity { namespace mozab {
-//........................................................................
-
- //====================================================================
- //= helper
- //====================================================================
- namespace
- {
- typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
- typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
- struct CardPropertyData
- {
- const sal_Char* pLDAPAttributeList;
- CardPropertyGetter PropGetter;
- CardPropertySetter PropSetter;
-
- CardPropertyData()
- :pLDAPAttributeList( NULL )
- ,PropGetter( NULL )
- ,PropSetter( NULL )
- {
- }
- CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
- :pLDAPAttributeList( _pLDAPAttributeList )
- ,PropGetter( _PropGetter )
- ,PropSetter( _PropSetter )
- {
- }
- };
-
- typedef ::boost::unordered_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
-
- #define DEF_CARD_ACCESS( PropertyName ) \
- &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
-
- static const MapPropertiesToAttributes& lcl_getPropertyMap()
- {
- static MapPropertiesToAttributes aMap;
- if ( aMap.empty() )
- {
- struct MapEntry
- {
- const sal_Char* pAsciiPropertyName;
- const sal_Char* pAsciiAttrributeList;
- CardPropertyGetter PropGetter;
- CardPropertySetter PropSetter;
- };
- const MapEntry aEntries[] = {
- { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
- { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
- { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
- { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
- { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
- { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
- { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
- { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
- { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
- { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
- { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
- { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
- { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
- { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
- { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
- { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
- { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
- { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
- { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
- { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
- { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
- { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
- { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
- { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
- { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
- { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
- { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
- { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
- { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
- { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
- { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
- { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
- { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
- { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
- { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
- { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
- { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
- { NULL, NULL, NULL, NULL }
- };
- const MapEntry* loop = aEntries;
- while ( loop->pAsciiPropertyName )
- {
- aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
- CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
- ++loop;
- }
- }
- return aMap;
- }
- }
-
- //====================================================================
- //= AttributeMap_Data
- //====================================================================
- struct AttributeMap_Data
- {
- };
-
- //====================================================================
- //= MLdapAttributeMap
- //====================================================================
- // -------------------------------------------------------------------
- MLdapAttributeMap::MLdapAttributeMap()
- :m_pData( new AttributeMap_Data )
- {
- }
-
- // -------------------------------------------------------------------
- MLdapAttributeMap::~MLdapAttributeMap()
- {
- }
-
- // -------------------------------------------------------------------
- NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
- }
-
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
- {
- OSL_FAIL( "MLdapAttributeMap::GetAttributes: not implemented!" );
- (void)aProperty;
- (void)aCount;
- (void)aAttrs;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
- {
- ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-
- if ( pos == rPropertyMap.end() )
- {
- _retval.SetIsVoid( PR_TRUE );
- }
- else
- {
- sal_Int32 tokenPos(0);
- ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
- MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
- }
-
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
- {
- OSL_FAIL( "MLdapAttributeMap::SetAttributeList: not implemented!" );
- (void)aProperty;
- (void)aAttributeList;
- (void)allowInconsistencies;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
- {
- OSL_FAIL( "MLdapAttributeMap::GetProperty: not implemented!" );
- (void)aAttribute;
- (void)_retval;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
- {
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-
- ::rtl::OStringBuffer aAllAttributes;
- for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
- loop != rPropertyMap.end();
- ++loop
- )
- {
- aAllAttributes.append( loop->second.pLDAPAttributeList );
- if ( loop != rPropertyMap.end() )
- aAllAttributes.append( ',' );
- }
-
- MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
- {
- // we do not allow modifying the map, so we're always in a valid state
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
- {
- OSL_FAIL( "MLdapAttributeMap::SetFromPrefs: not implemented!" );
- (void)aPrefBranchName;
- return NS_ERROR_NOT_IMPLEMENTED;
- }
-
- // -------------------------------------------------------------------
- NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
- {
- NS_ENSURE_ARG_POINTER( aMessage );
- NS_ENSURE_ARG_POINTER( aCard );
-
- // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
- aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- // split the list of attributes for the current property
- ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
- ::rtl::OString sAttribute;
-
- sal_Int32 tokenPos = 0;
- while ( tokenPos != -1 )
- {
- sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
-
- // retrieve the values for the current attribute
- PRUint32 valueCount = 0;
- PRUnichar** values = NULL;
- nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
- if ( NS_FAILED( rv ) )
- // try the next attribute
- continue;
-
- if ( valueCount )
- {
- CardPropertySetter propSetter = prop->second.PropSetter;
- OSL_ENSURE( propSetter,
- "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
- "unexpected: could retrieve an attribute value, but have no setter for it!" );
- if ( propSetter )
- {
- (aCard->*propSetter)( values[0] );
- }
-
- // we're done with this property - no need to handle the remaining attributes which
- // map to it
- break;
- }
- }
- }
- return NS_OK;
- }
-
- // -------------------------------------------------------------------
- namespace
- {
- struct PreferMailFormatType
- {
- const sal_Char* description;
- PRUint32 formatType;
-
- PreferMailFormatType()
- :description( NULL )
- ,formatType( nsIAbPreferMailFormat::unknown )
- {
- }
-
- PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
- :description( _description )
- ,formatType( _formatType )
- {
- }
- };
-
- static const PreferMailFormatType* lcl_getMailFormatTypes()
- {
- static const PreferMailFormatType aMailFormatTypes[] =
- {
- PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
- PreferMailFormatType( "text/html", nsIAbPreferMailFormat::html ),
- PreferMailFormatType( "unknown", nsIAbPreferMailFormat::unknown ),
- PreferMailFormatType()
- };
- return aMailFormatTypes;
- }
- }
-
- // -------------------------------------------------------------------
- void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
- {
- _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-
- ::rtl::OUString resultValue;
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- resultValue = _result.getValue( prop->first );
-
- CardPropertySetter propSetter = prop->second.PropSetter;
- if ( propSetter )
- {
- // PRUnichar != sal_Unicode in mingw
- (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
- unsigned int format = nsIAbPreferMailFormat::unknown;
- const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
- while ( pMailFormatType->description )
- {
- if ( resultValue.equalsAscii( pMailFormatType->description ) )
- {
- format = pMailFormatType->formatType;
- break;
- }
- ++pMailFormatType;
- }
- _card.SetPreferMailFormat(format);
- }
- else
- OSL_FAIL( "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
- }
- }
- }
-
- // -------------------------------------------------------------------
- void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
- {
- nsXPIDLString value;
- ::rtl::OUString resultValue;
-
- const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
- for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
- prop != rPropertyMap.end();
- ++prop
- )
- {
- CardPropertyGetter propGetter = prop->second.PropGetter;
- if ( propGetter )
- {
- (_card.*propGetter)( getter_Copies( value ) );
-
- nsAutoString temp( value );
- MTypeConverter::nsStringToOUString( temp, resultValue );
- }
- else
- {
- if ( prop->first.equals( "PreferMailFormat" ) )
- {
- unsigned int format = nsIAbPreferMailFormat::unknown;
- _card.GetPreferMailFormat( &format );
- const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
- while ( pMailFormatType->description )
- {
- if ( format == pMailFormatType->formatType )
- {
- resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
- break;
- }
- ++pMailFormatType;
- }
- }
- else
- OSL_FAIL( "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
- }
-
- _result.insert( prop->first, resultValue );
- }
- }
-
-//........................................................................
-} } // namespace connectivity::mozab
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
deleted file mode 100644
index 54461bfc22..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-
-#include <MNSInclude.hxx>
-
-#include <memory>
-
-//........................................................................
-namespace connectivity { namespace mozab {
-//........................................................................
-
- struct AttributeMap_Data;
- class MQueryHelperResultEntry;
-
- //====================================================================
- //= class MLdapAttributeMap
- //====================================================================
- /** implements the nsIAbLDAPAttributeMap interface
-
- Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
- implementation was changed to take the attribute mapping (from LDAP attributes
- to address book properties) not directly from the preferences. Instead, this mapping
- is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
- interface).
-
- */
- class MLdapAttributeMap : public nsIAbLDAPAttributeMap
- {
- public:
- MLdapAttributeMap();
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSIABLDAPATTRIBUTEMAP
-
- static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
- static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
-
- protected:
- virtual ~MLdapAttributeMap();
-
- private:
- ::std::auto_ptr< AttributeMap_Data > m_pData;
- };
-
-//........................................................................
-} } // namespace connectivity::mozab
-//........................................................................
-
-#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx
deleted file mode 100644
index de53040895..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSDeclares.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NS_DECLARES_HXX_
-#define _CONNECTIVITY_MAB_NS_DECLARES_HXX_
-
-#include <sal/types.h>
-
-
-const sal_Int32 RowStates_Normal = 0;
-const sal_Int32 RowStates_Inserted = 1;
-const sal_Int32 RowStates_Updated = 2;
-const sal_Int32 RowStates_Deleted = 4;
-const sal_Int32 RowStates_Error = 32;
-
-namespace connectivity{
- namespace mozab{
- class OConnection;
- }
-}
-sal_Bool isProfileLocked(connectivity::mozab::OConnection* _pCon);
-
-class nsIAbDirectory;
-sal_Int32 getDirectoryType(const nsIAbDirectory* directory);
-
-
-#endif // _CONNECTIVITY_MAB_NS_DECLARES_HXX_ 1
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
deleted file mode 100644
index 4dd1c511f1..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
-#define _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ 1
-
-//
-// Only include Mozilla include files once and using this file...
-//
-
-// moved this here and in first position due to "long l;" unxsoli4 warning
-#include <rtl/ustrbuf.hxx>
-
-#include "pre_include_mozilla.h"
-#if defined __GNUC__
- #pragma GCC system_header
-#endif
-
-#include <nsDebug.h>
-
-#include <nsCOMPtr.h>
-#include <nsISupportsArray.h>
-#include <nsString.h>
-
-#if defined __SUNPRO_CC
-#pragma disable_warn
- // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-#endif
-#include <nsMemory.h>
-#include <prtypes.h>
-#include <nsRDFCID.h>
-#include <nsXPIDLString.h>
-#include <nsIRDFService.h>
-#include <nsIRDFResource.h>
-#include <nsReadableUtils.h>
-#include <msgCore.h>
-#include <nsIServiceManager.h>
-#include <nsIAbCard.h>
-#include <nsAbBaseCID.h>
-#include <nsAbAddressCollecter.h>
-#include <nsIPref.h>
-#include <nsIAddrBookSession.h>
-#include <nsIMsgHeaderParser.h>
-#include <nsIAddrBookSession.h>
-#include <nsIAbDirectory.h>
-#include <nsAbDirectoryQuery.h>
-#include <nsIAbDirectoryQuery.h>
-#include <nsIAbDirectoryQueryProxy.h>
-#include <nsIAbDirFactory.h>
-#include <nsIRunnable.h>
-#include <nsIAbLDAPAttributeMap.h>
-#include <nsILDAPMessage.h>
-
-#include <prerr.h>
-
-#include "post_include_mozilla.h"
-
-#endif // _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
deleted file mode 100644
index 02cdcea1fe..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
+++ /dev/null
@@ -1,407 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include "MNSMozabProxy.hxx"
-
-#include "resource/mozab_res.hrc"
-#include "MDatabaseMetaDataHelper.hxx"
-#include "MQuery.hxx"
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-
-#include "pre_include_mozilla.h"
-#include <nsIProxyObjectManager.h>
-// More Mozilla includes for LDAP Connection Test
-#include "prprf.h"
-#include "nsILDAPURL.h"
-#include "nsILDAPMessage.h"
-#include "nsILDAPMessageListener.h"
-#include "nsILDAPErrors.h"
-#include "nsILDAPConnection.h"
-#include "nsILDAPOperation.h"
-#include "post_include_mozilla.h"
-#include "MQuery.hxx"
-#include <MQueryHelper.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <unotools/processfactory.hxx>
-#include "com/sun/star/mozilla/XProxyRunner.hpp"
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::mozilla;
-
-
-#define TYPEASSERT(value,type) if (value != type) return !NS_OK;
-
-using namespace connectivity::mozab;
-
-/* Implementation file */
-
-static ::osl::Mutex m_aThreadMutex;
-extern nsresult NewAddressBook(const ::rtl::OUString * aName);
-
-
-MNSMozabProxy::MNSMozabProxy()
-{
- m_Args = NULL;
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
- acquire();
-}
-
-MNSMozabProxy::~MNSMozabProxy()
-{
-}
-
-sal_Int32 MNSMozabProxy::StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile)
-{
- OSL_TRACE( "IN : MNSMozabProxy::StartProxy() \n" );
- ::osl::MutexGuard aGuard(m_aThreadMutex);
- m_Product = aProduct;
- m_Profile = aProfile;
- m_Args = args;
- if (!xRunner.is())
- {
- Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
- ::com::sun::star::uno::Reference<XInterface> xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xRunner = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner >(xInstance,UNO_QUERY);
- }
- const ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XCodeProxy > aCode(this);
- return xRunner->Run(aCode);
-}
-
-extern nsresult getTableStringsProxied(const sal_Char* sAbURI, sal_Int32 *nDirectoryType,MNameMapper *nmap,
- ::std::vector< ::rtl::OUString >* _rStrings,
- ::std::vector< ::rtl::OUString >* _rTypes,
- sal_Int32* pErrorId );
-
-::com::sun::star::mozilla::MozillaProductType SAL_CALL MNSMozabProxy::getProductType( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_Product;
-}
-::rtl::OUString SAL_CALL MNSMozabProxy::getProfileName( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return m_Profile;
-}
-
-sal_Int32 SAL_CALL MNSMozabProxy::run( ) throw (::com::sun::star::uno::RuntimeException)
-{
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "IN : MNSMozabProxy::Run() Caller thread :%4d \n" , m_oThreadID );
-#else
- OSL_TRACE( "IN : MNSMozabProxy::Run() \n" );
-#endif
- nsresult rv = NS_ERROR_INVALID_ARG;
- if (m_Args == NULL)
- return NS_ERROR_INVALID_ARG;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP:
- case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED:
- case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE:
- rv = testLDAPConnection();
- break;
- case ProxiedFunc::FUNC_GET_TABLE_STRINGS:
- rv = getTableStringsProxied((const sal_Char*)m_Args->arg1,
- (sal_Int32 *)m_Args->arg2,
- (MNameMapper *)m_Args->arg3,
- (::std::vector< ::rtl::OUString >*)m_Args->arg4,
- (::std::vector< ::rtl::OUString >*)m_Args->arg5,
- (sal_Int32 *)m_Args->arg6);
- break;
- case ProxiedFunc::FUNC_EXECUTE_QUERY:
- if (m_Args->arg1 && m_Args->arg2)
- {
- rv = ((MQuery*)m_Args->arg1)->executeQueryProxied((OConnection*)m_Args->arg2);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD:
- case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD:
- if (m_Args->arg1)
- {
- rv = QueryHelperStub();
- }
- break;
- case ProxiedFunc::FUNC_NEW_ADDRESS_BOOK:
- if (m_Args->arg1)
- {
- rv = NewAddressBook((const ::rtl::OUString*)m_Args->arg1 );
- }
- break;
- default:
- return NS_ERROR_INVALID_ARG;
- }
- return rv;
-}
-
-nsresult MNSMozabProxy::QueryHelperStub()
-{
- nsresult rv = NS_ERROR_INVALID_ARG;
- MQueryHelper * mHelper=(MQueryHelper*) m_Args->arg1;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD:
- if (m_Args->arg2 ) //m_Args->arg2 used to return cord number
- {
- *((sal_Int32*)m_Args->arg2) = mHelper->createNewCard();
- rv = NS_OK;
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD:
- if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->deleteCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD:
- if (m_Args->arg2 && m_Args->arg3 ) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->commitCard(*((sal_Int32*)m_Args->arg2),(nsIAbDirectory*)m_Args->arg3);
- }
- break;
- case ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD:
- if (m_Args->arg2) //m_Args->arg2 used to get the cord number
- {
- rv = mHelper->resyncRow(*((sal_Int32*)m_Args->arg2));
- }
- break;
- default:
- break;
- }
- return rv;
-}
-//-------------------------------------------------------------------
-
-#define NS_LDAPCONNECTION_CONTRACTID "@mozilla.org/network/ldap-connection;1"
-#define NS_LDAPOPERATION_CONTRACTID "@mozilla.org/network/ldap-operation;1"
-#define NS_LDAPMESSAGE_CONTRACTID "@mozilla.org/network/ldap-message;1"
-#define NS_LDAPURL_CONTRACTID "@mozilla.org/network/ldap-url;1"
-
-namespace connectivity {
- namespace mozab {
- class MLDAPMessageListener : public nsILDAPMessageListener
- {
- NS_DECL_ISUPPORTS
- NS_DECL_NSILDAPMESSAGELISTENER
-
- MLDAPMessageListener();
- virtual ~MLDAPMessageListener();
-
- sal_Bool initialized() const;
- sal_Bool goodConnection() const { return initialized() && m_GoodConnection; }
-
- protected:
-
- ::osl::Mutex m_aMutex;
- ::osl::Condition m_aCondition;
-
- sal_Bool m_IsComplete;
- sal_Bool m_GoodConnection;
-
- void setConnectionStatus( sal_Bool _good );
- };
- }
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(MLDAPMessageListener, nsILDAPMessageListener)
-
-MLDAPMessageListener::MLDAPMessageListener()
- : mRefCnt( 0 )
- , m_IsComplete( sal_False )
- , m_GoodConnection( sal_False )
-{
- m_aCondition.reset();
-}
-
-MLDAPMessageListener::~MLDAPMessageListener()
-{
-}
-
-sal_Bool MLDAPMessageListener::initialized() const
-{
- return const_cast< MLDAPMessageListener* >( this )->m_aCondition.check();
-}
-
-void MLDAPMessageListener::setConnectionStatus( sal_Bool _good )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- m_IsComplete = sal_True;
- m_GoodConnection = _good;
-
- m_aCondition.set();
-}
-
-NS_IMETHODIMP MLDAPMessageListener::OnLDAPInit(nsILDAPConnection* /*aConn*/, nsresult aStatus )
-{
- setConnectionStatus( NS_SUCCEEDED( aStatus ) ? sal_True : sal_False );
- return aStatus;
-}
-
-NS_IMETHODIMP MLDAPMessageListener::OnLDAPMessage( nsILDAPMessage* aMessage )
-{
- nsresult rv;
-
- PRInt32 messageType;
- rv = aMessage->GetType(&messageType);
- NS_ENSURE_SUCCESS(rv, rv);
- PRInt32 errCode;
- switch (messageType)
- {
- case nsILDAPMessage::RES_BIND:
- rv = aMessage->GetErrorCode(&errCode);
- // if the login failed
- if (errCode != (PRInt32)nsILDAPErrors::SUCCESS) {
- setConnectionStatus( sal_False );
- }
- else
- setConnectionStatus( sal_True );
- break;
- case nsILDAPMessage::RES_SEARCH_RESULT:
- setConnectionStatus( sal_True );
- break;
- default:
- break;
- }
-
- return NS_OK;
-}
-
-//-------------------------------------------------------------------
-
-nsresult
-MNSMozabProxy::testLDAPConnection( )
-{
- nsresult rv=NS_ERROR_INVALID_ARG;
- switch(m_Args->funcIndex)
- {
- case ProxiedFunc::FUNC_TESTLDAP_INIT_LDAP:
- if (m_Args->arg1 && m_Args->arg4 )
- {
- rv = InitLDAP((sal_Char*)m_Args->arg1,(sal_Unicode*)m_Args->arg2,(sal_Unicode*)m_Args->arg3,(sal_Bool*)m_Args->arg4);
- }
- break;
- case ProxiedFunc::FUNC_TESTLDAP_IS_LDAP_CONNECTED:
- if (m_Args->arg5)
- {
- const MLDAPMessageListener* pListener( static_cast< const MLDAPMessageListener* >( m_Args->arg5 ) );
- if ( pListener->initialized() )
- rv = pListener->goodConnection() ? 0 : (nsresult)PR_NOT_CONNECTED_ERROR;
- else
- rv = (nsresult)PR_CONNECT_TIMEOUT_ERROR;
- }
- break;
- case ProxiedFunc::FUNC_TESTLDAP_RELEASE_RESOURCE:
- if (m_Args->arg5)
- {
- ((MLDAPMessageListener*)m_Args->arg5)->Release();
- delete (MLDAPMessageListener*)m_Args->arg5;
- m_Args->arg5 = NULL;
- rv = 0;
- }
- break;
- default:
- return NS_ERROR_INVALID_ARG;
- }
- return rv;
-}
-nsresult
-MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPasswd,sal_Bool * nUseSSL)
-{
- sal_Bool useSSL = *nUseSSL;
- nsresult rv;
-
- nsCOMPtr<nsILDAPURL> url;
- url = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
- if ( NS_FAILED(rv) )
- return NS_ERROR_INVALID_ARG;
-
- rv = url->SetSpec( nsDependentCString(sUri) );
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString host;
- rv = url->GetAsciiHost(host);
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRInt32 port;
- rv = url->GetPort(&port);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCString dn;
- rv = url->GetDn(dn);
- NS_ENSURE_SUCCESS(rv, rv);
-
-
-
- // Get the ldap connection
- nsCOMPtr<nsILDAPConnection> ldapConnection;
- ldapConnection = do_CreateInstance(NS_LDAPCONNECTION_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- MLDAPMessageListener* messageListener =
- new MLDAPMessageListener ( );
- if (messageListener == NULL)
- return NS_ERROR_INVALID_ARG;
-
- messageListener->AddRef();
-
- nsCAutoString nsBind;
- // PRUnichar != sal_Unicode in mingw
- nsBind.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(sBindDN));
-
- // Now lets initialize the LDAP connection properly.
- rv = ldapConnection->Init(host.get(), port, useSSL, nsBind,
- messageListener,NULL,nsILDAPConnection::VERSION3);
- // Initiate the LDAP operation
- nsCOMPtr<nsILDAPOperation> ldapOperation =
- do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
-
- rv = ldapOperation->Init(ldapConnection, messageListener, nsnull);
- if (NS_FAILED(rv))
- return NS_ERROR_UNEXPECTED; // this should never happen
-
- if ( pPasswd && *pPasswd )
- {
- nsCAutoString nsPassword;
- // PRUnichar != sal_Unicode in mingw
- nsPassword.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(pPasswd));
- rv = ldapOperation->SimpleBind(nsPassword);
- }
-
- if (NS_SUCCEEDED(rv))
- m_Args->arg5 = messageListener;
- return rv;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx
deleted file mode 100644
index 85d6337381..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.hxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_MOZABHELPER_HXX_
-#define _CONNECTIVITY_MAB_MOZABHELPER_HXX_
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-
-#include <MNSInclude.hxx>
-#include <cppuhelper/compbase1.hxx>
-#include <com/sun/star/mozilla/XCodeProxy.hpp>
-#include "com/sun/star/mozilla/XProxyRunner.hdl"
-
-namespace connectivity
-{
- namespace mozab
- {
- namespace ProxiedFunc
- {
- enum
- {
- FUNC_TESTLDAP_INIT_LDAP=1,
- FUNC_TESTLDAP_IS_LDAP_CONNECTED,
- FUNC_TESTLDAP_RELEASE_RESOURCE,
- FUNC_GET_TABLE_STRINGS,
- FUNC_EXECUTE_QUERY,
- FUNC_QUERYHELPER_CREATE_NEW_CARD,
- FUNC_QUERYHELPER_DELETE_CARD,
- FUNC_QUERYHELPER_COMMIT_CARD,
- FUNC_QUERYHELPER_RESYNC_CARD,
- FUNC_NEW_ADDRESS_BOOK
- };
- }
-
- struct RunArgs
- {
- sal_Int32 funcIndex; //Function Index
- sal_Int32 argCount; //parameter count
- void * arg1;
- void * arg2;
- void * arg3;
- void * arg4;
- void * arg5;
- void * arg6;
- RunArgs()
- {
- arg1 = NULL;
- arg2 = NULL;
- arg3 = NULL;
- arg4 = NULL;
- arg5 = NULL;
- arg6 = NULL;
- }
- };
- typedef RunArgs RunArgs;
- typedef ::cppu::WeakImplHelper1< ::com::sun::star::mozilla::XCodeProxy > MNSMozabProxy_BASE;
-
-
- class MNSMozabProxy : public MNSMozabProxy_BASE
- {
- public:
- MNSMozabProxy();
- virtual ~MNSMozabProxy();
-
- //XCodeProxy
- virtual sal_Int32 SAL_CALL run( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::mozilla::MozillaProductType SAL_CALL getProductType( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getProfileName( ) throw (::com::sun::star::uno::RuntimeException);
-
- public:
- sal_Int32 StartProxy(RunArgs * args,::com::sun::star::mozilla::MozillaProductType aProduct,const ::rtl::OUString &aProfile); //Call this to start proxy
-
- protected:
- nsresult testLDAPConnection();
- nsresult InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* sPasswd,sal_Bool * nUseSSL);
- nsresult QueryHelperStub();
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XProxyRunner > xRunner;
-
- RunArgs * m_Args;
- ::com::sun::star::mozilla::MozillaProductType m_Product;
- ::rtl::OUString m_Profile;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
- };
- }
-}
-#endif //_CONNECTIVITY_MAB_MOZABHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx
deleted file mode 100644
index 6c2a2f5bc2..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-#include <MNSTerminateListener.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <MNSInit.hxx>
-
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::frame;
-::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> MNSTerminateListener::mxTerminateListener = new MNSTerminateListener();
-
-// -----------------------------------------
-// - MNSTerminateListener -
-// -----------------------------------------
-
-MNSTerminateListener::MNSTerminateListener( )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-MNSTerminateListener::~MNSTerminateListener()
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::disposing( const EventObject& /*Source*/ ) throw( RuntimeException )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::queryTermination( const EventObject& /*aEvent*/ ) throw( TerminationVetoException, RuntimeException )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL MNSTerminateListener::notifyTermination( const EventObject& /*aEvent*/ ) throw( RuntimeException )
-{
- MNS_Term(sal_True); //Force XPCOM to shutdown
-}
-
-void MNSTerminateListener::addTerminateListener()
-{
- Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
-
- if( xFact.is() )
- {
- Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
-
- if( xDesktop.is() )
- xDesktop->addTerminateListener(mxTerminateListener);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx
deleted file mode 100644
index 16a27c7702..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MNSTERMINATELISTENER_HXX
-#define _MNSTERMINATELISTENER_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-
-//class to implement the XTerminateListener interface
-class MNSTerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
-{
-
-private:
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
-
-
-public:
- MNSTerminateListener();
- virtual ~MNSTerminateListener();
-public:
- static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> mxTerminateListener;
- static void addTerminateListener();
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
deleted file mode 100644
index 38310179d7..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-
-#include <MNameMapper.hxx>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-
-using namespace connectivity::mozab;
-
-bool
-MNameMapper::ltstr::operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const
-{
- return s1.compareTo(s2) < 0;
-}
-
-MNameMapper::MNameMapper()
-{
- mDirMap = new MNameMapper::dirMap;
- mUriMap = new MNameMapper::uriMap;
-}
-MNameMapper::~MNameMapper()
-{
- clear();
-}
-
-void MNameMapper::reset()
-{
- clear();
- mDirMap = new MNameMapper::dirMap;
- mUriMap = new MNameMapper::uriMap;
-}
-void MNameMapper::clear()
-{
- if ( mUriMap != NULL ) {
- delete mUriMap;
- }
- if ( mDirMap != NULL ) {
- MNameMapper::dirMap::iterator iter;
- for (iter = mDirMap -> begin(); iter != mDirMap -> end(); ++iter) {
- NS_IF_RELEASE(((*iter).second));
- }
- delete mDirMap;
- }
-}
-const char * getURI(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return NULL; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return NULL; }
- return uri;
-}
-
-// May modify the name passed in so that it's unique
-nsresult
-MNameMapper::add( ::rtl::OUString& str, nsIAbDirectory* abook )
-{
- MNameMapper::dirMap::iterator iter;
-
- OSL_TRACE( "IN MNameMapper::add()\n" );
-
- if ( abook == NULL ) {
- OSL_TRACE( "\tOUT MNameMapper::add() called with null abook\n" );
- return NS_ERROR_NULL_POINTER;
- }
-
- ::rtl::OUString ouUri=::rtl::OUString::createFromAscii(getURI(abook));
- if ( mUriMap->find (ouUri) != mUriMap->end() ) //There's already an entry with same uri
- {
- return NS_ERROR_FILE_NOT_FOUND;
- }
- mUriMap->insert( MNameMapper::uriMap::value_type( ouUri, abook ) );
-
- ::rtl::OUString tempStr=str;
- long count =1;
- while ( mDirMap->find( tempStr ) != mDirMap->end() ) {
-
- tempStr = str + ::rtl::OUString::valueOf(count);;
- count ++;
- }
- str = tempStr;
- NS_IF_ADDREF(abook);
- mDirMap->insert( MNameMapper::dirMap::value_type( str, abook ) );
- OSL_TRACE( "\tOUT MNameMapper::add()\n" );
- return 0;
-}
-
-bool
-MNameMapper::getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook )
-{
- MNameMapper::dirMap::iterator iter;
-
- OSL_TRACE( "IN MNameMapper::getDir( %s )\n", OUtoCStr(str)?OUtoCStr(str):"NULL" );
-
- if ( (iter = mDirMap->find( str )) != mDirMap->end() ) {
- *abook = (*iter).second;
- NS_IF_ADDREF(*abook);
- } else {
- *abook = NULL;
- }
-
- OSL_TRACE( "\tOUT MNameMapper::getDir() : %s\n", (*abook)?"True":"False" );
-
- return( (*abook) != NULL );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
deleted file mode 100644
index 46651383c4..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_NAMEMAPPER_HXX_
-#define _CONNECTIVITY_MAB_NAMEMAPPER_HXX_ 1
-
-#include <map>
-
-// Mozilla includes
-#include <MNSInclude.hxx>
-
-// Star Includes
-#include <rtl/ustring.hxx>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MNameMapper
- {
- private:
-
- struct ltstr
- {
- bool operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const;
- };
-
-
- typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > dirMap;
- typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > uriMap;
-
- static MNameMapper *instance;
- dirMap *mDirMap;
- uriMap *mUriMap;
-
- //clear dirs
- void clear();
-
- public:
- static MNameMapper* getInstance();
-
- MNameMapper();
- ~MNameMapper();
-
- // May modify the name passed in so that it's unique
- nsresult add( ::rtl::OUString& str, nsIAbDirectory* abook );
-
- //reset dirs
- void reset();
-
- // Get the directory corresponding to str
- bool getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook );
-
- };
-
- }
-}
-
-#endif //_CONNECTIVITY_MAB_NAMEMAPPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
deleted file mode 100644
index 1e09198a87..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
+++ /dev/null
@@ -1,826 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <MQueryHelper.hxx>
-#include <MNameMapper.hxx>
-#include <MConnection.hxx>
-#include <connectivity/dbexception.hxx>
-#include "MQuery.hxx"
-#include "MLdapAttributeMap.hxx"
-#include "MTypeConverter.hxx"
-#include "MNSMozabProxy.hxx"
-#include <com/sun/star/uno/Reference.hxx>
-#include <unotools/processfactory.hxx>
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-
-#if OSL_DEBUG_LEVEL > 0
-# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
-#else /* OSL_DEBUG_LEVEL */
-# define OUtoCStr( x ) ("dummy")
-#endif /* OSL_DEBUG_LEVEL */
-
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS_CID);
-static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
-static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
-static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
-static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID);
-
-using namespace connectivity::mozab;
-using namespace connectivity;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbc;
-using namespace connectivity;
-
-// -------------------------------------------------------------------------
-// Used to store an nsIAbDirectoryQuery member without the need to use Mozilla
-// types in the MQuery.hxx file.
-//
-namespace connectivity {
- namespace mozab {
- struct MQueryDirectory {
- nsCOMPtr<nsIAbDirectory> directory;
- nsCOMPtr<nsIAbDirectoryQuery> directoryQuery;
- PRInt32 contextId;
- MQueryDirectory() : contextId(-1) {}
- };
- }
-}
-
-// -------------------------------------------------------------------------
-/*
-MQuery::MQuery()
-{
- OSL_TRACE( "IN MQuery::MQuery()\n" );
-
- construct();
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-
- OSL_TRACE( "\tOUT MQuery::MQuery()\n" );
-}
-*/
-// -------------------------------------------------------------------------
-MQuery::MQuery( const OColumnAlias& _ca )
- :m_rColumnAlias( _ca )
-{
- OSL_TRACE( "IN MQuery::MQuery( ca )\n" );
-
- construct();
-
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-
- OSL_TRACE( "\tOUT MQuery::MQuery( ca )\n" );
-}
-// -------------------------------------------------------------------------
-MQuery::~MQuery()
-{
- OSL_TRACE("IN MQuery::~MQuery()\n");
-
- // MQueryHelper is reference counted, so we need to decrement the
- // count here.
- //
- if ( m_aQueryDirectory->contextId != -1 && m_aQueryDirectory->directoryQuery !=
- NULL )
- m_aQueryDirectory->directoryQuery->StopQuery(m_aQueryDirectory->contextId);
-
- if ( m_aQueryDirectory )
- delete m_aQueryDirectory;
-
- NS_IF_RELEASE( m_aQueryHelper);
-
- OSL_TRACE("\tOUT MQuery::~MQuery()\n");
-}
-// -----------------------------------------------------------------------------
-void MQuery::construct()
-{
- // Set default values. (For now just as a reminder).
- m_aError.reset();
- m_bQuerySubDirs = sal_True; // LDAP Queryies require this to be set!
- m_nMaxNrOfReturns = -1; // Unlimited number of returns.
-
- m_aQueryDirectory = new MQueryDirectory();
- // MQueryHelper is reference counted, so we need to add to the
- // count here to prevent accidental deletion else where...
- //
- m_aQueryHelper = new MQueryHelper();
- NS_IF_ADDREF( m_aQueryHelper);
-}
-// -------------------------------------------------------------------------
-void MQuery::setAddressbook(::rtl::OUString &ab)
-{
- OSL_TRACE("IN MQuery::setAddressbook()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aAddressbook = ab;
-
- OSL_TRACE("\tOUT MQuery::setAddressbook()\n");
-}
-// -------------------------------------------------------------------------
-::rtl::OUString MQuery::getAddressbook() const
-{
- OSL_TRACE("IN MQuery::getAddressbook()\n");
-
- OSL_TRACE("\tOUT MQuery::getAddressbook()\n");
-
- return(m_aAddressbook);
-}
-// -------------------------------------------------------------------------
-void MQuery::setMaxNrOfReturns(const sal_Int32 mnr)
-{
- OSL_TRACE( "IN MQuery::setMaxNrOfReturns()\n" );
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_nMaxNrOfReturns = mnr;
- OSL_TRACE("\tOUT MQuery::setMaxNrOfReturns()\n" );
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::getMaxNrOfReturns() const
-{
- OSL_TRACE("IN MQuery::getMaxNrOfReturns()\n");
-
- OSL_TRACE("\tOUT MQuery::getMaxNrOfReturns()\n");
-
- return(m_nMaxNrOfReturns);
-}
-// -------------------------------------------------------------------------
-void MQuery::setQuerySubDirs(sal_Bool &qsd)
-{
- OSL_TRACE("IN MQuery::setQuerySubDirs()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_bQuerySubDirs = qsd;
- OSL_TRACE("\tOUT MQuery::setQuerySubDirs()\n");
-}
-// -------------------------------------------------------------------------
-sal_Bool MQuery::getQuerySubDirs() const
-{
- OSL_TRACE("IN MQuery::getQuerySubDirs()\n");
-
- OSL_TRACE("\tOUT MQuery::getQuerySubDirs()\n");
-
- return(m_bQuerySubDirs);
-}
-// -------------------------------------------------------------------------
-void MQuery::setExpression( MQueryExpression &_expr )
-{
- OSL_TRACE("IN MQuery::setExpression()\n");
- ::osl::MutexGuard aGuard(m_aMutex);
-
- m_aExpr = _expr;
-
- OSL_TRACE("\tOUT MQuery::setExpression()\n");
-}
-// -------------------------------------------------------------------------
-static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr,
- nsIAbBooleanExpression* queryExpression )
-{
- nsresult rv; // Store return values.
- // Array that holds all matchItems, to be passed to DoQuery().
- nsCOMPtr<nsISupportsArray> matchItems;
- NS_NewISupportsArray(getter_AddRefs(matchItems));
-
- // Add every individual boolString to matchItems array.
- nsString matchValue;
- // Initialise the matchItems container.
- MQueryExpression::ExprVector::iterator evIter;
- for( evIter = _aExpr->getExpressions().begin();
- evIter != _aExpr->getExpressions().end();
- ++evIter )
- {
- if ( (*evIter)->isStringExpr() ) {
- nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv);
- NS_ENSURE_SUCCESS( rv, rv );
-
- MQueryExpressionString* evStr = static_cast<MQueryExpressionString*> (*evIter);
-
- // Set the 'name' property of the boolString.
- // Check if it's an alias first...
- rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() );
- boolString->SetName( strdup( attrName.getStr() ) );
- OSL_TRACE("Name = %s ;", attrName.getStr() );
- // Set the 'matchType' property of the boolString. Check for equal length.
- sal_Bool requiresValue = sal_True;
- switch(evStr->getCond()) {
- case MQueryOp::Exists:
- OSL_TRACE("MQueryOp::Exists; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Exists);
- requiresValue = sal_False;
- break;
- case MQueryOp::DoesNotExist:
- OSL_TRACE("MQueryOp::DoesNotExist; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist);
- requiresValue = sal_False;
- break;
- case MQueryOp::Contains:
- OSL_TRACE("MQueryOp::Contains; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Contains);
- break;
- case MQueryOp::DoesNotContain:
- OSL_TRACE("MQueryOp::DoesNotContain; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain);
- break;
- case MQueryOp::Is:
- OSL_TRACE("MQueryOp::Is; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
- break;
- case MQueryOp::IsNot:
- OSL_TRACE("MQueryOp::IsNot; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot);
- break;
- case MQueryOp::BeginsWith:
- OSL_TRACE("MQueryOp::BeginsWith; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith);
- break;
- case MQueryOp::EndsWith:
- OSL_TRACE("MQueryOp::EndsWith; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith);
- break;
- case MQueryOp::SoundsLike:
- OSL_TRACE("MQueryOp::SoundsLike; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike);
- break;
- case MQueryOp::RegExp:
- OSL_TRACE("MQueryOp::RegExp; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp);
- break;
- default:
- OSL_TRACE("(default) MQueryOp::Is; ");
- boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
- break;
- }
- // Set the 'matchValue' property of the boolString. Value returned in unicode.
- if ( requiresValue )
- {
- OSL_TRACE("Value = %s \n", OUtoCStr( evStr->getValue() ) );
- MTypeConverter::ouStringToNsString( evStr->getValue(), matchValue);
- boolString->SetValue(matchValue.get ());
- }
- // Add the individual boolString to the container of matchItems.
- matchItems->AppendElement(boolString);
- }
- else if ( (*evIter)->isExpr() ) {
- nsCOMPtr< nsIAbBooleanExpression > subQueryExpr = do_CreateInstance( kBooleanExpressionCID , &rv);
- NS_ENSURE_SUCCESS( rv, rv );
- rv = generateExpression( _aQuery, static_cast< MQueryExpression* >(*evIter),
- subQueryExpr );
- NS_ENSURE_SUCCESS( rv, rv );
- matchItems->AppendElement(subQueryExpr);
- }
- else {
- // Should never see this...
- OSL_FAIL("Unknown Expression Type!");
- return( NS_ERROR_UNEXPECTED );
- }
- }
-
- queryExpression->SetExpressions(matchItems);
- if ( _aExpr->getExpressionCondition() == MQueryExpression::AND )
- queryExpression->SetOperation(nsIAbBooleanOperationTypes::AND);
- else
- queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR);
-
- return( NS_OK );
-}
-sal_uInt32 MQuery::InsertLoginInfo(OConnection* _pCon)
-{
- nsresult rv; // Store return values.
-
- rtl::OUString nameAB = _pCon->getHost().replace('.','_');
- rtl::OUString bindDN = _pCon->getBindDN();
- rtl::OUString password = _pCon->getPassword();
- sal_Bool useSSL = _pCon->getUseSSL();
-
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // create the ldap maxHits entry for the preferences file.
- // Note: maxHits is applicable to LDAP only in mozilla.
- nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers."));
- const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(nameAB.getStr());
- prefName.Append(pAddressBook);
-
- if (bindDN.getLength())
- {
- nsCAutoString bindPrefName=prefName;
- bindPrefName.Append(NS_LITERAL_CSTRING(".auth.dn"));
- rv = prefs->SetCharPref (bindPrefName.get(),
- MTypeConverter::ouStringToCCharStringAscii( bindDN.getStr() ) );
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCAutoString pwdPrefName=prefName;
- pwdPrefName.Append(NS_LITERAL_CSTRING(".auth.pwd"));
- rv = prefs->SetCharPref (pwdPrefName.get(),
- MTypeConverter::ouStringToCCharStringAscii( password.getStr() ) );
- NS_ENSURE_SUCCESS(rv, rv);
- }
- if (useSSL)
- {
- nsCAutoString sslPrefName=prefName;
- sslPrefName.Append(NS_LITERAL_CSTRING(".UseSSL"));
- rv = prefs->SetBoolPref (sslPrefName.get(),useSSL);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- return rv;
-}
-
-//determine whether current profile is locked,any error will lead to return true
-sal_Bool isProfileLocked(OConnection* _pCon)
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap > xMozillaBootstrap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- OSL_ENSURE( xFactory.is(), "can't get service factory" );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInstance = xFactory->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
- xMozillaBootstrap = ::com::sun::star::uno::Reference< ::com::sun::star::mozilla::XMozillaBootstrap >(xInstance,::com::sun::star::uno::UNO_QUERY);
- if (_pCon)
- return xMozillaBootstrap->isProfileLocked(_pCon->getProduct(),_pCon->getMozProfile());
- else
- return xMozillaBootstrap->isCurrentProfileLocked();
-}
-
-
-// -------------------------------------------------------------------------
-sal_Int32 getDirectoryType(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return SDBCAddress::Unknown; }
- const sal_Char *sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_LDAP );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::LDAP;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Mozilla;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_MOZILLA_MDB );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Mozilla;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_EXPRESS );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::OutlookExp;
- }
- sUriPrefix = ::connectivity::mozab::getSchemeURI( ::connectivity::mozab::SCHEME_OUTLOOK_MAPI );
- if (strncmp(uri,sUriPrefix,strlen(sUriPrefix)) == 0)
- {
- return SDBCAddress::Outlook;
- }
- return SDBCAddress::Unknown;
-
-}
-// -------------------------------------------------------------------------
-sal_Bool isForceQueryProxyUsed(const nsIAbDirectory* directory)
-{
- sal_Int32 nType = getDirectoryType(directory);
- if (nType == SDBCAddress::Outlook || nType == SDBCAddress::OutlookExp)
- return sal_True;
- return sal_False;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::commitRow(const sal_Int32 rowIndex)
-{
- if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery)
- return sal_False;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_COMMIT_CARD;
- args.argCount = 3;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&rowIndex;
- args.arg3 = (void*)m_aQueryDirectory->directory;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return rv;
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::deleteRow(const sal_Int32 rowIndex)
-{
- if (!m_aQueryHelper || !m_aQueryDirectory || !m_aQueryDirectory->directoryQuery)
- return sal_False;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_DELETE_CARD;
- args.argCount = 3;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&rowIndex;
- args.arg3 = (void*)m_aQueryDirectory->directory;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return rv;
-
-}
-
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::executeQuery(OConnection* _pCon)
-{
- ::osl::MutexGuard aGuard(m_aMutex);
- OSL_TRACE("IN MQuery::executeQuery()\n");
- m_Product = _pCon->getProduct();
- m_Profile = _pCon->getMozProfile();
-
- nsresult rv;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_EXECUTE_QUERY;
- args.argCount = 2;
- args.arg1 = (void*)this;
- args.arg2 = (void*)_pCon;
- rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- return rv;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
-{
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE("IN MQuery::executeQueryProxied() Caller thread: %4d \n", m_oThreadID);
-#endif
-
- nsresult rv; // Store return values.
- // MTypeConverter aTypeConverter;
- // Create a nsIAbDirectory object to initialise the nsIAbDirectoryQuery object.
- nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ;
- if (NS_FAILED(rv))
- return(-1);
-
- nsCOMPtr<nsIAbDirectory> directory;
- MNameMapper *nmap = _pCon->getNameMapper();
-
-
- if ( nmap->getDir( m_aAddressbook, getter_AddRefs( directory ) ) == sal_False )
- return( -1 );
-
-
- //insert ldap bind info to mozilla profile(in memery,none saved),so we can use it in mozilla part codes
- if (_pCon->isLDAP())
- {
- rv = InsertLoginInfo(_pCon);
- NS_ENSURE_SUCCESS(rv, rv);
-
- }
- // Since Outlook Express and Outlook in OCL mode support a very limited query capability,
- // we use the following bool to judge whether we need bypass any use of a DirectoryQuery
- // interface and instead force the use of the QueryProxy.
- sal_Bool forceQueryProxyUse = isForceQueryProxyUsed(directory);
-
- m_aQueryDirectory->directory = directory;
- // Initialize directory in cases of LDAP and Mozilla
- if (!forceQueryProxyUse) m_aQueryDirectory->directoryQuery = do_QueryInterface(directory, &rv);
-
- if ( NS_FAILED(rv) || forceQueryProxyUse)
- {
- // Create a nsIAbDirectoryQuery object which eventually will execute
- // the query by calling DoQuery().
- nsCOMPtr< nsIAbDirectoryQueryProxy > directoryQueryProxy = do_CreateInstance( kAbDirectoryQueryProxyCID, &rv);
-
- // Need to turn this off for anything using the Query Proxy since it
- // treats Mailing Lists as directories!
-
- m_bQuerySubDirs = sal_False;
-
- rv = directoryQueryProxy->Initiate (directory);
- NS_ENSURE_SUCCESS(rv, rv);
-
- m_aQueryDirectory->directoryQuery = do_QueryInterface (directoryQueryProxy, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- OSL_TRACE("Using the directoryQueryProxy\n");
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n");
-#endif /* OSL_DEBUG_LEVEL */
-
- /*
- // The problem here is that an LDAP Address Book may exist as
- // a Mozilla Address Book. So we need to limit the number of
- // records returned by the Server:
- // 1. Determine if this is an LDAP Address Book
- // [LDAP overrides the default operations(write|read|search) of all types with search only].
- // 2. Determine if the limit is already set by us.
- // 3. Use the mozilla preferences to see if this value is set.
- // 4. Use value or else default to 100.
- */
- PRBool isWriteable;
- rv = directory->GetOperations (&isWriteable);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!(isWriteable & nsIAbDirectory::opWrite))
- {
- if(m_nMaxNrOfReturns == -1)
- {
- // Determine if the limit maxHits has been set in the mozilla preferences
- // if set, then use the value otherwise default to 100
- nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // create the ldap maxHits entry for the preferences file.
- // Note: maxHits is applicable to LDAP only in mozilla.
- nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers."));
- const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(m_aAddressbook);
- prefName.Append(pAddressBook);
- prefName.Append(NS_LITERAL_CSTRING(".maxHits"));
-
- PRInt32 maxHits;
- rv = prefs->GetIntPref(prefName.get(), &maxHits);
- if (NS_FAILED(rv))
- m_nMaxNrOfReturns = 100;
- else
- m_nMaxNrOfReturns = maxHits;
- }
- }
-
-
- nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv);
- NS_ENSURE_SUCCESS( rv, rv );
- rv = generateExpression( this, &m_aExpr, queryExpression );
- NS_ENSURE_SUCCESS( rv, rv );
-
- // Use the nsIAbCard to return the card properties.
- const char *returnProperties[] = {"card:nsIAbCard"};
- PRInt32 count=1;
-
- nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetExpression(queryExpression);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetReturnProperties(count, returnProperties);
- NS_ENSURE_SUCCESS( rv, rv );
-
- rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
- NS_ENSURE_SUCCESS( rv, rv );
-
- nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap );
- rv = arguments->SetTypeSpecificArg( attributeMap );
- NS_ENSURE_SUCCESS( rv, rv );
-
- // Execute the query.
- OSL_TRACE( "****** calling DoQuery\n");
-
- m_aError.reset();
-
- m_aQueryHelper->reset();
-
- rv = m_aQueryDirectory->directoryQuery->DoQuery(arguments, m_aQueryHelper, m_nMaxNrOfReturns, -1, &m_aQueryDirectory->contextId);
-
-
- if (NS_FAILED(rv)) {
- m_aQueryDirectory->contextId = -1;
- OSL_TRACE( "****** DoQuery failed\n");
- OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n");
- m_aQueryHelper->notifyQueryError() ;
- return(-1);
- }
-#if OSL_DEBUG_LEVEL > 0
- else {
- OSL_TRACE( "****** DoQuery succeeded \n");
- }
-#endif
-
- OSL_TRACE("\tOUT MQuery::executeQueryProxied()\n");
-
- return(0);
-}
-
-// -------------------------------------------------------------------------
-//
-//
-// If the query executed is being done asynchronously then this may return
-// -1 as the count, ie. it's undetermined.
-//
-sal_Int32
-MQuery::getRowCount()
-{
- return( m_aQueryHelper->getResultCount() );
-}
-
-// -------------------------------------------------------------------------
-//
-//
-// As opposed to getRowCount() this returns the actual number of rows fetched
-// so far (if is an async query)
-//
-sal_uInt32
-MQuery::getRealRowCount()
-{
- return( m_aQueryHelper->getRealCount() );
-}
-
-//
-// If the query executed is being done asynchronously then this may be
-// false
-//
-sal_Bool
-MQuery::queryComplete( void )
-{
- return( hadError() || m_aQueryHelper->queryComplete() );
-}
-
-sal_Bool
-MQuery::waitForQueryComplete( void )
-{
- if( m_aQueryHelper->waitForQueryComplete( ) )
- return sal_True;
- m_aError = m_aQueryHelper->getError();
- return( sal_False );
-}
-
-// -------------------------------------------------------------------------
-
-sal_Bool
-MQuery::checkRowAvailable( sal_Int32 nDBRow )
-{
- while( !queryComplete() && m_aQueryHelper->getRealCount() <= (sal_uInt32)nDBRow )
- if ( !m_aQueryHelper->waitForRow( nDBRow ) ) {
- m_aError = m_aQueryHelper->getError();
- return( sal_False );
- }
-
- return( getRowCount() > nDBRow );
-}
-// -------------------------------------------------------------------------
-sal_Bool
-MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
- return sal_False;
- }
- switch ( nType )
- {
- case DataType::VARCHAR:
- xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() );
- break;
- default:
- OSL_FAIL( "invalid data type!" );
- break;
- }
-
- return sal_True;
-}
-
-// -------------------------------------------------------------------------
-sal_Bool
-MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType ) const
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
- rValue.setNull();
- return sal_False;
- }
- switch ( nType )
- {
- case DataType::VARCHAR:
- rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
- break;
-
- default:
- rValue.setNull();
- break;
- }
-
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32
-MQuery::getRowStates(sal_Int32 nDBRow)
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- m_aError = m_aQueryHelper->getError();
- return RowStates_Error;
- }
- return xResEntry->getRowStates();
-}
-sal_Bool
-MQuery::setRowStates(sal_Int32 nDBRow,sal_Int32 aState)
-{
- MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
-
- OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
- if (xResEntry == NULL )
- {
- m_aError = m_aQueryHelper->getError();
- return sal_False;
- }
- return xResEntry->setRowStates(aState);
-}
-
-sal_Bool
-MQuery::resyncRow(sal_Int32 nDBRow)
-{
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_RESYNC_CARD;
- args.argCount = 2;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&nDBRow;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- m_aError = m_aQueryHelper->getError();
- return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
-}
-
-sal_Int32
-MQuery::createNewCard()
-{
- sal_Int32 nNumber = 0;
- MNSMozabProxy xMProxy;
- RunArgs args;
- args.funcIndex = ProxiedFunc::FUNC_QUERYHELPER_CREATE_NEW_CARD;
- args.argCount = 2;
- args.arg1 = (void*)m_aQueryHelper;
- args.arg2 = (void*)&nNumber;
- nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
-
- m_aError = m_aQueryHelper->getError();
- NS_ENSURE_SUCCESS(rv,0);
- return nNumber;
-}
-// -------------------------------------------------------------------------
-
-MNameMapper*
-MQuery::CreateNameMapper()
-{
- return( new MNameMapper() );
-}
-
-// -------------------------------------------------------------------------
-void
-MQuery::FreeNameMapper( MNameMapper* _ptr )
-{
- delete _ptr;
-}
-// -------------------------------------------------------------------------
-sal_Bool MQuery::isWritable(OConnection* _pCon)
-{
- if ( !m_aQueryDirectory )
- return sal_False;
-
- nsresult rv; // Store return values.
- nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(m_aQueryDirectory->directory, &rv);;
- if (NS_FAILED(rv))
- return sal_False;
- if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(_pCon))
- return sal_False;
-
- PRBool isWriteable;
- rv = directory->GetOperations (&isWriteable);
- if (NS_FAILED(rv))
- return sal_False;
- sal_Bool bWritable = ( isWriteable & nsIAbDirectory::opWrite ) == nsIAbDirectory::opWrite;
- return bWritable;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
deleted file mode 100644
index 0495bf3cd6..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ /dev/null
@@ -1,282 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_QUERY_HXX_
-#define _CONNECTIVITY_MAB_QUERY_HXX_
-
-#include "MColumnAlias.hxx"
-#include "MErrorResource.hxx"
-#include <connectivity/FValue.hxx>
-#include "MNSDeclares.hxx"
-#include <osl/thread.hxx>
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
-
- class MQueryHelper;
- struct MQueryDirectory;
-
- namespace MQueryOp {
- typedef enum {
- Exists = 0,
- DoesNotExist = 1,
- Contains = 2,
- DoesNotContain = 3,
- Is = 4,
- IsNot = 5,
- BeginsWith = 6,
- EndsWith = 7,
- SoundsLike = 8,
- RegExp = 9
- } cond_type;
- }
-
- class MQueryExpressionBase {
- public:
- typedef enum {
- Unknown,
- StringExpr,
- Expr
- } node_type;
-
- protected:
- node_type m_eNodeType;
-
- MQueryExpressionBase() : m_eNodeType( Unknown ) {}
- MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {}
-
- public:
- sal_Bool isUnknown( ) const { return m_eNodeType == Unknown; }
- sal_Bool isStringExpr( ) const { return m_eNodeType == StringExpr; }
- sal_Bool isExpr( ) const { return m_eNodeType == Expr; }
- };
-
- class MQueryExpressionString : public MQueryExpressionBase {
- protected:
- ::rtl::OUString m_aName; // LHS
- MQueryOp::cond_type m_aBooleanCondition;
- ::rtl::OUString m_aValue; // RHS
-
- public:
-
- MQueryExpressionString( ::rtl::OUString& lhs,
- MQueryOp::cond_type cond,
- ::rtl::OUString rhs )
- : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
- , m_aName( lhs )
- , m_aBooleanCondition( cond )
- , m_aValue( rhs )
- {
- }
-
- MQueryExpressionString( ::rtl::OUString& lhs,
- MQueryOp::cond_type cond )
- : MQueryExpressionBase( MQueryExpressionBase::StringExpr )
- , m_aName( lhs )
- , m_aBooleanCondition( cond )
- , m_aValue( ::rtl::OUString() )
- {
- }
-
- const ::rtl::OUString& getName() const { return m_aName; }
- MQueryOp::cond_type getCond() const { return m_aBooleanCondition; }
- const ::rtl::OUString& getValue() const { return m_aValue; }
- };
-
- class MQuery;
-
- class MQueryExpression : public MQueryExpressionBase
- {
- friend class MQuery;
-
- public:
- typedef ::std::vector< MQueryExpressionBase* > ExprVector;
-
- typedef enum {
- AND,
- OR
- } bool_cond;
-
- void setExpressions( ExprVector& _exprVector )
- { m_aExprVector = _exprVector; }
-
- // All expressions on a peer level use same condition operator
- void setExpressionCondition( bool_cond _cond )
- { m_aExprCondType = _cond; }
-
- ExprVector& getExpressions( )
- { return m_aExprVector; }
-
- // All expressions on a peer level use same condition operator
- bool_cond getExpressionCondition( ) const
- { return m_aExprCondType; }
-
- MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ),
- m_aExprCondType( OR )
- { m_aExprVector.clear(); }
-
-
- protected:
- ExprVector m_aExprVector;
- bool_cond m_aExprCondType;
-
- };
-
-
- class MQuery
- {
- /*
- * A query resultset with a maximum limit of
- * m_nMaxNrOfReturns return items, is created from
- * the following SQL statement:
- *
- * -------------------------------------------------
- * SELECT m_aAttributes FROM m_aAddressbook
- * WHERE m_aMatchItems SQL_OPR m_aMatchValue
- * -------------------------------------------------
- *
- * We are\are not, depending on boolean m_bQuerySubDirs,
- * interested in querying the sub-directories of the
- * addressbook directory, if any.
- *
- * SQL_OPR:
- * m_aSqlOppr contains the SQL operations for every
- * attribute in m_aAttributes.
- * This member must be initialised together with
- * m_aAttributes.
- *
- * The SQL operations defined for 'SQL_OPR' are:
- * matchExists = 0,
- * matchDoesNotExist = 1,
- * matchContains = 2,
- * matchDoesNotContain = 3,
- * matchIs = 4,
- * matchIsNot = 5,
- * matchBeginsWith = 6,
- * matchEndsWith = 7,
- * matchSoundsLike = 8,
- * matchRegExp = 9.
- * There must be mapping to one of these values.
- *
- * The following members MUST be initialised before
- * a query is executed:
- * m_Attributes, m_aMapAttrOppr, m_aAddressbook,
- * m_aMatchItems and m_aMatchValue.
- *
- * m_bQuerySubDirs and m_nMaxNrReturns are set to a
- * default value in the constructor which can be
- * overridden. If (element of) m_aSqlOppr is not set,
- * the default SQL operation is 'matchIs'.
- *
- */
- private:
- MQueryDirectory *m_aQueryDirectory;
- MQueryHelper *m_aQueryHelper;
- ::rtl::OUString m_aAddressbook;
- sal_Int32 m_nMaxNrOfReturns;
- sal_Bool m_bQuerySubDirs;
- MQueryExpression m_aExpr;
- const OColumnAlias& m_rColumnAlias;
- ::com::sun::star::mozilla::MozillaProductType
- m_Product;
- ::rtl::OUString m_Profile;
- ErrorDescriptor m_aError;
-
- void construct();
- protected:
- ::osl::Mutex m_aMutex;
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
-
- public:
- /*
- * - Contains accessors to the members of this class.
- * - executeQuery() initiates a non-blocking query.
- */
- sal_Int32 executeQuery(OConnection* _pCon);
- sal_Int32 executeQueryProxied(OConnection* _pCon); //Used only by MNSMozabProxy
-
- sal_Int32 createNewCard(); //return Row count number
- sal_Int32 deleteRow(const sal_Int32 rowIndex);
- sal_Int32 commitRow(const sal_Int32 rowIndex);
- sal_Bool resyncRow(sal_Int32 nDBRow);
-
- sal_Bool isWritable(OConnection* _pCon);
-
- sal_uInt32 InsertLoginInfo(OConnection* _pCon);
-
- void setAddressbook( ::rtl::OUString&);
- ::rtl::OUString getAddressbook(void) const;
-
- const OColumnAlias& getColumnAlias() const { return m_rColumnAlias; }
-
- void setExpression( MQueryExpression &_expr );
-
- void setMaxNrOfReturns( const sal_Int32);
- sal_Int32 getMaxNrOfReturns(void) const;
-
- void setQuerySubDirs( sal_Bool&);
- sal_Bool getQuerySubDirs(void) const;
-
- sal_Int32 getRowCount( void );
- sal_uInt32 getRealRowCount( void );
- sal_Bool queryComplete( void );
- sal_Bool waitForQueryComplete( void );
- sal_Bool checkRowAvailable( sal_Int32 nDBRow );
- sal_Bool getRowValue( connectivity::ORowSetValue& rValue,
- sal_Int32 nDBRow,
- const rtl::OUString& aDBColumnName,
- sal_Int32 nType ) const;
- sal_Bool setRowValue( connectivity::ORowSetValue& rValue,
- sal_Int32 nDBRow,
- const rtl::OUString& aDBColumnName,
- sal_Int32 nType ) const;
- sal_Int32 getRowStates(sal_Int32 nDBRow);
- sal_Bool setRowStates(sal_Int32 nDBRow,sal_Int32 aState);
-
- bool hadError() const { return m_aError.is(); }
- inline const ErrorDescriptor& getError() const { return m_aError; }
-
- public:
-// MQuery();
- MQuery( const OColumnAlias& _ca );
- virtual ~MQuery();
- static MNameMapper* CreateNameMapper();
- static void FreeNameMapper( MNameMapper* _ptr );
- };
- }
-}
-
-#endif // _CONNECTIVITY_MAB_QUERY_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
deleted file mode 100644
index 4ea4daf8fa..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
+++ /dev/null
@@ -1,637 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include "MQueryHelper.hxx"
-#include "MTypeConverter.hxx"
-#include "MConnection.hxx"
-#include "MNSDeclares.hxx"
-#include "MLdapAttributeMap.hxx"
-
-#include <connectivity/dbexception.hxx>
-
-#include "resource/mozab_res.hrc"
-
-using namespace connectivity::mozab;
-
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
-
-//
-// class MQueryHelperResultEntry
-//
-
-
-MQueryHelperResultEntry::MQueryHelperResultEntry()
-{
- m_Card = NULL;
- m_RowStates = 0;
-}
-
-MQueryHelperResultEntry::~MQueryHelperResultEntry()
-{
- OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
- OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
-
-}
-void
-MQueryHelperResultEntry::setCard(nsIAbCard *card)
-{
- m_Card = card;
-}
-nsIAbCard *
-MQueryHelperResultEntry::getCard()
-{
- return m_Card;
-}
-void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value )
-{
- m_Fields[ key ] = value;
-}
-
-rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const
-{
- FieldMap::const_iterator iter = m_Fields.find( key );
- if ( iter == m_Fields.end() )
- {
- return rtl::OUString();
- }
- else
- {
- return iter->second;
- }
-}
-
-void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue)
-{
- m_Fields[ key ] = rValue;
-}
-//
-// class MQueryHelper
-//
-MQueryHelper::MQueryHelper()
- :m_nIndex( 0 )
- ,m_bHasMore( sal_True )
- ,m_bAtEnd( sal_False )
- ,m_bErrorCondition( sal_False )
- ,m_bQueryComplete( sal_False )
- ,mRefCnt( 0 ) // NSISUPPORTS - Initialize RefCnt to 0
-{
- m_aResults.clear();
-#if OSL_DEBUG_LEVEL > 0
- m_oThreadID = osl_getThreadIdentifier(NULL);
-#endif
-}
-
-MQueryHelper::~MQueryHelper()
-{
- OSL_TRACE("IN MQueryHelper::~MQueryHelper()\n");
- clear_results();
- OSL_TRACE("OUT MQueryHelper::~MQueryHelper()\n");
-}
-
-void
-MQueryHelper::append(MQueryHelperResultEntry* resEnt )
-{
- if ( resEnt != NULL ) {
- m_aResults.push_back( resEnt );
- m_bAtEnd = sal_False;
- }
-}
-
-void
-MQueryHelper::clear_results()
-{
- resultsArray::iterator iter = m_aResults.begin();
- while ( iter != m_aResults.end() ) {
- delete (*iter);
- ++iter;
- }
- m_aResults.clear();
-}
-
-void
-MQueryHelper::rewind()
-{
- m_nIndex = 0;
-}
-
-void
-MQueryHelper::reset()
-{
- m_nIndex = 0;
- m_bHasMore = sal_True;
- m_bQueryComplete = sal_False;
- m_bAtEnd = sal_False;
- m_bErrorCondition = sal_False;
- clear_results();
-}
-
-void
-MQueryHelper::clearResultOrComplete()
-{
- // Don't use a Mutex, it should be called by a method already holding it.
- OSL_TRACE("In/Out : clearResultOrComplete()");
- m_aCondition.reset();
-}
-
-void
-MQueryHelper::notifyResultOrComplete()
-{
- OSL_TRACE("In/Out : notifyResultOrComplete()");
- m_aCondition.set();
-}
-
-sal_Bool
-MQueryHelper::waitForResultOrComplete( )
-{
- TimeValue timeValue = { 1, 0 }; // 20 Seconds 0 NanoSecond timeout
- sal_Int32 times=0;
- osl::Condition::Result rv = ::osl::Condition::result_ok;
-
- OSL_TRACE("In : waitForResultOrComplete()");
- // Can't hold mutex or condition would never get set...
- while( (m_aCondition.check() == sal_False || rv == ::osl::Condition::result_error) && times < 20) {
- rv = m_aCondition.wait( &timeValue );
- times ++;
- }
- if (times >= 20 && rv == ::osl::Condition::result_timeout ) {
- OSL_TRACE("waitForResultOrComplete() : Timeout!");
- m_aError.setResId( STR_TIMEOUT_WAITING );
- return sal_False;
- }
-
- if ( isError() ) {
- OSL_TRACE("waitForResultOrComplete() : Error returned!");
- m_aError.setResId( STR_ERR_EXECUTING_QUERY );
- return sal_False;
- }
- m_aError.reset();
- OSL_TRACE(" Out : waitForResultOrComplete()");
- return sal_True;
-}
-
-
-MQueryHelperResultEntry*
-MQueryHelper::next( )
-{
- MQueryHelperResultEntry* result;
- sal_Int32 index;
-
- m_aMutex.acquire();
- index = m_nIndex;
- m_aMutex.release();
-
- result = getByIndex( index + 1) ; // Add 1 as Row is numbered from 1 to N
-
- if ( result ) {
- m_aMutex.acquire();
- m_nIndex++;
- m_aMutex.release();
- }
-
- return( result );
-}
-
-MQueryHelperResultEntry*
-MQueryHelper::getByIndex( sal_uInt32 nRow )
-{
- // Row numbers are from 1 to N, need to ensure this, and then
- // substract 1
- if ( nRow < 1 ) {
- return( NULL );
- }
-
- do {
- // Obtain the Mutex - don't use a guard as we want to be able to release
- // and acquire again...
- m_aMutex.acquire();
- if ( nRow > m_aResults.size() )
- {
- if ( m_bQueryComplete )
- {
- m_bAtEnd = sal_True;
- m_aMutex.release();
- return( NULL );
- }
- else
- {
- clearResultOrComplete();
- m_aMutex.release();
- if ( !waitForResultOrComplete( ) )
- return( NULL );
- }
- }
- else
- {
- m_aMutex.release();
- return( m_aResults[ nRow -1 ] );
- }
- } while ( sal_True );
-}
-
-sal_Bool
-MQueryHelper::hasMore() const
-{
- return m_bHasMore;
-}
-
-sal_Bool
-MQueryHelper::atEnd() const
-{
- return m_bAtEnd;
-}
-
-sal_Bool
-MQueryHelper::isError() const
-{
- return m_bErrorCondition;
-}
-
-sal_Bool
-MQueryHelper::queryComplete() const
-{
- return m_bQueryComplete;
-}
-
-sal_Bool
-MQueryHelper::waitForQueryComplete( )
-{
- m_aMutex.acquire();
-
- OSL_TRACE("In : waitForQueryComplete()");
- if ( ! m_bQueryComplete ) {
- do
- {
- m_aMutex.release();
- clearResultOrComplete();
- if ( !waitForResultOrComplete( ) )
- return( sal_False );
- m_aMutex.acquire();
- }
- while ( !m_bQueryComplete );
- }
-
- m_aMutex.release();
- OSL_TRACE("Out : waitForQueryComplete()");
- return( sal_True );
-}
-
-sal_Bool
-MQueryHelper::waitForRow( sal_Int32 rowNum )
-{
- m_aMutex.acquire();
- do
- {
- m_aMutex.release();
- clearResultOrComplete();
- if ( !waitForResultOrComplete() )
- return( sal_False );
- m_aMutex.acquire();
- }
- while ( !m_bQueryComplete && m_aResults.size() < (size_t)rowNum );
-
- m_aMutex.release();
- return( sal_True );
-}
-
-// -------------------------------------------------------------------------
-
-sal_Int32
-MQueryHelper::getResultCount() const
-{
- OSL_TRACE( "IN MQueryHelper::getResultCount()" );
- if ( !m_bQueryComplete )
- {
- OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = -1\n");
- return -1;
- }
- else
- {
- OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = %d\n", m_aResults.size() );
- return static_cast<sal_Int32>(m_aResults.size());
- }
-}
-
-// -------------------------------------------------------------------------
-
-sal_uInt32
-MQueryHelper::getRealCount() const
-{
- OSL_TRACE( "IN/OUT MQueryHelper::getRealCount() = %d\n", m_aResults.size() );
- return static_cast<sal_Int32>(m_aResults.size());
-}
-
-// -------------------------------------------------------------------------
-NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-#if OSL_DEBUG_LEVEL > 0
- OSL_TRACE( "IN MQueryHelper::OnQueryItem() Caller thread: %4d \n",m_oThreadID );
-#endif
- nsresult rv;
- PRInt32 resultType;
-
- if ( result == NULL ) {
- OSL_TRACE("\tresult ptr is NULL\n");
- return NS_OK;
- }
-
- // Get return status of executeQuery() call.
- rv = result -> GetType(&resultType);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Check for errors of the executeQuery() call.
- switch ( resultType ) {
- case nsIAbDirectoryQueryResult::queryResultError:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultError\n");
- m_bQueryComplete = sal_True;
- m_bErrorCondition = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultStopped:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultStopped\n");
- m_bQueryComplete = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultComplete:
- OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultComplete\n");
- m_bQueryComplete = sal_True;
- notifyResultOrComplete();
- return NS_OK;
- case nsIAbDirectoryQueryResult::queryResultMatch:
- OSL_TRACE("IN MQueryHelper::OnQueryItem --> queryResultMatch\n");
- // Don't return, continues onto rest of method.
- break;
- default:
- OSL_TRACE("\t******** Unexpected : resultType\n");
- m_bQueryComplete = sal_True;
- return NS_OK;
- }
-
- // Initialise an array that holds the resultset of the query.
- nsCOMPtr<nsISupportsArray> properties;
- rv = result -> GetResult(getter_AddRefs (properties));
- NS_ENSURE_SUCCESS(rv, rv);
-
-
- nsCOMPtr<nsISupports> item;
- rv = properties -> GetElementAt(0, getter_AddRefs(item));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIAbDirectoryQueryPropertyValue> property(do_QueryInterface(item, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- char *name;
- rv = property -> GetName(&name);
- NS_ENSURE_SUCCESS(rv, rv);
- if ( !strcmp(name,"card:nsIAbCard") )
- {
- nsCOMPtr<nsISupports> cardSupports;
- property->GetValueISupports (getter_AddRefs (cardSupports));
- nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- getCardValues(card);
- }
- nsMemory::Free(name);
-
- OSL_TRACE( "\tOUT MQueryHelper::OnQueryItem()\n" );
-
- notifyResultOrComplete();
-
- return(NS_OK);
-}
-
-// -----------------------------------------------------------------------------
-void MQueryHelper::notifyQueryError()
-{
- m_bQueryComplete = sal_True ;
- notifyResultOrComplete() ;
-}
-
-const char * getAddrURI(const nsIAbDirectory* directory)
-{
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)directory, &retCode) ;
- if (NS_FAILED(retCode)) { return NULL; }
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- if (NS_FAILED(retCode)) { return NULL; }
- return uri;
- }
-
-#define ENSURE_GETUPDATECARD(x) \
- if (NS_FAILED(retCode)) \
- { \
- OSL_TRACE( x ); \
- return card; \
- }
-static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
-
-//Some address book does not support query uri on card
-//In this case, we can't resync the cards, we just return the old cards
-nsIAbCard * getUpdatedCard( nsIAbCard* card)
-{
- OSL_ENSURE(card != NULL, "getUpdatedCard for NULL");
- nsresult retCode;
- nsCOMPtr<nsIRDFResource> rdfResource = do_QueryInterface((nsISupports *)card, &retCode) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not support nsIRDFResource\n" );
-
- const char * uri;
- retCode=rdfResource->GetValueConst(&uri);
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" );
-
- nsCOMPtr<nsIRDFService> rdfService (do_GetService(kRDFServiceCID, &retCode)) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Card does not has a uri\n" );
-
- nsCOMPtr<nsIRDFResource> rdfCard;
-
- retCode = rdfService->GetResource(nsDependentCString(uri), getter_AddRefs(rdfCard)) ;
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Can not get the updated card\n" );
-
- nsCOMPtr<nsIAbCard> aNewCard=do_QueryInterface((nsISupports *)rdfCard, &retCode);
- ENSURE_GETUPDATECARD( "IN getUpdatedCard: Error in get new card\n" );
-
- return aNewCard;
- }
-
-#define ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory) \
- if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(NULL)) \
- { \
- m_aError.setResId( STR_MOZILLA_IS_RUNNIG_NO_CHANGES ); \
- return sal_False; \
- }
-
-sal_Int32 MQueryHelper::commitCard(const sal_Int32 rowIndex,nsIAbDirectory * directory)
-{
- ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory);
-
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- return sal_False;
- }
- nsresult rv;
- PRBool hasCard;
- rv = directory->HasCard(card,&hasCard);
- if (setCardValues(rowIndex) != sal_True)
- return sal_False;
-
- if (!NS_FAILED(rv) && hasCard)
- {
- rv = card->EditCardToDatabase(getAddrURI(directory));
- }
- else
- {
- nsIAbCard *addedCard=NULL;
- rv = directory->AddCard(card,&addedCard);
- if (!NS_FAILED(rv))
- resEntry->setCard(addedCard);
- }
- //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
- if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
-
- return !(NS_FAILED(rv));
-}
-
-sal_Int32 MQueryHelper::deleteCard(const sal_Int32 rowIndex,nsIAbDirectory * directory)
-{
- ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory);
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- return sal_False;
- }
- nsresult rv;
- PRBool hasCard;
- if (resEntry->getRowStates() == RowStates_Inserted)
- {
- rv = 0;
- hasCard = sal_True;
- }
- else
- rv = directory->HasCard(card,&hasCard);
-
- if (!NS_FAILED(rv) && hasCard)
- {
- nsCOMPtr <nsISupportsArray> cardsToDelete;
- rv = NS_NewISupportsArray(getter_AddRefs(cardsToDelete));
- if (NS_SUCCEEDED(rv))
- {
- nsCOMPtr<nsISupports> supports = do_QueryInterface(card, &rv);
- if (NS_SUCCEEDED(rv))
- {
- rv = cardsToDelete->AppendElement(supports);
- if (NS_SUCCEEDED(rv))
- rv = directory->DeleteCards(cardsToDelete);
- }
- }
- }
-
- if (NS_SUCCEEDED(rv))
- resEntry->setRowStates(RowStates_Deleted);
- //We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
- if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
- return !(NS_FAILED(rv));
-}
-
-sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex)
-{
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- m_aError.setResId( STR_CANT_FIND_ROW );
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- if (!card)
- {
- m_aError.setResId( STR_CANT_FIND_CARD_FOR_ROW );
- return sal_False;
- }
-
- MLdapAttributeMap::fillCardFromResult( *card, *resEntry );
- return sal_True;
-}
-
-void MQueryHelper::getCardValues(nsIAbCard *card,sal_Int32 rowIndex)
-{
- MQueryHelperResultEntry *resEntry;
- if (rowIndex>0)
- {
- resEntry = getByIndex(rowIndex);
- }
- else
- resEntry = new MQueryHelperResultEntry();
-
- MLdapAttributeMap::fillResultFromCard( *resEntry, *card );
- resEntry->setCard(card);
- if (!rowIndex)
- append( resEntry );
-}
-sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex)
-{
-
- MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
- if (!resEntry)
- {
- m_aError.setResId( STR_CANT_FIND_ROW );
- return sal_False;
- }
- nsIAbCard *card=resEntry->getCard();
- card = getUpdatedCard(card);
- getCardValues(card,rowIndex);
- return sal_True;
-}
-// -------------------------------------------------------------------------
-sal_Int32 MQueryHelper::createNewCard()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- nsresult rv;
- nsCOMPtr <nsIAbCard> card = do_CreateInstance(NS_ABCARDPROPERTY_CONTRACTID, &rv);
- //set default values
- getCardValues(card);
- return static_cast<sal_Int32>(m_aResults.size());
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
deleted file mode 100644
index 3d81453f06..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-#define _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-
-#include <MNSInclude.hxx>
-#include "MErrorResource.hxx"
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <osl/mutex.hxx>
-#include <osl/conditn.hxx>
-#include <comphelper/stl_types.hxx>
-#include <osl/thread.hxx>
-
-#include <boost/unordered_map.hpp>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MQueryHelperResultEntry
- {
- private:
- typedef ::boost::unordered_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap;
-
- mutable ::osl::Mutex m_aMutex;
- FieldMap m_Fields;
- nsCOMPtr<nsIAbCard> m_Card;
- sal_Int32 m_RowStates;
-
- public:
- MQueryHelperResultEntry();
- ~MQueryHelperResultEntry();
-
- void insert( const rtl::OString &key, rtl::OUString &value );
- rtl::OUString getValue( const rtl::OString &key ) const;
- void setValue( const rtl::OString &key, const rtl::OUString & rValue);
-
- void setCard(nsIAbCard *card);
- nsIAbCard *getCard();
- sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;};
- sal_Int32 getRowStates() const { return m_RowStates;};
- };
-
- class MQueryHelper : public nsIAbDirectoryQueryResultListener
- {
- private:
- typedef std::vector< MQueryHelperResultEntry* > resultsArray;
-
- mutable ::osl::Mutex m_aMutex;
- ::osl::Condition m_aCondition;
- resultsArray m_aResults;
- sal_Int32 m_nIndex;
- sal_Bool m_bHasMore;
- sal_Bool m_bAtEnd;
- sal_Bool m_bErrorCondition;
- sal_Bool m_bQueryComplete;
- ErrorDescriptor m_aError;
-
- void append(MQueryHelperResultEntry* resEnt );
-
- void clear_results();
-
- void clearResultOrComplete();
- void notifyResultOrComplete();
- sal_Bool waitForResultOrComplete( );
- void getCardValues(nsIAbCard *card,sal_Int32 rowIndex=0);
-#if OSL_DEBUG_LEVEL > 0
- oslThreadIdentifier m_oThreadID;
-#endif
-
- public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER
-
- MQueryHelper();
- virtual ~MQueryHelper();
-
- void reset();
- void rewind();
-
- MQueryHelperResultEntry* next( );
-
- MQueryHelperResultEntry* getByIndex( sal_uInt32 nRow );
-
- const ErrorDescriptor& getError() const { return m_aError; }
-
- sal_Bool isError() const;
- sal_Bool hasMore() const;
- sal_Bool atEnd() const;
-
- sal_Bool queryComplete() const;
-
- sal_Bool waitForQueryComplete( );
- sal_Bool waitForRow( sal_Int32 rowNum );
-
- sal_Int32 getResultCount() const;
- sal_uInt32 getRealCount() const;
- sal_Int32 createNewCard(); //return Row count number
- sal_Bool resyncRow(sal_Int32 rowIndex);
-
- void notifyQueryError() ;
- sal_Bool setCardValues(const sal_Int32 rowIndex);
- sal_Int32 commitCard(const sal_Int32 rowIndex, nsIAbDirectory * directory);
- sal_Int32 deleteCard(const sal_Int32 rowIndex, nsIAbDirectory * directory);
- };
- }
-}
-#endif // _CONNECTIVITY_MAB_QUERYHELPER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
deleted file mode 100644
index 42517f5515..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_connectivity.hxx"
-
-#include <MNSInclude.hxx>
-#include "MTypeConverter.hxx"
-#include <ucbhelper/content.hxx>
-
-using namespace connectivity::mozab;
-
-// -------------------------------------------------------------------------
-void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss)
-{
- // Convert to ::rtl::OString (utf-8 encoding).
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8));
-
- const char *cs = os.getStr();
- PRUint32 csLen = os.getLength();
-
- NS_ConvertUTF8toUCS2 mozString(cs, csLen);
- //const PRUnichar* uniMozString = (const PRUnichar*) mozString;
- nss = mozString; // temp.
-}
-// -------------------------------------------------------------------------
-::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source )
-{
- const char* buffer = _source.BeginReading();
- const char* bufferEnd = _source.EndReading();
- return ::rtl::OUString( buffer, static_cast<sal_Int32>(bufferEnd - buffer), RTL_TEXTENCODING_ASCII_US );
-}
-// -------------------------------------------------------------------------
-::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source )
-{
- const char* buffer = _source.BeginReading();
- const char* bufferEnd = _source.EndReading();
- return ::rtl::OString( buffer, static_cast<sal_Int32>(bufferEnd - buffer) );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest )
-{
- ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
- asciiToNsACString( sAsciiVersion.getStr(), _dest );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest )
-{
- _dest.Truncate();
- _dest.AppendASCII( _asciiString );
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
-{
- // Get clone of buffer.
- PRUnichar *uc = ToNewUnicode(nss);
- sal_Int32 nssLen = nss.Length();
-
- // TODO check if this is ok.
- // PRUnichar != sal_Unicode in mingw
- ::rtl::OUString _ous(reinterpret_cast_mingw_only<sal_Unicode *>(uc), nssLen);
- ous = _ous;
-
- nsMemory::Free(uc);
-}
-// -------------------------------------------------------------------------
-void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous)
-{
- // TODO, specify length.
- // PRUnichar != sal_Unicode in mingw
- ::rtl::OUString _ous(reinterpret_cast_mingw_only<const sal_Unicode *>(pru));
- ous = _ous;
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous)
-{
- // Convert to ::rtl::OString,
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8));
-
- const char *cs = os.getStr();
-
- return(strdup(cs));
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous)
-{
- // Convert ::rtl::OUString to ::rtl::OString,
- ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_ASCII_US));
-
- return(strdup(os.getStr()));
-}
-// -------------------------------------------------------------------------
-char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss)
-{
- char cs[1024];
- nss.ToCString(cs, 1024);
-
- return(strdup(cs));
-}
-// -------------------------------------------------------------------------
-::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous)
-{
- // Convert ::rtl::OUString to ::rtl::OString.
- ::rtl::OString os(rtl::OUStringToOString(ous,RTL_TEXTENCODING_ASCII_US));
- return( ::std::string(os.getStr()));
-}
-// -------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
deleted file mode 100644
index 55c1246d43..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-#define _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-
-#include <rtl/ustring.hxx>
-
-#include<string>
-
-namespace connectivity
-{
- namespace mozab
- {
- class MTypeConverter
- {
- public:
- static void ouStringToNsString(const ::rtl::OUString&, nsString&);
- static void nsStringToOUString(const nsString&, ::rtl::OUString&);
- static void prUnicharToOUString(const PRUnichar*, ::rtl::OUString&);
- // Use free() for the following 3 calls.
- static char *ouStringToCCharStringAscii(const ::rtl::OUString&);
- static char *nsStringToCCharStringAscii(const nsString&);
- static char *ouStringToCCharStringUtf8(const ::rtl::OUString&);
- // Convert to stl-string.
- static ::std::string ouStringToStlString(const ::rtl::OUString&);
- static ::std::string nsStringToStlString(const nsString&);
-
- static ::rtl::OUString nsACStringToOUString( const nsACString& _source );
- static ::rtl::OString nsACStringToOString( const nsACString& _source );
- static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest );
- static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest );
-
- private:
- MTypeConverter() {};
- };
- }
-}
-
-#endif // _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
deleted file mode 100755
index 810be9bcb4..0000000000
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-CALL_CDECL=TRUE
-
-#mozilla specific stuff.
-MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
-MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla
-#End of mozilla specific stuff.
-
-PRJ=..$/..$/..$/..
-PRJINC=..$/..$/..
-PRJNAME=connectivity
-TARGET=mozabsrc
-
-# --- Settings ----------------------------------
-
-USE_DEFFILE=TRUE
-ENABLE_EXCEPTIONS=TRUE
-VISIBILITY_HIDDEN=TRUE
-
-.INCLUDE : settings.mk
-
-.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO"
-dummy:
- @echo " Not building the mozillasrc stuff in LibreOffice build"
- @echo " dependency to Mozilla developer snapshots not feasable at the moment"
- @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137"
-.ELSE
-
-.INCLUDE : $(PRJ)$/version.mk
-
-.INCLUDE : ../makefile_mozab.mk
-
-INCPRE += -I../bootstrap
-
-# --- Files -------------------------------------
-
-SLOFILES = \
- $(SLO)$/MQueryHelper.obj \
- $(SLO)$/MDatabaseMetaDataHelper.obj \
- $(SLO)$/MQuery.obj \
- $(SLO)$/MTypeConverter.obj \
- $(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj \
- $(SLO)$/MLdapAttributeMap.obj \
-
-.ENDIF
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h
deleted file mode 100755
index cf365e1008..0000000000
--- a/connectivity/source/drivers/mozab/post_include_mozilla.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#if defined __SUNPRO_CC
-#pragma enable_warn
-#elif defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#ifdef MOZ_BOOL
-# undef BOOL
-# undef Bool
-#endif
-
-#ifdef DEBUG_WAS_DEFINED
- #define DEBUG DEBUG_WAS_DEFINED
-#endif
-
-#ifdef _DEBUG_WAS_DEFINED
- #define _DEBUG _DEBUG_WAS_DEFINED
-#endif
-
-#ifndef _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
-#define _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
-
-#ifdef __cplusplus
-#ifdef __MINGW32__
-template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return reinterpret_cast<T1>(p); }
-#else
-template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return p; }
-#endif
-#endif
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h
deleted file mode 100755
index e518d820dc..0000000000
--- a/connectivity/source/drivers/mozab/pre_include_mozilla.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// Turn off DEBUG Assertions
-#ifdef _DEBUG
- #define _DEBUG_WAS_DEFINED _DEBUG
- #ifndef MOZILLA_ENABLE_DEBUG
- #undef _DEBUG
- #endif
-#else
- #undef _DEBUG_WAS_DEFINED
- #ifdef MOZILLA_ENABLE_DEBUG
- #define _DEBUG 1
- #endif
-#endif
-
-// and turn off the additional virtual methods which are part of some interfaces when compiled
-// with debug
-#ifdef DEBUG
- #define DEBUG_WAS_DEFINED DEBUG
- #ifndef MOZILLA_ENABLE_DEBUG
- #undef DEBUG
- #endif
-#else
- #undef DEBUG_WAS_DEFINED
- #ifdef MOZILLA_ENABLE_DEBUG
- #define DEBUG 1
- #endif
-#endif
-
-#if defined __GNUC__
- #pragma GCC system_header
-#elif defined __SUNPRO_CC
- #pragma disable_warn
-#elif defined _MSC_VER
- #pragma warning(push, 1)
- #pragma warning(disable:4946 4710)
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */