diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-11 20:56:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-21 08:20:50 +0100 |
commit | 00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch) | |
tree | fd1a9bb264fe15dcc129498e62060ecd256b1ee7 /dbaccess/source/ext | |
parent | fa987cbb813cfd729fe490f2f1258b7c8d7fb174 (diff) |
migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
results in inserting the english original so something can be found, now the
standard fallback of using the english original from the source key is used, so
partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
com::sun::star::resource::OfficeResourceLoader
com::sun::star::resource::XResourceBundleLoader
com::sun::star::resource::XResourceBundle
when translating strings via uno apis
com.sun.star.resource.StringResourceWithLocation
can continue to be used
Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
Diffstat (limited to 'dbaccess/source/ext')
14 files changed, 132 insertions, 440 deletions
diff --git a/dbaccess/source/ext/macromigration/dbmm_global.hrc b/dbaccess/source/ext/macromigration/dbmm_global.hrc deleted file mode 100644 index 9105d11721dc..000000000000 --- a/dbaccess/source/ext/macromigration/dbmm_global.hrc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef DBACCESS_DBMM_GLOBAL_HRC -#define DBACCESS_DBMM_GLOBAL_HRC - -#include <svl/solar.hrc> - -#define RID_DBMM_STRING_START RID_DBACCESS_START + 0 - -#define STR_FORM ( RID_DBMM_STRING_START + 0 ) -#define STR_REPORT ( RID_DBMM_STRING_START + 1 ) -#define STR_OVERALL_PROGRESS ( RID_DBMM_STRING_START + 2 ) -#define STR_DATABASE_DOCUMENT ( RID_DBMM_STRING_START + 3 ) -#define STR_SAVED_COPY_TO ( RID_DBMM_STRING_START + 4 ) -#define STR_MOVED_LIBRARY ( RID_DBMM_STRING_START + 5 ) -#define STR_OOO_BASIC ( RID_DBMM_STRING_START + 6 ) -#define STR_JAVA_SCRIPT ( RID_DBMM_STRING_START + 7 ) -#define STR_BEAN_SHELL ( RID_DBMM_STRING_START + 8 ) -#define STR_JAVA ( RID_DBMM_STRING_START + 9 ) -#define STR_PYTHON ( RID_DBMM_STRING_START + 10 ) -#define STR_DIALOG ( RID_DBMM_STRING_START + 11 ) -#define STR_MIGRATING_LIBS ( RID_DBMM_STRING_START + 12 ) -#define STR_ERRORS ( RID_DBMM_STRING_START + 13 ) -#define STR_WARNINGS ( RID_DBMM_STRING_START + 14 ) -#define STR_EXCEPTION ( RID_DBMM_STRING_START + 15 ) -#define STR_LIBRARY_TYPE_AND_NAME ( RID_DBMM_STRING_START + 16 ) -#define STR_INVALID_NUMBER_ARGS ( RID_DBMM_STRING_START + 17 ) -#define STR_NO_DATABASE ( RID_DBMM_STRING_START + 18 ) -#define STR_NOT_READONLY ( RID_DBMM_STRING_START + 19 ) -#define STR_STATE_CLOSE_SUB_DOCS ( RID_DBMM_STRING_START + 20 ) -#define STR_STATE_BACKUP_DBDOC ( RID_DBMM_STRING_START + 21 ) -#define STR_STATE_MIGRATE ( RID_DBMM_STRING_START + 22 ) -#define STR_STATE_SUMMARY ( RID_DBMM_STRING_START + 23 ) -#define STR_INVALID_BACKUP_LOCATION ( RID_DBMM_STRING_START + 25 ) - -#endif // DBACCESS_DBMM_GLOBAL_HRC - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/dbmm_module.cxx b/dbaccess/source/ext/macromigration/dbmm_module.cxx deleted file mode 100644 index 826e945ae167..000000000000 --- a/dbaccess/source/ext/macromigration/dbmm_module.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "dbmm_module.hxx" - -#include <rtl/instance.hxx> - -namespace dbmm -{ - - IMPLEMENT_MODULE( MacroMigrationModule, "dbmm" ); - -} // namespace dbmm - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/dbmm_module.hxx b/dbaccess/source/ext/macromigration/dbmm_module.hxx deleted file mode 100644 index ff171823703f..000000000000 --- a/dbaccess/source/ext/macromigration/dbmm_module.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DBMM_MODULE_HXX -#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DBMM_MODULE_HXX - -#include <unotools/componentresmodule.hxx> - -namespace dbmm -{ - - DEFINE_MODULE( MacroMigrationModule, MacroMigrationModuleClient, MacroMigrationResId ) - -} // namespace dbmm - -#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DBMM_MODULE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/dbmm_services.cxx b/dbaccess/source/ext/macromigration/dbmm_services.cxx index 332d82987d20..1ced4c105042 100644 --- a/dbaccess/source/ext/macromigration/dbmm_services.cxx +++ b/dbaccess/source/ext/macromigration/dbmm_services.cxx @@ -17,26 +17,25 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "dbmm_module.hxx" +#include <cppuhelper/factory.hxx> #include "macromigrationwizard.hxx" -namespace dbmm +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL dbmm_component_getFactory( + const sal_Char* pImplementationName, SAL_UNUSED_PARAMETER void*, + SAL_UNUSED_PARAMETER void* ) { + css::uno::Reference<css::uno::XInterface> xRet; - static void initializeModule() + if (dbmm::MacroMigrationDialogService::getImplementationName_static() == OUString::createFromAscii(pImplementationName)) { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - createRegistryInfo_MacroMigrationDialogService(); + xRet = ::cppu::createSingleComponentFactory(dbmm::MacroMigrationDialogService::Create, + dbmm::MacroMigrationDialogService::getImplementationName_static(), + dbmm::MacroMigrationDialogService::getSupportedServiceNames_static(), nullptr); } -} // namespace dbmm - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL dbmm_component_getFactory( - const sal_Char* pImplementationName, SAL_UNUSED_PARAMETER void*, - SAL_UNUSED_PARAMETER void* ) -{ - ::dbmm::initializeModule(); - return ::dbmm::MacroMigrationModule::getInstance().getComponentFactory( pImplementationName ); + if (xRet.is()) + xRet->acquire(); + return xRet.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/dbmm_types.cxx b/dbaccess/source/ext/macromigration/dbmm_types.cxx index 87f7311ec952..554945c068a3 100644 --- a/dbaccess/source/ext/macromigration/dbmm_types.cxx +++ b/dbaccess/source/ext/macromigration/dbmm_types.cxx @@ -17,30 +17,30 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <osl/diagnose.h> +#include "core_resource.hxx" #include "dbmm_types.hxx" - -#include "dbmm_global.hrc" -#include "dbmm_module.hxx" +#include "strings.hrc" namespace dbmm { - // helper OUString getScriptTypeDisplayName( const ScriptType _eType ) { - sal_uInt16 nResId( 0 ); + const char *pResId = nullptr; switch ( _eType ) { - case eBasic: nResId = STR_OOO_BASIC; break; - case eBeanShell: nResId = STR_BEAN_SHELL; break; - case eJavaScript: nResId = STR_JAVA_SCRIPT; break; - case ePython: nResId = STR_PYTHON; break; - case eJava: nResId = STR_JAVA; break; - case eDialog: nResId = STR_DIALOG; break; + case eBasic: pResId = STR_OOO_BASIC; break; + case eBeanShell: pResId = STR_BEAN_SHELL; break; + case eJavaScript: pResId = STR_JAVA_SCRIPT; break; + case ePython: pResId = STR_PYTHON; break; + case eJava: pResId = STR_JAVA; break; + case eDialog: pResId = STR_DIALOG; break; } - OSL_ENSURE( nResId != 0, "getScriptTypeDisplayName: illegal script type!" ); - return nResId ? OUString( MacroMigrationResId( nResId ) ) : OUString(); + OSL_ENSURE( pResId != nullptr, "getScriptTypeDisplayName: illegal script type!" ); + + return pResId ? DBA_RES(pResId) : OUString(); } } // namespace dbmm diff --git a/dbaccess/source/ext/macromigration/macromigration.hrc b/dbaccess/source/ext/macromigration/macromigration.hrc deleted file mode 100644 index e4bc293c6803..000000000000 --- a/dbaccess/source/ext/macromigration/macromigration.hrc +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef DBACCESS_MACROMIGRATION_HRC -#define DBACCESS_MACROMIGRATION_HRC - -// height and width of tab pages -#define TAB_PAGE_WIDTH 280 -#define TAB_PAGE_HEIGHT 185 - -#endif // DBACCESS_MACROMIGRATION_HRC - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/macromigration.src b/dbaccess/source/ext/macromigration/macromigration.src deleted file mode 100644 index fe5812bfc50c..000000000000 --- a/dbaccess/source/ext/macromigration/macromigration.src +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "dbmm_global.hrc" - -String STR_STATE_CLOSE_SUB_DOCS -{ - Text [ en-US ] = "Prepare"; -}; - -String STR_STATE_BACKUP_DBDOC -{ - Text [ en-US ] = "Backup Document"; -}; - -String STR_STATE_MIGRATE -{ - Text [ en-US ] = "Migrate"; -}; - -String STR_STATE_SUMMARY -{ - Text [ en-US ] = "Summary"; -}; - -String STR_FORM -{ - Text [ en-US ] = "Form '$name$'"; - Text [ x-comment ] = "This refers to a form document inside a database document."; -}; - -String STR_REPORT -{ - Text [ en-US ] = "Report '$name$'"; - Text [ x-comment ] = "This refers to a report document inside a database document."; -}; - -String STR_OVERALL_PROGRESS -{ - Text [ en-US ] = "document $current$ of $overall$"; -}; - -String STR_DATABASE_DOCUMENT -{ - Text[ en-US ] = "Database Document"; -}; - -String STR_SAVED_COPY_TO -{ - Text[ en-US ] = "saved copy to $location$"; -}; - -String STR_MOVED_LIBRARY -{ - Text[ en-US ] = "migrated $type$ library '$old$' to '$new$'"; -}; - -String STR_LIBRARY_TYPE_AND_NAME -{ - Text [ en-US ] = "$type$ library '$library$'"; -}; - -String STR_MIGRATING_LIBS -{ - Text [ en-US ] = "migrating libraries ..."; -}; - -String STR_OOO_BASIC -{ - Text[ en-US ] = "%PRODUCTNAME Basic"; -}; - -String STR_JAVA_SCRIPT -{ - Text[ en-US ] = "JavaScript"; -}; - -String STR_BEAN_SHELL -{ - Text[ en-US ] = "BeanShell"; -}; - -String STR_JAVA -{ - Text[ en-US ] = "Java"; -}; - -String STR_PYTHON -{ - Text[ en-US ] = "Python"; -}; - -String STR_DIALOG -{ - Text[ en-US ] = "dialog"; -}; - -String STR_ERRORS -{ - Text [ en-US ] = "Error(s)"; -}; - -String STR_WARNINGS -{ - Text [ en-US ] = "Warnings"; -}; - -String STR_EXCEPTION -{ - Text [ en-US ] = "caught exception:"; -}; - -String STR_INVALID_BACKUP_LOCATION -{ - Text [ en-US ] = "You need to choose a backup location other than the document location itself."; -}; - -String STR_INVALID_NUMBER_ARGS -{ - Text [ en-US ] = "Invalid number of initialization arguments. Expected 1."; -}; - -String STR_NO_DATABASE -{ - Text [ en-US ] = "No database document found in the initialization arguments."; -}; - -String STR_NOT_READONLY -{ - Text [ en-US ] = "Not applicable to read-only documents."; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx index 6637bb32f49c..349c95d2b35d 100644 --- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx @@ -17,10 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "dbmm_global.hrc" -#include "dbmm_module.hxx" #include "docinteraction.hxx" -#include "macromigration.hrc" +#include "core_resource.hxx" +#include "strings.hrc" #include "macromigrationdialog.hxx" #include "macromigrationpages.hxx" #include "migrationengine.hxx" @@ -57,6 +56,10 @@ namespace dbmm #define PATH_DEFAULT 1 +// height and width of tab pages +#define TAB_PAGE_WIDTH 280 +#define TAB_PAGE_HEIGHT 185 + using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::XInterface; @@ -125,10 +128,10 @@ namespace dbmm : MacroMigrationDialog_Base(_pParent) , m_pData( new MacroMigrationDialog_Data( _rContext, _rxDocument ) ) { - OUString sTitlePrepare( MacroMigrationResId( STR_STATE_CLOSE_SUB_DOCS ) ); - OUString sTitleStoreAs( MacroMigrationResId( STR_STATE_BACKUP_DBDOC ) ); - OUString sTitleMigrate( MacroMigrationResId( STR_STATE_MIGRATE ) ); - OUString sTitleSummary( MacroMigrationResId( STR_STATE_SUMMARY ) ); + OUString sTitlePrepare( DBA_RES( STR_STATE_CLOSE_SUB_DOCS ) ); + OUString sTitleStoreAs( DBA_RES( STR_STATE_BACKUP_DBDOC ) ); + OUString sTitleMigrate( DBA_RES( STR_STATE_MIGRATE ) ); + OUString sTitleSummary( DBA_RES( STR_STATE_SUMMARY ) ); describeState( STATE_CLOSE_SUB_DOCS, sTitlePrepare, &PreparationPage::Create ); describeState( STATE_BACKUP_DBDOC, sTitleStoreAs, &SaveDBDocPage::Create ); @@ -382,7 +385,7 @@ namespace dbmm // check that the backup location isn't the same as the document itself if ( lcl_equalURLs_nothrow( m_pData->aContext, sBackupLocation, m_pData->xDocumentModel->getURL() ) ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( STR_INVALID_BACKUP_LOCATION ) ); + ScopedVclPtrInstance< MessageDialog > aErrorBox( const_cast< MacroMigrationDialog* >( this ), DBA_RES( STR_INVALID_BACKUP_LOCATION ) ); aErrorBox->Execute(); rBackupPage.grabLocationFocus(); return false; diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx index dd1f49942698..e2e134d5ac52 100644 --- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx @@ -18,9 +18,7 @@ */ #include "dbaccess_helpid.hrc" -#include "dbmm_module.hxx" -#include "dbmm_global.hrc" -#include "macromigration.hrc" +#include "strings.hrc" #include "macromigrationpages.hxx" #include "macromigrationdialog.hxx" diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx index 96201b2f801f..4cb72dce82df 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx @@ -17,83 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "dbmm_module.hxx" -#include "dbmm_global.hrc" -#include "macromigrationdialog.hxx" #include "macromigrationwizard.hxx" -#include <com/sun/star/ucb/AlreadyInitializedException.hpp> -#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> -#include <com/sun/star/frame/XStorable.hpp> - -#include <svtools/genericunodialog.hxx> - namespace dbmm { - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::beans::Property; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::sdb::XOfficeDatabaseDocument; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::frame::XStorable; - - // MacroMigrationDialogService - class MacroMigrationDialogService; - typedef ::svt::OGenericUnoDialog MacroMigrationDialogService_Base; - typedef ::comphelper::OPropertyArrayUsageHelper< MacroMigrationDialogService > MacroMigrationDialogService_PBase; - - class MacroMigrationDialogService - :public MacroMigrationDialogService_Base - ,public MacroMigrationDialogService_PBase - ,public MacroMigrationModuleClient - { - public: - explicit MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext ); - - // XTypeProvider - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; - - // XPropertySet - virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() override; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; - - // helper for factories - static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& _rxContext ); - /// @throws RuntimeException - static OUString SAL_CALL getImplementationName_static(); - /// @throws RuntimeException - static Sequence< OUString > SAL_CALL getSupportedServiceNames_static(); - - protected: - virtual ~MacroMigrationDialogService() override; - - protected: - virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; - - private: - Reference< XOfficeDatabaseDocument > m_xDocument; - }; - // MacroMigrationDialogService MacroMigrationDialogService::MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext ) :MacroMigrationDialogService_Base( _rxContext ) @@ -157,7 +84,7 @@ namespace dbmm if ( _rArguments.getLength() != 1 ) throw IllegalArgumentException( - MacroMigrationResId(STR_INVALID_NUMBER_ARGS), + DBA_RES(STR_INVALID_NUMBER_ARGS), *this, 1 ); @@ -165,7 +92,7 @@ namespace dbmm m_xDocument.set( _rArguments[0], UNO_QUERY ); if ( !m_xDocument.is() ) throw IllegalArgumentException( - MacroMigrationResId(STR_NO_DATABASE), + DBA_RES(STR_NO_DATABASE), *this, 1 ); @@ -173,7 +100,7 @@ namespace dbmm Reference< XStorable > xDocStor( m_xDocument, UNO_QUERY_THROW ); if ( xDocStor->isReadonly() ) throw IllegalArgumentException( - MacroMigrationResId(STR_NOT_READONLY), + DBA_RES(STR_NOT_READONLY), *this, 1 ); @@ -197,12 +124,6 @@ namespace dbmm describeProperties( aProps ); return new ::cppu::OPropertyArrayHelper( aProps ); } - - void createRegistryInfo_MacroMigrationDialogService() - { - static OAutoRegistration< MacroMigrationDialogService > aAutoRegistration; - } - } // namespace dbmm /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.hxx b/dbaccess/source/ext/macromigration/macromigrationwizard.hxx index 3c0bb6c37bbc..ebe1634c8bf6 100644 --- a/dbaccess/source/ext/macromigration/macromigrationwizard.hxx +++ b/dbaccess/source/ext/macromigration/macromigrationwizard.hxx @@ -17,17 +17,82 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONWIZARD_HXX -#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONWIZARD_HXX +#include "macromigrationdialog.hxx" -#include <sal/config.h> +#include <com/sun/star/ucb/AlreadyInitializedException.hpp> +#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> +#include <com/sun/star/frame/XStorable.hpp> -namespace dbmm { +#include <svtools/genericunodialog.hxx> -void createRegistryInfo_MacroMigrationDialogService(); +#include "core_resource.hxx" +#include "strings.hrc" -} +namespace dbmm +{ -#endif + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::beans::Property; + using ::com::sun::star::ucb::AlreadyInitializedException; + using ::com::sun::star::sdb::XOfficeDatabaseDocument; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::frame::XStorable; + + // MacroMigrationDialogService + class MacroMigrationDialogService; + typedef ::svt::OGenericUnoDialog MacroMigrationDialogService_Base; + typedef ::comphelper::OPropertyArrayUsageHelper< MacroMigrationDialogService > MacroMigrationDialogService_PBase; + + class MacroMigrationDialogService + :public MacroMigrationDialogService_Base + ,public MacroMigrationDialogService_PBase + { + public: + explicit MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext ); + + // XTypeProvider + virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XPropertySet + virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + + // helper for factories + static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& _rxContext ); + /// @throws RuntimeException + static OUString SAL_CALL getImplementationName_static(); + /// @throws RuntimeException + static Sequence< OUString > SAL_CALL getSupportedServiceNames_static(); + + protected: + virtual ~MacroMigrationDialogService() override; + + protected: + virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) override; + + private: + Reference< XOfficeDatabaseDocument > m_xDocument; + }; + +} // namespace dbmm /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 8b0b7a3c8a5f..ebfe416d28e5 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "dbmm_global.hrc" -#include "dbmm_module.hxx" #include "dbmm_types.hxx" #include "docinteraction.hxx" #include "migrationengine.hxx" @@ -27,6 +25,8 @@ #include "migrationlog.hxx" #include "progresscapture.hxx" #include "progressmixer.hxx" +#include "core_resource.hxx" +#include "strings.hrc" #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp> @@ -209,8 +209,8 @@ namespace dbmm OUString lcl_getSubDocumentDescription( const SubDocument& _rDocument ) { OUString sObjectName( - OUString(MacroMigrationResId( - _rDocument.eType == eForm ? STR_FORM : STR_REPORT)). + DBA_RES( + _rDocument.eType == eForm ? STR_FORM : STR_REPORT). replaceFirst("$name$", _rDocument.sHierarchicalName)); return sObjectName; } @@ -924,7 +924,7 @@ namespace dbmm // initialize global progress sal_Int32 nOverallRange( m_aSubDocs.size() ); OUString sProgressSkeleton( - OUString(MacroMigrationResId(STR_OVERALL_PROGRESS)). + DBA_RES( STR_OVERALL_PROGRESS). replaceFirst("$overall$", OUString::number(nOverallRange))); m_rProgress.start( nOverallRange ); @@ -1045,7 +1045,7 @@ namespace dbmm } // migrate the libraries - ProgressDelegator aDelegator(m_rProgress, sObjectName, MacroMigrationResId(STR_MIGRATING_LIBS)); + ProgressDelegator aDelegator(m_rProgress, sObjectName, DBA_RES(STR_MIGRATING_LIBS)); ProgressMixer aProgressMixer( aDelegator ); aProgressMixer.registerPhase( PHASE_JAVASCRIPT, 1 ); aProgressMixer.registerPhase( PHASE_BEANSHELL, 1 ); @@ -1773,7 +1773,7 @@ namespace dbmm { // a human-readable description of the affected library OUString sLibraryDescription( - OUString(MacroMigrationResId(STR_LIBRARY_TYPE_AND_NAME)). + DBA_RES(STR_LIBRARY_TYPE_AND_NAME). replaceFirst("$type$", getScriptTypeDisplayName(_eScriptType)). replaceFirst("$library$", _rLibraryName)); diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx index 6c82391b8197..1346999440fe 100644 --- a/dbaccess/source/ext/macromigration/migrationlog.cxx +++ b/dbaccess/source/ext/macromigration/migrationlog.cxx @@ -17,12 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "dbmm_module.hxx" -#include "dbmm_global.hrc" +#include "core_resource.hxx" #include "migrationerror.hxx" #include "migrationlog.hxx" +#include "strings.hrc" #include <comphelper/anytostring.hxx> +#include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <vector> @@ -340,13 +341,13 @@ namespace dbmm } } - void lcl_describeErrors( OUStringBuffer& _rBuffer, const ErrorLog& _rErrors, const sal_uInt16 _nHeadingResId ) + void lcl_describeErrors( OUStringBuffer& _rBuffer, const ErrorLog& _rErrors, const char* pHeadingResId ) { _rBuffer.append( "=== " ); - _rBuffer.append ( OUString( MacroMigrationResId( _nHeadingResId ) ) ); + _rBuffer.append( DBA_RES(pHeadingResId) ); _rBuffer.append( " ===\n" ); - OUString sException( MacroMigrationResId( STR_EXCEPTION ) ); + OUString sException( DBA_RES( STR_EXCEPTION ) ); for ( ErrorLog::const_iterator error = _rErrors.begin(); error != _rErrors.end(); @@ -386,10 +387,10 @@ namespace dbmm if ( !m_pData->sBackupLocation.isEmpty() ) { - OUString sBackedUp( MacroMigrationResId( STR_SAVED_COPY_TO ) ); + OUString sBackedUp( DBA_RES( STR_SAVED_COPY_TO ) ); sBackedUp = sBackedUp.replaceAll( "$location$", m_pData->sBackupLocation ); - aBuffer.append( "=== " + OUString( MacroMigrationResId( STR_DATABASE_DOCUMENT ) ) + aBuffer.append( "=== " + DBA_RES( STR_DATABASE_DOCUMENT ) + " ===\n" + sBackedUp + "\n\n"); } @@ -400,7 +401,7 @@ namespace dbmm } else { - OUString sMovedLibTemplate( MacroMigrationResId( STR_MOVED_LIBRARY ) ); + OUString sMovedLibTemplate( DBA_RES( STR_MOVED_LIBRARY ) ); for ( DocumentLogs::const_iterator doc = m_pData->aDocumentLogs.begin(); doc != m_pData->aDocumentLogs.end(); @@ -412,7 +413,7 @@ namespace dbmm if ( rDoc.aMovedLibraries.empty() ) continue; - OUString sDocTitle( MacroMigrationResId( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) ); + OUString sDocTitle( DBA_RES( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) ); sDocTitle = sDocTitle.replaceAll( "$name$", rDoc.sName ); aBuffer.append( "=== " + sDocTitle + " ===\n" ); diff --git a/dbaccess/source/ext/macromigration/migrationprogress.hxx b/dbaccess/source/ext/macromigration/migrationprogress.hxx index 55087bfc7756..49feb9af9181 100644 --- a/dbaccess/source/ext/macromigration/migrationprogress.hxx +++ b/dbaccess/source/ext/macromigration/migrationprogress.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONPROGRESS_HXX #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONPROGRESS_HXX +#include <sal/types.h> +#include <rtl/ustring.hxx> + namespace dbmm { |