diff options
Diffstat (limited to 'dbaccess/source/ext/adabas')
19 files changed, 3098 insertions, 0 deletions
diff --git a/dbaccess/source/ext/adabas/ANewDb.cxx b/dbaccess/source/ext/adabas/ANewDb.cxx new file mode 100644 index 000000000000..1b2f5a50e588 --- /dev/null +++ b/dbaccess/source/ext/adabas/ANewDb.cxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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 ADABASUI_NEWDB_HXX +#include "ANewDb.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif +#ifndef adabasui_ADABAS_CREATEDB_HXX +#include "AdabasNewDb.hxx" +#endif +#ifndef adabasui_SHARED_DBUSTRINGS_HRC +#include "adabasuistrings.hrc" +#endif +#ifndef _SV_MSGBOX_HXX +#include <vcl/msgbox.hxx> +#endif + +using namespace adabasui; +using namespace dbtools; + +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdb; + +extern "C" void SAL_CALL createRegistryInfo_OAdabasCreateDialog() +{ + static OMultiInstanceAutoRegistration< OAdabasCreateDialog > aAutoRegistration; +} + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; + +//========================================================================= +//------------------------------------------------------------------------- +OAdabasCreateDialog::OAdabasCreateDialog(const Reference< XMultiServiceFactory >& _rxORB) + :OAdabasCreateDialogBase(_rxORB) + ,m_pDialog(NULL) +{ + registerProperty(PROPERTY_CREATECATALOG, PROPERTY_ID_CREATECATALOG, PropertyAttribute::TRANSIENT,&m_xCreateCatalog, ::getCppuType(&m_xCreateCatalog)); + registerProperty(PROPERTY_DATABASENAME, PROPERTY_ID_DATABASENAME, PropertyAttribute::TRANSIENT,&m_sDatabaseName, ::getCppuType(&m_sDatabaseName)); + registerProperty(PROPERTY_CONTROL_USER, PROPERTY_ID_CONTROL_USER, PropertyAttribute::TRANSIENT,&m_sControlUser, ::getCppuType(&m_sControlUser)); + registerProperty(PROPERTY_CONTROL_PASSWORD, PROPERTY_ID_CONTROL_PASSWORD, PropertyAttribute::TRANSIENT,&m_sControlPassword, ::getCppuType(&m_sControlPassword)); + registerProperty(PROPERTY_USER, PROPERTY_ID_USER, PropertyAttribute::TRANSIENT,&m_sUser, ::getCppuType(&m_sUser)); + registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD, PropertyAttribute::TRANSIENT,&m_sUserPassword, ::getCppuType(&m_sUserPassword)); + registerProperty(PROPERTY_CACHESIZE, PROPERTY_ID_CACHESIZE, PropertyAttribute::TRANSIENT,&m_nCacheSize, ::getCppuType(&m_nCacheSize)); +} + +//------------------------------------------------------------------------- +Sequence<sal_Int8> SAL_CALL OAdabasCreateDialog::getImplementationId( ) throw(RuntimeException) +{ + static ::cppu::OImplementationId aId; + return aId.getImplementationId(); +} + +//------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OAdabasCreateDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory) +{ + return *(new OAdabasCreateDialog(_rxFactory)); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OAdabasCreateDialog::getImplementationName() throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------------- +::rtl::OUString OAdabasCreateDialog::getImplementationName_Static() throw(RuntimeException) +{ + return ::rtl::OUString::createFromAscii("org.openoffice.comp.adabasui.AdabasCreateDialog"); +} + +//------------------------------------------------------------------------- +::comphelper::StringSequence SAL_CALL OAdabasCreateDialog::getSupportedServiceNames() throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +//------------------------------------------------------------------------- +::comphelper::StringSequence OAdabasCreateDialog::getSupportedServiceNames_Static() throw(RuntimeException) +{ + ::comphelper::StringSequence aSupported(1); + aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.AdabasCreationDialog"); + return aSupported; +} + +//------------------------------------------------------------------------- +Reference<XPropertySetInfo> SAL_CALL OAdabasCreateDialog::getPropertySetInfo() throw(RuntimeException) +{ + Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& OAdabasCreateDialog::getInfoHelper() +{ + return *const_cast<OAdabasCreateDialog*>(this)->getArrayHelper(); +} + +//------------------------------------------------------------------------------ +::cppu::IPropertyArrayHelper* OAdabasCreateDialog::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} + +//------------------------------------------------------------------------------ +Dialog* OAdabasCreateDialog::createDialog(Window* _pParent) +{ + if(!m_xCreateCatalog.is()) + throw SQLException(); + m_pDialog = new OAdabasNewDbDlg(_pParent,m_xCreateCatalog,m_aContext.getLegacyServiceFactory()); + return m_pDialog; +} +// ----------------------------------------------------------------------------- +void OAdabasCreateDialog::executedDialog(sal_Int16 _nExecutionResult) +{ + if(m_pDialog && _nExecutionResult == RET_OK) + { // fill the variables + m_sDatabaseName = m_pDialog->GetDatabaseName(); + m_sControlUser = m_pDialog->GetControlUser(); + m_sControlPassword = m_pDialog->GetControlPassword(); + m_sUser = m_pDialog->GetUser(); + m_sUserPassword = m_pDialog->GetUserPassword(); + m_nCacheSize = m_pDialog->GetCacheSize(); + } +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ext/adabas/ANewDb.hxx b/dbaccess/source/ext/adabas/ANewDb.hxx new file mode 100644 index 000000000000..46de53c1fcaf --- /dev/null +++ b/dbaccess/source/ext/adabas/ANewDb.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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 ADABASUI_NEWDB_HXX +#define ADABASUI_NEWDB_HXX + +#ifndef _SVT_GENERICUNODIALOG_HXX_ +#include <svtools/genericunodialog.hxx> +#endif +#ifndef _EXTENSIONS_COMPONENT_MODULE_HXX_ +#include "Acomponentmodule.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCREATECATALOG_HPP_ +#include <com/sun/star/sdbcx/XCreateCatalog.hpp> +#endif + + + +//......................................................................... +namespace adabasui +{ +//......................................................................... + class OAdabasNewDbDlg; + typedef ::svt::OGenericUnoDialog OAdabasCreateDialogBase; + class OAdabasCreateDialog + :public OAdabasCreateDialogBase + ,public ::comphelper::OPropertyArrayUsageHelper< OAdabasCreateDialog > + ,public OModuleResourceClient + { + protected: + OAdabasNewDbDlg* m_pDialog; // just to avoid a cast + // <properties> + ::rtl::OUString m_sDatabaseName; + ::rtl::OUString m_sControlUser; + ::rtl::OUString m_sControlPassword; + ::rtl::OUString m_sUser; + ::rtl::OUString m_sUserPassword; + sal_Int32 m_nCacheSize; + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XCreateCatalog> m_xCreateCatalog; + // </properties> + protected: + OAdabasCreateDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + + public: + // XTypeProvider + virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); + virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); + + // XServiceInfo - static methods + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( com::sun::star::uno::RuntimeException ); + static ::rtl::OUString getImplementationName_Static(void) throw( com::sun::star::uno::RuntimeException ); + static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + SAL_CALL Create(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&); + + // XPropertySet + virtual com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + protected: + // OGenericUnoDialog overridables + virtual Dialog* createDialog(Window* _pParent); + virtual void executedDialog(sal_Int16 _nExecutionResult); + }; +//......................................................................... +} // namespace adabasui +//......................................................................... + +#endif // ADABASUI_NEWDB_HXX diff --git a/dbaccess/source/ext/adabas/ASQLNameEdit.hxx b/dbaccess/source/ext/adabas/ASQLNameEdit.hxx new file mode 100644 index 000000000000..e434eff9ee64 --- /dev/null +++ b/dbaccess/source/ext/adabas/ASQLNameEdit.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * 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 ADABASUI_SQLNAMEEDIT_HXX +#define ADABASUI_SQLNAMEEDIT_HXX + +#ifndef _SV_EDIT_HXX +#include <vcl/edit.hxx> +#endif +#ifndef _SV_COMBOBOX_HXX +#include <vcl/combobox.hxx> +#endif + +namespace adabasui +{ + class OSQLNameChecker + { + public: + sal_Bool checkString(const ::rtl::OUString& _sOldValue,const ::rtl::OUString& _sToCheck,::rtl::OUString& _rsCorrected); + }; + //================================================================== + class OSQLNameEdit : public Edit + ,public OSQLNameChecker + { + public: + OSQLNameEdit(Window* _pParent,const ResId& _rRes) + : Edit(_pParent,_rRes) + { + } + + // Edit + virtual void Modify(); + }; +} +#endif // DBAUI_SQLNAMEEDIT_HXX + + diff --git a/dbaccess/source/ext/adabas/ASqlNameEdit.cxx b/dbaccess/source/ext/adabas/ASqlNameEdit.cxx new file mode 100644 index 000000000000..e0fd807982e6 --- /dev/null +++ b/dbaccess/source/ext/adabas/ASqlNameEdit.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 ADABASUI_SQLNAMEEDIT_HXX +#include "ASQLNameEdit.hxx" +#endif +namespace adabasui +{ + //------------------------------------------------------------------ + sal_Bool isCharOk(sal_Unicode _cChar) + { + return ( + (_cChar >= 'A' && _cChar <= 'Z') || + _cChar == '_' || + ((_cChar >= '0' && _cChar <= '9')) || + ((_cChar >= 'a' && _cChar <= 'z')) + ); + } + //------------------------------------------------------------------ + sal_Bool OSQLNameChecker::checkString( const ::rtl::OUString& _sOldValue, + const ::rtl::OUString& _sToCheck, + ::rtl::OUString& _rsCorrected) + { + sal_Bool bCorrected = sal_False; + XubString sSavedValue = _sOldValue; + XubString sText = _sToCheck; + xub_StrLen nMatch = 0; + for ( xub_StrLen i=nMatch;i < sText.Len(); ++i ) + { + if ( !isCharOk( sText.GetBuffer()[i]) ) + { + _rsCorrected += sText.Copy( nMatch, i - nMatch ); + bCorrected = sal_True; + nMatch = i + 1; + } + } + _rsCorrected += sText.Copy( nMatch, sText.Len() - nMatch ); + return bCorrected; + } + //------------------------------------------------------------------ + void OSQLNameEdit::Modify() + { + ::rtl::OUString sCorrected; + if ( checkString( GetSavedValue(),GetText(),sCorrected ) ) + { + Selection aSel = GetSelection(); + aSel.setMax( aSel.getMin() ); + SetText( sCorrected, aSel ); + + SaveValue(); + } + Edit::Modify(); + } +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ext/adabas/Acomponentmodule.cxx b/dbaccess/source/ext/adabas/Acomponentmodule.cxx new file mode 100644 index 000000000000..467a36b75afb --- /dev/null +++ b/dbaccess/source/ext/adabas/Acomponentmodule.cxx @@ -0,0 +1,351 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_COMPONENT_MODULE_HXX_ +#include "Acomponentmodule.hxx" +#endif + +#ifndef _TOOLS_RESMGR_HXX +#include <tools/resmgr.hxx> +#endif +#ifndef _SOLAR_HRC +#include <svl/solar.hrc> +#endif +#ifndef _COMPHELPER_SEQUENCE_HXX_ +#include <comphelper/sequence.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + +#define ENTER_MOD_METHOD() \ + ::osl::MutexGuard aGuard(s_aMutex); \ + ensureImpl() + +//......................................................................... +namespace COMPMOD_NAMESPACE +{ +//......................................................................... + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::registry; + using namespace ::comphelper; + using namespace ::cppu; + + //========================================================================= + //= OModuleImpl + //========================================================================= + /** implementation for <type>OModule</type>. not threadsafe, has to be guarded by it's owner + */ + class OModuleImpl + { + ResMgr* m_pRessources; + sal_Bool m_bInitialized; + ByteString m_sFilePrefix; + + public: + /// ctor + OModuleImpl(); + ~OModuleImpl(); + + /// get the manager for the ressources of the module + ResMgr* getResManager(); + void setResourceFilePrefix(const ::rtl::OString& _rPrefix) { m_sFilePrefix = _rPrefix; } + }; + + //------------------------------------------------------------------------- + OModuleImpl::OModuleImpl() + :m_pRessources(NULL) + ,m_bInitialized(sal_False) + { + } + + //------------------------------------------------------------------------- + OModuleImpl::~OModuleImpl() + { + if (m_pRessources) + delete m_pRessources; + } + + //------------------------------------------------------------------------- + ResMgr* OModuleImpl::getResManager() + { + // note that this method is not threadsafe, which counts for the whole class ! + if (!m_pRessources && !m_bInitialized) + { + DBG_ASSERT(m_sFilePrefix.Len(), "OModuleImpl::getResManager: no resource file prefix!"); + // create a manager with a fixed prefix + ByteString aMgrName = m_sFilePrefix; + + m_pRessources = ResMgr::CreateResMgr(aMgrName.GetBuffer()); + DBG_ASSERT(m_pRessources, + (ByteString("OModuleImpl::getResManager: could not create the resource manager (file name: ") + += aMgrName + += ByteString(")!")).GetBuffer()); + + m_bInitialized = sal_True; + } + return m_pRessources; + } + + //========================================================================= + //= OModule + //========================================================================= + ::osl::Mutex OModule::s_aMutex; + sal_Int32 OModule::s_nClients = 0; + OModuleImpl* OModule::s_pImpl = NULL; + ::rtl::OString OModule::s_sResPrefix; + //------------------------------------------------------------------------- + ResMgr* OModule::getResManager() + { + ENTER_MOD_METHOD(); + return s_pImpl->getResManager(); + } + + //------------------------------------------------------------------------- + void OModule::setResourceFilePrefix(const ::rtl::OString& _rPrefix) + { + ::osl::MutexGuard aGuard(s_aMutex); + s_sResPrefix = _rPrefix; + if (s_pImpl) + s_pImpl->setResourceFilePrefix(_rPrefix); + } + + //------------------------------------------------------------------------- + void OModule::registerClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + ++s_nClients; + } + + //------------------------------------------------------------------------- + void OModule::revokeClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + if (!--s_nClients && s_pImpl) + { + delete s_pImpl; + s_pImpl = NULL; + } + } + + //------------------------------------------------------------------------- + void OModule::ensureImpl() + { + if (s_pImpl) + return; + s_pImpl = new OModuleImpl(); + s_pImpl->setResourceFilePrefix(s_sResPrefix); + } + + //-------------------------------------------------------------------------- + //- registration helper + //-------------------------------------------------------------------------- + + Sequence< ::rtl::OUString >* OModule::s_pImplementationNames = NULL; + Sequence< Sequence< ::rtl::OUString > >* OModule::s_pSupportedServices = NULL; + Sequence< sal_Int64 >* OModule::s_pCreationFunctionPointers = NULL; + Sequence< sal_Int64 >* OModule::s_pFactoryFunctionPointers = NULL; + + //-------------------------------------------------------------------------- + void OModule::registerComponent( + const ::rtl::OUString& _rImplementationName, + const Sequence< ::rtl::OUString >& _rServiceNames, + ComponentInstantiation _pCreateFunction, + FactoryInstantiation _pFactoryFunction) + { + if (!s_pImplementationNames) + { + OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers, + "OModule::registerComponent : inconsistent state (the pointers (1)) !"); + s_pImplementationNames = new Sequence< ::rtl::OUString >; + s_pSupportedServices = new Sequence< Sequence< ::rtl::OUString > >; + s_pCreationFunctionPointers = new Sequence< sal_Int64 >; + s_pFactoryFunctionPointers = new Sequence< sal_Int64 >; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OModule::registerComponent : inconsistent state (the pointers (2)) !"); + + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OModule::registerComponent : inconsistent state !"); + + sal_Int32 nOldLen = s_pImplementationNames->getLength(); + s_pImplementationNames->realloc(nOldLen + 1); + s_pSupportedServices->realloc(nOldLen + 1); + s_pCreationFunctionPointers->realloc(nOldLen + 1); + s_pFactoryFunctionPointers->realloc(nOldLen + 1); + + s_pImplementationNames->getArray()[nOldLen] = _rImplementationName; + s_pSupportedServices->getArray()[nOldLen] = _rServiceNames; + s_pCreationFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pCreateFunction); + s_pFactoryFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pFactoryFunction); + } + + //-------------------------------------------------------------------------- + void OModule::revokeComponent(const ::rtl::OUString& _rImplementationName) + { + if (!s_pImplementationNames) + { + OSL_ASSERT("OModule::revokeComponent : have no class infos ! Are you sure called this method at the right time ?"); + return; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OModule::revokeComponent : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OModule::revokeComponent : inconsistent state !"); + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplNames = s_pImplementationNames->getConstArray(); + for (sal_Int32 i=0; i<nLen; ++i, ++pImplNames) + { + if (pImplNames->equals(_rImplementationName)) + { + removeElementAt(*s_pImplementationNames, i); + removeElementAt(*s_pSupportedServices, i); + removeElementAt(*s_pCreationFunctionPointers, i); + removeElementAt(*s_pFactoryFunctionPointers, i); + break; + } + } + + if (s_pImplementationNames->getLength() == 0) + { + delete s_pImplementationNames; s_pImplementationNames = NULL; + delete s_pSupportedServices; s_pSupportedServices = NULL; + delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = NULL; + delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = NULL; + } + } + + //-------------------------------------------------------------------------- + sal_Bool OModule::writeComponentInfos( + const Reference< XMultiServiceFactory >& /*_rxServiceManager*/, + const Reference< XRegistryKey >& _rxRootKey) + { + OSL_ENSURE(_rxRootKey.is(), "OModule::writeComponentInfos : invalid argument !"); + + if (!s_pImplementationNames) + { + OSL_ASSERT("OModule::writeComponentInfos : have no class infos ! Are you sure called this method at the right time ?"); + return sal_True; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OModule::writeComponentInfos : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OModule::writeComponentInfos : inconsistent state !"); + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); + const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); + + ::rtl::OUString sRootKey("/", 1, RTL_TEXTENCODING_ASCII_US); + for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices) + { + ::rtl::OUString aMainKeyName(sRootKey); + aMainKeyName += *pImplName; + aMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES"); + + try + { + Reference< XRegistryKey > xNewKey( _rxRootKey->createKey(aMainKeyName) ); + + const ::rtl::OUString* pService = pServices->getConstArray(); + for (sal_Int32 j=0; j<pServices->getLength(); ++j, ++pService) + xNewKey->createKey(*pService); + } + catch(Exception&) + { + OSL_ASSERT("OModule::writeComponentInfos : something went wrong while creating the keys !"); + return sal_False; + } + } + + return sal_True; + } + + //-------------------------------------------------------------------------- + Reference< XInterface > OModule::getComponentFactory( + const ::rtl::OUString& _rImplementationName, + const Reference< XMultiServiceFactory >& _rxServiceManager) + { + OSL_ENSURE(_rxServiceManager.is(), "OModule::getComponentFactory : invalid argument (service manager) !"); + OSL_ENSURE(_rImplementationName.getLength(), "OModule::getComponentFactory : invalid argument (implementation name) !"); + + if (!s_pImplementationNames) + { + OSL_ASSERT("OModule::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?"); + return NULL; + } + OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, + "OModule::getComponentFactory : inconsistent state (the pointers) !"); + OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) + && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) + && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), + "OModule::getComponentFactory : inconsistent state !"); + + + Reference< XInterface > xReturn; + + + sal_Int32 nLen = s_pImplementationNames->getLength(); + const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); + const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); + const sal_Int64* pComponentFunction = s_pCreationFunctionPointers->getConstArray(); + const sal_Int64* pFactoryFunction = s_pFactoryFunctionPointers->getConstArray(); + + for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices, ++pComponentFunction, ++pFactoryFunction) + { + if (pImplName->equals(_rImplementationName)) + { + const FactoryInstantiation FactoryInstantiationFunction = reinterpret_cast<const FactoryInstantiation>(*pFactoryFunction); + const ComponentInstantiation ComponentInstantiationFunction = reinterpret_cast<const ComponentInstantiation>(*pComponentFunction); + + xReturn = FactoryInstantiationFunction( _rxServiceManager, *pImplName, ComponentInstantiationFunction, *pServices, NULL); + if (xReturn.is()) + { + xReturn->acquire(); + return xReturn.get(); + } + } + } + + return NULL; + } + + +//......................................................................... +} // namespace COMPMOD_NAMESPACE +//......................................................................... + diff --git a/dbaccess/source/ext/adabas/Acomponentmodule.hxx b/dbaccess/source/ext/adabas/Acomponentmodule.hxx new file mode 100644 index 000000000000..7b5f1466a092 --- /dev/null +++ b/dbaccess/source/ext/adabas/Acomponentmodule.hxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_COMPONENT_MODULE_HXX_ +#define _EXTENSIONS_COMPONENT_MODULE_HXX_ + +/** you may find this file helpfull if you implement a component (in it's own library) which can't use + the usual infrastructure.<br/> + More precise, you find helper classes to ease the use of resources and the registration of services. + <p> + You need to define a preprocessor variable COMPMOD_NAMESPACE in order to use this file. Set it to a string + which should be used as namespace for the classes defined herein.</p> +*/ + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif +#ifndef _TOOLS_RESID_HXX +#include <tools/resid.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _RTL_STRING_HXX_ +#include <rtl/string.hxx> +#endif + +class ResMgr; + +//......................................................................... +namespace COMPMOD_NAMESPACE +{ +//......................................................................... + +typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > (SAL_CALL *FactoryInstantiation) + ( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rServiceManager, + const ::rtl::OUString & _rComponentName, + ::cppu::ComponentInstantiation _pCreateFunction, + const ::com::sun::star::uno::Sequence< ::rtl::OUString > & _rServiceNames, + rtl_ModuleCount* _pModuleCounter + ); + + //========================================================================= + //= OModule + //========================================================================= + class OModuleImpl; + class OModule + { + friend class OModuleResourceClient; + + private: + OModule(); + // not implemented. OModule is a static class + + protected: + // resource administration + static ::osl::Mutex s_aMutex; /// access safety + static sal_Int32 s_nClients; /// number of registered clients + static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered + static ::rtl::OString s_sResPrefix; + + // auto registration administration + static ::com::sun::star::uno::Sequence< ::rtl::OUString >* + s_pImplementationNames; + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >* + s_pSupportedServices; + static ::com::sun::star::uno::Sequence< sal_Int64 >* + s_pCreationFunctionPointers; + static ::com::sun::star::uno::Sequence< sal_Int64 >* + s_pFactoryFunctionPointers; + + public: + // cna be set as long as no resource has been accessed ... + static void setResourceFilePrefix(const ::rtl::OString& _rPrefix); + + /// get the vcl res manager of the module + static ResMgr* getResManager(); + + /** register a component implementing a service with the given data. + @param _rImplementationName + the implementation name of the component + @param _rServiceNames + the services the component supports + @param _pCreateFunction + a function for creating an instance of the component + @param _pFactoryFunction + a function for creating a factory for that component + @see revokeComponent + */ + static void registerComponent( + const ::rtl::OUString& _rImplementationName, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, + ::cppu::ComponentInstantiation _pCreateFunction, + FactoryInstantiation _pFactoryFunction); + + /** revoke the registration for the specified component + @param _rImplementationName + the implementation name of the component + */ + static void revokeComponent( + const ::rtl::OUString& _rImplementationName); + + /** write the registration information of all known components + <p>writes the registration information of all components which are currently registered into the + specified registry.<p/> + <p>Usually used from within component_writeInfo.<p/> + @param _rxServiceManager + the service manager + @param _rRootKey + the registry key under which the information will be stored + @return + sal_True if the registration of all implementations was successfull, sal_False otherwise + */ + static sal_Bool writeComponentInfos( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >& _rRootKey); + + /** creates a Factory for the component with the given implementation name. + <p>Usually used from within component_getFactory.<p/> + @param _rxServiceManager + a pointer to an XMultiServiceFactory interface as got in component_getFactory + @param _pImplementationName + the implementation name of the component + @return + the XInterface access to a factory for the component + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory( + const ::rtl::OUString& _rImplementationName, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager + ); + + protected: + /// register a client for the module + static void registerClient(); + /// revoke a client for the module + static void revokeClient(); + + private: + /** ensure that the impl class exists + @precond m_aMutex is guarded when this method gets called + */ + static void ensureImpl(); + }; + + //========================================================================= + //= OModuleResourceClient + //========================================================================= + /** base class for objects which uses any global module-specific ressources + */ + class OModuleResourceClient + { + public: + OModuleResourceClient() { OModule::registerClient(); } + ~OModuleResourceClient() { OModule::revokeClient(); } + }; + + //========================================================================= + //= ModuleRes + //========================================================================= + /** specialized ResId, using the ressource manager provided by the global module + */ + class ModuleRes : public ::ResId + { + public: + ModuleRes(USHORT _nId) : ResId(_nId, *OModule::getResManager()) { } + }; + + //========================================================================== + //= OMultiInstanceAutoRegistration + //========================================================================== + template <class TYPE> + class OMultiInstanceAutoRegistration + { + public: + /** automatically registeres a multi instance component + <p>Assumed that the template argument has the three methods + <ul> + <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> + </li> + <ul/> + the instantiation of this object will automatically register the class via <method>OModule::registerComponent</method>. + <p/> + The factory creation function used is <code>::cppu::createSingleFactory</code>. + @see OOneInstanceAutoRegistration + */ + OMultiInstanceAutoRegistration(); + ~OMultiInstanceAutoRegistration(); + }; + + template <class TYPE> + OMultiInstanceAutoRegistration<TYPE>::OMultiInstanceAutoRegistration() + { + OModule::registerComponent( + TYPE::getImplementationName_Static(), + TYPE::getSupportedServiceNames_Static(), + TYPE::Create, + ::cppu::createSingleFactory + ); + } + + template <class TYPE> + OMultiInstanceAutoRegistration<TYPE>::~OMultiInstanceAutoRegistration() + { + OModule::revokeComponent(TYPE::getImplementationName_Static()); + } + + //========================================================================== + //= OOneInstanceAutoRegistration + //========================================================================== + template <class TYPE> + class OOneInstanceAutoRegistration + { + public: + /** automatically registeres a single instance component + <p>Assumed that the template argument has the three methods + <ul> + <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> + <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> + </li> + <ul/> + the instantiation of this object will automatically register the class via <method>OModule::registerComponent</method>. + <p/> + The factory creation function used is <code>::cppu::createOneInstanceFactory</code>. + @see OOneInstanceAutoRegistration + */ + OOneInstanceAutoRegistration(); + ~OOneInstanceAutoRegistration(); + }; + + template <class TYPE> + OOneInstanceAutoRegistration<TYPE>::OOneInstanceAutoRegistration() + { + OModule::registerComponent( + TYPE::getImplementationName_Static(), + TYPE::getSupportedServiceNames_Static(), + TYPE::Create, + ::cppu::createOneInstanceFactory + ); + } + + template <class TYPE> + OOneInstanceAutoRegistration<TYPE>::~OOneInstanceAutoRegistration() + { + OModule::revokeComponent(TYPE::getImplementationName_Static()); + } + +//......................................................................... +} // namespace COMPMOD_NAMESPACE +//......................................................................... + +#endif // _EXTENSIONS_COMPONENT_MODULE_HXX_ + diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.cxx b/dbaccess/source/ext/adabas/AdabasNewDb.cxx new file mode 100644 index 000000000000..d4a68435a548 --- /dev/null +++ b/dbaccess/source/ext/adabas/AdabasNewDb.cxx @@ -0,0 +1,805 @@ +/************************************************************************* + * + * 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 adabasui_ADABAS_CREATEDB_HXX +#include "AdabasNewDb.hxx" +#endif +#ifndef adabasui_ADABASNEWDB_HRC +#include "AdabasNewDb.hrc" +#endif + +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif +#ifndef _OSL_PROCESS_H_ +#include <osl/process.h> +#endif +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _PASSWD_HXX //autogen +#include <sfx2/passwd.hxx> +#endif +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif +#ifndef _BIGINT_HXX +#include <tools/bigint.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _EXTENSIONS_COMPONENT_MODULE_HXX_ +#include "Acomponentmodule.hxx" +#endif +#ifndef _UNOTOOLS_TEMPFILE_HXX +#include <unotools/tempfile.hxx> +#endif +#ifndef _ADABASUI_RESOURCE_HRC_ +#include "adabasui_resource.hrc" +#endif +#ifndef _UCBHELPER_CONTENT_HXX +#include <ucbhelper/content.hxx> +#endif +#ifndef _SV_WAITOBJ_HXX +#include <vcl/waitobj.hxx> +#endif +#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX +#include <unotools/pathoptions.hxx> +#endif +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/unohlp.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COMPHELPER_EXTRACT_HXX_ +#include <comphelper/extract.hxx> +#endif +#ifndef _UNOTOOLS_TEMPFILE_HXX +#include <unotools/tempfile.hxx> +#endif +#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX +#include <unotools/localfilehelper.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ +#include <com/sun/star/sdbc/SQLException.hpp> +#endif +#ifndef _UNOTOOLS_UCBHELPER_HXX +#include <unotools/ucbhelper.hxx> +#endif +#ifndef _CONNECTIVITY_DBTOOLS_HXX_ +#include <connectivity/dbtools.hxx> +#endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif +#include "adabasuistrings.hrc" +#ifndef _THREAD_HXX_ +#include <osl/thread.hxx> +#endif +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + + +using namespace adabasui; +using namespace ucbhelper; +using namespace utl; +using namespace vos; +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::ucb; +using namespace ::com::sun::star::lang; +namespace adabasui +{ + class ODatabaseCreator : public ::osl::Thread + { + Link m_aTerminateHandler; + Sequence< PropertyValue> m_aValues; + Reference<XCreateCatalog> m_xCreateCatalog; + Reference< XMultiServiceFactory > m_xORB; + Window* m_pErrorWindow; + public: + ODatabaseCreator(const Reference<XCreateCatalog>& _rxCreateCatalog + ,Window* _pErrorWindow + ,const Reference< XMultiServiceFactory >& _xORB + ,const Sequence< PropertyValue>& _rValues) + : m_aValues(_rValues) + , m_xCreateCatalog(_rxCreateCatalog) + , m_xORB(_xORB) + , m_pErrorWindow(_pErrorWindow) + {} + + void setTerminateHandler(const Link& _aTerminateHandler) { m_aTerminateHandler = _aTerminateHandler; } + + protected: + + /// Working method which should be overridden. + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + }; + + void SAL_CALL ODatabaseCreator::run() + { + try + { + m_xCreateCatalog->createCatalog(m_aValues); + } + catch(SQLException& e) + { + ::dbtools::showError(::dbtools::SQLExceptionInfo(e),VCLUnoHelper::GetInterface(m_pErrorWindow),m_xORB); + } + catch(Exception&) + { + OSL_ASSERT(0); + // showError(::dbtools::SQLExceptionInfo(e),this,); + } + } + void SAL_CALL ODatabaseCreator::onTerminated() + { + if ( m_aTerminateHandler.IsSet() ) + m_aTerminateHandler.Call(NULL); + } +} +DBG_NAME( OAdabasNewDbDlg ) +//======================================================================== +OAdabasNewDbDlg::OAdabasNewDbDlg( Window* pParent, + const Reference<XCreateCatalog>& _rxCreateCatalog, + const Reference< XMultiServiceFactory >& _rxORB, + BOOL _bRestore) + :ModalDialog( pParent, ModuleRes( DLG_ADABAS_NEWDB )) + ,m_FT_DATABASENAME( this, ModuleRes( FT_DATABASENAME ) ) + ,m_ET_DATABASENAME( this, ModuleRes( ET_DATABASENAME ) ) + ,m_FL_USER( this, ModuleRes( FL_USER ) ) + ,m_FT_SYSUSR( this, ModuleRes( FT_SYSUSR ) ) + ,m_FT_CONUSR( this, ModuleRes( FT_CONUSR ) ) + ,m_FT_DOMAIN_USR( this, ModuleRes( FT_DOMAIN_USR ) ) + ,m_ET_SYSUSR( this, ModuleRes( ET_SYSUSR ) ) + ,m_PB_SYSPWD( this, ModuleRes( PB_SYSPWD ) ) + ,m_ET_CONUSR( this, ModuleRes( ET_CONUSR ) ) + ,m_PB_CONPWD( this, ModuleRes( PB_CONPWD ) ) + ,m_ET_DOMAIN_USR( this, ModuleRes( ET_DOMAIN_USR ) ) + ,m_PB_DOMAINPWD( this, ModuleRes( PB_DOMAINPWD ) ) + ,m_BMP_CON( this, ModuleRes( BMP_CON ) ) + ,m_BMP_SYS( this, ModuleRes( BMP_SYS ) ) + ,m_BMP_DOMAIN( this, ModuleRes( BMP_DOMAIN ) ) + ,m_FT_RESTORE( this, ModuleRes( FT_RESTORE ) ) + ,m_ET_RESTORE( this, ModuleRes( ET_RESTORE ) ) + ,m_PB_RESTORE( this, ModuleRes( PB_RESTORE ) ) + ,m_FL_DBSETTINGS( this, ModuleRes( FL_DBSETTINGS ) ) + ,m_FT_SYSDEVSPACE( this, ModuleRes( FT_SYSDEVSPACE ) ) + ,m_FT_TRANSACTIONLOG( this, ModuleRes( FT_TRANSACTIONLOG ) ) + ,m_FT_DATADEVSPACE( this, ModuleRes( FT_DATADEVSPACE ) ) + ,m_ET_SYSDEVSPACE( this, ModuleRes( ET_SYSDEVSPACE ) ) + ,m_PB_SYSDEVSPACE( this, ModuleRes( PB_SYSDEVSPACE ) ) + ,m_ET_TRANSACTIONLOG( this, ModuleRes( ET_TRANSACTIONLOG ) ) + ,m_PB_TRANSACTIONLOG( this, ModuleRes( PB_TRANSACTIONLOG ) ) + ,m_ET_DATADEVSPACE( this, ModuleRes( ET_DATADEVSPACE ) ) + ,m_PB_DATADEVSPACE( this, ModuleRes( PB_DATADEVSPACE ) ) + ,m_FT_TRANSACTIONLOG_SIZE( this, ModuleRes( FT_TRANSACTIONLOG_SIZE ) ) + ,m_NF_TRANSACTIONLOG_SIZE( this, ModuleRes( NF_TRANSACTIONLOG_SIZE ) ) + ,m_FT_DATADEVSPACE_SIZE( this, ModuleRes( FT_DATADEVSPACE_SIZE ) ) + ,m_NF_DATADEVSPACE_SIZE( this, ModuleRes( NF_DATADEVSPACE_SIZE ) ) + ,m_FT_CACHE_SIZE( this, ModuleRes( FT_CACHE_SIZE ) ) + ,m_NF_CACHE_SIZE( this, ModuleRes( NF_CACHE_SIZE ) ) + ,m_FL_END( this, ModuleRes( FL_END ) ) + ,m_PB_OK( this, ModuleRes( PB_OK ) ) + ,m_PB_CANCEL( this, ModuleRes( PB_CANCEL ) ) + ,m_xCreateCatalog(_rxCreateCatalog) + ,m_xORB(_rxORB) + ,m_bRestore(_bRestore) + ,m_nSetBitmap(0) +{ + DBG_CTOR( OAdabasNewDbDlg, NULL ); + FreeResource(); + if(m_bRestore) + { + m_FL_DBSETTINGS.SetPosPixel(m_FL_DBSETTINGS.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_SYSDEVSPACE.SetPosPixel(m_FT_SYSDEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_TRANSACTIONLOG.SetPosPixel(m_FT_TRANSACTIONLOG.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_DATADEVSPACE.SetPosPixel(m_FT_DATADEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_ET_SYSDEVSPACE.SetPosPixel(m_ET_SYSDEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_PB_SYSDEVSPACE.SetPosPixel(m_PB_SYSDEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_ET_TRANSACTIONLOG.SetPosPixel(m_ET_TRANSACTIONLOG.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_PB_TRANSACTIONLOG.SetPosPixel(m_PB_TRANSACTIONLOG.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_ET_DATADEVSPACE.SetPosPixel(m_ET_DATADEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_PB_DATADEVSPACE.SetPosPixel(m_PB_DATADEVSPACE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_TRANSACTIONLOG_SIZE.SetPosPixel(m_FT_TRANSACTIONLOG_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_NF_TRANSACTIONLOG_SIZE.SetPosPixel(m_NF_TRANSACTIONLOG_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_DATADEVSPACE_SIZE.SetPosPixel(m_FT_DATADEVSPACE_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_NF_DATADEVSPACE_SIZE.SetPosPixel(m_NF_DATADEVSPACE_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_FT_CACHE_SIZE.SetPosPixel(m_FT_CACHE_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_NF_CACHE_SIZE.SetPosPixel(m_NF_CACHE_SIZE.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_PB_OK.SetPosPixel(m_PB_OK.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + m_PB_CANCEL.SetPosPixel(m_PB_CANCEL.GetPosPixel()-LogicToPixel( Point(0,14), MAP_APPFONT )); + + Size aSize(GetSizePixel().Width(),GetSizePixel().Height()-LogicToPixel( Size(0,14), MAP_APPFONT ).Height()); + SetSizePixel(aSize); + + m_FT_SYSUSR.Hide(); + m_FT_DOMAIN_USR.Hide(); + m_FL_USER.SetText(ModuleRes(STR_BACKUPFILE_LOAD)); + m_PB_SYSPWD.Hide(); + m_PB_DOMAINPWD.Hide(); + m_ET_SYSUSR.Hide(); + m_ET_DOMAIN_USR.Hide(); + + m_ET_SYSUSR.SetText(String::CreateFromAscii("DUMMY")); + m_BMP_SYS.Hide(); + m_BMP_DOMAIN.Hide(); + m_ET_RESTORE.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_RESTORE.SetLoseFocusHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_RESTORE.SetMaxTextLen(40); + } + else + { + m_FT_RESTORE.Hide(); + m_ET_RESTORE.Hide(); + m_PB_RESTORE.Hide(); + + m_ET_SYSUSR.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_CONUSR.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_DOMAIN_USR.Enable(FALSE); + + // m_ET_SYSUSR.setUpperCase(); + // m_ET_CONUSR.setUpperCase(); + } + + + m_ET_SYSDEVSPACE.SetLoseFocusHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_TRANSACTIONLOG.SetLoseFocusHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_ET_DATADEVSPACE.SetLoseFocusHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + + m_ET_SYSDEVSPACE.SetMaxTextLen(40); + m_ET_TRANSACTIONLOG.SetMaxTextLen(40); + m_ET_DATADEVSPACE.SetMaxTextLen(40); + + m_NF_TRANSACTIONLOG_SIZE.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_NF_DATADEVSPACE_SIZE.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + m_NF_CACHE_SIZE.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + + m_NF_TRANSACTIONLOG_SIZE.SetMin(10); + m_NF_DATADEVSPACE_SIZE.SetMin(10); + m_NF_CACHE_SIZE.SetMin(4); + + m_NF_TRANSACTIONLOG_SIZE.SetMax(LONG_MAX); + m_NF_DATADEVSPACE_SIZE.SetMax(LONG_MAX); + m_NF_CACHE_SIZE.SetMax(LONG_MAX); + + m_NF_TRANSACTIONLOG_SIZE.SetValue(20); + m_NF_DATADEVSPACE_SIZE.SetValue(20); + m_NF_CACHE_SIZE.SetValue(4); + + m_NF_TRANSACTIONLOG_SIZE.SetDecimalDigits(0); + m_NF_DATADEVSPACE_SIZE.SetDecimalDigits(0); + m_NF_CACHE_SIZE.SetDecimalDigits(0); + + m_ET_DATABASENAME.SetMaxTextLen( 8 ); //98292 + + m_PB_CONPWD.SetClickHdl( LINK(this,OAdabasNewDbDlg,PwdClickHdl)); + m_PB_SYSPWD.SetClickHdl( LINK(this,OAdabasNewDbDlg,PwdClickHdl)); + m_PB_DOMAINPWD.SetClickHdl( LINK(this,OAdabasNewDbDlg,PwdClickHdl)); + + m_PB_RESTORE.SetClickHdl( LINK(this,OAdabasNewDbDlg,LoadButtonClickHdl)); + + m_PB_SYSDEVSPACE.SetClickHdl( LINK(this,OAdabasNewDbDlg,ButtonClickHdl)); + m_PB_TRANSACTIONLOG.SetClickHdl( LINK(this,OAdabasNewDbDlg,ButtonClickHdl)); + m_PB_DATADEVSPACE.SetClickHdl( LINK(this,OAdabasNewDbDlg,ButtonClickHdl)); + + m_BMP_CON.SetImage( ModuleRes(UNCHECK_RED) ); + m_BMP_SYS.SetImage( ModuleRes(UNCHECK_RED) ); + m_BMP_DOMAIN.SetImage( ModuleRes(UNCHECK_RED) ); + + static String s_sRoot(RTL_CONSTASCII_USTRINGPARAM("DBROOT")); + static String s_sConfig(RTL_CONSTASCII_USTRINGPARAM("DBCONFIG")); + static String s_sWork(RTL_CONSTASCII_USTRINGPARAM("DBWORK")); + + sal_Bool bError = fillEnvironmentVariable(s_sWork,m_sDbWork); + if ( bError || !m_sDbWork.Len() ) + bError = fillEnvironmentVariable(s_sRoot,m_sDbWork); + + bError = fillEnvironmentVariable(s_sConfig,m_sDbConfig); + if ( bError || !m_sDbConfig.Len() ) + bError = fillEnvironmentVariable(s_sRoot,m_sDbConfig); + + if ( m_sDbConfig.Len() && m_sDbWork.Len() ) + { + m_sDbConfig.AppendAscii("/"); + m_sDbWork.AppendAscii("/"); + + String sDefaultName,sExt; + sDefaultName.AssignAscii("MYDB"); + String sConfig = m_sDbConfig; + sConfig.AppendAscii("config"); + TempFile aDefaultDatabase(sDefaultName,&sExt,&sConfig); + aDefaultDatabase.EnableKillingFile(); + INetURLObject aURL(aDefaultDatabase.GetURL()); + + m_ET_DATABASENAME.SetText(aURL.GetName()); + m_DBName = m_ET_DATABASENAME.GetText(); + + // create temp names for my files + // here we need only a name the creation is done by the driver + // so we delete the files after we get a valid name + // with this we avoiding to mention anything when the user presses cancel + + String aSysExt; + sal_Bool bValid = sal_True; + { + aSysExt.AssignAscii(".sys"); + ::utl::TempFile aTmpFile(m_ET_DATABASENAME.GetText(),&aSysExt,&m_sDbWork); + aTmpFile.EnableKillingFile(); + bValid = aTmpFile.IsValid(); + if(bValid) + LocalFileHelper::ConvertURLToPhysicalName(aTmpFile.GetURL(),m_SYSDEV_File); + } + { + aSysExt.AssignAscii(".trs"); + ::utl::TempFile aTmpFile(m_ET_DATABASENAME.GetText(),&aSysExt,&m_sDbWork); + aTmpFile.EnableKillingFile(); + bValid = !bValid || aTmpFile.IsValid(); + if(aTmpFile.IsValid()) + LocalFileHelper::ConvertURLToPhysicalName(aTmpFile.GetURL(),m_TRANSDEV_File); + } + { + aSysExt.AssignAscii(".dat"); + ::utl::TempFile aTmpFile(m_ET_DATABASENAME.GetText(),&aSysExt,&m_sDbWork); + aTmpFile.EnableKillingFile(); + bValid = !bValid || aTmpFile.IsValid(); + if(aTmpFile.IsValid()) + LocalFileHelper::ConvertURLToPhysicalName(aTmpFile.GetURL(),m_DATADEV_File); + } + if(!bValid) // we found a file which isn't valid so we report an error message + PostUserEvent(LINK(this, OAdabasNewDbDlg, OnNoAccessRights)); + + } + + if(m_SYSDEV_File.Len() < 41 && m_TRANSDEV_File.Len() < 41 && m_DATADEV_File.Len() < 41) + { + m_ET_SYSDEVSPACE.SetText(m_SYSDEV_File ); + m_ET_TRANSACTIONLOG.SetText(m_TRANSDEV_File); + m_ET_DATADEVSPACE.SetText(m_DATADEV_File); + } + else + { + m_SYSDEV_File = m_TRANSDEV_File = m_DATADEV_File = String(); + PostUserEvent(LINK(this, OAdabasNewDbDlg, OnNoDefaultPath)); + } + + m_ET_CONUSR.SetText(String::CreateFromAscii("CONTROL")); + + m_PB_OK.SetClickHdl(LINK(this,OAdabasNewDbDlg,ImplOKHdl)); + m_PB_OK.Enable(FALSE); + + m_ET_DATABASENAME.SetModifyHdl( LINK(this,OAdabasNewDbDlg,LoseFocusHdl)); + +} +// ----------------------------------------------------------------------- +OAdabasNewDbDlg::~OAdabasNewDbDlg() +{ + DBG_DTOR( OAdabasNewDbDlg, NULL ); +} +//------------------------------------------------------------------ +IMPL_LINK(OAdabasNewDbDlg, OnError, void*, /*_pArg*/) +{ + String sErrorMsg(ModuleRes(STR_ERROR_IN_ADABAS_INSTALLATION)); + ErrorBox(this, WB_OK, sErrorMsg).Execute(); + EndDialog(RET_CANCEL); + return 0L; +} +//------------------------------------------------------------------ +IMPL_LINK(OAdabasNewDbDlg, OnNoDefaultPath, void*, /*_pArg*/) +{ + String sErrorMsg(ModuleRes(STR_ADABAS_NO_DEFAULTNAME)); + ErrorBox(this, WB_OK, sErrorMsg).Execute(); + return 0L; +} +//------------------------------------------------------------------ +IMPL_LINK(OAdabasNewDbDlg, OnNoAccessRights, void*, /*_pArg*/) +{ + String sErrorMsg(ModuleRes(STR_ADABAS_NO_ACCESSRIGHTS)); + ErrorBox(this, WB_OK, sErrorMsg).Execute(); + return 0L; +} + +// ----------------------------------------------------------------------- +IMPL_LINK( OAdabasNewDbDlg, ImplOKHdl, OKButton*, /*EMPTYARG*/ ) +{ + m_SYSDEV_File = m_ET_SYSDEVSPACE.GetText(); + m_TRANSDEV_File = m_ET_TRANSACTIONLOG.GetText(); + m_DATADEV_File = m_ET_DATADEVSPACE.GetText(); + + m_Backup_File = m_ET_RESTORE.GetText(); + if(m_bRestore) + { + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetURL(m_Backup_File); + Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>()); + try + { + if(!aContent.isDocument()) + { + String aString1 = String(ModuleRes(STR_ADABAS_NO_BACKUP_FILE)); + String aString2 = String(ModuleRes(STR_STAT_WARNING)); + SQLException aSql(aString1,NULL,aString2,1000,Any()); + return 0; + } + + } + catch(Exception&) + { + String aString1 = String(ModuleRes(STR_ADABAS_NO_BACKUP_FILE)); + String aString2 = String(ModuleRes(STR_STAT_WARNING)); + SQLException aSql(aString1,NULL,aString2,1000,Any()); + throw aSql; + } + if(m_Backup_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + aInfo.Execute(); + return 0; + } + } + else if(m_SYSDEV_File.Len() > 40 || m_TRANSDEV_File.Len() > 40 || m_DATADEV_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + aInfo.Execute(); + return 0; + } + + + BOOL bOk = FALSE; + + { + // we need url + String sTemp; + bOk = LocalFileHelper::ConvertPhysicalNameToURL(m_DATADEV_File,sTemp); + m_DATADEV_File = sTemp; + sTemp = String(); + bOk = LocalFileHelper::ConvertPhysicalNameToURL(m_SYSDEV_File,sTemp); + m_SYSDEV_File = sTemp; + sTemp = String(); + bOk = LocalFileHelper::ConvertPhysicalNameToURL(m_TRANSDEV_File,sTemp); + m_TRANSDEV_File = sTemp; + } + String aErrorMessage = String(ModuleRes(STR_DEVSPACE_NO_FILE)); + if(!m_SYSDEV_File.Len()) + aErrorMessage.SearchAndReplace(String::CreateFromAscii("$name$"),String::CreateFromAscii("SYSDEVSPACE")); + else if(!m_TRANSDEV_File.Len()) + aErrorMessage.SearchAndReplace(String::CreateFromAscii("$name$"),String::CreateFromAscii("TRANSACTIONLOG")); + else if(!m_DATADEV_File.Len()) + aErrorMessage.SearchAndReplace(String::CreateFromAscii("$name$"),String::CreateFromAscii("DATDEVSPACE")); + else if(m_ET_SYSUSR.GetText() == m_ET_CONUSR.GetText()) + aErrorMessage = String(ModuleRes(STR_NO_SAME_USER)); + else + bOk = TRUE; + + + if (!bOk) + { + ErrorBox(this, WB_OK, aErrorMessage).Execute(); + return FALSE; + } + + sal_Int32 nPos = 0; + Sequence< PropertyValue> aCreateArgs(m_bRestore ? 14 : 12); + aCreateArgs[nPos].Name = PROPERTY_CONTROL_USER; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_ET_CONUSR.GetText().ToUpperAscii()); + aCreateArgs[nPos].Name = PROPERTY_CONTROL_PASSWORD; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_ConPwd); + aCreateArgs[nPos].Name = PROPERTY_USER; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_ET_SYSUSR.GetText().ToUpperAscii()); + aCreateArgs[nPos].Name = PROPERTY_PASSWORD; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_SysPwd); + aCreateArgs[nPos].Name = PROPERTY_DOMAINPASSWORD; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_DomainPwd); + aCreateArgs[nPos].Name = PROPERTY_CACHESIZE; + aCreateArgs[nPos++].Value <<= ::rtl::OUString::valueOf(sal_Int32(m_NF_CACHE_SIZE.GetValue()*256)); + aCreateArgs[nPos].Name = PROPERTY_DATABASENAME; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_ET_DATABASENAME.GetText().ToUpperAscii()); + aCreateArgs[nPos].Name = PROPERTY_DATADEVSPACE; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_DATADEV_File); + aCreateArgs[nPos].Name = PROPERTY_SYSDEVSPACE; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_SYSDEV_File); + aCreateArgs[nPos].Name = PROPERTY_TRANSACTION_LOG; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_TRANSDEV_File); + aCreateArgs[nPos].Name = PROPERTY_DATADEVSIZE; + aCreateArgs[nPos++].Value <<= sal_Int32(m_NF_DATADEVSPACE_SIZE.GetValue()*256); + aCreateArgs[nPos].Name = PROPERTY_LOGDEVSIZE; + aCreateArgs[nPos++].Value <<= sal_Int32(m_NF_TRANSACTIONLOG_SIZE.GetValue()*256); + + if(m_bRestore) + { + aCreateArgs[nPos].Name = PROPERTY_RESTOREDATABASE; + aCreateArgs[nPos++].Value <<= ::cppu::bool2any(sal_True); + aCreateArgs[nPos].Name = PROPERTY_BACKUPNAME; + aCreateArgs[nPos++].Value <<= ::rtl::OUString(m_Backup_File); + } + + Disable(); + + m_aCreatorWait = ::std::auto_ptr<WaitObject>(new WaitObject(this)); + m_aCreatorThread = ::std::auto_ptr<ODatabaseCreator>(new ODatabaseCreator(m_xCreateCatalog,this,m_xORB,aCreateArgs)); + m_aCreatorThread->setTerminateHandler(LINK(this,OAdabasNewDbDlg,TerminateHdl)); + m_aCreatorThread->create(); + + return TRUE; +} +//------------------------------------------------------------------------- +IMPL_LINK( OAdabasNewDbDlg, TerminateHdl, void*, /*NOTUSABLE*/ ) +{ + EndDialog(RET_OK); + return 0; +} +//------------------------------------------------------------------------ +IMPL_LINK( OAdabasNewDbDlg, LoseFocusHdl, Edit *, pEdit ) +{ + if(&m_ET_SYSDEVSPACE == pEdit) + m_SYSDEV_File = pEdit->GetText(); + else if(&m_ET_TRANSACTIONLOG == pEdit) + m_TRANSDEV_File = pEdit->GetText(); + else if(&m_ET_DATADEVSPACE == pEdit) + m_DATADEV_File = pEdit->GetText(); + else if(&m_ET_RESTORE == pEdit) + m_Backup_File = pEdit->GetText(); + else if(&m_ET_DATABASENAME == pEdit) + {// check if the new dbname already exists + String sNewDbName = pEdit->GetText(); + String sConfig = m_sDbConfig; + sConfig.AppendAscii("config/"); + sConfig += sNewDbName; + if(UCBContentHelper::IsDocument(sConfig)) + { + String sErrorMessage = String(ModuleRes(STR_ADABAS_DB_EXISTS)); + ErrorBox(this, WB_OK, sErrorMessage).Execute(); + m_DBName.Erase(); + } + else if ( m_DBName.SearchAscii(" ") != STRING_NOTFOUND ) + { + String sErrorMessage = String(ModuleRes(STR_ADABAS_DB_EXISTS)); + ErrorBox(this, WB_OK, sErrorMessage).Execute(); + m_DBName = m_DBName.GetToken(0,' '); + } + else + m_DBName = sNewDbName; + } + + CheckBitmaps(); + return 0; +} +//------------------------------------------------------------------------ +IMPL_LINK( OAdabasNewDbDlg, LoadButtonClickHdl, Button *, /*pButton*/ ) +{ + ::sfx2::FileDialogHelper aLoad(WB_3DLOOK | WB_STDMODAL | WB_OPEN); + if(!m_Backup_File.Len()) + aLoad.SetDisplayDirectory(SvtPathOptions().GetWorkPath()); + else + aLoad.SetDisplayDirectory(m_Backup_File); + if (aLoad.Execute()) + { + INetURLObject aUrl(aLoad.GetPath()); + m_Backup_File = aUrl.PathToFileName(); + if(m_Backup_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + } + m_ET_RESTORE.SetText(m_Backup_File); + } + CheckBitmaps(); + return 0; +} +//------------------------------------------------------------------------ +IMPL_LINK( OAdabasNewDbDlg, ButtonClickHdl, Button *, pButton ) +{ + WinBits nBits(WB_3DLOOK|WB_STDMODAL|WB_SAVEAS); + ::sfx2::FileDialogHelper aFileDlg( static_cast<sal_uInt32>(nBits) ); // new FileDialog( this, nBits ); + + String aPath; + if(pButton == &m_PB_SYSDEVSPACE) + aPath = m_SYSDEV_File; + else if(pButton == &m_PB_TRANSACTIONLOG) + aPath = m_TRANSDEV_File; + else if(pButton == &m_PB_DATADEVSPACE) + aPath = m_DATADEV_File; + + String sUrl; + ::utl::LocalFileHelper::ConvertPhysicalNameToURL(aPath,sUrl); + aFileDlg.SetDisplayDirectory(sUrl); + + + + if (aFileDlg.Execute() == ERRCODE_NONE) + { + INetURLObject aUrl(aFileDlg.GetPath()); + if(pButton == &m_PB_SYSDEVSPACE) + { + m_SYSDEV_File = aUrl.PathToFileName(); + if(m_SYSDEV_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + aInfo.Execute(); + return 0; + } + m_ET_SYSDEVSPACE.SetText(aUrl.PathToFileName()); + } + else if(pButton == &m_PB_TRANSACTIONLOG) + { + m_TRANSDEV_File = aUrl.PathToFileName(); + if(m_TRANSDEV_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + aInfo.Execute(); + return 0; + } + m_ET_TRANSACTIONLOG.SetText(aUrl.PathToFileName()); + } + else if(pButton == &m_PB_DATADEVSPACE) + { + m_DATADEV_File = aUrl.PathToFileName(); + if(m_DATADEV_File.Len() > 40) + { + InfoBox aInfo(this,ModuleRes(INFO_STR_MAX_FILE_LENGTH)); + String aMsg(aInfo.GetMessText()); + aMsg.SearchAndReplace(String::CreateFromAscii("\'#\'"),String::CreateFromAscii("40")); + aInfo.SetMessText(aMsg); + aInfo.Execute(); + return 0; + } + m_ET_DATADEVSPACE.SetText(aUrl.PathToFileName()); + } + } + + CheckBitmaps(); + return 0; +} +//------------------------------------------------------------------------ +IMPL_LINK( OAdabasNewDbDlg, PwdClickHdl, Button *, pButton ) +{ + SfxPasswordDialog aDlg(this); + aDlg.ShowExtras(SHOWEXTRAS_CONFIRM); + if(aDlg.Execute()) + { + String sPwd = aDlg.GetPassword().ToUpperAscii(); + // no space in password allowed + if ( sPwd.GetTokenCount(' ') == 1 ) + { + if(pButton == &m_PB_CONPWD) + { + m_ConPwd = sPwd; + m_nSetBitmap &=~2; + } + else if(pButton == &m_PB_SYSPWD) + { + m_SysPwd = sPwd; + if(!m_DomainPwd.Len()) + { + m_nSetBitmap = 1; + m_DomainPwd = m_SysPwd; + } + if(!m_ConPwd.Len()) + { + m_nSetBitmap |= 2; + m_ConPwd = m_SysPwd; + } + + } + else if(pButton == &m_PB_DOMAINPWD) + { + m_DomainPwd = sPwd; + m_nSetBitmap &=~1; + } + } + else + { + String sErrorMsg(ModuleRes(STR_ADABAS_PASSWORD_ILLEGAL)); + ErrorBox(this, WB_OK, sErrorMsg).Execute(); + } + } + CheckBitmaps(); + return 0; +} +//------------------------------------------------------------------------ +void OAdabasNewDbDlg::CheckBitmaps() +{ + INT16 i=0; + if(m_ConPwd.Len() && m_ET_CONUSR.GetText().Len()) + i++,m_BMP_CON.SetImage(ModuleRes(((m_nSetBitmap & 2) == 2) ? DEFAULT_BLUE : CHECK_GREEN)); + else + m_BMP_CON.SetImage(ModuleRes(UNCHECK_RED)); + + if(!m_bRestore) + { + if(m_SysPwd.Len() && m_ET_SYSUSR.GetText().Len()) + i++,m_BMP_SYS.SetImage(ModuleRes(CHECK_GREEN)); + else + m_BMP_SYS.SetImage(ModuleRes(UNCHECK_RED)); + + if(m_DomainPwd.Len() ) + i++,m_BMP_DOMAIN.SetImage(ModuleRes(((m_nSetBitmap & 1) == 1) ? DEFAULT_BLUE : CHECK_GREEN)); + else + m_BMP_DOMAIN.SetImage(ModuleRes(UNCHECK_RED)); + } + else if(m_Backup_File.Len()) + i+=2; + + if(m_ET_SYSDEVSPACE.GetText().Len() && m_ET_TRANSACTIONLOG.GetText().Len() && m_ET_DATADEVSPACE.GetText().Len() && + m_ET_SYSDEVSPACE.GetText() != m_ET_TRANSACTIONLOG.GetText() && m_ET_SYSDEVSPACE.GetText() != m_ET_DATADEVSPACE.GetText() && + m_ET_DATADEVSPACE.GetText() != m_ET_TRANSACTIONLOG.GetText()) + i++; + + if(m_DBName.Len()) + i++; + + m_PB_OK.Enable(i == 5); +} +// ----------------------------------------------------------------------------- +sal_Bool OAdabasNewDbDlg::fillEnvironmentVariable(const ::rtl::OUString& _sVariableName,String& _rsValue) +{ + rtl_uString* pDbVar = NULL; + sal_Bool bError = sal_False; + if(osl_getEnvironment(_sVariableName.pData,&pDbVar) == osl_Process_E_None && pDbVar) + { + _rsValue = pDbVar; + String sTemp; + LocalFileHelper::ConvertPhysicalNameToURL(_rsValue,sTemp); + _rsValue = sTemp; + rtl_uString_release(pDbVar); + pDbVar = NULL; + + // ensure dir exists + osl::FileBase::RC rc = osl::Directory::createPath(_rsValue); + if(rc != osl::FileBase::E_None && rc != osl::FileBase::E_EXIST) + { + bError = sal_True; + PostUserEvent(LINK(this, OAdabasNewDbDlg, OnError)); + } + } + return bError; +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.hrc b/dbaccess/source/ext/adabas/AdabasNewDb.hrc new file mode 100644 index 000000000000..30216a30e6b7 --- /dev/null +++ b/dbaccess/source/ext/adabas/AdabasNewDb.hrc @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 ADABASUI_ADABASNEWDB_HRC +#define ADABASUI_ADABASNEWDB_HRC + + +#define PB_SYSDEVSPACE 1 +#define PB_TRANSACTIONLOG 2 +#define PB_DATADEVSPACE 3 +#define PB_DOMAINPWD 4 +#define PB_CONPWD 5 +#define PB_SYSPWD 6 +#define PB_OK 7 +#define PB_CANCEL 8 +#define PB_RESTORE 9 + +#define NF_TRANSACTIONLOG_SIZE 1 +#define NF_DATADEVSPACE_SIZE 2 +#define NF_CACHE_SIZE 3 + +#define ET_SYSUSR 1 +#define ET_DOMAIN_USR 2 +#define ET_CONUSR 3 +#define ET_SYSDEVSPACE 4 +#define ET_TRANSACTIONLOG 5 +#define ET_DATADEVSPACE 6 +#define ET_RESTORE 7 +#define ET_DATABASENAME 8 + +#define FT_SYSUSR 1 +#define FT_DOMAIN_USR 2 +#define FT_TRANSACTIONLOG_SIZE 3 +#define FT_DATADEVSPACE_SIZE 4 +#define FT_CONUSR 6 +#define FT_SYSDEVSPACE 7 +#define FT_TRANSACTIONLOG 8 +#define FT_DATADEVSPACE 9 +#define FT_CACHE_SIZE 10 +#define FT_RESTORE 11 +#define FT_DATABASENAME 12 + +#define FL_USER 1 +#define FL_DBSETTINGS 2 +#define FL_END 3 + +#define BMP_CON 1 +#define BMP_SYS 2 +#define BMP_DOMAIN 3 + +#define STR_BACKUPFILE_LOAD 1 + +#endif // ADABASUI_ADABASNEWDB_HRC + diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.hxx b/dbaccess/source/ext/adabas/AdabasNewDb.hxx new file mode 100644 index 000000000000..4a29f7c68e7e --- /dev/null +++ b/dbaccess/source/ext/adabas/AdabasNewDb.hxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * 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 ADABASUI_ADABAS_CREATEDB_HXX +#define ADABASUI_ADABAS_CREATEDB_HXX + + +#ifndef _SV_DIALOG_HXX +#include <vcl/dialog.hxx> +#endif + +#ifndef _SV_FIXED_HXX +#include <vcl/fixed.hxx> +#endif +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#ifndef _SV_FIELD_HXX +#include <vcl/field.hxx> +#endif +#ifndef _SV_EDIT_HXX +#include <vcl/edit.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCREATECATALOG_HPP_ +#include <com/sun/star/sdbcx/XCreateCatalog.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _FILEDLGHELPER_HXX +#include <sfx2/filedlghelper.hxx> +#endif +#include <memory> +#include "ASQLNameEdit.hxx" + +class WaitObject; + +namespace adabasui +{ + class ODatabaseCreator; + //======================================================================== + // ADABAS for new db; is called from typepage + //======================================================================== + class OAdabasNewDbDlg : public ModalDialog + { + private: + FixedText m_FT_DATABASENAME; + OSQLNameEdit m_ET_DATABASENAME; + + FixedLine m_FL_USER; + FixedText m_FT_SYSUSR; + FixedText m_FT_CONUSR; + FixedText m_FT_DOMAIN_USR; + + OSQLNameEdit m_ET_SYSUSR; + PushButton m_PB_SYSPWD; + OSQLNameEdit m_ET_CONUSR; + PushButton m_PB_CONPWD; + OSQLNameEdit m_ET_DOMAIN_USR; + PushButton m_PB_DOMAINPWD; + + FixedImage m_BMP_CON; + FixedImage m_BMP_SYS; + FixedImage m_BMP_DOMAIN; + + FixedText m_FT_RESTORE; + Edit m_ET_RESTORE; + PushButton m_PB_RESTORE; + + FixedLine m_FL_DBSETTINGS; + FixedText m_FT_SYSDEVSPACE; + FixedText m_FT_TRANSACTIONLOG; + FixedText m_FT_DATADEVSPACE; + Edit m_ET_SYSDEVSPACE; + PushButton m_PB_SYSDEVSPACE; + Edit m_ET_TRANSACTIONLOG; + PushButton m_PB_TRANSACTIONLOG; + Edit m_ET_DATADEVSPACE; + PushButton m_PB_DATADEVSPACE; + + FixedText m_FT_TRANSACTIONLOG_SIZE; + NumericField m_NF_TRANSACTIONLOG_SIZE; + FixedText m_FT_DATADEVSPACE_SIZE; + NumericField m_NF_DATADEVSPACE_SIZE; + FixedText m_FT_CACHE_SIZE; + NumericField m_NF_CACHE_SIZE; + + FixedLine m_FL_END; + + OKButton m_PB_OK; + CancelButton m_PB_CANCEL; + + String m_SYSDEV_File; + String m_TRANSDEV_File; + String m_DATADEV_File; + String m_Backup_File; + String m_ConPwd; + String m_SysPwd; + String m_DomainPwd; + String m_DBName; + String m_sDbWork; + String m_sDbConfig; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XCreateCatalog> m_xCreateCatalog; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xORB; + BOOL m_bRestore; + INT8 m_nSetBitmap; + + ::std::auto_ptr<WaitObject> m_aCreatorWait; + ::std::auto_ptr<ODatabaseCreator> m_aCreatorThread; + + DECL_LINK( LoadButtonClickHdl, Button * ); + DECL_LINK( ButtonClickHdl, Button * ); + DECL_LINK( PwdClickHdl, Button * ); + DECL_LINK( ImplOKHdl, OKButton * ); + DECL_LINK( LoseFocusHdl, Edit * ); + DECL_LINK( TerminateHdl, void * ); + + void CheckBitmaps(); + + DECL_LINK(OnError, void*); + DECL_LINK(OnNoDefaultPath, void*); + DECL_LINK(OnNoAccessRights, void*); + + sal_Bool fillEnvironmentVariable(const ::rtl::OUString& _sVariableName,String& _rsValue); + public: + OAdabasNewDbDlg(Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XCreateCatalog>& _rxCreateCatalog, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& _rxORB, + BOOL _bRestore=FALSE); + virtual ~OAdabasNewDbDlg(); + + ::rtl::OUString GetDatabaseName() const { return m_ET_DATABASENAME.GetText(); } + ::rtl::OUString GetControlUser() const { return m_ET_CONUSR.GetText(); } + ::rtl::OUString GetControlPassword() const { return m_ConPwd; } + ::rtl::OUString GetUser() const { return m_ET_SYSUSR.GetText(); } + ::rtl::OUString GetUserPassword() const { return m_SysPwd; } + sal_Int32 GetCacheSize() const { return static_cast<sal_Int32>(m_NF_CACHE_SIZE.GetValue()); } + }; +} +#endif // adabasui_ADABAS_CREATEDB_HXX + diff --git a/dbaccess/source/ext/adabas/AdabasNewDb.src b/dbaccess/source/ext/adabas/AdabasNewDb.src new file mode 100644 index 000000000000..33915b06266b --- /dev/null +++ b/dbaccess/source/ext/adabas/AdabasNewDb.src @@ -0,0 +1,455 @@ +/************************************************************************* + * + * 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 ADABASUI_ADABASNEWDB_HRC +#include "AdabasNewDb.hrc" +#endif +#include "dbaccess_helpid.hrc" +#include "adabasui_resource.hrc" +//================================================================== +// NEWDB Admin +//================================================================== +#define WIN_X 268 +#define WIN_Y 210 +#define MOVE_Y 21 +#define ADJUST_X 45 +ModalDialog DLG_ADABAS_NEWDB +{ + Moveable = TRUE ; + Closeable = TRUE ; + OutputSize = TRUE ; + SVLook = TRUE; + HelpID = HID_DLG_ADABAS_NEWDB ; + Size = MAP_APPFONT ( WIN_X , WIN_Y + MOVE_Y) ; + + FixedText FT_DATABASENAME + { + Pos = MAP_APPFONT ( 12 , 6) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 10 ) ; + Text[ en-US ] = "Database ~name"; +}; + Edit ET_DATABASENAME + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 5) ; + Size = MAP_APPFONT ( 161 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_DBNAME ; + }; + + FixedLine FL_USER + { + Pos = MAP_APPFONT ( 6 , 3 + MOVE_Y) ; + Size = MAP_APPFONT ( WIN_X - 12 , 8 ) ; + Text[ en-US ] = "User settings"; +}; + + FixedText FT_CONUSR + { + Pos = MAP_APPFONT ( 12 , 31 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 10 ) ; + Text[ en-US ] = "~Control user"; +}; + FixedText FT_SYSUSR + { + Pos = MAP_APPFONT ( 12 , 14 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 10 ) ; + Text[ en-US ] = "~Administrator"; +}; + FixedText FT_DOMAIN_USR + { + Pos = MAP_APPFONT ( 12 , 48 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 10 ) ; + Text[ en-US ] = "~Domain user"; +}; + + Edit ET_SYSUSR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 13 + MOVE_Y) ; + Size = MAP_APPFONT ( 105 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_SYSUSR ; + }; + + PushButton PB_SYSPWD + { + Pos = MAP_APPFONT ( 188 , 13 + MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_SYSPWD ; + Text[ en-US ] = "P~assword..."; +}; + + Edit ET_CONUSR + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 30 + MOVE_Y) ; + Size = MAP_APPFONT ( 105 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_CONUSR ; + }; + + PushButton PB_CONPWD + { + Pos = MAP_APPFONT ( 188 , 30 + MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_CONPWD ; + Text[ en-US ] = "~Password..."; +}; + Edit ET_DOMAIN_USR + { + Pos = MAP_APPFONT ( 77 + ADJUST_X, 47 + MOVE_Y) ; + Size = MAP_APPFONT ( 105 - ADJUST_X, 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + ReadOnly= TRUE; + HelpID = HID_DLG_ADABAS_USR ; + Text = "adabas"; + }; + + PushButton PB_DOMAINPWD + { + Pos = MAP_APPFONT ( 188 , 47 + MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_DOMAINPWD ; + Text[ en-US ] = "Passwo~rd..."; +}; + + FixedImage BMP_CON + { + Pos = MAP_APPFONT ( 240 , 27 + MOVE_Y) ; + Size = MAP_APPFONT ( 20 , 20 ) ; + HelpID = HID_DLG_ADABAS_CON_PWD ; + }; + FixedImage BMP_SYS + { + Pos = MAP_APPFONT ( 240 , 11 + MOVE_Y) ; + Size = MAP_APPFONT ( 20 , 20 ) ; + HelpID = HID_DLG_ADABAS_SYS_PWD ; + }; + FixedImage BMP_DOMAIN + { + Pos = MAP_APPFONT ( 240 , 44 + MOVE_Y) ; + Size = MAP_APPFONT ( 20 , 20 ) ; + HelpID = HID_DLG_ADABAS_DOMAIN_PWD ; + }; + + FixedText FT_RESTORE + { + Pos = MAP_APPFONT ( 12 , 13 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 10 ) ; + Text[ en-US ] = "~Backup file"; +}; + + Edit ET_RESTORE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 13 + MOVE_Y) ; + Size = MAP_APPFONT ( 105 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_RESTORE ; + }; + + PushButton PB_RESTORE + { + Pos = MAP_APPFONT ( 188 , 13 + MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_PBRESTORE ; + Text[ en-US ] = "..."; +}; + + /* DEVSPACE positions */ + FixedLine FL_DBSETTINGS + { + Pos = MAP_APPFONT ( 6 , 70 + MOVE_Y) ; + Size = MAP_APPFONT ( WIN_X - 12 , 8 ) ; + Text[ en-US ] = "Database settings"; +}; + + FixedText FT_SYSDEVSPACE + { + Pos = MAP_APPFONT ( 12 , 83 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "S~YSDEVSPACE"; +}; + + FixedText FT_TRANSACTIONLOG + { + Pos = MAP_APPFONT ( 12 , 99 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "TRANSACTI~ONLOG"; +}; + + FixedText FT_DATADEVSPACE + { + Pos = MAP_APPFONT ( 12 , 116 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "DATAD~EVSPACE"; +}; + + Edit ET_SYSDEVSPACE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 81 + MOVE_Y) ; + Size = MAP_APPFONT ( 161 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_SYSDEVSPACE ; + }; + + PushButton PB_SYSDEVSPACE + { + Pos = MAP_APPFONT ( WIN_X - 24, 81 + MOVE_Y) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_PBSYSDEVSPACE ; + Text[ en-US ] = "..."; +}; + + Edit ET_TRANSACTIONLOG + { + Border = TRUE ; + Pos = MAP_APPFONT ( 77 + ADJUST_X, 97 + MOVE_Y) ; + Size = MAP_APPFONT ( 161 - ADJUST_X, 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_TRANSACTIONLOG ; + }; + + PushButton PB_TRANSACTIONLOG + { + Pos = MAP_APPFONT ( WIN_X - 24, 97+ MOVE_Y) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_PBTRANSACTIONLOG ; + Text[ en-US ] = "..."; +}; + + Edit ET_DATADEVSPACE + { + Pos = MAP_APPFONT ( 77 + ADJUST_X, 114 + MOVE_Y) ; + Size = MAP_APPFONT ( 161 - ADJUST_X, 12) ; + Border = TRUE ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_DATADEVSPACE ; + }; + + + PushButton PB_DATADEVSPACE + { + Pos = MAP_APPFONT ( WIN_X - 24, 114 + MOVE_Y) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + HelpID = HID_DLG_ADABAS_PBDATADEVSPACE ; + Text[ en-US ] = "..."; +}; + /* DEVSPACE sizes */ + FixedText FT_TRANSACTIONLOG_SIZE + { + Pos = MAP_APPFONT ( 12 , 133 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "Transaction ~file (MB)"; +}; + NumericField NF_TRANSACTIONLOG_SIZE + { + Pos = MAP_APPFONT ( 77 + ADJUST_X, 131 + MOVE_Y) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Spin = TRUE ; +StrictFormat = TRUE; + HelpID = HID_DLG_ADABAS_TRANSACTIONLOG_SIZE ; + }; + FixedText FT_DATADEVSPACE_SIZE + { + Pos = MAP_APPFONT ( 12 , 150 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "Data~base size (MB)"; +}; + NumericField NF_DATADEVSPACE_SIZE + { + Pos = MAP_APPFONT ( 77 + ADJUST_X, 148 + MOVE_Y) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Spin = TRUE ; +StrictFormat = TRUE; + HelpID = HID_DLG_ADABAS_DATADEVSPACE_SIZE ; + }; + FixedText FT_CACHE_SIZE + { + Pos = MAP_APPFONT ( 12 , 167 + MOVE_Y) ; + Size = MAP_APPFONT ( 64 + ADJUST_X, 8 ) ; + Text[ en-US ] = "Data ~buffer size (MB)"; +}; + NumericField NF_CACHE_SIZE + { + Pos = MAP_APPFONT ( 77 + ADJUST_X, 165 + MOVE_Y) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Spin = TRUE ; +StrictFormat = TRUE; + HelpID = HID_DLG_ADABAS_CACHE_SIZE ; + }; + FixedLine FL_END + { + Pos = MAP_APPFONT ( 0 , WIN_Y - 24 + MOVE_Y) ; + Size = MAP_APPFONT ( WIN_X , 1 ) ; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( WIN_X - 112, WIN_Y - 20 + MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( WIN_X - 56 , WIN_Y - 20+ MOVE_Y) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + + String STR_BACKUPFILE_LOAD + { + Text[ en-US ] = "Backup file information"; +}; + + Text[ en-US ] = "Create New Adabas D Database"; +}; + +Image CHECK_GREEN +{ + ImageBitmap = Bitmap { File = "nu07.bmp"; }; + MaskColor = Color { Red = 0xFFFF; Green = 0x0; Blue = 0xFFFF; }; +}; +Image UNCHECK_RED +{ + ImageBitmap = Bitmap { File = "nu08.bmp"; }; + MaskColor = Color { Red = 0xFFFF; Green = 0x0; Blue = 0xFFFF; }; +}; +Image DEFAULT_BLUE +{ + ImageBitmap = Bitmap { File = "nu09.bmp"; }; + MaskColor = Color { Red = 0xFFFF; Green = 0x0; Blue = 0xFFFF; }; +}; +/* Fehlermeldungen beim Erstellen einer Adabas DB */ + +String STR_ADABAS_NO_PARAM_SET +{ + Text[ en-US ] = "No entry could be written in the configuration file."; +}; + +String STR_ADABAS_NO_DB_CREATED +{ + Text[ en-US ] = "An error occurred as the DB files were being created."; +}; + +String STR_ADABAS_NO_SYSTEM_TABLES +{ + Text[ en-US ] = "An error occurred as the system tables were being created."; +}; +String STR_ADABAS_NO_BACKUP_FILE +{ + Text[ en-US ] = "The backup file entered does not exist."; +}; + +InfoBox INFO_STR_MAX_FILE_LENGTH +{ + Message[ en-US ] = "The fully qualified file cannot be longer than \'#\' characters."; +}; + +String STR_NO_SAME_USER +{ + Text[ en-US ] = "The administrator and the control user cannot have the same name!"; +}; +String STR_DEVSPACE_NO_FILE +{ + Text[ en-US ] = "No name has been entered for the $name$ file!"; +}; +String STR_NO_PERMISSION +{ + Text[ en-US ] = "You have to have administrator rights to create a new database!"; +}; + +String STR_FILE_OR_DIR_UNKNOWN +{ + Text[ en-US ] = "The specified file name or directory does not exist."; +}; + +String STR_ERROR_IN_ADABAS_INSTALLATION +{ + Text [ en-US ] = "No new database can be created.\nPlease check your Adabas D installation, especially the variables \"DBROOT\" and \"DBWORK\"."; +}; + +String STR_STAT_WARNING +{ + Text [ en-US ] = "Warning!" ; +}; + +String STR_ADABAS_CREATEFILES +{ + Text [ en-US ] = "Creating database files." ; +}; + +String STR_ADABAS_CREATEPARAM_FILE +{ + Text [ en-US ] = "Creating database configuration file." ; +}; +String STR_ADABAS_START_DATABASE +{ + Text [ en-US ] = "Starting database for the first time." ; + +}; +String STR_ADABAS_DB_EXISTS +{ + Text[ en-US ] = "The name entered already exists."; +}; + +String STR_ADABAS_NO_DEFAULTNAME +{ + Text[ en-US ] = "No default names could be set for the database files. The total length is more than 40 characters."; +}; + +String STR_ADABAS_NO_ACCESSRIGHTS +{ + Text[ en-US ] = "No default names could be set for the database files. There is no write access."; +}; + +String STR_ADABAS_CANNOT_CONVERT +{ + Text[ en-US ] = "The current database need to be converted. Please insert control user and password."; +}; + +String STR_ADABAS_PASSWORD_ILLEGAL +{ + Text[ en-US ] = "Spaces are not permitted in the password. Please enter a new password."; +}; + diff --git a/dbaccess/source/ext/adabas/Aservices.cxx b/dbaccess/source/ext/adabas/Aservices.cxx new file mode 100644 index 000000000000..7ea45579157f --- /dev/null +++ b/dbaccess/source/ext/adabas/Aservices.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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 _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _EXTENSIONS_COMPONENT_MODULE_HXX_ +#include "Acomponentmodule.hxx" +#endif + + +/********************************************************************************************/ + +using namespace ::rtl; +using namespace ::adabasui; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; + +//*************************************************************************************** +// +// registry functions +extern "C" void SAL_CALL createRegistryInfo_OAdabasCreateDialog(); + +//*************************************************************************************** +extern "C" void SAL_CALL createRegistryInfo_adabasui() +{ + static sal_Bool bInit = sal_False; + if (!bInit) + { + createRegistryInfo_OAdabasCreateDialog(); + ::adabasui::OModule::setResourceFilePrefix("adabasui"); + bInit = sal_True; + } +} + +//--------------------------------------------------------------------------------------- + +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment ** + ) +{ + createRegistryInfo_adabasui(); + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + return OModule::writeComponentInfos( + static_cast<XMultiServiceFactory*>(pServiceManager), + static_cast<XRegistryKey*>(pRegistryKey)); + } + catch (InvalidRegistryException& ) + { + OSL_ASSERT("DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* /*pRegistryKey*/) +{ + Reference< XInterface > xRet; + if (pServiceManager && pImplementationName) + { + xRet = OModule::getComponentFactory( + ::rtl::OUString::createFromAscii(pImplementationName), + static_cast< XMultiServiceFactory* >(pServiceManager)); + } + + if (xRet.is()) + xRet->acquire(); + return xRet.get(); +}; diff --git a/dbaccess/source/ext/adabas/Astringconstants.cxx b/dbaccess/source/ext/adabas/Astringconstants.cxx new file mode 100644 index 000000000000..bede25514524 --- /dev/null +++ b/dbaccess/source/ext/adabas/Astringconstants.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +//============================================================ +//= property names +//============================================================ + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CREATECATALOG, "CreateCatalog"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATABASENAME, "DatabaseName"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROL_USER, "ControlUser"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROL_PASSWORD, "ControlPassword"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_USER, "User"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PASSWORD, "Password"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SYSDEVSPACE, "SYSDEVSPACE"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATADEVSPACE, "DataDevSpace"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TRANSACTION_LOG, "TRANSACTION_LOG"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BACKUPNAME, "Backup"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CACHESIZE, "CacheSize"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CACHESIZE_INCREMENT, "DataCacheSizeIncrement"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESTOREDATABASE, "RestoreDatabase"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DOMAINPASSWORD, "DomainPassword"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LOGDEVSIZE, "LogDevSize"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATADEVSIZE, "DataDevSize"); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SHUTDOWN, "ShutdownDatabase"); +//============================================================ +//= service names +//============================================================ +//============================================================ +//= SQLSTATE +//============================================================ +IMPLEMENT_CONSTASCII_USTRING(SQLSTATE_GENERAL, "01000"); + + + + + diff --git a/dbaccess/source/ext/adabas/Astringconstants.hrc b/dbaccess/source/ext/adabas/Astringconstants.hrc new file mode 100644 index 000000000000..49697f556024 --- /dev/null +++ b/dbaccess/source/ext/adabas/Astringconstants.hrc @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 ADABASUI_STRINGCONSTANTS_HRC_ +#define ADABASUI_STRINGCONSTANTS_HRC_ + +#ifndef STRINGCONSTANTS_INCLUDED_INDIRECT +#error "don't include this file directly! use adabasuistrings.hrc instead!" +#endif + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +//============================================================ +//= a helper for static ascii pseudo-unicode strings +//============================================================ +// string constants +struct _ConstAsciiString_ +{ + sal_Int32 length; + sal_Char const* str; + + operator ::rtl::OUString () const { return ::rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } + operator const sal_Char* () const { return str; } +}; + +#define DECLARE_CONSTASCII_USTRING( name ) \ + extern _ConstAsciiString_ const name + +#define IMPLEMENT_CONSTASCII_USTRING( name, string ) \ + _ConstAsciiString_ const name = { sizeof(string)-1, string } + +//============================================================ +//= property ids +//============================================================ + +#define PROPERTY_ID_CREATECATALOG 3 +#define PROPERTY_ID_DATABASENAME 4 +#define PROPERTY_ID_CONTROL_USER 5 +#define PROPERTY_ID_CONTROL_PASSWORD 6 +#define PROPERTY_ID_USER 7 +#define PROPERTY_ID_PASSWORD 8 +#define PROPERTY_ID_CACHESIZE 9 + +//============================================================ +//= property names +//============================================================ + +DECLARE_CONSTASCII_USTRING(PROPERTY_CREATECATALOG); +DECLARE_CONSTASCII_USTRING(PROPERTY_DATABASENAME); +DECLARE_CONSTASCII_USTRING(PROPERTY_USER); +DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROL_USER); +DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROL_PASSWORD); +DECLARE_CONSTASCII_USTRING(PROPERTY_SYSDEVSPACE); +DECLARE_CONSTASCII_USTRING(PROPERTY_TRANSACTION_LOG); +DECLARE_CONSTASCII_USTRING(PROPERTY_DATADEVSPACE); +DECLARE_CONSTASCII_USTRING(PROPERTY_BACKUPNAME); +DECLARE_CONSTASCII_USTRING(PROPERTY_PASSWORD); +DECLARE_CONSTASCII_USTRING(PROPERTY_CACHESIZE); +DECLARE_CONSTASCII_USTRING(PROPERTY_CACHESIZE_INCREMENT); +DECLARE_CONSTASCII_USTRING(PROPERTY_RESTOREDATABASE); +DECLARE_CONSTASCII_USTRING(PROPERTY_DOMAINPASSWORD); +DECLARE_CONSTASCII_USTRING(PROPERTY_LOGDEVSIZE); +DECLARE_CONSTASCII_USTRING(PROPERTY_DATADEVSIZE); +DECLARE_CONSTASCII_USTRING(PROPERTY_SHUTDOWN); + +//============================================================ +//= SQLSTATE +//============================================================ +DECLARE_CONSTASCII_USTRING(SQLSTATE_GENERAL); + + +#endif // ADABASUI_STRINGCONSTANTS_HRC_ + + diff --git a/dbaccess/source/ext/adabas/adabasui.dxp b/dbaccess/source/ext/adabas/adabasui.dxp new file mode 100644 index 000000000000..db9c0a52f288 --- /dev/null +++ b/dbaccess/source/ext/adabas/adabasui.dxp @@ -0,0 +1,4 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory + diff --git a/dbaccess/source/ext/adabas/adabasui_resource.hrc b/dbaccess/source/ext/adabas/adabasui_resource.hrc new file mode 100644 index 000000000000..b0b0e63e91c7 --- /dev/null +++ b/dbaccess/source/ext/adabas/adabasui_resource.hrc @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 _ADABASUI_RESOURCE_HRC_ +#define _ADABASUI_RESOURCE_HRC_ + +#ifndef _SOLAR_HRC +#include <svl/solar.hrc> +#endif + +#define RID_DIALOG_START RID_DB_EXTENSIONS_START +#define RID_PAGE_START RID_DB_EXTENSIONS_START +#define RID_ERRORBOX_START RID_DB_EXTENSIONS_START +#define RID_QUERYBOX_START RID_DB_EXTENSIONS_START +#define RID_TOOLBOX_START RID_DB_EXTENSIONS_START +#define RID_BITMAP_START RID_DB_EXTENSIONS_START +#define RID_IMAGE_START RID_DB_EXTENSIONS_START +#define RID_IMAGELIST_START RID_DB_EXTENSIONS_START +#define RID_MENU_START RID_DB_EXTENSIONS_START +#define RID_STRING_START RID_DB_EXTENSIONS_START +#define RID_UNTYPED_START RID_DB_EXTENSIONS_START +#define RID_WARN_START RID_DB_EXTENSIONS_START + +//======================================================================== +// dialog ids + +#define DLG_ADABAS_NEWDB RID_DIALOG_START + 0 +//======================================================================== +// images + +#define CHECK_GREEN RID_IMAGE_START + 0 +#define UNCHECK_RED RID_IMAGE_START + 1 +#define DEFAULT_BLUE RID_IMAGE_START + 2 + +//======================================================================== +// warning boxes + +#define INFO_STR_MAX_FILE_LENGTH RID_WARN_START + 0 + +//======================================================================== +// strings + +#define STR_ADABAS_NO_BACKUP_FILE RID_STRING_START + 0 +// +#define STR_NO_SAME_USER RID_STRING_START + 2 +#define STR_DEVSPACE_NO_FILE RID_STRING_START + 3 +#define STR_NO_PERMISSION RID_STRING_START + 4 +#define STR_FILE_OR_DIR_UNKNOWN RID_STRING_START + 5 +#define STR_STAT_WARNING RID_STRING_START + 6 +// +#define STR_ADABAS_NO_PARAM_SET RID_STRING_START + 8 +// +// +#define STR_ADABAS_NO_DB_CREATED RID_STRING_START + 11 +#define STR_ADABAS_NO_SYSTEM_TABLES RID_STRING_START + 12 +#define STR_ERROR_IN_ADABAS_INSTALLATION RID_STRING_START + 13 +#define STR_ADABAS_CREATEFILES RID_STRING_START + 14 +#define STR_ADABAS_CREATEPARAM_FILE RID_STRING_START + 15 +#define STR_ADABAS_START_DATABASE RID_STRING_START + 16 +#define STR_ADABAS_DB_EXISTS RID_STRING_START + 17 +#define STR_ADABAS_NO_DEFAULTNAME RID_STRING_START + 18 +#define STR_ADABAS_NO_ACCESSRIGHTS RID_STRING_START + 19 +#define STR_ADABAS_CANNOT_CONVERT RID_STRING_START + 20 +#define STR_ADABAS_PASSWORD_ILLEGAL RID_STRING_START + 21 + + +#endif // _ADABASUI_RESOURCE_HRC_ + diff --git a/dbaccess/source/ext/adabas/adabasuistrings.cxx b/dbaccess/source/ext/adabas/adabasuistrings.cxx new file mode 100644 index 000000000000..c1dae127c868 --- /dev/null +++ b/dbaccess/source/ext/adabas/adabasuistrings.cxx @@ -0,0 +1,37 @@ +/************************************************************************* + * + * 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 ADABASUI_SHARED_DBUSTRINGS_HRC +#include "adabasuistrings.hrc" +#endif + +namespace adabasui +{ +#include "Astringconstants.cxx" +} + + diff --git a/dbaccess/source/ext/adabas/adabasuistrings.hrc b/dbaccess/source/ext/adabas/adabasuistrings.hrc new file mode 100644 index 000000000000..7ee5fd19275c --- /dev/null +++ b/dbaccess/source/ext/adabas/adabasuistrings.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * 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 ADABASUI_SHARED_DBUSTRINGS_HRC +#define ADABASUI_SHARED_DBUSTRINGS_HRC + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +namespace adabasui +{ +#define STRINGCONSTANTS_INCLUDED_INDIRECT +#include "Astringconstants.hrc" +#undef STRINGCONSTANTS_INCLUDED_INDIRECT +} + +#endif // adabasui_SHARED_DBUSTRINGS_HRC diff --git a/dbaccess/source/ext/adabas/exports.dxp b/dbaccess/source/ext/adabas/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/dbaccess/source/ext/adabas/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/dbaccess/source/ext/adabas/makefile.mk b/dbaccess/source/ext/adabas/makefile.mk new file mode 100644 index 000000000000..e23310ac92f3 --- /dev/null +++ b/dbaccess/source/ext/adabas/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# 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=..$/..$/.. + +PRJNAME=dbaccess +TARGET=adabasui +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE + +# --- Settings ---------------------------------- +.INCLUDE : settings.mk + +# --- resource ----------------------------------------------------- +SRS1NAME=$(TARGET) +SRC1FILES = \ + AdabasNewDb.src + +# --- defines ------------------------------------------------------ +CDEFS+=-DCOMPMOD_NAMESPACE=adabasui + +# --- Files ------------------------------------- +SLOFILES=\ + $(SLO)$/ASqlNameEdit.obj \ + $(SLO)$/AdabasNewDb.obj \ + $(SLO)$/ANewDb.obj \ + $(SLO)$/adabasuistrings.obj \ + $(SLO)$/Aservices.obj \ + $(SLO)$/Acomponentmodule.obj + +# --- Library ----------------------------------- +SHL1TARGET=$(TARGET)$(DLLPOSTFIX) + +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(DBTOOLSLIB) \ + $(UNOTOOLSLIB) \ + $(SVTOOLLIB) \ + $(TOOLSLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(UCBHELPERLIB) \ + $(SFXLIB) \ + $(TKLIB) \ + $(COMPHELPERLIB) + +SHL1IMPLIB=i$(SHL1TARGET) + +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +SHL1LIBS=$(SLB)$/$(TARGET).lib +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=$(TARGET).dxp +SHL1VERSIONMAP=$(SOLARENV)/src/component.map + +# --- .res file ---------------------------------------------------------- +RES1FILELIST=\ + $(SRS)$/$(SRS1NAME).srs + +RESLIB1NAME=$(TARGET) +RESLIB1IMAGES=$(PRJ)$/res +RESLIB1SRSFILES=$(RES1FILELIST) + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + |