diff options
Diffstat (limited to 'extensions/source/abpilot')
31 files changed, 0 insertions, 4979 deletions
diff --git a/extensions/source/abpilot/abp.component b/extensions/source/abpilot/abp.component deleted file mode 100644 index a07cef986..000000000 --- a/extensions/source/abpilot/abp.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="org.openoffice.comp.abp.OAddressBookSourcePilot"> - <service name="com.sun.star.ui.dialogs.AddressBookSourcePilot"/> - </implementation> -</component> diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx deleted file mode 100644 index 1fb72439c..000000000 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abpfinalpage.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include <tools/debug.hxx> -#include <tools/urlobj.hxx> -#include <unotools/ucbhelper.hxx> -#include <sfx2/filedlghelper.hxx> -#include <unotools/pathoptions.hxx> -#include <svl/filenotation.hxx> -#include <sfx2/docfilt.hxx> -#include <vcl/msgbox.hxx> -#include <comphelper/componentcontext.hxx> -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> - -//......................................................................... -namespace abp -{ -//......................................................................... - using namespace ::svt; - using namespace ::utl; - - const SfxFilter* lcl_getBaseFilter() - { - static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); - return pFilter; - } - //===================================================================== - //= FinalPage - //===================================================================== - //--------------------------------------------------------------------- - FinalPage::FinalPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_FINAL)) - ,m_aExplanation ( this, ModuleRes( FT_FINISH_EXPL ) ) - ,m_aLocationLabel ( this, ModuleRes( FT_LOCATION ) ) - ,m_aLocation ( this, ModuleRes( CBB_LOCATION ) ) - ,m_aBrowse ( this, ModuleRes( PB_BROWSE ) ) - ,m_aRegisterName ( this, ModuleRes( CB_REGISTER_DS ) ) - ,m_aNameLabel ( this, ModuleRes( FT_NAME_EXPL ) ) - ,m_aName ( this, ModuleRes( ET_DATASOURCENAME ) ) - ,m_aDuplicateNameError ( this, ModuleRes( FT_DUPLICATENAME ) ) - ,m_aLocationController( ::comphelper::ComponentContext( _pParent->getORB() ), m_aLocation, m_aBrowse ) - { - FreeResource(); - - m_aName.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aLocation.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aRegisterName.SetClickHdl( LINK( this, FinalPage, OnRegister ) ); - m_aRegisterName.Check(sal_True); - } - - //--------------------------------------------------------------------- - sal_Bool FinalPage::isValidName() const - { - ::rtl::OUString sCurrentName(m_aName.GetText()); - - if (0 == sCurrentName.getLength()) - // the name must not be empty - return sal_False; - - if ( m_aInvalidDataSourceNames.find( sCurrentName ) != m_aInvalidDataSourceNames.end() ) - // there already is a data source with this name - return sal_False; - - return sal_True; - } - - //--------------------------------------------------------------------- - void FinalPage::setFields() - { - AddressSettings& rSettings = getSettings(); - - INetURLObject aURL( rSettings.sDataSourceName ); - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - String sPath = SvtPathOptions().GetWorkPath(); - sPath += '/'; - sPath += String(rSettings.sDataSourceName); - - const SfxFilter* pFilter = lcl_getBaseFilter(); - if ( pFilter ) - { - String sExt = pFilter->GetDefaultExtension(); - sPath += sExt.GetToken(1,'*'); - } - - aURL.SetURL(sPath); - } - OSL_ENSURE( aURL.GetProtocol() != INET_PROT_NOT_VALID ,"No valid file name!"); - rSettings.sDataSourceName = aURL.GetMainURL( INetURLObject::NO_DECODE ); - m_aLocationController.setURL( rSettings.sDataSourceName ); - String sName = aURL.getName( ); - xub_StrLen nPos = sName.Search(String(aURL.GetExtension())); - if ( nPos != STRING_NOTFOUND ) - { - sName.Erase(nPos-1,4); - } - m_aName.SetText(sName); - - OnRegister(&m_aRegisterName); - } - - //--------------------------------------------------------------------- - void FinalPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - setFields(); - } - - //--------------------------------------------------------------------- - sal_Bool FinalPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - if ( ( ::svt::WizardTypes::eTravelBackward != _eReason ) - && ( !m_aLocationController.prepareCommit() ) - ) - return sal_False; - - AddressSettings& rSettings = getSettings(); - rSettings.sDataSourceName = m_aLocationController.getURL(); - rSettings.bRegisterDataSource = m_aRegisterName.IsChecked(); - if ( rSettings.bRegisterDataSource ) - rSettings.sRegisteredDataSourceName = m_aName.GetText(); - - return sal_True; - } - - //--------------------------------------------------------------------- - void FinalPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - // get the names of all data sources - ODataSourceContext aContext( getORB() ); - aContext.getDataSourceNames( m_aInvalidDataSourceNames ); - - // give the name edit the focus - m_aLocation.GrabFocus(); - - // default the finish button - getDialog()->defaultButton( WZB_FINISH ); - } - - //--------------------------------------------------------------------- - void FinalPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - - // default the "next" button, again - getDialog()->defaultButton( WZB_NEXT ); - // disable the finish button - getDialog()->enableButtons( WZB_FINISH, sal_False ); - } - - //--------------------------------------------------------------------- - bool FinalPage::canAdvance() const - { - return false; - } - - //--------------------------------------------------------------------- - void FinalPage::implCheckName() - { - sal_Bool bValidName = isValidName(); - sal_Bool bEmptyName = 0 == m_aName.GetText().Len(); - sal_Bool bEmptyLocation = 0 == m_aLocation.GetText().Len(); - - // enable or disable the finish button - getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_aRegisterName.IsChecked() || bValidName) ); - - // show the error message for an invalid name - m_aDuplicateNameError.Show( !bValidName && !bEmptyName ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( FinalPage, OnNameModified, Edit*, /**/ ) - { - implCheckName(); - return 0L; - } - - // ----------------------------------------------------------------------------- - IMPL_LINK( FinalPage, OnRegister, CheckBox*, EMPTYARG ) - { - sal_Bool bEnable = m_aRegisterName.IsChecked(); - m_aNameLabel.Enable(bEnable); - m_aName.Enable(bEnable); - implCheckName(); - return 0L; - } -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx deleted file mode 100644 index 6fbf76b54..000000000 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABPFINALPAGE_HXX -#define EXTENSIONS_ABP_ABPFINALPAGE_HXX - -#include "abspage.hxx" -#include "abptypes.hxx" - -#include <svtools/urlcontrol.hxx> -#include <svx/databaselocationinput.hxx> -#include <vcl/edit.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FinalPage - //===================================================================== - class FinalPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - FixedText m_aLocationLabel; - ::svt::OFileURLControl m_aLocation; - PushButton m_aBrowse; - CheckBox m_aRegisterName; - FixedText m_aNameLabel; - Edit m_aName; - FixedText m_aDuplicateNameError; - - ::svx::DatabaseLocationInputController - m_aLocationController; - - StringBag m_aInvalidDataSourceNames; - - public: - FinalPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnNameModified, Edit* ); - DECL_LINK( OnRegister, CheckBox* ); - - sal_Bool isValidName() const; - void implCheckName(); - void setFields(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABPFINALPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abpresid.hrc b/extensions/source/abpilot/abpresid.hrc deleted file mode 100644 index 4a364a43c..000000000 --- a/extensions/source/abpilot/abpresid.hrc +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABPRESID_HRC -#define EXTENSIONS_ABPRESID_HRC - -#include "abpilot.hrc" -#include "extensio.hrc" - -//======================================================================== -// basics - -#define RID_DIALOG_START RID_ABP_START -#define RID_PAGE_START RID_ABP_START -#define RID_STRING_START RID_ABP_START -#define RID_ERRORBOX_START RID_ABP_START -#define RID_UNTYPED_START RID_ABP_START -#define RID_QUERYBOX_START RID_ABP_START -#define RID_BITMAP_START RID_ABP_START - -//======================================================================== -// dialogs - -#define RID_DLG_ADDRESSBOOKSOURCEPILOT ( RID_DIALOG_START + 0 ) -// please adjust RID_DIALOG_END (below) when adding new dialogs - -#define RID_DIALOG_END RID_DLG_ADDRESSBOOKSOURCEPILOT - -//======================================================================== -// tab pages - -#define RID_PAGE_SELECTABTYPE ( RID_PAGE_START + 0 ) -#define RID_PAGE_ADMININVOKATION ( RID_PAGE_START + 1 ) -#define RID_PAGE_TABLESELECTION_AB ( RID_PAGE_START + 2 ) -#define RID_PAGE_FIELDMAPPING ( RID_PAGE_START + 3 ) -#define RID_PAGE_FINAL ( RID_PAGE_START + 4 ) -// please adjust RID_PAGE_END (below) when adding new tab pages - -#define RID_PAGE_END RID_PAGE_FINAL - -//======================================================================== -// strings - -#define RID_STR_DEFAULT_NAME ( RID_STRING_START + 0 ) -#define RID_STR_ADMINDIALOGTITLE ( RID_STRING_START + 1 ) -#define RID_STR_NOCONNECTION ( RID_STRING_START + 2 ) -#define RID_STR_PLEASECHECKSETTINGS ( RID_STRING_START + 3 ) -#define RID_STR_FIELDDIALOGTITLE ( RID_STRING_START + 4 ) -#define RID_STR_NOFIELDSASSIGNED ( RID_STRING_START + 5 ) -// please adjust RID_STRING_END (below) when adding new strings - -#define RID_STRING_END RID_STR_NOFIELDSASSIGNED - -//======================================================================== -// error boxes - -#define RID_ERR_NEEDTYPESELECTION ( RID_ERRORBOX_START + 0 ) -// please adjust RID_ERRORBOX_END (below) when adding new error boxes - -#define RID_ERRORBOX_END RID_ERR_NEEDTYPESELECTION - -//======================================================================== -// query boxes - -#define RID_QRY_NOTABLES ( RID_QUERYBOX_START + 0 ) -// please adjust RID_QUERYBOX_END (below) when adding new query boxes - -#define RID_QRY_NO_EVO_GW ( RID_QUERYBOX_START + 1 ) - -#define RID_QUERYBOX_END RID_QRY_NO_EVO_GW - -//======================================================================== -// untyped resources - -#define RID_RSC_NOTUSEDYET ( RID_UNTYPED_START + 0 ) -// please adjust RID_UNTYPED_END (below) when adding new untyped resources - -#define RID_UNTYPED_END RID_RSC_NOTUSEDYET - -//======================================================================== -// bitmaps - -#define BMP_HEADERIMAGE ( RID_BITMAP_START + 0 ) -// please adjust RID_BITMAP_END (below) when adding new bitmaps - -#define RID_BITMAP_END BMP_HEADERIMAGE - -//======================================================================== -//======================================================================== -//= range checks - -#if RID_DIALOG_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_PAGE_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_STRING_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_ERRORBOX_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_QUERYBOX_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_UNTYPED_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_BITMAP_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif - -//======================================================================== -// local resource ids - -//........................................................................ -#define FL_SEPARATOR 1 -#define FL_TYPE 2 -#define FL_NAME 3 - -//........................................................................ -#define FT_TYPE_HINTS 1 -#define FT_ADMINEXPLANATION 3 -#define FT_NAME_EXPL 4 -#define FT_ERROR 5 -#define FL_TOOMUCHTABLES 6 -#define FT_FIELDASSIGMENTEXPL 7 -#define FT_ASSIGNEDFIELDS 8 -#define FT_FINISH_EXPL 9 -#define FT_DUPLICATENAME 10 -#define FT_LOCATION 11 - -//........................................................................ -#define RB_MORK 1 -#define RB_THUNDERBIRD 2 -#define RB_EVOLUTION 3 -#define RB_KAB 4 -#define RB_MACAB 5 -#define RB_LDAP 6 -#define RB_OUTLOOK 7 -#define RB_OUTLOOKEXPRESS 8 -#define RB_OTHER 9 -#define RB_EVOLUTION_GROUPWISE 10 -#define RB_EVOLUTION_LDAP 11 - -//........................................................................ -#define ET_DATASOURCENAME 1 -#define ET_LOCATION 2 - -//........................................................................ -#define PB_INVOKE_ADMIN_DIALOG 1 -#define PB_INVOKE_FIELDS_DIALOG 2 -#define PB_BROWSE 3 - -//........................................................................ -#define LB_TABLELIST 1 - -//........................................................................ -#define CB_REGISTER_DS 1 - -//........................................................................ -#define CBB_LOCATION 1 - -//........................................................................ -#define STR_SELECT_ABTYPE 1 -#define STR_INVOKE_ADMIN_DIALOG 2 -#define STR_TABLE_SELECTION 3 -#define STR_MANUAL_FIELD_MAPPING 4 -#define STR_FINAL_CONFIRM 5 - -//======================================================================== -// some defines - -//........................................................................ -#define WINDOW_SIZE_X 240 -#define WINDOW_SIZE_Y 185 - -#define WINDOW_BORDER_X 12 -#define WINDOW_BORDER_Y 14 - -#define BUTTON_SIZE_X 50 -#define BUTTON_SIZE_Y 14 - -#define HEADER_SIZE_Y 30 - -#define BORDER_X 12 - -//........................................................................ - -#endif // EXTENSIONS_ABPRESID_HRC - -/************************************************************************* - * history: - * - * Revision 1.0 30.01.01 16:38:29 fs - ************************************************************************/ - diff --git a/extensions/source/abpilot/abpservices.cxx b/extensions/source/abpilot/abpservices.cxx deleted file mode 100644 index d78593126..000000000 --- a/extensions/source/abpilot/abpservices.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "componentmodule.hxx" - -//--------------------------------------------------------------------------------------- - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno(); - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL abp_initializeModule() -{ - static sal_Bool s_bInit = sal_False; - if (!s_bInit) - { - createRegistryInfo_OABSPilotUno(); - ::abp::OModule::setResourceFilePrefix("abp"); - s_bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - abp_initializeModule(); - - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::abp::OModule::getComponentFactory( - ::rtl::OUString::createFromAscii(pImplementationName), - static_cast< XMultiServiceFactory* >(pServiceManager)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abptypes.hxx b/extensions/source/abpilot/abptypes.hxx deleted file mode 100644 index 3df98e9a9..000000000 --- a/extensions/source/abpilot/abptypes.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABPTYPES_HXX -#define EXTENSIONS_ABP_ABPTYPES_HXX - -#include <comphelper/stl_types.hxx> -#include <rtl/ustring.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringBag ); - - DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, MapString2String ); - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABPTYPES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspage.cxx b/extensions/source/abpilot/abspage.cxx deleted file mode 100644 index 993396ab3..000000000 --- a/extensions/source/abpilot/abspage.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abspage.hxx" -#include "abspilot.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::svt; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - //===================================================================== - //= AddressBookSourcePage - //===================================================================== - AddressBookSourcePage::AddressBookSourcePage( OAddessBookSourcePilot* _pParent, const ResId& _rId ) - :AddressBookSourcePage_Base(_pParent, _rId) - { - } - - //--------------------------------------------------------------------- - void AddressBookSourcePage::DeactivatePage() - { - AddressBookSourcePage_Base::DeactivatePage(); - getDialog()->enableButtons(WZB_NEXT, sal_True); - } - - //--------------------------------------------------------------------- - OAddessBookSourcePilot* AddressBookSourcePage::getDialog() - { - return static_cast<OAddessBookSourcePilot*>(GetParent()); - } - - //--------------------------------------------------------------------- - const OAddessBookSourcePilot* AddressBookSourcePage::getDialog() const - { - return static_cast<const OAddessBookSourcePilot*>(GetParent()); - } - - //--------------------------------------------------------------------- - AddressSettings& AddressBookSourcePage::getSettings() - { - return getDialog()->getSettings(); - } - - //--------------------------------------------------------------------- - const AddressSettings& AddressBookSourcePage::getSettings() const - { - return getDialog()->getSettings(); - } - - //--------------------------------------------------------------------- - Reference< XMultiServiceFactory > AddressBookSourcePage::getORB() - { - return getDialog()->getORB(); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx deleted file mode 100644 index c80c8a7a2..000000000 --- a/extensions/source/abpilot/abspage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABSPAGE_HXX -#define EXTENSIONS_ABP_ABSPAGE_HXX - -#include <svtools/wizardmachine.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include <vcl/fixed.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - class OAddessBookSourcePilot; - struct AddressSettings; - - //===================================================================== - //= AddressBookSourcePage - //===================================================================== - typedef ::svt::OWizardPage AddressBookSourcePage_Base; - /// the base class for all tab pages in the address book source wizard - class AddressBookSourcePage : public AddressBookSourcePage_Base - { - protected: - AddressBookSourcePage( OAddessBookSourcePilot* _pParent, const ResId& _rId ); - - protected: - // helper - OAddessBookSourcePilot* getDialog(); - const OAddessBookSourcePilot* getDialog() const; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getORB(); - AddressSettings& getSettings(); - const AddressSettings& getSettings() const; - - // TabDialog overridables - virtual void DeactivatePage(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABSPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx deleted file mode 100644 index f9124a10d..000000000 --- a/extensions/source/abpilot/abspilot.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abspilot.hxx" -#include "abpilot.hrc" -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include <tools/debug.hxx> -#include <svtools/localresaccess.hxx> -#include "typeselectionpage.hxx" -#include "admininvokationpage.hxx" -#include "tableselectionpage.hxx" -#include <vcl/waitobj.hxx> -#include <vcl/msgbox.hxx> -#include "abpfinalpage.hxx" -#include "fieldmappingpage.hxx" -#include "fieldmappingimpl.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - -#define STATE_SELECT_ABTYPE 0 -#define STATE_INVOKE_ADMIN_DIALOG 1 -#define STATE_TABLE_SELECTION 2 -#define STATE_MANUAL_FIELD_MAPPING 3 -#define STATE_FINAL_CONFIRM 4 - -#define PATH_COMPLETE 1 -#define PATH_NO_SETTINGS 2 -#define PATH_NO_FIELDS 3 -#define PATH_NO_SETTINGS_NO_FIELDS 4 - - using namespace ::svt; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - - //===================================================================== - //= OAddessBookSourcePilot - //===================================================================== - //--------------------------------------------------------------------- - OAddessBookSourcePilot::OAddessBookSourcePilot(Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB) - :OAddessBookSourcePilot_Base( _pParent, ModuleRes( RID_DLG_ADDRESSBOOKSOURCEPILOT ), - WZB_HELP | WZB_FINISH | WZB_CANCEL | WZB_NEXT | WZB_PREVIOUS ) - ,m_xORB(_rxORB) - ,m_aNewDataSource(_rxORB) - ,m_eNewDataSourceType( AST_INVALID ) - { - SetPageSizePixel(LogicToPixel(Size(WINDOW_SIZE_X, WINDOW_SIZE_Y), MAP_APPFONT)); - - ShowButtonFixedLine(sal_True); - - declarePath( PATH_COMPLETE, - STATE_SELECT_ABTYPE, - STATE_INVOKE_ADMIN_DIALOG, - STATE_TABLE_SELECTION, - STATE_MANUAL_FIELD_MAPPING, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_SETTINGS, - STATE_SELECT_ABTYPE, - STATE_TABLE_SELECTION, - STATE_MANUAL_FIELD_MAPPING, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_FIELDS, - STATE_SELECT_ABTYPE, - STATE_INVOKE_ADMIN_DIALOG, - STATE_TABLE_SELECTION, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_SETTINGS_NO_FIELDS, - STATE_SELECT_ABTYPE, - STATE_TABLE_SELECTION, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - - m_pPrevPage->SetHelpId(HID_ABSPILOT_PREVIOUS); - m_pNextPage->SetHelpId(HID_ABSPILOT_NEXT); - m_pCancel->SetHelpId(HID_ABSPILOT_CANCEL); - m_pFinish->SetHelpId(HID_ABSPILOT_FINISH); - m_pHelp->SetUniqueId(UID_ABSPILOT_HELP); - - m_pCancel->SetClickHdl( LINK( this, OAddessBookSourcePilot, OnCancelClicked) ); - - // some initial settings -#ifdef UNX -#ifdef MACOSX - m_aSettings.eType = AST_MACAB; -#else -// FIXME: if KDE use KAB instead - m_aSettings.eType = AST_EVOLUTION; -#endif -#else - m_aSettings.eType = AST_OTHER; -#endif - m_aSettings.sDataSourceName = String(ModuleRes(RID_STR_DEFAULT_NAME)); - m_aSettings.bRegisterDataSource = false; - m_aSettings.bIgnoreNoTable = false; - - defaultButton(WZB_NEXT); - enableButtons(WZB_FINISH, sal_False); - ActivatePage(); - - typeSelectionChanged( m_aSettings.eType ); - } - - //--------------------------------------------------------------------- - String OAddessBookSourcePilot::getStateDisplayName( WizardState _nState ) const - { - sal_uInt16 nResId = 0; - switch ( _nState ) - { - case STATE_SELECT_ABTYPE: nResId = STR_SELECT_ABTYPE; break; - case STATE_INVOKE_ADMIN_DIALOG: nResId = STR_INVOKE_ADMIN_DIALOG; break; - case STATE_TABLE_SELECTION: nResId = STR_TABLE_SELECTION; break; - case STATE_MANUAL_FIELD_MAPPING: nResId = STR_MANUAL_FIELD_MAPPING; break; - case STATE_FINAL_CONFIRM: nResId = STR_FINAL_CONFIRM; break; - } - DBG_ASSERT( nResId, "OAddessBookSourcePilot::getStateDisplayName: don't know this state!" ); - - String sDisplayName; - if ( nResId ) - { - svt::OLocalResourceAccess aAccess( ModuleRes( RID_DLG_ADDRESSBOOKSOURCEPILOT ), RSC_MODALDIALOG ); - sDisplayName = String( ModuleRes( nResId ) ); - } - - return sDisplayName; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCommitAll() - { - // in real, the data source already exists in the data source context - // Thus, if the user changed the name, we have to rename the data source - if ( m_aSettings.sDataSourceName != m_aNewDataSource.getName() ) - m_aNewDataSource.rename( m_aSettings.sDataSourceName ); - - // 1. the data source - m_aNewDataSource.store(); - - // 2. check if we need to register the data source - if ( m_aSettings.bRegisterDataSource ) - m_aNewDataSource.registerDataSource(m_aSettings.sRegisteredDataSourceName); - - // 3. write the data source / table names into the configuration - addressconfig::writeTemplateAddressSource( getORB(), m_aSettings.bRegisterDataSource ? m_aSettings.sRegisteredDataSourceName : m_aSettings.sDataSourceName, m_aSettings.sSelectedTable ); - - // 4. write the field mapping - fieldmapping::writeTemplateAddressFieldMapping( getORB(), m_aSettings.aFieldMapping ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCleanup() - { - if ( m_aNewDataSource.isValid() ) - m_aNewDataSource.remove(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OAddessBookSourcePilot, OnCancelClicked, void*, /*NOTINTERESTEDIN*/ ) - { - // do cleanups - implCleanup(); - - // reset the click hdl - m_pCancel->SetClickHdl( Link() ); - // simulate the click again - this time, the default handling of the button will strike .... - m_pCancel->Click(); - - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::Close() - { - implCleanup(); - - return OAddessBookSourcePilot_Base::Close(); - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::onFinish() - { - if ( !OAddessBookSourcePilot_Base::onFinish() ) - return sal_False; - - implCommitAll(); - - addressconfig::markPilotSuccess( getORB() ); - - return sal_True; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::enterState( WizardState _nState ) - { - switch ( _nState ) - { - case STATE_SELECT_ABTYPE: - impl_updateRoadmap( static_cast< TypeSelectionPage* >( GetPage( STATE_SELECT_ABTYPE ) )->getSelectedType() ); - break; - - case STATE_FINAL_CONFIRM: - if ( !needManualFieldMapping( ) ) - implDoAutoFieldMapping(); - break; - - case STATE_TABLE_SELECTION: - implDefaultTableName(); - break; - } - - OAddessBookSourcePilot_Base::enterState(_nState); - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::prepareLeaveCurrentState( CommitPageReason _eReason ) - { - if ( !OAddessBookSourcePilot_Base::prepareLeaveCurrentState( _eReason ) ) - return sal_False; - - if ( _eReason == eTravelBackward ) - return sal_True; - - sal_Bool bAllow = sal_True; - - switch ( getCurrentState() ) - { - case STATE_SELECT_ABTYPE: - implCreateDataSource(); - if ( needAdminInvokationPage() ) - break; - // no break here - - case STATE_INVOKE_ADMIN_DIALOG: - if ( !connectToDataSource( sal_False ) ) - { - // connecting did not succeed -> do not allow proceeding - bAllow = sal_False; - break; - } - - // ........................................................ - // now that we connected to the data source, check whether we need the "table selection" page - const StringBag& aTables = m_aNewDataSource.getTableNames(); - - if ( aTables.empty() ) - { - if ( RET_YES != QueryBox( this, ModuleRes( ( getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_QRY_NO_EVO_GW : RID_QRY_NOTABLES ) ) ).Execute() ) - { - // cannot ask the user, or the user chose to use this data source, though there are no tables - bAllow = sal_False; - break; - } - - m_aSettings.bIgnoreNoTable = true; - } - - if ( aTables.size() == 1 ) - // remember the one and only table we have - m_aSettings.sSelectedTable = *aTables.begin(); - - break; - } - - impl_updateRoadmap( m_aSettings.eType ); - return bAllow; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implDefaultTableName() - { - const StringBag& rTableNames = getDataSource().getTableNames(); - if ( rTableNames.end() != rTableNames.find( getSettings().sSelectedTable ) ) - // already a valid table selected - return; - - const sal_Char* pGuess = NULL; - switch ( getSettings().eType ) - { - case AST_MORK : - case AST_THUNDERBIRD : pGuess = "Personal Address book"; break; - case AST_LDAP : pGuess = "LDAP Directory"; break; - case AST_EVOLUTION : - case AST_EVOLUTION_GROUPWISE: - case AST_EVOLUTION_LDAP : pGuess = "Personal"; break; - default: - OSL_FAIL( "OAddessBookSourcePilot::implDefaultTableName: unhandled case!" ); - return; - } - const ::rtl::OUString sGuess = ::rtl::OUString::createFromAscii( pGuess ); - if ( rTableNames.end() != rTableNames.find( sGuess ) ) - getSettings().sSelectedTable = sGuess; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implDoAutoFieldMapping() - { - DBG_ASSERT( !needManualFieldMapping( ), "OAddessBookSourcePilot::implDoAutoFieldMapping: invalid call!" ); - - fieldmapping::defaultMapping( getORB(), m_aSettings.aFieldMapping ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCreateDataSource() - { - if (m_aNewDataSource.isValid()) - { // we already have a data source object - if ( m_aSettings.eType == m_eNewDataSourceType ) - // and it already has the correct type - return; - - // it has a wrong type -> remove it - m_aNewDataSource.remove(); - } - - ODataSourceContext aContext( getORB() ); - aContext.disambiguate( m_aSettings.sDataSourceName ); - - switch (m_aSettings.eType) - { - case AST_MORK: - m_aNewDataSource = aContext.createNewMORK( m_aSettings.sDataSourceName ); - break; - - case AST_THUNDERBIRD: - m_aNewDataSource = aContext.createNewThunderbird( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION: - m_aNewDataSource = aContext.createNewEvolution( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION_GROUPWISE: - m_aNewDataSource = aContext.createNewEvolutionGroupwise( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION_LDAP: - m_aNewDataSource = aContext.createNewEvolutionLdap( m_aSettings.sDataSourceName ); - break; - - case AST_KAB: - m_aNewDataSource = aContext.createNewKab( m_aSettings.sDataSourceName ); - break; - - case AST_MACAB: - m_aNewDataSource = aContext.createNewMacab( m_aSettings.sDataSourceName ); - break; - - case AST_LDAP: - m_aNewDataSource = aContext.createNewLDAP( m_aSettings.sDataSourceName ); - break; - - case AST_OUTLOOK: - m_aNewDataSource = aContext.createNewOutlook( m_aSettings.sDataSourceName ); - break; - - case AST_OE: - m_aNewDataSource = aContext.createNewOE( m_aSettings.sDataSourceName ); - break; - - case AST_OTHER: - m_aNewDataSource = aContext.createNewDBase( m_aSettings.sDataSourceName ); - break; - - case AST_INVALID: - OSL_FAIL( "OAddessBookSourcePilot::implCreateDataSource: illegal data source type!" ); - break; - } - m_eNewDataSourceType = m_aSettings.eType; - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::connectToDataSource( sal_Bool _bForceReConnect ) - { - DBG_ASSERT( m_aNewDataSource.isValid(), "OAddessBookSourcePilot::implConnect: invalid current data source!" ); - - WaitObject aWaitCursor( this ); - if ( _bForceReConnect && m_aNewDataSource.isConnected( ) ) - m_aNewDataSource.disconnect( ); - - return m_aNewDataSource.connect( this ); - } - - //--------------------------------------------------------------------- - OWizardPage* OAddessBookSourcePilot::createPage(WizardState _nState) - { - switch (_nState) - { - case STATE_SELECT_ABTYPE: - return new TypeSelectionPage( this ); - - case STATE_INVOKE_ADMIN_DIALOG: - return new AdminDialogInvokationPage( this ); - - case STATE_TABLE_SELECTION: - return new TableSelectionPage( this ); - - case STATE_MANUAL_FIELD_MAPPING: - return new FieldMappingPage( this ); - - case STATE_FINAL_CONFIRM: - return new FinalPage( this ); - - default: - OSL_FAIL("OAddessBookSourcePilot::createPage: invalid state!"); - return NULL; - } - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::impl_updateRoadmap( AddressSourceType _eType ) - { - bool bSettingsPage = needAdminInvokationPage( _eType ); - bool bTablesPage = needTableSelection( _eType ); - bool bFieldsPage = needManualFieldMapping( _eType ); - - bool bConnected = m_aNewDataSource.isConnected(); - bool bCanSkipTables = - ( m_aNewDataSource.hasTable( m_aSettings.sSelectedTable ) - || m_aSettings.bIgnoreNoTable - ); - - enableState( STATE_INVOKE_ADMIN_DIALOG, bSettingsPage ); - - enableState( STATE_TABLE_SELECTION, - bTablesPage && ( bConnected ? !bCanSkipTables : !bSettingsPage ) - // if we do not need a settings page, we connect upon "Next" on the first page - ); - - enableState( STATE_MANUAL_FIELD_MAPPING, - bFieldsPage && bConnected && m_aNewDataSource.hasTable( m_aSettings.sSelectedTable ) - ); - - enableState( STATE_FINAL_CONFIRM, - bConnected && bCanSkipTables - ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::typeSelectionChanged( AddressSourceType _eType ) - { - PathId nCurrentPathID( PATH_COMPLETE ); - bool bSettingsPage = needAdminInvokationPage( _eType ); - bool bFieldsPage = needManualFieldMapping( _eType ); - if ( !bSettingsPage ) - if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_SETTINGS_NO_FIELDS; - else - nCurrentPathID = PATH_NO_SETTINGS; - else - if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_FIELDS; - else - nCurrentPathID = PATH_COMPLETE; - activatePath( nCurrentPathID, true ); - - m_aNewDataSource.disconnect(); - m_aSettings.bIgnoreNoTable = false; - impl_updateRoadmap( _eType ); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx deleted file mode 100644 index 74c010e22..000000000 --- a/extensions/source/abpilot/abspilot.hxx +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABSPILOT_HXX -#define EXTENSIONS_ABSPILOT_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <svtools/roadmapwizard.hxx> -#include "addresssettings.hxx" -#include <vcl/fixed.hxx> -#include "datasourcehandling.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OAddessBookSourcePilot - //===================================================================== - typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base; - class OAddessBookSourcePilot : public OAddessBookSourcePilot_Base - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - AddressSettings m_aSettings; - - ODataSource m_aNewDataSource; - AddressSourceType m_eNewDataSourceType; - - public: - /// ctor - OAddessBookSourcePilot( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - /// get the service factory which was used to create the dialog - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getORB() { return m_xORB; } - AddressSettings& getSettings() { return m_aSettings; } - const AddressSettings& getSettings() const { return m_aSettings; } - - const ODataSource& getDataSource() const { return m_aNewDataSource; } - - sal_Bool connectToDataSource( sal_Bool _bForceReConnect ); - - void travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); } - - /// to be called when the selected type changed - void typeSelectionChanged( AddressSourceType _eType ); - - protected: - // OWizardMachine overridables - virtual ::svt::OWizardPage* createPage( WizardState _nState ); - virtual void enterState( WizardState _nState ); - virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); - virtual sal_Bool onFinish(); - - // RoadmapWizard - virtual String getStateDisplayName( WizardState _nState ) const; - - virtual sal_Bool Close(); - - private: - DECL_LINK( OnCancelClicked, void* ); - - /** creates a new data source of the type indicated by m_aSettings - <p>If another data source has been created before, this one is deleted.</p> - */ - void implCreateDataSource(); - - /// does an automatic field mapping (possible for all types except AST_OTHER) - void implDoAutoFieldMapping(); - - /// guesses a default for the table name, if no valid table is selected - void implDefaultTableName(); - - inline sal_Bool needAdminInvokationPage( AddressSourceType _eType ) const - { - return ( ( AST_LDAP == _eType ) - || ( AST_OTHER == _eType ) - ); - } - /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source - inline sal_Bool needAdminInvokationPage() const - { - return needAdminInvokationPage( m_aSettings.eType ); - } - - inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const - { - return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) || - ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) || - ( AST_EVOLUTION_LDAP == _eType ); - } - /// checks if we need a manual (user-guided) field mapping - inline sal_Bool needManualFieldMapping() const - { - return needManualFieldMapping( m_aSettings.eType ); - } - - /// determines whether the given address book type does provide one table only - inline bool needTableSelection( AddressSourceType _eType ) const - { - return ( AST_LDAP != _eType ) && ( AST_KAB != _eType ); - } - - inline bool needTableSelection() const - { - return needTableSelection( m_aSettings.eType ); - } - - void implCleanup(); - void implCommitAll(); - - void impl_updateRoadmap( AddressSourceType _eType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABSPILOT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.src b/extensions/source/abpilot/abspilot.src deleted file mode 100644 index c21980a94..000000000 --- a/extensions/source/abpilot/abspilot.src +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABPRESID_HRC -#include "abpresid.hrc" -#endif - -//........................................................................ -ModalDialog RID_DLG_ADDRESSBOOKSOURCEPILOT -{ - Text [ en-US ] = "Address Book Data Source Wizard" ; - - HelpId = HID_ABSPILOT; - - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE; - - String STR_SELECT_ABTYPE - { - Text [ en-US ] = "Address book type"; - }; - - String STR_INVOKE_ADMIN_DIALOG - { - Text [ en-US ] = "Connection Settings"; - }; - - String STR_TABLE_SELECTION - { - Text [ en-US ] = "Table selection"; - }; - - String STR_MANUAL_FIELD_MAPPING - { - Text [ en-US ] = "Field Assignment"; - }; - - String STR_FINAL_CONFIRM - { - Text [ en-US ] = "Data Source Title"; - }; -}; - -//........................................................................ -TabPage RID_PAGE_SELECTABTYPE -{ - HelpID = "extensions:TabPage:RID_PAGE_SELECTABTYPE"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_TYPE_HINTS - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "%PRODUCTNAME lets you access address data already present in your system. To do this, a %PRODUCTNAME data source will be created in which your address data is available in tabular form.\n\nThis wizard helps you create the data source."; - }; - - FixedLine FL_TYPE - { - Pos = MAP_APPFONT ( 7, 56 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 8 ) ; - - Text [ en-US ] = "Please select the type of your external address book:"; - }; - - RadioButton RB_EVOLUTION - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution"; - }; - RadioButton RB_EVOLUTION_GROUPWISE - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION_GROUPWISE"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Groupwise"; - }; - RadioButton RB_EVOLUTION_LDAP - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION_LDAP"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution LDAP"; - }; - RadioButton RB_MORK - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_MORK"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Mozilla / Netscape"; - }; - RadioButton RB_THUNDERBIRD - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_THUNDERBIRD"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Thunderbird"; - }; - RadioButton RB_KAB - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_KAB"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "KDE address book"; - }; - RadioButton RB_MACAB - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_MACAB"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Mac OS X address book"; - }; - RadioButton RB_LDAP - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_LDAP"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "LDAP address data"; - }; - RadioButton RB_OUTLOOK - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OUTLOOK"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Outlook address book"; - }; - RadioButton RB_OUTLOOKEXPRESS - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OUTLOOKEXPRESS"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Windows system address book"; - }; - RadioButton RB_OTHER - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OTHER"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Other external data source"; - }; -}; - -//........................................................................ -TabPage RID_PAGE_ADMININVOKATION -{ - HelpID = "extensions:TabPage:RID_PAGE_ADMININVOKATION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_ADMINEXPLANATION - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 48 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "To set up the new data source, additional information is required.\n\nClick the following button to open another dialog in which you then enter the necessary information."; - }; - - PushButton PB_INVOKE_ADMIN_DIALOG - { - HelpID = "extensions:PushButton:RID_PAGE_ADMININVOKATION:PB_INVOKE_ADMIN_DIALOG"; - Pos = MAP_APPFONT ( ( WINDOW_SIZE_X - BUTTON_SIZE_X ) / 2, 60 ) ; - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ) ; - - Text [ en-US ] = "Settings"; - }; - - FixedText FT_ERROR - { - Pos = MAP_APPFONT ( BORDER_X, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 48 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 48 ) ; - WordBreak = TRUE; - Hide = TRUE; - - Text [ en-US ] = "The connection to the data source could not be established.\nBefore you proceed, please check the settings made, or (on the previous page) choose another address data source type."; - }; -}; - -//........................................................................ -TabPage RID_PAGE_TABLESELECTION_AB -{ - HelpID = "extensions:TabPage:RID_PAGE_TABLESELECTION_AB"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FL_TOOMUCHTABLES - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "The external data source you have chosen contains more than one address book.\nPlease select the one you mainly want to work with:"; - }; - - ListBox LB_TABLELIST - { - HelpID = "extensions:ListBox:RID_PAGE_TABLESELECTION_AB:LB_TABLELIST"; - Pos = MAP_APPFONT ( BORDER_X, 36 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 50 ) ; - SVLook = TRUE; - Sort = TRUE; - DropDown = FALSE; - AutoHScroll = TRUE; - Border = TRUE; - }; -}; - -//........................................................................ -TabPage RID_PAGE_FIELDMAPPING -{ - HelpID = "extensions:TabPage:RID_PAGE_FIELDMAPPING"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_FIELDASSIGMENTEXPL - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 72 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "To incorporate the address data in your templates, %PRODUCTNAME has to know which fields contain which data.\n\nFor instance, you could have stored the e-mail addresses in a field named \"email\", or \"E-mail\" or \"EM\" - or something completely different.\n\nClick the button below to open another dialog where you can enter the settings for your data source."; - }; - - PushButton PB_INVOKE_FIELDS_DIALOG - { - HelpID = "extensions:PushButton:RID_PAGE_FIELDMAPPING:PB_INVOKE_FIELDS_DIALOG"; - Pos = MAP_APPFONT ( ( WINDOW_SIZE_X - BUTTON_SIZE_X ) / 2, 84 ) ; - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ) ; - - Text [ en-US ] = "Field Assignment"; - }; - - FixedText FT_ASSIGNEDFIELDS - { - Pos = MAP_APPFONT ( BORDER_X, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 32 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 32 ) ; - WordBreak = TRUE; - }; -}; - -//........................................................................ -TabPage RID_PAGE_FINAL -{ - HelpID = "extensions:TabPage:RID_PAGE_FINAL"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_FINISH_EXPL - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "That was all the information necessary to integrate your address data into %PRODUCTNAME.\n\nNow, just enter the name under which you want to register the data source in %PRODUCTNAME."; - }; - - FixedText FT_LOCATION - { - Pos = MAP_APPFONT ( BORDER_X, 53 ) ; - Size = MAP_APPFONT ( 50, 8 ) ; - Group = TRUE; - - Text [ en-US ] = "Location"; - }; - - ComboBox CBB_LOCATION - { - HelpID = "extensions:ComboBox:RID_PAGE_FINAL:CBB_LOCATION"; - Pos = MAP_APPFONT ( BORDER_X , 64 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 53 - BORDER_X - BORDER_X, 12) ; - SVLook = TRUE; - Border = TRUE; - DropDown = TRUE ; - AutoHScroll = TRUE ; - }; - - PushButton PB_BROWSE - { - HelpID = "extensions:PushButton:RID_PAGE_FINAL:PB_BROWSE"; - Pos = MAP_APPFONT ( WINDOW_SIZE_X - 50 - BORDER_X , 63 ) ; - Size = MAP_APPFONT ( 50, 14) ; - SVLook = TRUE; - Group = FALSE; - - Text [ en-US ] = "Browse..."; - }; - - CheckBox CB_REGISTER_DS - { - HelpID = "extensions:CheckBox:RID_PAGE_FINAL:CB_REGISTER_DS"; - Pos = MAP_APPFONT ( BORDER_X, 82 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X, 8) ; - SVLook = TRUE; - Group = TRUE; - - Text [ en-US ] = "Make this address book available to all modules in %PRODUCTNAME."; - }; - FixedText FT_NAME_EXPL - { - Pos = MAP_APPFONT ( BORDER_X + 10, 93 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X - 10, 8 ) ; - - Text [ en-US ] = "Address book name"; - }; - - Edit ET_DATASOURCENAME - { - HelpID = "extensions:Edit:RID_PAGE_FINAL:ET_DATASOURCENAME"; - Pos = MAP_APPFONT ( BORDER_X + 10, 104 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 56 - BORDER_X - BORDER_X - 10, 12) ; - SVLook = TRUE; - Border = TRUE; - }; - - FixedText FT_DUPLICATENAME - { - Pos = MAP_APPFONT ( BORDER_X + 10, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 24 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24) ; - WordBreak = TRUE; - Hide = TRUE; - Group = FALSE; - - Text [ en-US ] = "Another data source already has this name. As data sources have to have globally unique names, you need to choose another one."; - }; -}; - -//........................................................................ -ErrorBox RID_ERR_NEEDTYPESELECTION -{ - Buttons = WB_OK; - - Message [ en-US ] = "Please select a type of address book."; -}; - -//........................................................................ -QueryBox RID_QRY_NOTABLES -{ - Buttons = WB_YES_NO; - DefButton = WB_DEF_NO; - - Message [ en-US ] = "The data source does not contain any tables.\nDo you want to set it up as an address data source, anyway?"; -}; - -//........................................................................ -QueryBox RID_QRY_NO_EVO_GW -{ - Buttons = WB_YES_NO; - DefButton = WB_DEF_NO; - - Message [ en-US ] = "You don't seem to have any GroupWise account configured in Evolution.\nDo you want to set it up as an address data source, anyway?"; -}; - -//........................................................................ -String RID_STR_DEFAULT_NAME -{ - Text [ en-US ] = "Addresses"; -}; - -String RID_STR_ADMINDIALOGTITLE -{ - Text [ en-US ] = "Create Address Data Source"; -}; - -String RID_STR_NOCONNECTION -{ - Text [ en-US ] = "The connection could not be established."; -}; - -String RID_STR_PLEASECHECKSETTINGS -{ - Text [ en-US ] = "Please check the settings made for the data source."; -}; - -String RID_STR_FIELDDIALOGTITLE -{ - Text [ en-US ] = "Address Data - Field Assignment"; -}; - -String RID_STR_NOFIELDSASSIGNED -{ - Text [ en-US ] = "There are no fields assigned at this time.\nYou can either assign fields now or do so later by first choosing:\n\"File - Template - Address Book Source...\""; -}; - -//........................................................................ -Bitmap BMP_HEADERIMAGE -{ - file = "addresspilot.bmp"; -}; diff --git a/extensions/source/abpilot/addresssettings.hxx b/extensions/source/abpilot/addresssettings.hxx deleted file mode 100644 index 9c05144be..000000000 --- a/extensions/source/abpilot/addresssettings.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADDRESSSETTINGS_HXX -#define EXTENSIONS_ABP_ADDRESSSETTINGS_HXX - -#include <rtl/ustring.hxx> -#include "abptypes.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AddressSourceType - //===================================================================== - enum AddressSourceType - { - AST_MORK, - AST_THUNDERBIRD, - AST_EVOLUTION, - AST_EVOLUTION_GROUPWISE, - AST_EVOLUTION_LDAP, - AST_KAB, - AST_MACAB, - AST_LDAP, - AST_OUTLOOK, - AST_OE, - - AST_OTHER, - - AST_INVALID - }; - - //===================================================================== - //= AddressSettings - //===================================================================== - struct AddressSettings - { - AddressSourceType eType; - ::rtl::OUString sDataSourceName; - ::rtl::OUString sRegisteredDataSourceName; - ::rtl::OUString sSelectedTable; - bool bIgnoreNoTable; - MapString2String aFieldMapping; - bool bRegisterDataSource; - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADDRESSSETTINGS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx deleted file mode 100644 index 61ef82dca..000000000 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "admininvokationimpl.hxx" -#include <tools/debug.hxx> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <vcl/stdtext.hxx> -#include <toolkit/unohlp.hxx> -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include <vcl/waitobj.hxx> - - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::ui::dialogs; - - //===================================================================== - //= OAdminDialogInvokation - //===================================================================== - //--------------------------------------------------------------------- - OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XMultiServiceFactory >& _rxORB - , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource - , Window* _pMessageParent) - :m_xORB(_rxORB) - ,m_xDataSource(_xDataSource) - ,m_pMessageParent(_pMessageParent) - { - DBG_ASSERT(m_xORB.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); - DBG_ASSERT(m_xDataSource.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid preferred name!"); - DBG_ASSERT(m_pMessageParent, "OAdminDialogInvokation::OAdminDialogInvokation: invalid message parent!"); - } - - //--------------------------------------------------------------------- - sal_Bool OAdminDialogInvokation::invokeAdministration( sal_Bool _bFixedType ) - { - if (!m_xORB.is()) - return sal_False; - - try - { - // the service name of the administration dialog - const static ::rtl::OUString s_sAdministrationServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatasourceAdministrationDialog")); - const static ::rtl::OUString s_sDataSourceTypeChangeDialog = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DataSourceTypeChangeDialog")); - - // the parameters for the call - Sequence< Any > aArguments(3); - Any* pArguments = aArguments.getArray(); - - // the parent window - Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface(m_pMessageParent); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), -1, makeAny(xDialogParent), PropertyState_DIRECT_VALUE); - - // the title of the dialog - String sAdminDialogTitle(ModuleRes(RID_STR_ADMINDIALOGTITLE)); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), -1, makeAny(::rtl::OUString(sAdminDialogTitle)), PropertyState_DIRECT_VALUE); - - // the name of the new data source - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InitialSelection")), -1, makeAny(m_xDataSource), PropertyState_DIRECT_VALUE); - - // create the dialog - Reference< XExecutableDialog > xDialog; - { - // creating the dialog service is potentially expensive (if all the libraries invoked need to be loaded) - // so we display a wait cursor - WaitObject aWaitCursor(m_pMessageParent); - xDialog = Reference< XExecutableDialog >( m_xORB->createInstanceWithArguments( _bFixedType ? s_sAdministrationServiceName : s_sDataSourceTypeChangeDialog, aArguments ), UNO_QUERY ); - - // just for a smoother UI: What the dialog does upon execution, is (amongst other things) creating - // the DriverManager service - // If this context has never been accessed before, this may be expensive (it includes loading of - // at least one library). - // As this wizard is intended to run on the first office start, it is very likely that the - // context needs to be freshly created - // Thus, we access the context here (within the WaitCursor), which means the user sees a waitcursor - // while his/her office blocks a few seconds .... - m_xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.DriverManager" )) ); - } - - if (xDialog.is()) - { // execute it - if (xDialog->execute()) - return sal_True; - } - else - ShowServiceNotAvailableError(m_pMessageParent, s_sAdministrationServiceName, sal_True); - } - catch(const Exception&) - { - OSL_FAIL("OAdminDialogInvokation::invokeAdministration: caught an exception while executing the dialog!"); - } - return sal_False; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx deleted file mode 100644 index 760d2270e..000000000 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX -#define EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - - -class Window; -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OAdminDialogInvokation - //===================================================================== - /** outsourced from AdminDialogInvokationPage, 'cause this class here, in opposite to - the page, needs exception handlíng to be enabled. - */ - class OAdminDialogInvokation - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource; - Window* m_pMessageParent; - - public: - OAdminDialogInvokation( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource, - Window* _pMessageParent - ); - - sal_Bool invokeAdministration( sal_Bool _bFixedType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationpage.cxx b/extensions/source/abpilot/admininvokationpage.cxx deleted file mode 100644 index 872c05050..000000000 --- a/extensions/source/abpilot/admininvokationpage.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "admininvokationpage.hxx" -#include "abspilot.hxx" -#include "admininvokationimpl.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AdminDialogInvokationPage - //===================================================================== - AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION)) - ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION)) - ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG)) - ,m_aErrorMessage (this, ModuleRes(FT_ERROR)) - ,m_bSuccessfullyExecutedDialog(sal_False) - { - FreeResource(); - - m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) ); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - m_aInvokeAdminDialog.GrabFocus(); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::implUpdateErrorMessage() - { - const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected(); - m_aErrorMessage.Show( !bIsConnected ); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::initializePage() - { - AddressBookSourcePage::initializePage(); - m_aErrorMessage.Hide(); - // if we're entering this page, we assume we had no connection trial with this data source - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::implTryConnect() - { - getDialog()->connectToDataSource( sal_True ); - - // show our error message if and only if we could not connect - implUpdateErrorMessage(); - - // the status of the next button may have changed - updateDialogTravelUI(); - - // automatically go to the next page (if successfully connected) - if ( canAdvance() ) - getDialog()->travelNext(); - } - - //--------------------------------------------------------------------- - bool AdminDialogInvokationPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ ) - { - OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() ); - if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) ) - { - // try to connect to this data source - implTryConnect(); - } - - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationpage.hxx b/extensions/source/abpilot/admininvokationpage.hxx deleted file mode 100644 index ac435be2c..000000000 --- a/extensions/source/abpilot/admininvokationpage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX -#define EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX - -#include "abspage.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AdminDialogInvokationPage - //===================================================================== - class AdminDialogInvokationPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - PushButton m_aInvokeAdminDialog; - FixedText m_aErrorMessage; - - sal_Bool m_bSuccessfullyExecutedDialog; - - public: - AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent ); - - protected: - // TabDialog overridables - virtual void ActivatePage(); - virtual void initializePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnInvokeAdminDialog, void* ); - - void implTryConnect(); - void implUpdateErrorMessage(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx deleted file mode 100644 index b65635bb6..000000000 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ /dev/null @@ -1,641 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "abpresid.hrc" -#include "abptypes.hxx" -#include "componentmodule.hxx" -#include "datasourcehandling.hxx" - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/sdb/SQLContext.hpp> -#include <com/sun/star/sdb/XCompletedConnection.hpp> -#include <com/sun/star/sdb/XDatabaseRegistrations.hpp> -#include <com/sun/star/sdb/XDocumentDataSource.hpp> -#include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/uno/XNamingService.hpp> - -#include <comphelper/interaction.hxx> -#include <comphelper/componentcontext.hxx> -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <unotools/confignode.hxx> -#include <unotools/sharedunocomponent.hxx> -#include <vcl/stdtext.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::utl; - using namespace ::comphelper; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::task; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::frame; - - //===================================================================== - struct PackageAccessControl { }; - - //===================================================================== - //--------------------------------------------------------------------- - static Reference< XNameAccess > lcl_getDataSourceContext( const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW (( Exception )) - { - Reference< XNameAccess > xContext( _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DatabaseContext" )) ), UNO_QUERY ); - DBG_ASSERT(xContext.is(), "lcl_getDataSourceContext: could not access the data source context!"); - return xContext; - } - - //--------------------------------------------------------------------- - /// creates a new data source and inserts it into the context - static void lcl_implCreateAndInsert( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName, - Reference< XPropertySet >& /* [out] */ _rxNewDataSource ) SAL_THROW (( ::com::sun::star::uno::Exception )) - { - //............................................................. - // get the data source context - Reference< XNameAccess > xContext = lcl_getDataSourceContext( _rxORB ); - - DBG_ASSERT( !xContext->hasByName( _rName ), "lcl_implCreateAndInsert: name already used!" ); - (void)_rName; - - //............................................................. - // create a new data source - Reference< XSingleServiceFactory > xFactory( xContext, UNO_QUERY ); - Reference< XPropertySet > xNewDataSource; - if (xFactory.is()) - xNewDataSource = Reference< XPropertySet >( xFactory->createInstance(), UNO_QUERY ); - DBG_ASSERT( xNewDataSource.is(), "lcl_implCreateAndInsert: could not create a new data source!" ); - - //............................................................. - // insert the data source into the context - Reference< XNamingService > xDynamicContext( xContext, UNO_QUERY ); - DBG_ASSERT( xDynamicContext.is(), "lcl_implCreateAndInsert: missing an interface on the context (XNamingService)!" ); - if (xDynamicContext.is()) - { - // xDynamicContext->registerObject( _rName, xNewDataSource ); - _rxNewDataSource = xNewDataSource; - } - } - - //--------------------------------------------------------------------- - /// creates and inserts a data source, and sets it's URL property to the string given - static ODataSource lcl_implCreateAndSetURL( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName, - const sal_Char* _pInitialAsciiURL ) SAL_THROW (( )) - { - ODataSource aReturn( _rxORB ); - try - { - // create the new data source - Reference< XPropertySet > xNewDataSource; - lcl_implCreateAndInsert( _rxORB, _rName, xNewDataSource ); - - //............................................................. - // set the URL property - if (xNewDataSource.is()) - { - xNewDataSource->setPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )), - makeAny( ::rtl::OUString::createFromAscii( _pInitialAsciiURL ) ) - ); - } - - aReturn.setDataSource( xNewDataSource, _rName,PackageAccessControl() ); - } - catch(const Exception&) - { - OSL_FAIL( "lcl_implCreateAndSetURL: caught an exception while creating the data source!" ); - } - - return aReturn; - } - //--------------------------------------------------------------------- - void lcl_registerDataSource( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _sName, - const ::rtl::OUString& _sURL ) SAL_THROW (( ::com::sun::star::uno::Exception )) - { - OSL_ENSURE( _sName.getLength(), "lcl_registerDataSource: invalid name!" ); - OSL_ENSURE( _sURL.getLength(), "lcl_registerDataSource: invalid URL!" ); - try - { - - ::comphelper::ComponentContext aContext( _rxORB ); - Reference< XDatabaseRegistrations > xRegistrations( - aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); - - if ( xRegistrations->hasRegisteredDatabase( _sName ) ) - xRegistrations->changeDatabaseLocation( _sName, _sURL ); - else - xRegistrations->registerDatabaseLocation( _sName, _sURL ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //===================================================================== - //= ODataSourceContextImpl - //===================================================================== - struct ODataSourceContextImpl - { - Reference< XMultiServiceFactory > xORB; - Reference< XNameAccess > xContext; /// the UNO data source context - StringBag aDataSourceNames; /// for quicker name checks (without the UNO overhead) - - ODataSourceContextImpl( const Reference< XMultiServiceFactory >& _rxORB ) : xORB( _rxORB ) { } - ODataSourceContextImpl( const ODataSourceContextImpl& _rSource ) - :xORB ( _rSource.xORB ) - ,xContext ( _rSource.xContext ) - { - } - }; - - //===================================================================== - //= ODataSourceContext - //===================================================================== - //--------------------------------------------------------------------- - ODataSourceContext::ODataSourceContext(const Reference< XMultiServiceFactory >& _rxORB) - :m_pImpl( new ODataSourceContextImpl( _rxORB ) ) - { - try - { - // create the UNO context - m_pImpl->xContext = lcl_getDataSourceContext( _rxORB ); - - if (m_pImpl->xContext.is()) - { - // collect the data source names - Sequence< ::rtl::OUString > aDSNames = m_pImpl->xContext->getElementNames(); - const ::rtl::OUString* pDSNames = aDSNames.getConstArray(); - const ::rtl::OUString* pDSNamesEnd = pDSNames + aDSNames.getLength(); - - for ( ;pDSNames != pDSNamesEnd; ++pDSNames ) - m_pImpl->aDataSourceNames.insert( *pDSNames ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "ODataSourceContext::ODataSourceContext: caught an exception!" ); - } - } - - //--------------------------------------------------------------------- - ::rtl::OUString& ODataSourceContext::disambiguate(::rtl::OUString& _rDataSourceName) - { - ::rtl::OUString sCheck( _rDataSourceName ); - ConstStringBagIterator aPos = m_pImpl->aDataSourceNames.find( sCheck ); - - sal_Int32 nPostFix = 1; - while ( ( m_pImpl->aDataSourceNames.end() != aPos ) && ( nPostFix < 65535 ) ) - { // there already is a data source with this name - sCheck = _rDataSourceName; - sCheck += ::rtl::OUString::valueOf( nPostFix++ ); - - aPos = m_pImpl->aDataSourceNames.find( sCheck ); - } - - _rDataSourceName = sCheck; - return _rDataSourceName; - } - - //--------------------------------------------------------------------- - void ODataSourceContext::getDataSourceNames( StringBag& _rNames ) const SAL_THROW (( )) - { - _rNames = m_pImpl->aDataSourceNames; - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewLDAP( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:ldap:" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewMORK( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:mozilla" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewThunderbird( const ::rtl::OUString& _rName ) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:thunderbird" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolutionLdap( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:ldap" ); - } - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolutionGroupwise( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:groupwise" ); - } - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolution( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:local" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewKab( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:kab" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewMacab( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:macab" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewOutlook( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:outlook" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewOE( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:outlookexp" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewDBase( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:dbase:" ); - } - - //===================================================================== - //= ODataSourceImpl - //===================================================================== - struct ODataSourceImpl - { - public: - Reference< XMultiServiceFactory > xORB; /// the service factory - Reference< XPropertySet > xDataSource; /// the UNO data source - ::utl::SharedUNOComponent< XConnection > - xConnection; - StringBag aTables; // the cached table names - ::rtl::OUString sName; - sal_Bool bTablesUpToDate; // table name cache up-to-date? - - ODataSourceImpl( const Reference< XMultiServiceFactory >& _rxORB ) - :xORB( _rxORB ) - ,bTablesUpToDate( sal_False ) - { - } - - ODataSourceImpl( const ODataSourceImpl& _rSource ); - }; - - //--------------------------------------------------------------------- - ODataSourceImpl::ODataSourceImpl( const ODataSourceImpl& _rSource ) - :xORB( _rSource.xORB ) - ,xDataSource( _rSource.xDataSource ) - ,xConnection( _rSource.xConnection ) - ,aTables( _rSource.aTables ) - ,sName( _rSource.sName ) - ,bTablesUpToDate( _rSource.bTablesUpToDate ) - { - } - - //===================================================================== - //= ODataSource - //===================================================================== - //--------------------------------------------------------------------- - ODataSource::ODataSource( const ODataSource& _rSource ) - :m_pImpl( NULL ) - { - *this = _rSource; - } - - //--------------------------------------------------------------------- - ODataSource& ODataSource::operator=( const ODataSource& _rSource ) - { - if( this != &_rSource ) - { - delete m_pImpl; - m_pImpl = new ODataSourceImpl( *_rSource.m_pImpl ); - } - return *this; - } - - //--------------------------------------------------------------------- - ODataSource::ODataSource( const Reference< XMultiServiceFactory >& _rxORB ) - :m_pImpl(new ODataSourceImpl(_rxORB)) - { - } - - //--------------------------------------------------------------------- - ODataSource::~ODataSource( ) - { - delete m_pImpl; - } - - //--------------------------------------------------------------------- - void ODataSource::store() SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - try - { - Reference< XDocumentDataSource > xDocAccess( m_pImpl->xDataSource, UNO_QUERY ); - Reference< XStorable > xStorable; - if ( xDocAccess.is() ) - xStorable = xStorable.query( xDocAccess->getDatabaseDocument() ); - OSL_ENSURE( xStorable.is(),"DataSource is no XStorable!" ); - if ( xStorable.is() ) - xStorable->storeAsURL(m_pImpl->sName,Sequence<PropertyValue>()); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::registerDataSource: caught an exception while creating the data source!" ); - } - } - //--------------------------------------------------------------------- - void ODataSource::registerDataSource( const ::rtl::OUString& _sRegisteredDataSourceName) SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - - try - { - // invalidate ourself - lcl_registerDataSource(m_pImpl->xORB,_sRegisteredDataSourceName,m_pImpl->sName); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::registerDataSource: caught an exception while creating the data source!" ); - } - } - - //--------------------------------------------------------------------- - void ODataSource::setDataSource( const Reference< XPropertySet >& _rxDS,const ::rtl::OUString& _sName, PackageAccessControl ) - { - if (m_pImpl->xDataSource.get() == _rxDS.get()) - // nothing to do - return; - - if ( isConnected() ) - disconnect(); - - m_pImpl->sName = _sName; - m_pImpl->xDataSource = _rxDS; - } - - //--------------------------------------------------------------------- - void ODataSource::remove() SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - - try - { - // invalidate ourself - m_pImpl->xDataSource.clear(); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::remove: caught an exception while creating the data source!" ); - } - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::rename( const ::rtl::OUString& _rName ) SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return sal_False; - - m_pImpl->sName = _rName; - return sal_True; - } - - //--------------------------------------------------------------------- - ::rtl::OUString ODataSource::getName() const SAL_THROW (( )) - { - if ( !isValid() ) - return ::rtl::OUString(); - return m_pImpl->sName; - } - - //--------------------------------------------------------------------- - bool ODataSource::hasTable( const ::rtl::OUString& _rTableName ) const - { - if ( !isConnected() ) - return false; - - const StringBag& aTables( getTableNames() ); - return aTables.find( _rTableName ) != aTables.end(); - } - - //--------------------------------------------------------------------- - const StringBag& ODataSource::getTableNames() const SAL_THROW (( )) - { - m_pImpl->aTables.clear(); - if ( !isConnected() ) - { - OSL_FAIL( "ODataSource::getTableNames: not connected!" ); - } - else - { - try - { - // get the tables container from the connection - Reference< XTablesSupplier > xSuppTables( m_pImpl->xConnection.getTyped(), UNO_QUERY ); - Reference< XNameAccess > xTables; - if ( xSuppTables.is( ) ) - xTables = xSuppTables->getTables(); - DBG_ASSERT( xTables.is(), "ODataSource::getTableNames: could not retrieve the tables container!" ); - - // get the names - Sequence< ::rtl::OUString > aTableNames; - if ( xTables.is( ) ) - aTableNames = xTables->getElementNames( ); - - // copy the names - const ::rtl::OUString* pTableNames = aTableNames.getConstArray(); - const ::rtl::OUString* pTableNamesEnd = pTableNames + aTableNames.getLength(); - for (;pTableNames < pTableNamesEnd; ++pTableNames) - m_pImpl->aTables.insert( *pTableNames ); - } - catch(const Exception&) - { - } - } - - // now the table cache is up-to-date - m_pImpl->bTablesUpToDate = sal_True; - return m_pImpl->aTables; - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::connect( Window* _pMessageParent ) SAL_THROW (( )) - { - if ( isConnected( ) ) - // nothing to do - return sal_True; - - // ................................................................ - // create the interaction handler (needed for authentication and error handling) - static ::rtl::OUString s_sInteractionHandlerServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")); - Reference< XInteractionHandler > xInteractions; - try - { - xInteractions = Reference< XInteractionHandler >( - m_pImpl->xORB->createInstance( s_sInteractionHandlerServiceName ), - UNO_QUERY - ); - } - catch(const Exception&) - { - } - - // ................................................................ - // failure to create the interaction handler is a serious issue ... - if (!xInteractions.is()) - { - if ( _pMessageParent ) - ShowServiceNotAvailableError( _pMessageParent, s_sInteractionHandlerServiceName, sal_True ); - return sal_False; - } - - // ................................................................ - // open the connection - Any aError; - Reference< XConnection > xConnection; - try - { - Reference< XCompletedConnection > xComplConn( m_pImpl->xDataSource, UNO_QUERY ); - DBG_ASSERT( xComplConn.is(), "ODataSource::connect: missing the XCompletedConnection interface on the data source!" ); - if ( xComplConn.is() ) - xConnection = xComplConn->connectWithCompletion( xInteractions ); - } - catch( const SQLContext& e ) { aError <<= e; } - catch( const SQLWarning& e ) { aError <<= e; } - catch( const SQLException& e ) { aError <<= e; } - catch( const Exception& ) - { - OSL_FAIL( "ODataSource::connect: caught a generic exception!" ); - } - - // ................................................................ - // handle errors - if ( aError.hasValue() && _pMessageParent ) - { - try - { - SQLException aException; - aError >>= aException; - if ( !aException.Message.getLength() ) - { - // prepend some context info - SQLContext aDetailedError; - aDetailedError.Message = String( ModuleRes( RID_STR_NOCONNECTION ) ); - aDetailedError.Details = String( ModuleRes( RID_STR_PLEASECHECKSETTINGS ) ); - aDetailedError.NextException = aError; - // handle (aka display) the new context info - xInteractions->handle( new OInteractionRequest( makeAny( aDetailedError ) ) ); - } - else - { - // handle (aka display) the original error - xInteractions->handle( new OInteractionRequest( makeAny( aException ) ) ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "ODataSource::connect: caught an exception while trying to display the error!" ); - } - } - - if ( !xConnection.is() ) - return sal_False; - - // ................................................................ - // success - m_pImpl->xConnection.reset( xConnection ); - m_pImpl->aTables.clear(); - m_pImpl->bTablesUpToDate = sal_False; - - return sal_True; - } - - //--------------------------------------------------------------------- - void ODataSource::disconnect( ) SAL_THROW (( )) - { - m_pImpl->xConnection.clear(); - m_pImpl->aTables.clear(); - m_pImpl->bTablesUpToDate = sal_False; - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::isConnected( ) const SAL_THROW (( )) - { - return m_pImpl->xConnection.is(); - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::isValid() const SAL_THROW (( )) - { - return m_pImpl && m_pImpl->xDataSource.is(); - } - //--------------------------------------------------------------------- - Reference< XPropertySet > ODataSource::getDataSource() const SAL_THROW (( )) - { - return m_pImpl ? m_pImpl->xDataSource : Reference< XPropertySet >(); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx deleted file mode 100644 index cce6253bb..000000000 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_DATASOURCEHANDLING_HXX -#define EXTENSIONS_ABP_DATASOURCEHANDLING_HXX - -#include <com/sun/star/uno/Reference.hxx> -#include "abptypes.hxx" - -//======================================================================== -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } - namespace beans { - class XPropertySet; - } -} } } - -class Window; - - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= ODataSourceContext - //===================================================================== - struct ODataSourceContextImpl; - class ODataSource; - /// a non-UNO wrapper for the data source context - class ODataSourceContext - { - private: - ODataSourceContextImpl* m_pImpl; - - public: - ODataSourceContext( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - /// retrieves the names of all data sources - void getDataSourceNames( StringBag& _rNames ) const SAL_THROW (( )); - - /// disambiguates the given name by appending auccessive numbers - ::rtl::OUString& disambiguate(::rtl::OUString& _rDataSourceName); - - /// creates a new MORK data source - ODataSource createNewMORK( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Thunderbird data source - ODataSource createNewThunderbird( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution local data source - ODataSource createNewEvolution( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution LDAP data source - ODataSource createNewEvolutionLdap( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution GROUPWISE data source - ODataSource createNewEvolutionGroupwise( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new KDE address book data source - ODataSource createNewKab( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Mac OS X address book data source - ODataSource createNewMacab( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new LDAP data source - ODataSource createNewLDAP( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Outlook data source - ODataSource createNewOutlook( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Outlook express data source - ODataSource createNewOE( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new dBase data source - ODataSource createNewDBase( const ::rtl::OUString& _rName ) SAL_THROW (( )); - }; - - //===================================================================== - //= ODataSource - //===================================================================== - struct ODataSourceImpl; - struct PackageAccessControl; - /** a non-UNO wrapper for a data source - <p>This class allows to access data sources without the need to compile the respective file with - exception handling enabled (hopefully :).</p> - <p>In addition to wrapping an UNO data source, an instance of this class can handle at most - one valid connection, as obtained from the data source.</p> - */ - class ODataSource - { - private: - ODataSourceImpl* m_pImpl; - - public: - // ---------------------------------------------------------------- - // - ctor/dtor/assignment - // ---------------------------------------------------------------- - /// constructs an object which is initially invalid - ODataSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - /// copy ctor - ODataSource( const ODataSource& _rSource ); - - /// dtor - ~ODataSource( ); - - /// assignment - ODataSource& operator=( const ODataSource& _rSource ); - - // ---------------------------------------------------------------- - /// checks whether or not the object represents a valid data source - sal_Bool isValid() const SAL_THROW (( )); - - // ---------------------------------------------------------------- - /// removes the data source represented by the object from the data source context - void remove() SAL_THROW (( )); - // TODO: put this into the context class - - /// returns the name of the data source - ::rtl::OUString - getName() const SAL_THROW (( )); - - /// renames the data source - sal_Bool rename( const ::rtl::OUString& _rName ) SAL_THROW (( )); - // TODO: put this into the context class - - // ---------------------------------------------------------------- - // - connection handling - // ---------------------------------------------------------------- - /** connects to the data source represented by this object - @param _pMessageParent - the window to use as parent for any error messages. If this is <NULL/>, no messages are displayed - at all. - @see isConnected - */ - sal_Bool connect( Window* _pMessageParent ) SAL_THROW (( )); - - /// returns <TRUE/> if the object has a valid connection, obtained from it's data source - sal_Bool isConnected( ) const SAL_THROW (( )); - - /// disconnects from the data source (i.e. disposes the UNO connection hold internally) - void disconnect( ) SAL_THROW (( )); - - /// stores the database file - void store() SAL_THROW (( )); - - /// register the data source under the given name in the configuration - void registerDataSource( const ::rtl::OUString& _sRegisteredDataSourceName ) SAL_THROW (( )); - - // ---------------------------------------------------------------- - /** retrieves the tables names from the connection - <p>to be called when <method>isConnection</method> returns <TRUE/> only</p> - */ - const StringBag& getTableNames() const SAL_THROW (( )); - - /** determines whether a given table exists - */ - bool hasTable( const ::rtl::OUString& _rTableName ) const; - - /// return the intern data source object - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataSource() const SAL_THROW (( )); - - - // ---------------------------------------------------------------- - /** set a new data source. - <p>Available to selected clients only</p> - */ - void setDataSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDS - ,const ::rtl::OUString& _sName - ,PackageAccessControl - ); - - private: - ODataSource( ); // never implemented - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_DATASOURCEHANDLING_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/exports.dxp b/extensions/source/abpilot/exports.dxp deleted file mode 100644 index 700330789..000000000 --- a/extensions/source/abpilot/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx deleted file mode 100644 index f5c64323f..000000000 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ /dev/null @@ -1,372 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "fieldmappingimpl.hxx" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <tools/debug.hxx> -#include <toolkit/unohlp.hxx> -#include <vcl/stdtext.hxx> -#include <com/sun/star/util/AliasProgrammaticPair.hpp> -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include <unotools/confignode.hxx> -#include "sal/macros.h" - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::utl; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::ui::dialogs; - - //--------------------------------------------------------------------- - static const ::rtl::OUString& lcl_getDriverSettingsNodeName() - { - static const ::rtl::OUString s_sDriverSettingsNodeName(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver" )); - return s_sDriverSettingsNodeName; - } - - //--------------------------------------------------------------------- - static const ::rtl::OUString& lcl_getAddressBookNodeName() - { - static const ::rtl::OUString s_sAddressBookNodeName(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/AddressBook" )); - return s_sAddressBookNodeName; - } - - //..................................................................... - namespace fieldmapping - { - //..................................................................... - - //----------------------------------------------------------------- - sal_Bool invokeDialog( const Reference< XMultiServiceFactory >& _rxORB, class Window* _pParent, - const Reference< XPropertySet >& _rxDataSource, AddressSettings& _rSettings ) SAL_THROW ( ( ) ) - { - _rSettings.aFieldMapping.clear(); - - DBG_ASSERT( _rxORB.is(), "fieldmapping::invokeDialog: invalid service factory!" ); - DBG_ASSERT( _rxDataSource.is(), "fieldmapping::invokeDialog: invalid data source!" ); - if ( !_rxORB.is() || !_rxDataSource.is() ) - return sal_False; - - try - { - // ........................................................ - // the parameters for creating the dialog - Sequence< Any > aArguments(5); - Any* pArguments = aArguments.getArray(); - - // the parent window - Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface( _pParent ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), -1, makeAny( xDialogParent ), PropertyState_DIRECT_VALUE); - - // the data source to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSource" )), -1, makeAny( _rxDataSource ), PropertyState_DIRECT_VALUE); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" )), -1, makeAny( (sal_Bool)_rSettings.bRegisterDataSource ? _rSettings.sRegisteredDataSourceName : _rSettings.sDataSourceName ), PropertyState_DIRECT_VALUE); - - // the table to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Command" )), -1, makeAny( _rSettings.sSelectedTable ), PropertyState_DIRECT_VALUE); - - // the title - ::rtl::OUString sTitle = String( ModuleRes( RID_STR_FIELDDIALOGTITLE ) ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )), -1, makeAny( sTitle ), PropertyState_DIRECT_VALUE); - - // ........................................................ - // create an instance of the dialog service - static ::rtl::OUString s_sAdressBookFieldAssignmentServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" )); - Reference< XExecutableDialog > xDialog( - _rxORB->createInstanceWithArguments( s_sAdressBookFieldAssignmentServiceName, aArguments ), - UNO_QUERY - ); - if ( !xDialog.is( ) ) - { - ShowServiceNotAvailableError( _pParent, s_sAdressBookFieldAssignmentServiceName, sal_True ); - return sal_False; - } - - // execute the dialog - if ( xDialog->execute() ) - { - // retrieve the field mapping as set by he user - Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY ); - - Sequence< AliasProgrammaticPair > aMapping; -#ifdef DBG_UTIL - sal_Bool bSuccess = -#endif - xDialogProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FieldMapping" )) ) >>= aMapping; - DBG_ASSERT( bSuccess, "fieldmapping::invokeDialog: invalid property type for FieldMapping!" ); - - // and copy it into the map - const AliasProgrammaticPair* pMapping = aMapping.getConstArray(); - const AliasProgrammaticPair* pMappingEnd = pMapping + aMapping.getLength(); - for (;pMapping != pMappingEnd; ++pMapping) - _rSettings.aFieldMapping[ pMapping->ProgrammaticName ] = pMapping->Alias; - - return sal_True; - } - - } - catch(const Exception&) - { - OSL_FAIL("fieldmapping::invokeDialog: caught an exception while executing the dialog!"); - } - return sal_False; - } - - //----------------------------------------------------------------- - void defaultMapping( const Reference< XMultiServiceFactory >& _rxORB, MapString2String& _rFieldAssignment ) SAL_THROW ( ( ) ) - { - _rFieldAssignment.clear(); - - try - { - // what we have: - // a) For the address data source, we need a mapping from programmatic names (1) to real column names - // b) The SDBC driver has a fixed set of columns, which, when returned, are named according to - // some configuration entries. E.g., the driver displays the field which it knows contains - // the first name as "First Name" - the latter string is stored in the config. - // For this, the driver uses programmatic names, too, but they differ from the programmatic names the - // template documents have. - // So what we need first is a mapping from programmatic names (1) to programmatic names (2) - const sal_Char* pMappingProgrammatics[] = - { - "FirstName", "FirstName", - "LastName", "LastName", - "Street", "HomeAddress", - "Zip", "HomeZipCode", - "City", "HomeCity", - "State", "HomeState", - "Country", "HomeCountry", - "PhonePriv", "HomePhone", - "PhoneComp", "WorkPhone", - "PhoneCell", "CellularNumber", - "Pager", "PagerNumber", - "Fax", "FaxNumber", - "EMail", "PrimaryEmail", - "URL", "WebPage1", - "Note", "Notes", - "Altfield1", "Custom1", - "Altfield2", "Custom2", - "Altfield3", "Custom3", - "Altfield4", "Custom4", - "Title", "JobTitle", - "Company", "Company", - "Department", "Department" - }; - // (this list is not complete: both lists of programmatic names are larger in real, - // but this list above is the intersection) - - - // access the configuration information which the driver uses for determining it's column names - ::rtl::OUString sDriverAliasesNodeName = lcl_getDriverSettingsNodeName(); - sDriverAliasesNodeName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/ColumnAliases" )); - - // create a config node for this - OConfigurationTreeRoot aDriverFieldAliasing = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sDriverAliasesNodeName, -1, OConfigurationTreeRoot::CM_READONLY); - - // loop through all programmatic pairs - DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2, - "fieldmapping::defaultMapping: invalid programmatic map!" ); - // number of pairs - sal_Int32 nIntersectedProgrammatics = SAL_N_ELEMENTS( pMappingProgrammatics ) / 2; - - const sal_Char** pProgrammatic = pMappingProgrammatics; - ::rtl::OUString sAddressProgrammatic; - ::rtl::OUString sDriverProgrammatic; - ::rtl::OUString sDriverUI; - for ( sal_Int32 i=0; - i < nIntersectedProgrammatics; - ++i - ) - { - sAddressProgrammatic = ::rtl::OUString::createFromAscii( *pProgrammatic++ ); - sDriverProgrammatic = ::rtl::OUString::createFromAscii( *pProgrammatic++ ); - - if ( aDriverFieldAliasing.hasByName( sDriverProgrammatic ) ) - { - aDriverFieldAliasing.getNodeValue( sDriverProgrammatic ) >>= sDriverUI; - if ( 0 == sDriverUI.getLength() ) - { - OSL_FAIL( "fieldmapping::defaultMapping: invalid driver UI column name!"); - } - else - _rFieldAssignment[ sAddressProgrammatic ] = sDriverUI; - } - else - { - OSL_FAIL( "fieldmapping::defaultMapping: invalid driver programmatic name!" ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL("fieldmapping::defaultMapping: code is assumed to throw no exceptions!"); - // the config nodes we're using herein should not do this .... - } - } - - //----------------------------------------------------------------- - void writeTemplateAddressFieldMapping( const Reference< XMultiServiceFactory >& _rxORB, const MapString2String& _rFieldAssignment ) SAL_THROW ( ( ) ) - { - // want to have a non-const map for easier handling - MapString2String aFieldAssignment( _rFieldAssignment ); - - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - OConfigurationNode aFields = aAddressBookSettings.openNode( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Fields" )) ); - - // loop through all existent fields - Sequence< ::rtl::OUString > aExistentFields = aFields.getNodeNames(); - const ::rtl::OUString* pExistentFields = aExistentFields.getConstArray(); - const ::rtl::OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - - const ::rtl::OUString sProgrammaticNodeName(RTL_CONSTASCII_USTRINGPARAM( "ProgrammaticFieldName" )); - const ::rtl::OUString sAssignedNodeName(RTL_CONSTASCII_USTRINGPARAM( "AssignedFieldName" )); - - for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) - { -#ifdef DBG_UTIL - ::rtl::OUString sRedundantProgrammaticName; - aFields.openNode( *pExistentFields ).getNodeValue( sProgrammaticNodeName ) >>= sRedundantProgrammaticName; -#endif - DBG_ASSERT( sRedundantProgrammaticName == *pExistentFields, - "fieldmapping::writeTemplateAddressFieldMapping: inconsistent config data!" ); - // there should be a redundancy in the config data .... if this asserts, there isn't anymore! - - // do we have a new alias for the programmatic? - MapString2StringIterator aPos = aFieldAssignment.find( *pExistentFields ); - if ( aFieldAssignment.end() != aPos ) - { // yes - // -> set a new value - OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); - aExistentField.setNodeValue( sAssignedNodeName, makeAny( aPos->second ) ); - // and remove the mapping entry - aFieldAssignment.erase( *pExistentFields ); - } - else - { // no - // -> remove it - aFields.removeNode( *pExistentFields ); - } - } - - // now everything remaining in aFieldAssignment marks a mapping entry which was not present - // in the config before - for ( ConstMapString2StringIterator aNewMapping = aFieldAssignment.begin(); - aNewMapping != aFieldAssignment.end(); - ++aNewMapping - ) - { - DBG_ASSERT( !aFields.hasByName( aNewMapping->first ), - "fieldmapping::writeTemplateAddressFieldMapping: inconsistence!" ); - // in case the config node for the fields already has the node named <aNewMapping->first>, - // the entry should have been removed from aNewMapping (in the above loop) - OConfigurationNode aNewField = aFields.createNode( aNewMapping->first ); - aNewField.setNodeValue( sProgrammaticNodeName, makeAny( aNewMapping->first ) ); - aNewField.setNodeValue( sAssignedNodeName, makeAny( aNewMapping->second ) ); - } - - // commit the changes done - aAddressBookSettings.commit(); - } - - //..................................................................... - } // namespace fieldmapping - //..................................................................... - - //..................................................................... - namespace addressconfig - { - //..................................................................... - - //----------------------------------------------------------------- - void writeTemplateAddressSource( const Reference< XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rTableName ) SAL_THROW ( ( ) ) - { - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" )), makeAny( _rDataSourceName ) ); - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Command" )), makeAny( _rTableName ) ); - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandType" )), makeAny( (sal_Int32)CommandType::TABLE ) ); - - // commit the changes done - aAddressBookSettings.commit(); - } - - //----------------------------------------------------------------- - void markPilotSuccess( const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW ( ( ) ) - { - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - // set the flag - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoPilotCompleted" )), makeAny( (sal_Bool)sal_True ) ); - - // commit the changes done - aAddressBookSettings.commit(); - } - - //..................................................................... - } // namespace addressconfig - //..................................................................... - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx deleted file mode 100644 index fe93fd01f..000000000 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX -#define EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX - -#include <rtl/ustring.hxx> -#include "abptypes.hxx" -#include <com/sun/star/uno/Reference.hxx> -#include "addresssettings.hxx" - -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } - namespace beans { - class XPropertySet; - } -} } } -class Window; - -//......................................................................... -namespace abp -{ -//......................................................................... - - //..................................................................... - namespace fieldmapping - { - //..................................................................... - - //----------------------------------------------------------------- - /** invokes the field mapping dialog - @param _rxORB - service factory to use for creating UNO services - @param _pParent - window to use as parent for the dialog and error messages - @param _rSettings - current settings. Upon return, the field mapping member of this - structure will be filled with the settings the user did in the - field mapping dialog. - */ - sal_Bool invokeDialog( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - class Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDataSource, - AddressSettings& _rSettings - ) SAL_THROW ( ( ) ); - - //----------------------------------------------------------------- - /** creates a default field mapping for usage with the address book SDBC driver - <p>The column names as used by the SDBC driver for address books is stored in the configuration, - and this function creates a mapping which uses this configuration information.</p> - */ - void defaultMapping( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - MapString2String& /* [out] */ _rFieldAssignment - ) SAL_THROW ( ( ) ); - - //----------------------------------------------------------------- - /** writes a field mapping for the template document address source - */ - void writeTemplateAddressFieldMapping( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const MapString2String& _rFieldAssignment - ) SAL_THROW ( ( ) ); - - //..................................................................... - } // namespace fieldmapping - //..................................................................... - - //..................................................................... - namespace addressconfig - { - //..................................................................... - - //----------------------------------------------------------------- - /** writes the data source / table name given into the configuration, to where the template documents - expect it. - */ - void writeTemplateAddressSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rDataSourceName, - const ::rtl::OUString& _rTableName - ) SAL_THROW ( ( ) ); - - /** writes the configuration entry which states the the pilot has been completed successfully - */ - void markPilotSuccess( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ) SAL_THROW ( ( ) ); - - //..................................................................... - } // namespace addressconfig - //..................................................................... - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingpage.cxx b/extensions/source/abpilot/fieldmappingpage.cxx deleted file mode 100644 index 85f518dbd..000000000 --- a/extensions/source/abpilot/fieldmappingpage.cxx +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "fieldmappingpage.hxx" -#include "fieldmappingimpl.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FieldMappingPage - //===================================================================== - //--------------------------------------------------------------------- - FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage( _pParent, ModuleRes( RID_PAGE_FIELDMAPPING ) ) - ,m_aExplanation ( this, ModuleRes( FT_FIELDASSIGMENTEXPL ) ) - ,m_aInvokeDialog ( this, ModuleRes( PB_INVOKE_FIELDS_DIALOG ) ) - ,m_aHint ( this, ModuleRes( FT_ASSIGNEDFIELDS ) ) - { - FreeResource(); - - m_aInvokeDialog.SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) ); - - // check the size of the InvokeDialog button - some languages are very ... gossipy here .... - sal_Int32 nTextWidth = m_aInvokeDialog.GetTextWidth( m_aInvokeDialog.GetText() ); - - sal_Int32 nBorderSpace = m_aInvokeDialog.LogicToPixel( Point( 4, 0 ), MAP_APPFONT ).X(); - sal_Int32 nSpace = m_aInvokeDialog.GetOutputSizePixel().Width() - 2 * nBorderSpace; - - if ( nSpace < nTextWidth ) - { - Size aButtonSize = m_aInvokeDialog.GetSizePixel(); - aButtonSize.Width() += nTextWidth - nSpace; - m_aInvokeDialog.SetSizePixel( aButtonSize ); - } - } - - //--------------------------------------------------------------------- - void FieldMappingPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - m_aInvokeDialog.GrabFocus(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::initializePage() - { - AddressBookSourcePage::initializePage(); - implUpdateHint(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::implUpdateHint() - { - const AddressSettings& rSettings = getSettings(); - String sHint; - if ( 0 == rSettings.aFieldMapping.size() ) - sHint = String( ModuleRes( RID_STR_NOFIELDSASSIGNED ) ); - m_aHint.SetText( sHint ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( FieldMappingPage, OnInvokeDialog, void*, /*NOTINTERESTEDIN*/ ) - { - AddressSettings& rSettings = getSettings(); - - // invoke the dialog doing the mapping - if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) ) - { - if ( rSettings.aFieldMapping.size() ) - getDialog()->travelNext(); - else - implUpdateHint(); - } - - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingpage.hxx b/extensions/source/abpilot/fieldmappingpage.hxx deleted file mode 100644 index 3da50be83..000000000 --- a/extensions/source/abpilot/fieldmappingpage.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX -#define EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX - -#include "abspage.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FieldMappingPage - //===================================================================== - class FieldMappingPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - PushButton m_aInvokeDialog; - FixedText m_aHint; - - public: - FieldMappingPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - private: - DECL_LINK( OnInvokeDialog, void* ); - - void implUpdateHint(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/makefile.mk b/extensions/source/abpilot/makefile.mk deleted file mode 100644 index 7f8482824..000000000 --- a/extensions/source/abpilot/makefile.mk +++ /dev/null @@ -1,115 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. -PRJINC=..$/inc - -PRJNAME=extensions -TARGET=abp -USE_DEFFILE=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- defines ------------------------------------------------------ - -CDEFS+=-DCOMPMOD_NAMESPACE=abp -CDEFS+=-DCOMPMOD_RESPREFIX=abp - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/abpfinalpage.obj \ - $(SLO)$/abpservices.obj \ - $(SLO)$/abspage.obj \ - $(SLO)$/abspilot.obj \ - $(SLO)$/admininvokationimpl.obj \ - $(SLO)$/admininvokationpage.obj \ - $(SLO)$/datasourcehandling.obj \ - $(SLO)$/fieldmappingimpl.obj \ - $(SLO)$/fieldmappingpage.obj \ - $(SLO)$/moduleabp.obj \ - $(SLO)$/tableselectionpage.obj \ - $(SLO)$/typeselectionpage.obj \ - $(SLO)$/unodialogabp.obj \ - -SLOFILES= \ - $(EXCEPTIONSFILES) - - -.IF "$(WITH_MOZILLA)" != "NO" -.IF "$(SYSTEM_MOZILLA)" != "YES" -CDEFS+=-DWITH_MOZILLA -.ENDIF -.ENDIF - -SRS1NAME=$(TARGET) -SRC1FILES= abspilot.src - -RESLIB1NAME=abp -RESLIB1IMAGES=$(PRJ)$/res -RESLIB1SRSFILES= $(SRS)$/abp.srs - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(SFXLIB) \ - $(SVLLIB) \ - $(SVTLIB) \ - $(SVTOOLLIB) \ - $(SVXCORELIB) \ - $(SVXLIB) \ - $(TKLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(VCLLIB) \ - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/abp.component - -$(MISC)/abp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - abp.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt abp.component diff --git a/extensions/source/abpilot/moduleabp.cxx b/extensions/source/abpilot/moduleabp.cxx deleted file mode 100644 index ead975319..000000000 --- a/extensions/source/abpilot/moduleabp.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "componentmodule.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/tableselectionpage.cxx b/extensions/source/abpilot/tableselectionpage.cxx deleted file mode 100644 index 5e6a2182d..000000000 --- a/extensions/source/abpilot/tableselectionpage.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "tableselectionpage.hxx" -#include "abptypes.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include <tools/debug.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TableSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - TableSelectionPage::TableSelectionPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_TABLESELECTION_AB)) - ,m_aLabel ( this, ModuleRes( FL_TOOMUCHTABLES ) ) - ,m_aTableList ( this, ModuleRes( LB_TABLELIST ) ) - { - FreeResource(); - - m_aTableList.SetSelectHdl( LINK( this, TableSelectionPage, OnTableSelected ) ); - m_aTableList.SetDoubleClickHdl( LINK( this, TableSelectionPage, OnTableDoubleClicked ) ); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - m_aTableList.GrabFocus(); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - const AddressSettings& rSettings = getSettings(); - - m_aTableList.Clear(); - - // get the table names - const StringBag& aTableNames = getDialog()->getDataSource().getTableNames(); - DBG_ASSERT( aTableNames.size() > 1, "TableSelectionPage::initializePage: to be called for more than one table only!"); - // this page should never bother the user if there is 1 or less tables. - - // fill the list - for ( ConstStringBagIterator aTables = aTableNames.begin(); - aTables != aTableNames.end(); - ++aTables - ) - m_aTableList.InsertEntry( *aTables ); - - // initially select the proper table - m_aTableList.SelectEntry( rSettings.sSelectedTable ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( TableSelectionPage, OnTableDoubleClicked, void*, /*NOTINTERESTEDIN*/ ) - { - if ( 1 == m_aTableList.GetSelectEntryCount() ) - getDialog()->travelNext(); - - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK( TableSelectionPage, OnTableSelected, void*, /*NOTINTERESTEDIN*/ ) - { - updateDialogTravelUI(); - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool TableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - AddressSettings& rSettings = getSettings(); - rSettings.sSelectedTable = m_aTableList.GetSelectEntry(); - - return sal_True; - } - - //--------------------------------------------------------------------- - bool TableSelectionPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() - && ( 0 < m_aTableList.GetSelectEntryCount() ); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/tableselectionpage.hxx b/extensions/source/abpilot/tableselectionpage.hxx deleted file mode 100644 index 82b2d5d57..000000000 --- a/extensions/source/abpilot/tableselectionpage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX -#define EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX - -#include "abspage.hxx" -#include <vcl/lstbox.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TableSelectionPage - //===================================================================== - class TableSelectionPage : public AddressBookSourcePage - { - protected: - FixedText m_aLabel; - ListBox m_aTableList; - - public: - TableSelectionPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnTableSelected, void* ); - DECL_LINK( OnTableDoubleClicked, void* ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx deleted file mode 100644 index f78878f04..000000000 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "typeselectionpage.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include <vcl/msgbox.hxx> -#include <com/sun/star/sdbc/XDriverAccess.hpp> - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::sdbc; - - //===================================================================== - //= TypeSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - TypeSelectionPage::TypeSelectionPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_SELECTABTYPE)) - ,m_aHint (this, ModuleRes(FT_TYPE_HINTS)) - ,m_aTypeSep (this, ModuleRes(FL_TYPE)) - ,m_aEvolution (this, ModuleRes(RB_EVOLUTION)) - ,m_aEvolutionGroupwise (this, ModuleRes(RB_EVOLUTION_GROUPWISE)) - ,m_aEvolutionLdap (this, ModuleRes(RB_EVOLUTION_LDAP)) - ,m_aMORK (this, ModuleRes(RB_MORK)) - ,m_aThunderbird (this, ModuleRes(RB_THUNDERBIRD)) - ,m_aKab (this, ModuleRes(RB_KAB)) - ,m_aMacab (this, ModuleRes(RB_MACAB)) - ,m_aLDAP (this, ModuleRes(RB_LDAP)) - ,m_aOutlook (this, ModuleRes(RB_OUTLOOK)) - ,m_aOE (this, ModuleRes(RB_OUTLOOKEXPRESS)) - ,m_aOther (this, ModuleRes(RB_OTHER)) - { - FreeResource(); - - Point aTopLeft( LogicToPixel( Point( 15, 68 ), MAP_APPFONT ) ); - Size aItemSize( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ) ); - aItemSize.Width() = GetOutputSizePixel().Width() - 30; - - bool bWithMozilla = true, bUnx = true; - bool bHaveEvolution = true, bHaveKab = true; - bool bHaveMacab = true; - -#if !defined WITH_MOZILLA || defined MACOSX - bWithMozilla = false; -#endif -#ifndef UNX - bUnx = false; - bHaveEvolution = false; - bHaveKab = false; - bHaveMacab = false; -#else - Reference< XDriverAccess> xManager(_pParent->getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager"))), UNO_QUERY); - - // check whether Evolution is available - Reference< XDriver > xDriver( xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:evolution:local"))) ); - if ( !xDriver.is() ) - bHaveEvolution = false; - - // check whether KDE address book is available - xDriver = xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:kab"))); - if ( !xDriver.is() ) - bHaveKab = false; - - // check whether Mac OS X address book is available - xDriver = xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:macab"))); - if ( !xDriver.is() ) - bHaveMacab = false; -#endif - - // Items are displayed in list order - m_aAllTypes.push_back( ButtonItem( &m_aEvolution, AST_EVOLUTION, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aEvolutionGroupwise, AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aEvolutionLdap, AST_EVOLUTION_LDAP, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aMORK, AST_MORK, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aThunderbird, AST_THUNDERBIRD, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aKab, AST_KAB, bHaveKab ) ); - m_aAllTypes.push_back( ButtonItem( &m_aMacab, AST_MACAB, bHaveMacab ) ); - m_aAllTypes.push_back( ButtonItem( &m_aLDAP, AST_LDAP, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOutlook, AST_OUTLOOK, bWithMozilla && !bUnx ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOE, AST_OE, bWithMozilla && !bUnx ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOther, AST_OTHER, true ) ); - - bool bFirstVisible = true; - Link aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); - const Size aSpacing( LogicToPixel( Size( 0, 3 ), MAP_APPFONT ) ); - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = *loop; - if (!aItem.m_bVisible) - aItem.m_pItem->Hide(); - else - { - aItem.m_pItem->SetPosPixel( aTopLeft ); - aTopLeft.Y() += aItemSize.Height() + aSpacing.Height(); - aItem.m_pItem->SetClickHdl( aTypeSelectionHandler ); - aItem.m_pItem->Show(); - - if ( bFirstVisible ) - { - aItem.m_pItem->SetStyle( aItem.m_pItem->GetStyle() | WB_GROUP ); - bFirstVisible = false; - } - } - } - } - - //--------------------------------------------------------------------- - TypeSelectionPage::~TypeSelectionPage() - { - for ( ::std::vector< ButtonItem >::iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - loop->m_bVisible = false; - } - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - const ButtonItem& rItem = (*loop); - if( rItem.m_pItem->IsChecked() && rItem.m_bVisible ) - { - rItem.m_pItem->GrabFocus(); - break; - } - } - - getDialog()->enableButtons(WZB_PREVIOUS, sal_False); - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - getDialog()->enableButtons(WZB_PREVIOUS, sal_True); - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::selectType( AddressSourceType _eType ) - { - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = (*loop); - aItem.m_pItem->Check( _eType == aItem.m_eType ); - } - } - - //--------------------------------------------------------------------- - AddressSourceType TypeSelectionPage::getSelectedType() const - { - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = (*loop); - if ( aItem.m_pItem->IsChecked() ) - return aItem.m_eType; - } - - return AST_INVALID; - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - const AddressSettings& rSettings = getSettings(); - selectType(rSettings.eType); - } - - //--------------------------------------------------------------------- - sal_Bool TypeSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - if (AST_INVALID == getSelectedType( )) - { - ErrorBox aError(this, ModuleRes(RID_ERR_NEEDTYPESELECTION)); - aError.Execute(); - return sal_False; - } - - AddressSettings& rSettings = getSettings(); - rSettings.eType = getSelectedType(); - - return sal_True; - } - - //--------------------------------------------------------------------- - bool TypeSelectionPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() - && (AST_INVALID != getSelectedType()); - } - - //--------------------------------------------------------------------- - IMPL_LINK( TypeSelectionPage, OnTypeSelected, void*, /*NOTINTERESTEDIN*/ ) - { - getDialog()->typeSelectionChanged( getSelectedType() ); - updateDialogTravelUI(); - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx deleted file mode 100644 index 37e0a8beb..000000000 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX -#define EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX - -#include "abspage.hxx" -#include "addresssettings.hxx" -#include <vcl/edit.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TypeSelectionPage - //===================================================================== - class TypeSelectionPage : public AddressBookSourcePage - { - protected: - FixedText m_aHint; - FixedLine m_aTypeSep; - RadioButton m_aEvolution; - RadioButton m_aEvolutionGroupwise; - RadioButton m_aEvolutionLdap; - RadioButton m_aMORK; - RadioButton m_aThunderbird; - RadioButton m_aKab; - RadioButton m_aMacab; - RadioButton m_aLDAP; - RadioButton m_aOutlook; - RadioButton m_aOE; - RadioButton m_aOther; - - struct ButtonItem { - RadioButton *m_pItem; - AddressSourceType m_eType; - bool m_bVisible; - - ButtonItem( RadioButton *pItem, - AddressSourceType eType, - bool bVisible ) : - m_pItem( pItem ), - m_eType( eType ), - m_bVisible( bVisible ) - {} - }; - - ::std::vector< ButtonItem > m_aAllTypes; - - public: - TypeSelectionPage( OAddessBookSourcePilot* _pParent ); - ~TypeSelectionPage(); - - // retrieves the currently selected type - AddressSourceType getSelectedType() const; - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnTypeSelected, void* ); - - void selectType( AddressSourceType _eType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx deleted file mode 100644 index 2491ab61d..000000000 --- a/extensions/source/abpilot/unodialogabp.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "unodialogabp.hxx" -#include <cppuhelper/typeprovider.hxx> -#include "abspilot.hxx" -#include <comphelper/sequence.hxx> -#include <vcl/msgbox.hxx> - -extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno() -{ - static ::abp::OMultiInstanceAutoRegistration< ::abp::OABSPilotUno > aAutoRegistration; -} - -#define PROPERTY_ID_DATASOURCENAME 3 -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::ui::dialogs; - - //===================================================================== - //= OABSPilotUno - //===================================================================== - //--------------------------------------------------------------------- - OABSPilotUno::OABSPilotUno(const Reference< XMultiServiceFactory >& _rxORB) - :OGenericUnoDialog(_rxORB) - { - registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName")), PROPERTY_ID_DATASOURCENAME, PropertyAttribute::READONLY , - &m_sDataSourceName, ::getCppuType( &m_sDataSourceName ) ); - } - - //-------------------------------------------------------------------------- - Any SAL_CALL OABSPilotUno::queryInterface( const Type& aType ) throw (RuntimeException) - { - Any aReturn = OABSPilotUno_DBase::queryInterface( aType ); - return aReturn.hasValue() ? aReturn : OABSPilotUno_JBase::queryInterface( aType ); - } - - //-------------------------------------------------------------------------- - void SAL_CALL OABSPilotUno::acquire( ) throw () - { - OABSPilotUno_DBase::acquire(); - } - - //-------------------------------------------------------------------------- - void SAL_CALL OABSPilotUno::release( ) throw () - { - OABSPilotUno_DBase::release(); - } - - //--------------------------------------------------------------------- - Sequence< Type > SAL_CALL OABSPilotUno::getTypes( ) throw (RuntimeException) - { - return ::comphelper::concatSequences( - OABSPilotUno_DBase::getTypes(), - OABSPilotUno_JBase::getTypes() - ); - } - - //--------------------------------------------------------------------- - Sequence<sal_Int8> SAL_CALL OABSPilotUno::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId* s_pId; - if ( !s_pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !s_pId ) - { - static ::cppu::OImplementationId s_aId; - s_pId = &s_aId; - } - } - return s_pId->getImplementationId(); - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OABSPilotUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) - { - return *(new OABSPilotUno(_rxFactory)); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OABSPilotUno::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString OABSPilotUno::getImplementationName_Static() throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.abp.OAddressBookSourcePilot")); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OABSPilotUno::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence OABSPilotUno::getSupportedServiceNames_Static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.AddressBookSourcePilot")); - return aSupported; - } - - //--------------------------------------------------------------------- - Reference<XPropertySetInfo> SAL_CALL OABSPilotUno::getPropertySetInfo() throw(RuntimeException) - { - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OABSPilotUno::getInfoHelper() - { - return *const_cast<OABSPilotUno*>(this)->getArrayHelper(); - } - - //-------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* OABSPilotUno::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //-------------------------------------------------------------------------- - Dialog* OABSPilotUno::createDialog(Window* _pParent) - { - return new OAddessBookSourcePilot(_pParent, m_aContext.getLegacyServiceFactory()); - } - - //-------------------------------------------------------------------------- - Any SAL_CALL OABSPilotUno::execute( const Sequence< NamedValue >& /*lArgs*/ ) throw (IllegalArgumentException, Exception, RuntimeException) - { - // not interested in the context, not interested in the args - // -> call the execute method of the XExecutableDialog - static_cast< XExecutableDialog* >( this )->execute(); - - // result interest not really ... - // We show this dialog one times only! - // User has one chance to accept it or not. - // (or he can start it again by using wizard-menu!) - // So we should deregister it on our general job execution service by using right protocol parameters. - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > lProtocol(1); - lProtocol[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deactivate")); - lProtocol[0].Value <<= sal_True; - return makeAny( lProtocol ); - } - // ----------------------------------------------------------------------------- - void OABSPilotUno::executedDialog(sal_Int16 _nExecutionResult) - { - if ( _nExecutionResult == RET_OK ) - { - const AddressSettings& aSettings = static_cast<OAddessBookSourcePilot*>(m_pDialog)->getSettings(); - m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName; - } - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx deleted file mode 100644 index ab56106b5..000000000 --- a/extensions/source/abpilot/unodialogabp.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_UNODIALOG_HXX -#define EXTENSIONS_ABP_UNODIALOG_HXX - -#include <svtools/genericunodialog.hxx> -#include <comphelper/proparrhlp.hxx> -#include "componentmodule.hxx" -#include <com/sun/star/task/XJob.hpp> -#include <cppuhelper/implbase1.hxx> - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OABSPilotUno - //===================================================================== - class OABSPilotUno; - typedef ::svt::OGenericUnoDialog OABSPilotUno_DBase; - typedef ::cppu::ImplHelper1< ::com::sun::star::task::XJob > OABSPilotUno_JBase; - typedef ::comphelper::OPropertyArrayUsageHelper< OABSPilotUno > OABSPilotUno_PBase; - /// the UNO wrapper for the address book source pilot - class OABSPilotUno - :public OABSPilotUno_DBase - ,public OABSPilotUno_JBase - ,public OABSPilotUno_PBase - ,public OModuleResourceClient - { - ::rtl::OUString m_sDataSourceName; - OABSPilotUno(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - public: - // XInterface (disambiguation) - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire( ) throw (); - virtual void SAL_CALL release( ) throw (); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); - 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; - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - using OABSPilotUno_DBase::execute; - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - virtual void executedDialog(sal_Int16 _nExecutionResult); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_UNODIALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |