summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-30 20:44:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-31 15:07:47 +0200
commit0e944350e92810adfcf080ae1d98ad7bc4bd578d (patch)
tree5cc040e33e3a40b598d288a38a51cd2ae340de86
parent6cc5baa0a15014c442932c60bb60dc2a84edc25f (diff)
[API CHANGE] remove MacroMigrationWizard
https://wiki.openoffice.org/wiki/Macros_in_Database_Documents Prior to OpenOffice 3 (2008) base didn't support macros, but subdocuments might have had macros. since OOo3 base supported macros and subdocuments not, and a migration wizard is available to update pre OOo3 documents to the new scheme. Here I presume whatever is going to get migrated has been migrated at this point and drop the migration wizard This undoes the addition of the idl for sdb::application::MacroMigrationWizard of commit 5b982b69363f0f067fe4a0f679528ce1c5a2eafc Date: Mon Mar 11 17:51:56 2013 +0200 so flag as an api change, though not to anything published Change-Id: I37271752234dda4e7e8f033e0136825fd356439b Reviewed-on: https://gerrit.libreoffice.org/78326 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--Repository.mk1
-rwxr-xr-xbin/update_pch1
-rw-r--r--dbaccess/Library_dbmm.mk56
-rw-r--r--dbaccess/Module_dbaccess.mk1
-rw-r--r--dbaccess/UIConfig_dbaccess.mk4
-rw-r--r--dbaccess/inc/pch/precompiled_dbmm.cxx12
-rw-r--r--dbaccess/inc/pch/precompiled_dbmm.hxx105
-rw-r--r--dbaccess/source/ext/macromigration/dbmm.component25
-rw-r--r--dbaccess/source/ext/macromigration/dbmm_services.cxx41
-rw-r--r--dbaccess/source/ext/macromigration/dbmm_types.cxx48
-rw-r--r--dbaccess/source/ext/macromigration/dbmm_types.hxx53
-rw-r--r--dbaccess/source/ext/macromigration/docinteraction.cxx108
-rw-r--r--dbaccess/source/ext/macromigration/docinteraction.hxx80
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationdialog.cxx556
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationdialog.hxx76
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationpages.cxx308
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationpages.hxx152
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationwizard.cxx132
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationwizard.hxx96
-rw-r--r--dbaccess/source/ext/macromigration/migrationengine.cxx1824
-rw-r--r--dbaccess/source/ext/macromigration/migrationengine.hxx80
-rw-r--r--dbaccess/source/ext/macromigration/migrationerror.hxx153
-rw-r--r--dbaccess/source/ext/macromigration/migrationlog.cxx433
-rw-r--r--dbaccess/source/ext/macromigration/migrationlog.hxx110
-rw-r--r--dbaccess/source/ext/macromigration/migrationprogress.hxx49
-rw-r--r--dbaccess/source/ext/macromigration/progresscapture.cxx95
-rw-r--r--dbaccess/source/ext/macromigration/progresscapture.hxx65
-rw-r--r--dbaccess/source/ext/macromigration/progressmixer.cxx177
-rw-r--r--dbaccess/source/ext/macromigration/progressmixer.hxx87
-rw-r--r--dbaccess/source/ext/macromigration/rangeprogressbar.hxx71
-rw-r--r--dbaccess/source/ui/app/AppController.cxx31
-rw-r--r--dbaccess/source/ui/inc/browserids.hxx1
-rw-r--r--dbaccess/uiconfig/dbapp/menubar/menubar.xml1
-rw-r--r--dbaccess/uiconfig/ui/backuppage.ui128
-rw-r--r--dbaccess/uiconfig/ui/migratepage.ui214
-rw-r--r--dbaccess/uiconfig/ui/preparepage.ui66
-rw-r--r--dbaccess/uiconfig/ui/summarypage.ui82
-rw-r--r--include/svx/databaselocationinput.hxx45
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/sdb/application/MacroMigrationWizard.idl43
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu5
-rw-r--r--postprocess/Rdb_services.mk1
-rw-r--r--solenv/clang-format/blacklist24
-rw-r--r--svx/source/form/databaselocationinput.cxx216
44 files changed, 0 insertions, 5857 deletions
diff --git a/Repository.mk b/Repository.mk
index e4eadbd2b927..8068e52572bc 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -352,7 +352,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
$(call gb_Helper_optional,DBCONNECTIVITY, \
dba \
dbase \
- dbmm \
dbaxml \
dbahsql) \
dbtools \
diff --git a/bin/update_pch b/bin/update_pch
index adac49592fa1..0fd06b5bdbd5 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -65,7 +65,6 @@ DEFAULTS = \
'cui.cui' : ( 8, EXCLUDE, INCLUDE, EXCLUDE), # 19.7
'dbaccess.dba' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 13.8
'dbaccess.dbaxml' : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), # 6.5
- 'dbaccess.dbmm' : (10, EXCLUDE, INCLUDE, EXCLUDE), # 4.3
'dbaccess.dbu' : (12, EXCLUDE, EXCLUDE, EXCLUDE), # 23.6
'dbaccess.sdbt' : ( 1, EXCLUDE, INCLUDE, EXCLUDE), # 2.9
'desktop.deployment' : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), # 6.1
diff --git a/dbaccess/Library_dbmm.mk b/dbaccess/Library_dbmm.mk
deleted file mode 100644
index 0d78aa00bea9..000000000000
--- a/dbaccess/Library_dbmm.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_Library_Library,dbmm))
-
-$(eval $(call gb_Library_set_include,dbmm,\
- $$(INCLUDE) \
- -I$(SRCDIR)/dbaccess/inc \
-))
-
-$(eval $(call gb_Library_use_external,dbmm,boost_headers))
-
-$(eval $(call gb_Library_set_precompiled_header,dbmm,$(SRCDIR)/dbaccess/inc/pch/precompiled_dbmm))
-
-$(eval $(call gb_Library_use_sdk_api,dbmm))
-
-$(eval $(call gb_Library_use_libraries,dbmm,\
- comphelper \
- cppu \
- cppuhelper \
- dba \
- sal \
- svl \
- svt \
- svxcore \
- svx \
- tl \
- tk \
- ucbhelper \
- utl \
- vcl \
- xmlscript \
-))
-
-$(eval $(call gb_Library_set_componentfile,dbmm,dbaccess/source/ext/macromigration/dbmm))
-
-$(eval $(call gb_Library_add_exception_objects,dbmm,\
- dbaccess/source/ext/macromigration/dbmm_services \
- dbaccess/source/ext/macromigration/dbmm_types \
- dbaccess/source/ext/macromigration/docinteraction \
- dbaccess/source/ext/macromigration/macromigrationdialog \
- dbaccess/source/ext/macromigration/macromigrationpages \
- dbaccess/source/ext/macromigration/macromigrationwizard \
- dbaccess/source/ext/macromigration/migrationengine \
- dbaccess/source/ext/macromigration/migrationlog \
- dbaccess/source/ext/macromigration/progresscapture \
- dbaccess/source/ext/macromigration/progressmixer \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk
index 0a66d5fe7586..99073bb80a70 100644
--- a/dbaccess/Module_dbaccess.mk
+++ b/dbaccess/Module_dbaccess.mk
@@ -15,7 +15,6 @@ $(eval $(call gb_Module_add_targets,dbaccess,\
$(if $(filter WNT,$(OS)),Executable_odbcconfig) \
Library_dba \
Library_dbaxml \
- Library_dbmm \
Library_dbu \
Library_sdbt \
Library_dbahsql \
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index eacb9eb112c2..1a026563b9db 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -15,7 +15,6 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/applycolpage \
dbaccess/uiconfig/ui/authentificationpage \
dbaccess/uiconfig/ui/autocharsetpage \
- dbaccess/uiconfig/ui/backuppage \
dbaccess/uiconfig/ui/choosedatasourcedialog \
dbaccess/uiconfig/ui/collectionviewdialog \
dbaccess/uiconfig/ui/colwidthdialog \
@@ -46,14 +45,12 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/keymenu \
dbaccess/uiconfig/ui/ldapconnectionpage \
dbaccess/uiconfig/ui/ldappage \
- dbaccess/uiconfig/ui/migratepage \
dbaccess/uiconfig/ui/mysqlnativepage \
dbaccess/uiconfig/ui/mysqlnativesettings \
dbaccess/uiconfig/ui/namematchingpage \
dbaccess/uiconfig/ui/odbcpage \
dbaccess/uiconfig/ui/parametersdialog \
dbaccess/uiconfig/ui/password \
- dbaccess/uiconfig/ui/preparepage \
dbaccess/uiconfig/ui/querycolmenu \
dbaccess/uiconfig/ui/queryfilterdialog \
dbaccess/uiconfig/ui/queryfuncmenu \
@@ -68,7 +65,6 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/specialsettingspage \
dbaccess/uiconfig/ui/sortdialog \
dbaccess/uiconfig/ui/sqlexception \
- dbaccess/uiconfig/ui/summarypage \
dbaccess/uiconfig/ui/tabledesignrowmenu \
dbaccess/uiconfig/ui/tabledesignsavemodifieddialog \
dbaccess/uiconfig/ui/tablesfilterdialog \
diff --git a/dbaccess/inc/pch/precompiled_dbmm.cxx b/dbaccess/inc/pch/precompiled_dbmm.cxx
deleted file mode 100644
index 12625fa8b685..000000000000
--- a/dbaccess/inc/pch/precompiled_dbmm.cxx
+++ /dev/null
@@ -1,12 +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/.
- */
-
-#include "precompiled_dbmm.hxx"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/inc/pch/precompiled_dbmm.hxx b/dbaccess/inc/pch/precompiled_dbmm.hxx
deleted file mode 100644
index a0c4ad5415c4..000000000000
--- a/dbaccess/inc/pch/precompiled_dbmm.hxx
+++ /dev/null
@@ -1,105 +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 has been autogenerated by update_pch.sh. It is possible to edit it
- manually (such as when an include file has been moved/renamed/removed). All such
- manual changes will be rewritten by the next run of update_pch.sh (which presumably
- also fixes all possible problems, so it's usually better to use it).
-
- Generated on 2019-05-12 16:56:51 using:
- ./bin/update_pch dbaccess dbmm --cutoff=10 --exclude:system --include:module --exclude:local
-
- If after updating build fails, use the following command to locate conflicting headers:
- ./bin/update_pch_bisect ./dbaccess/inc/pch/precompiled_dbmm.hxx "make dbaccess.build" --find-conflicts
-*/
-
-#if PCH_LEVEL >= 1
-#include <algorithm>
-#include <cassert>
-#include <cstddef>
-#include <cstring>
-#include <functional>
-#include <iomanip>
-#include <limits.h>
-#include <limits>
-#include <math.h>
-#include <memory>
-#include <new>
-#include <ostream>
-#include <stddef.h>
-#include <string.h>
-#include <type_traits>
-#include <utility>
-#include <vector>
-#endif // PCH_LEVEL >= 1
-#if PCH_LEVEL >= 2
-#include <osl/diagnose.h>
-#include <osl/endian.h>
-#include <osl/interlck.h>
-#include <osl/mutex.h>
-#include <osl/thread.h>
-#include <rtl/alloc.h>
-#include <rtl/math.h>
-#include <rtl/math.hxx>
-#include <rtl/ref.hxx>
-#include <rtl/strbuf.h>
-#include <rtl/strbuf.hxx>
-#include <rtl/string.h>
-#include <rtl/string.hxx>
-#include <rtl/stringutils.hxx>
-#include <rtl/textcvt.h>
-#include <rtl/textenc.h>
-#include <rtl/unload.h>
-#include <rtl/ustrbuf.h>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-#include <sal/config.h>
-#include <sal/macros.h>
-#include <sal/mathconf.h>
-#include <sal/saldllapi.h>
-#include <sal/types.h>
-#include <sal/typesizes.h>
-#include <vcl/dllapi.h>
-#endif // PCH_LEVEL >= 2
-#if PCH_LEVEL >= 3
-#include <basegfx/basegfxdllapi.h>
-#include <basegfx/numeric/ftools.hxx>
-#include <basegfx/tuple/b2dtuple.hxx>
-#include <basegfx/tuple/b2ituple.hxx>
-#include <basegfx/vector/b2enums.hxx>
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Type.h>
-#include <com/sun/star/uno/Type.hxx>
-#include <com/sun/star/uno/TypeClass.hdl>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/uno/genfunc.h>
-#include <com/sun/star/uno/genfunc.hxx>
-#include <cppu/cppudllapi.h>
-#include <cppu/unotype.hxx>
-#include <o3tl/cow_wrapper.hxx>
-#include <o3tl/typed_flags_set.hxx>
-#include <o3tl/underlyingenumvalue.hxx>
-#include <tools/gen.hxx>
-#include <tools/toolsdllapi.h>
-#include <typelib/typeclass.h>
-#include <typelib/typedescription.h>
-#include <typelib/uik.h>
-#include <uno/any2.h>
-#include <uno/data.h>
-#include <uno/sequence2.h>
-#endif // PCH_LEVEL >= 3
-#if PCH_LEVEL >= 4
-#endif // PCH_LEVEL >= 4
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/dbmm.component b/dbaccess/source/ext/macromigration/dbmm.component
deleted file mode 100644
index 60e18fc69420..000000000000
--- a/dbaccess/source/ext/macromigration/dbmm.component
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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 .
- -->
-
-<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="dbmm" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.dbaccess.macromigration.MacroMigrationDialogService">
- <service name="com.sun.star.sdb.application.MacroMigrationWizard"/>
- </implementation>
-</component>
diff --git a/dbaccess/source/ext/macromigration/dbmm_services.cxx b/dbaccess/source/ext/macromigration/dbmm_services.cxx
deleted file mode 100644
index 2482e70722ce..000000000000
--- a/dbaccess/source/ext/macromigration/dbmm_services.cxx
+++ /dev/null
@@ -1,41 +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 <cppuhelper/factory.hxx>
-#include "macromigrationwizard.hxx"
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* dbmm_component_getFactory(
- const sal_Char* pImplementationName, SAL_UNUSED_PARAMETER void*,
- SAL_UNUSED_PARAMETER void* )
-{
- css::uno::Reference<css::uno::XInterface> xRet;
-
- if (dbmm::MacroMigrationDialogService::getImplementationName_static() == OUString::createFromAscii(pImplementationName))
- {
- xRet = ::cppu::createSingleComponentFactory(dbmm::MacroMigrationDialogService::Create,
- dbmm::MacroMigrationDialogService::getImplementationName_static(),
- dbmm::MacroMigrationDialogService::getSupportedServiceNames_static(), nullptr);
- }
-
- 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
deleted file mode 100644
index 303fcef575a6..000000000000
--- a/dbaccess/source/ext/macromigration/dbmm_types.cxx
+++ /dev/null
@@ -1,48 +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 <osl/diagnose.h>
-#include <core_resource.hxx>
-#include "dbmm_types.hxx"
-#include <strings.hrc>
-
-namespace dbmm
-{
- // helper
- OUString getScriptTypeDisplayName( const ScriptType _eType )
- {
- const char *pResId = nullptr;
-
- switch ( _eType )
- {
- 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( pResId != nullptr, "getScriptTypeDisplayName: illegal script type!" );
-
- return pResId ? DBA_RES(pResId) : OUString();
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/dbmm_types.hxx b/dbaccess/source/ext/macromigration/dbmm_types.hxx
deleted file mode 100644
index 5d5f0b8bf9e1..000000000000
--- a/dbaccess/source/ext/macromigration/dbmm_types.hxx
+++ /dev/null
@@ -1,53 +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_TYPES_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DBMM_TYPES_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace dbmm
-{
-
- // ScriptType
- enum ScriptType
- {
- eBasic,
- eBeanShell,
- eJavaScript,
- ePython,
- eJava,
- eDialog
- };
-
- // SubDocumentType
- enum SubDocumentType
- {
- eForm,
- eReport
- };
-
- // helper
- OUString getScriptTypeDisplayName( const ScriptType _eType );
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DBMM_TYPES_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/docinteraction.cxx b/dbaccess/source/ext/macromigration/docinteraction.cxx
deleted file mode 100644
index 98875eb29bd9..000000000000
--- a/dbaccess/source/ext/macromigration/docinteraction.cxx
+++ /dev/null
@@ -1,108 +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 "docinteraction.hxx"
-
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/task/DocumentPasswordRequest.hpp>
-
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/interaction.hxx>
-#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
-
-namespace dbmm
-{
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::XComponentContext;
- using ::com::sun::star::task::XInteractionHandler;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::task::DocumentPasswordRequest;
- using ::com::sun::star::task::InteractionClassification_QUERY;
- using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER;
- using ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER;
-
- // InteractionHandler_Data
- struct InteractionHandler_Data
- {
- Reference< XInteractionHandler > xHandler;
-
- explicit InteractionHandler_Data( const Reference<XComponentContext>& _rContext )
- :xHandler( css::task::InteractionHandler::createWithParent(_rContext, nullptr) )
- {
- }
- };
-
- // InteractionHandler
- InteractionHandler::InteractionHandler( const Reference<XComponentContext>& _rContext, const Reference< XModel >& _rxDocument )
- :m_pData( new InteractionHandler_Data( _rContext ) )
- {
- // check whether the document has its own interaction handler set
- ::comphelper::NamedValueCollection aDocArgs( _rxDocument->getArgs() );
- m_pData->xHandler = aDocArgs.getOrDefault( "InteractionHandler", m_pData->xHandler );
- }
-
- InteractionHandler::~InteractionHandler()
- {
- }
-
- bool InteractionHandler::requestDocumentPassword( const OUString& _rDocumentName, OUString& _io_rPassword )
- {
- // create request
- DocumentPasswordRequest aRequest(
- OUString(), nullptr,
- InteractionClassification_QUERY,
- _io_rPassword.isEmpty() ? PasswordRequestMode_PASSWORD_ENTER : PasswordRequestMode_PASSWORD_REENTER,
- _rDocumentName
- );
-
- ::rtl::Reference pRequest( new ::comphelper::OInteractionRequest( makeAny( aRequest ) ) );
- ::rtl::Reference pPassword( new ::comphelper::OInteractionPassword( _io_rPassword ) );
- ::rtl::Reference pAbort( new ::comphelper::OInteractionAbort );
- pRequest->addContinuation( pPassword.get() );
- pRequest->addContinuation( pAbort.get() );
-
- // handle
- m_pData->xHandler->handle( pRequest.get() );
-
- // finish up
- if ( pAbort->wasSelected() )
- return false;
-
- _io_rPassword = pPassword->getPassword();
- return true;
- }
-
- void InteractionHandler::reportError( const Any& _rError )
- {
- ::rtl::Reference pRequest( new ::comphelper::OInteractionRequest( _rError ) );
- ::rtl::Reference pApprove( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( pApprove.get() );
-
- m_pData->xHandler->handle( pRequest.get() );
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/docinteraction.hxx b/dbaccess/source/ext/macromigration/docinteraction.hxx
deleted file mode 100644
index e9ecb04bb8cf..000000000000
--- a/dbaccess/source/ext/macromigration/docinteraction.hxx
+++ /dev/null
@@ -1,80 +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_DOCINTERACTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DOCINTERACTION_HXX
-
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <memory>
-
-namespace dbmm
-{
-
- // DocumentErrorHandling
- struct InteractionHandler_Data;
- /** wraps common operations with an interaction handler.
- */
- class InteractionHandler
- {
- public:
- /** creates an interaction handler by instantiating a css.task.InteractionHandler
- component at the given component context, or using the given document's interaction handler,
- if one is specified in the document's media descriptor.
- */
- InteractionHandler(
- const css::uno::Reference< css::uno::XComponentContext >& _rContext,
- const css::uno::Reference< css::frame::XModel >& _rxDocument );
-
- /** destructor
- */
- ~InteractionHandler();
-
- /** requests a document password
- @param _rDocumentName
- the document name
- @param _io_rPassword
- the initial password on method entry, the password as entered by the user on method leave
- @return
- <TRUE/> if and only if the user entered a password, and confirmed with OK, <FALSE/>
- if the user aborted the request.
- */
- bool requestDocumentPassword(
- const OUString& _rDocumentName,
- OUString& _io_rPassword
- );
-
- /** reports the given error (usually an exception caught on the caller's side)
- to the user
- */
- void reportError(
- const css::uno::Any& _rError
- );
-
- private:
- std::unique_ptr< InteractionHandler_Data > m_pData;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_DOCINTERACTION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
deleted file mode 100644
index 2b8d58a3123d..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
+++ /dev/null
@@ -1,556 +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 "docinteraction.hxx"
-#include <core_resource.hxx>
-#include <strings.hrc>
-#include "macromigrationdialog.hxx"
-#include "macromigrationpages.hxx"
-#include "migrationengine.hxx"
-#include "migrationerror.hxx"
-#include "migrationlog.hxx"
-
-#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/util/CloseVetoException.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/ucb/UniversalContentBroker.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-
-#include <comphelper/namedvaluecollection.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <rtl/ref.hxx>
-#include <svl/filenotation.hxx>
-#include <tools/diagnose_ex.h>
-#include <ucbhelper/content.hxx>
-#include <vcl/weld.hxx>
-#include <vcl/svapp.hxx>
-
-#include <vector>
-
-namespace dbmm
-{
-
-#define STATE_CLOSE_SUB_DOCS 0
-#define STATE_BACKUP_DBDOC 1
-#define STATE_MIGRATE 2
-#define STATE_SUMMARY 3
-
-#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;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::sdb::application::XDatabaseDocumentUI;
- using ::com::sun::star::sdb::XOfficeDatabaseDocument;
- using ::com::sun::star::frame::XModel2;
- using ::com::sun::star::frame::XController2;
- using ::com::sun::star::container::XEnumeration;
- using ::com::sun::star::frame::XStorable;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::util::XCloseable;
- using ::com::sun::star::util::CloseVetoException;
- using ::com::sun::star::frame::XComponentLoader;
- using ::com::sun::star::util::XModifiable;
- using ::com::sun::star::ucb::UniversalContentBroker;
- using ::com::sun::star::ucb::XCommandEnvironment;
- using ::com::sun::star::ucb::XContent;
- using ::com::sun::star::ucb::XContentIdentifier;
-
- // helper
- static void lcl_getControllers_throw(const Reference< XModel2 >& _rxDocument,
- std::vector< Reference< XController2 > >& _out_rControllers )
- {
- _out_rControllers.clear();
- Reference< XEnumeration > xControllerEnum( _rxDocument->getControllers(), UNO_SET_THROW );
- while ( xControllerEnum->hasMoreElements() )
- _out_rControllers.emplace_back( xControllerEnum->nextElement(), UNO_QUERY_THROW );
- }
-
- // MacroMigrationDialog_Data
- struct MacroMigrationDialog_Data
- {
- Reference<XComponentContext> aContext;
- MigrationLog aLogger;
- Reference< XOfficeDatabaseDocument > xDocument;
- Reference< XModel2 > xDocumentModel;
- OUString sSuccessfulBackupLocation;
- bool bMigrationIsRunning;
- bool bMigrationFailure;
- bool bMigrationSuccess;
-
- MacroMigrationDialog_Data(
- const Reference<XComponentContext>& _rContext,
- const Reference< XOfficeDatabaseDocument >& _rxDocument )
- :aContext( _rContext )
- ,aLogger()
- ,xDocument( _rxDocument )
- ,xDocumentModel( _rxDocument, UNO_QUERY )
- ,bMigrationIsRunning( false )
- ,bMigrationFailure( false )
- ,bMigrationSuccess( false )
- {
- }
- };
-
- // MacroMigrationDialog
- MacroMigrationDialog::MacroMigrationDialog(vcl::Window* _pParent, const Reference<XComponentContext>& _rContext,
- const Reference< XOfficeDatabaseDocument >& _rxDocument)
- : MacroMigrationDialog_Base(_pParent)
- , m_pData( new MacroMigrationDialog_Data( _rContext, _rxDocument ) )
- {
- 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 );
- describeState( STATE_MIGRATE, sTitleMigrate, &ProgressPage::Create );
- describeState( STATE_SUMMARY, sTitleSummary, &ResultPage::Create );
-
- declarePath( PATH_DEFAULT, {STATE_CLOSE_SUB_DOCS, STATE_BACKUP_DBDOC, STATE_MIGRATE, STATE_SUMMARY} );
-
- SetPageSizePixel(LogicToPixel(::Size(TAB_PAGE_WIDTH, TAB_PAGE_HEIGHT), MapMode(MapUnit::MapAppFont)));
- SetRoadmapInteractive( true );
- enableAutomaticNextButtonState();
- defaultButton( WizardButtonFlags::NEXT );
- enableButtons( WizardButtonFlags::FINISH, true );
- ActivatePage();
-
- OSL_PRECOND( m_pData->xDocumentModel.is(), "MacroMigrationDialog::MacroMigrationDialog: illegal document!" );
- }
-
- const Reference<XComponentContext>& MacroMigrationDialog::getComponentContext() const
- {
- return m_pData->aContext;
- }
-
- const Reference< XOfficeDatabaseDocument >& MacroMigrationDialog::getDocument() const
- {
- return m_pData->xDocument;
- }
-
- short MacroMigrationDialog::Execute()
- {
- short nResult = MacroMigrationDialog_Base::Execute();
- if ( !m_pData->bMigrationFailure && !m_pData->bMigrationSuccess )
- // migration did not even start
- return nResult;
-
- OSL_ENSURE( !m_pData->bMigrationFailure || !m_pData->bMigrationSuccess,
- "MacroMigrationDialog::Execute: success *and* failure at the same time?!" );
- impl_reloadDocument_nothrow( m_pData->bMigrationSuccess );
-
- return nResult;
- }
-
- bool MacroMigrationDialog::Close()
- {
- if ( m_pData->bMigrationIsRunning )
- return false;
- return MacroMigrationDialog_Base::Close();
- }
-
- void MacroMigrationDialog::enterState( WizardState _nState )
- {
- MacroMigrationDialog_Base::enterState( _nState );
-
- switch ( _nState )
- {
- case STATE_CLOSE_SUB_DOCS:
- enableButtons( WizardButtonFlags::FINISH, false );
- enableState( STATE_MIGRATE, false );
- enableState( STATE_SUMMARY, false );
- break;
-
- case STATE_BACKUP_DBDOC:
- enableState( STATE_MIGRATE );
- // Note that the state is automatically disabled if the current page
- // (SaveDBDocPage) returns false in its canAdvance, not caring that
- // we enabled it here.
- break;
-
- case STATE_MIGRATE:
- {
- // disable everything. The process we will start here cannot be cancelled, the user
- // needs to wait 'til it's finished.
- enableState( STATE_CLOSE_SUB_DOCS, false );
- enableState( STATE_BACKUP_DBDOC, false );
- enableState( STATE_SUMMARY, false );
-
- enableButtons( WizardButtonFlags::FINISH | WizardButtonFlags::CANCEL | WizardButtonFlags::PREVIOUS | WizardButtonFlags::NEXT, false );
-
- // start the migration asynchronously
- PostUserEvent( LINK( this, MacroMigrationDialog, OnStartMigration ), nullptr, true );
- }
- break;
-
- case STATE_SUMMARY:
- // disable the previous step - we can't return to the actual migration, it already happened (or failed)
- enableState( STATE_MIGRATE, false );
- updateTravelUI();
-
- // display the results
- dynamic_cast< ResultPage& >( *GetPage( STATE_SUMMARY ) ).displayMigrationLog(
- m_pData->bMigrationSuccess, m_pData->aLogger.getCompleteLog() );
-
- enableButtons( WizardButtonFlags::FINISH, m_pData->bMigrationSuccess );
- enableButtons( WizardButtonFlags::CANCEL, m_pData->bMigrationFailure );
- defaultButton( m_pData->bMigrationSuccess ? WizardButtonFlags::FINISH : WizardButtonFlags::CANCEL );
- break;
-
- default:
- OSL_FAIL( "MacroMigrationDialog::enterState: unhandled state!" );
- }
- }
-
- bool MacroMigrationDialog::prepareLeaveCurrentState( CommitPageReason _eReason )
- {
- if ( !MacroMigrationDialog_Base::prepareLeaveCurrentState( _eReason ) )
- return false;
-
- switch ( getCurrentState() )
- {
- case STATE_CLOSE_SUB_DOCS:
- if ( !impl_closeSubDocs_nothrow() )
- return false;
- break;
- case STATE_BACKUP_DBDOC:
- if ( !impl_backupDocument_nothrow() )
- return false;
- break;
- case STATE_MIGRATE:
- break;
- case STATE_SUMMARY:
- break;
- default:
- OSL_FAIL( "MacroMigrationDialog::prepareLeaveCurrentState: unhandled state!" );
- }
-
- return true;
- }
-
- IMPL_LINK_NOARG( MacroMigrationDialog, OnStartMigration, void*, void )
- {
- // prevent closing
- m_pData->bMigrationIsRunning = true;
-
- // initialize migration engine and progress
- ProgressPage& rProgressPage( dynamic_cast< ProgressPage& >( *GetPage( STATE_MIGRATE ) ) );
- MigrationEngine aEngine( m_pData->aContext, m_pData->xDocument, rProgressPage, m_pData->aLogger );
- rProgressPage.setDocumentCounts( aEngine.getFormCount(), aEngine.getReportCount() );
-
- // do the migration
- m_pData->bMigrationSuccess = aEngine.migrateAll();
- m_pData->bMigrationFailure = !m_pData->bMigrationSuccess;
-
- // re-enable the UI
- enableButtons( WizardButtonFlags::FINISH | WizardButtonFlags::NEXT, true );
- enableState( STATE_SUMMARY );
- updateTravelUI();
-
- m_pData->bMigrationIsRunning = false;
-
- if ( m_pData->bMigrationSuccess )
- {
- rProgressPage.onFinishedSuccessfully();
- }
- else
- { // if there was an error, show the summary automatically
- travelNext();
- }
- }
-
- void MacroMigrationDialog::impl_showCloseDocsError( bool _bShow )
- {
- PreparationPage* pPreparationPage = dynamic_cast< PreparationPage* >( GetPage( STATE_CLOSE_SUB_DOCS ) );
- OSL_ENSURE( pPreparationPage, "MacroMigrationDialog::impl_showCloseDocsError: did not find the page!" );
- if ( pPreparationPage )
- pPreparationPage->showCloseDocsError( _bShow );
- }
-
- bool MacroMigrationDialog::impl_closeSubDocs_nothrow()
- {
- OSL_PRECOND( m_pData->xDocument.is(), "MacroMigrationDialog::impl_closeSubDocs_nothrow: no document!" );
- if ( !m_pData->xDocument.is() )
- return false;
-
- impl_showCloseDocsError( false );
-
- bool bSuccess = true;
- try
- {
- // collect all controllers of our document
- std::vector< Reference< XController2 > > aControllers;
- lcl_getControllers_throw( m_pData->xDocumentModel, aControllers );
-
- // close all sub documents of all controllers
- for (auto const& controller : aControllers)
- {
- Reference< XDatabaseDocumentUI > xController( controller, UNO_QUERY );
- OSL_ENSURE( xController.is(), "MacroMigrationDialog::impl_closeSubDocs_nothrow: unexpected: controller is missing an important interface!" );
- // at the moment, only one implementation for a DBDoc's controller exists, which should
- // support this interface
- if ( !xController.is() )
- continue;
-
- bSuccess = xController->closeSubComponents();
- if (!bSuccess)
- break;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- bSuccess = false;
- }
-
- impl_showCloseDocsError( !bSuccess );
- return bSuccess;
- }
-
- namespace
- {
- bool lcl_equalURLs_nothrow(
- const Reference< XComponentContext >& context,
- const OUString& _lhs, const OUString& _rhs )
- {
- // the cheap situation: the URLs are equal
- if ( _lhs == _rhs )
- return true;
-
- bool bEqual = true;
- try
- {
- ::ucbhelper::Content aContentLHS( _lhs, Reference< XCommandEnvironment >(), context );
- ::ucbhelper::Content aContentRHS( _rhs, Reference< XCommandEnvironment >(), context );
- Reference< XContent > xContentLHS( aContentLHS.get(), UNO_SET_THROW );
- Reference< XContent > xContentRHS( aContentRHS.get(), UNO_SET_THROW );
- Reference< XContentIdentifier > xID1( xContentLHS->getIdentifier(), UNO_SET_THROW );
- Reference< XContentIdentifier > xID2( xContentRHS->getIdentifier(), UNO_SET_THROW );
-
- bEqual = UniversalContentBroker::create(context)->compareContentIds( xID1, xID2 ) == 0;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- return bEqual;
- }
- }
-
- bool MacroMigrationDialog::impl_backupDocument_nothrow() const
- {
- if ( !m_pData->xDocumentModel.is() )
- // should never happen, but has been reported as assertion before
- return false;
-
- SaveDBDocPage& rBackupPage = dynamic_cast< SaveDBDocPage& >( *GetPage( STATE_BACKUP_DBDOC ) );
- OUString sBackupLocation( rBackupPage.getBackupLocation() );
-
- Any aError;
- try
- {
- // 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() ) )
- {
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok, DBA_RES(STR_INVALID_BACKUP_LOCATION)));
- xErrorBox->run();
- rBackupPage.grabLocationFocus();
- return false;
- }
-
- // store to the backup location
- const Reference< XStorable > xDocument( getDocument(), UNO_QUERY_THROW );
- xDocument->storeToURL( sBackupLocation, Sequence< PropertyValue >() );
- m_pData->sSuccessfulBackupLocation = sBackupLocation;
- }
- catch( const Exception& )
- {
- aError = ::cppu::getCaughtException();
- }
- if ( !aError.hasValue() )
- {
- ::svt::OFileNotation aFileNotation( sBackupLocation );
- m_pData->aLogger.backedUpDocument( aFileNotation.get( ::svt::OFileNotation::N_SYSTEM ) );
- return true;
- }
-
- // display the error to the user
- InteractionHandler aHandler( m_pData->aContext, m_pData->xDocumentModel.get() );
- aHandler.reportError( aError );
-
- m_pData->aLogger.logFailure( MigrationError(
- ERR_DOCUMENT_BACKUP_FAILED,
- sBackupLocation,
- aError
- ) );
-
- return false;
- }
-
- void MacroMigrationDialog::impl_reloadDocument_nothrow( bool _bMigrationSuccess )
- {
- typedef std::pair< Reference< XFrame >, OUString > ViewDescriptor;
- std::vector< ViewDescriptor > aViews;
-
- try
- {
- // the information which is necessary to reload the document
- OUString sDocumentURL ( m_pData->xDocumentModel->getURL() );
- ::comphelper::NamedValueCollection aDocumentArgs( m_pData->xDocumentModel->getArgs() );
- if ( !_bMigrationSuccess )
- {
- // if the migration was not successful, then reload from the backup
- aDocumentArgs.put( "SalvagedFile", m_pData->sSuccessfulBackupLocation );
- // reset the modified flag of the document, so the controller can be suspended later
- Reference< XModifiable > xModify( m_pData->xDocument, UNO_QUERY_THROW );
- xModify->setModified( false );
- // after this reload, don't show the migration warning, again
- aDocumentArgs.put( "SuppressMigrationWarning", true );
- }
-
- // remove anything from the args which might refer to the old document
- aDocumentArgs.remove( "Model" );
- aDocumentArgs.remove( "Stream" );
- aDocumentArgs.remove( "InputStream" );
- aDocumentArgs.remove( "FileName" );
- aDocumentArgs.remove( "URL" );
-
- // collect all controllers of our document
- std::vector< Reference< XController2 > > aControllers;
- lcl_getControllers_throw( m_pData->xDocumentModel, aControllers );
-
- // close all those controllers
- for (auto const& controller : aControllers)
- {
- Reference< XController2 > xController( controller, UNO_SET_THROW );
-
- Reference< XFrame > xFrame( xController->getFrame(), UNO_SET_THROW );
- OUString sViewName( xController->getViewControllerName() );
-
- if ( !xController->suspend( true ) )
- { // ouch. There shouldn't be any modal dialogs and such, so there
- // really is no reason why suspending shouldn't work.
- OSL_FAIL( "MacroMigrationDialog::impl_reloadDocument_nothrow: could not suspend a controller!" );
- // ignoring this would be at the cost of a crash (potentially)
- // so, we cannot continue here.
- throw CloseVetoException();
- }
-
- aViews.emplace_back( xFrame, sViewName );
- xFrame->setComponent( nullptr, nullptr );
- xController->dispose();
- }
- aControllers.clear();
-
- // Note the document is closed now - disconnecting the last controller
- // closes it automatically.
-
- Reference< XOfficeDatabaseDocument > xNewDocument;
-
- // re-create the views
- for (auto const& view : aViews)
- {
- // load the document into this frame
- Reference< XComponentLoader > xLoader( view.first, UNO_QUERY_THROW );
- aDocumentArgs.put( "ViewName", view.second );
- Reference< XInterface > xReloaded( xLoader->loadComponentFromURL(
- sDocumentURL,
- "_self",
- 0,
- aDocumentArgs.getPropertyValues()
- ) );
-
- OSL_ENSURE( xReloaded != m_pData->xDocumentModel,
- "MacroMigrationDialog::impl_reloadDocument_nothrow: this should have been a new instance!" );
- // this would be unexpected, but recoverable: The loader should at least have done
- // this: really *load* the document, even if it loaded it into the old document instance
- if ( !xNewDocument.is() )
- {
- xNewDocument.set( xReloaded, UNO_QUERY_THROW );
- // for subsequent loads, into different frames, put the document into the load args
- aDocumentArgs.put( "Model", xNewDocument );
- }
- #if OSL_DEBUG_LEVEL > 0
- else
- {
- OSL_ENSURE( xNewDocument == xReloaded,
- "MacroMigrationDialog::impl_reloadDocument_nothrow: unexpected: subsequent load attempt returned a wrong document!" );
- }
- #endif
- }
- aViews.clear();
-
- m_pData->xDocument = xNewDocument;
- m_pData->xDocumentModel.set( xNewDocument, UNO_QUERY );
-
- // finally, now that the document has been reloaded - if the migration was not successful,
- // then it was reloaded from the backup, but the real document still is broken. So, save
- // the document once, which will write the content loaded from the backup to the real docfile.
- if ( !_bMigrationSuccess )
- {
- Reference< XModifiable > xModify( m_pData->xDocument, UNO_QUERY_THROW );
- xModify->setModified( true );
- // this is just paranoia - in case saving the doc fails, perhaps the user is tempted to do so
- Reference< XStorable > xStor( m_pData->xDocument, UNO_QUERY_THROW );
- xStor->store();
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
-
- // close all frames from aViews - the respective controllers have been closed, but
- // reloading didn't work, so the frames are zombies now.
- for (auto const& view : aViews)
- {
- try
- {
- Reference< XCloseable > xFrameClose( view.first, UNO_QUERY_THROW );
- xFrameClose->close( true );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- }
- aViews.clear();
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.hxx b/dbaccess/source/ext/macromigration/macromigrationdialog.hxx
deleted file mode 100644
index 60d04bad4c1e..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.hxx
+++ /dev/null
@@ -1,76 +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_MACROMIGRATIONDIALOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONDIALOG_HXX
-
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include <vcl/roadmapwizard.hxx>
-
-#include <memory>
-
-namespace dbmm
-{
-
- // MacroMigrationDialog
- struct MacroMigrationDialog_Data;
- typedef ::vcl::RoadmapWizard MacroMigrationDialog_Base;
- class MacroMigrationDialog : public MacroMigrationDialog_Base
- {
- public:
- MacroMigrationDialog(
- vcl::Window* _pParent,
- const css::uno::Reference< css::uno::XComponentContext >& _rContext,
- const css::uno::Reference< css::sdb::XOfficeDatabaseDocument >& _rxDocument
- );
-
- const css::uno::Reference< css::uno::XComponentContext >&
- getComponentContext() const;
- const css::uno::Reference< css::sdb::XOfficeDatabaseDocument >&
- getDocument() const;
-
- protected:
- // OWizardMachine overridables
- virtual void enterState( WizardState _nState ) override;
- virtual bool prepareLeaveCurrentState( CommitPageReason _eReason ) override;
-
- // Dialog overridables
- virtual bool Close() override;
- virtual short Execute() override;
-
- private:
- void impl_showCloseDocsError( bool _bShow );
- bool impl_closeSubDocs_nothrow();
- bool impl_backupDocument_nothrow() const;
- void impl_reloadDocument_nothrow( bool _bMigrationSuccess );
-
- private:
- DECL_LINK( OnStartMigration, void*, void );
-
- private:
- std::unique_ptr< MacroMigrationDialog_Data > m_pData;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONDIALOG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
deleted file mode 100644
index 6c49497934de..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ /dev/null
@@ -1,308 +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 "macromigrationpages.hxx"
-#include "macromigrationdialog.hxx"
-
-#include <com/sun/star/frame/XModel.hpp>
-
-#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/metric.hxx>
-
-namespace dbmm
-{
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::frame::XModel;
-
- MacroMigrationPage::MacroMigrationPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription)
- : MacroMigrationPage_Base(pParent, rID, rUIXMLDescription)
- {
- }
-
- MacroMigrationDialog& MacroMigrationPage::getDialog()
- {
- auto pDialog = dynamic_cast<MacroMigrationDialog*>(GetParentDialog());
- assert(pDialog);
- return *pDialog;
- }
-
- // PreparationPage
- PreparationPage::PreparationPage(vcl::Window *pParent)
- : MacroMigrationPage(pParent, "PreparePage" ,"dbaccess/ui/preparepage.ui")
- {
- get(m_pCloseDocError, "closedocerror");
- }
-
- PreparationPage::~PreparationPage()
- {
- disposeOnce();
- }
-
- void PreparationPage::dispose()
- {
- m_pCloseDocError.clear();
- MacroMigrationPage::dispose();
- }
-
- void PreparationPage::showCloseDocsError( bool _bShow )
- {
- m_pCloseDocError->Show( _bShow );
- }
-
- VclPtr<TabPage> PreparationPage::Create( ::vcl::RoadmapWizard& _rParentDialog )
- {
- return VclPtr<PreparationPage>::Create(&_rParentDialog);
- }
-
- // SaveDBDocPage
- SaveDBDocPage::SaveDBDocPage(MacroMigrationDialog& _rParentDialog)
- : MacroMigrationPage(&_rParentDialog, "BackupPage" ,"dbaccess/ui/backuppage.ui")
- {
- get(m_pStartMigration, "startmigrate");
- get(m_pBrowseSaveAsLocation, "browse");
- get(m_pSaveAsLocation, "location");
- m_pLocationController.reset( new svx::SvxDatabaseLocationInputController(
- _rParentDialog.getComponentContext(), *m_pSaveAsLocation, *m_pBrowseSaveAsLocation) );
-
- m_pSaveAsLocation->SetModifyHdl( LINK( this, SaveDBDocPage, OnLocationModified ) );
- m_pSaveAsLocation->SetDropDownLineCount( 20 );
-
- impl_updateLocationDependentItems();
- }
-
- SaveDBDocPage::~SaveDBDocPage()
- {
- disposeOnce();
- }
-
- void SaveDBDocPage::dispose()
- {
- m_pLocationController.reset();
- m_pSaveAsLocation.clear();
- m_pBrowseSaveAsLocation.clear();
- m_pStartMigration.clear();
- MacroMigrationPage::dispose();
- }
-
- void SaveDBDocPage::impl_updateLocationDependentItems()
- {
- updateDialogTravelUI();
- m_pStartMigration->Show(!m_pSaveAsLocation->GetText().isEmpty());
- }
-
- IMPL_LINK_NOARG( SaveDBDocPage, OnLocationModified, Edit&, void )
- {
- impl_updateLocationDependentItems();
- }
-
- void SaveDBDocPage::initializePage()
- {
- OWizardPage::initializePage();
-
- try
- {
- // get the document's current URL
- Reference< XModel > xDocument( getDialog().getDocument(), UNO_QUERY_THROW );
- INetURLObject aURLParser( xDocument->getURL() );
- OSL_ENSURE( aURLParser.GetProtocol() != INetProtocol::NotValid, "SaveDBDocPage::initializePage: illegal document URL!" );
-
- OUStringBuffer aBaseName( aURLParser.getBase() );
- aBaseName.append( ".backup" );
- aURLParser.setBase( aBaseName.makeStringAndClear() );
-
- m_pLocationController->setURL( aURLParser.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- impl_updateLocationDependentItems();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- }
-
- bool SaveDBDocPage::canAdvance() const
- {
- if ( !MacroMigrationPage::canAdvance() )
- return false;
-
- return !m_pSaveAsLocation->GetText().isEmpty();
- }
-
- bool SaveDBDocPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason )
- {
- if ( !MacroMigrationPage::commitPage( _eReason ) )
- return false;
-
- if ( ::vcl::WizardTypes::eTravelBackward == _eReason )
- return true;
-
- if ( !m_pLocationController->prepareCommit() )
- return false;
-
- return true;
- }
-
- VclPtr<TabPage> SaveDBDocPage::Create( ::vcl::RoadmapWizard& _rParentDialog )
- {
- return VclPtr<SaveDBDocPage>::Create( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
- }
-
- // ProgressPage
- ProgressPage::ProgressPage(vcl::Window* pParent)
- : MacroMigrationPage(pParent, "MigratePage" ,"dbaccess/ui/migratepage.ui")
- {
- get(m_pObjectCount, "count");
- get(m_pCurrentObject, "object");
- get(m_pCurrentAction, "current");
- m_aCurrentProgress.Set(get<ProgressBar>("currentprogress"));
- get(m_pAllProgressText, "overall");
- m_aAllProgress.Set(get<ProgressBar>("allprogress"));
- get(m_pMigrationDone, "done");
- }
-
- ProgressPage::~ProgressPage()
- {
- disposeOnce();
- }
-
- void ProgressPage::dispose()
- {
- m_pObjectCount.clear();
- m_pCurrentObject.clear();
- m_pCurrentAction.clear();
- m_pAllProgressText.clear();
- m_pMigrationDone.clear();
- MacroMigrationPage::dispose();
- }
-
- VclPtr<TabPage> ProgressPage::Create(::vcl::RoadmapWizard& _rParentDialog)
- {
- return VclPtr<ProgressPage>::Create(&_rParentDialog);
- }
-
- void ProgressPage::setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports )
- {
- OUString sText( m_pObjectCount->GetText() );
- sText = sText.replaceFirst( "$forms$", OUString::number( _nForms ) );
- sText = sText.replaceFirst( "$reports$", OUString::number( _nReports ) );
- m_pObjectCount->SetText( sText );
- }
-
- void ProgressPage::onFinishedSuccessfully()
- {
- m_pMigrationDone->Show();
- }
-
- void ProgressPage::startObject( const OUString& _rObjectName, const OUString& _rCurrentAction, const sal_uInt32 _nRange )
- {
- m_pCurrentObject->SetText( _rObjectName );
- m_pCurrentAction->SetText( _rCurrentAction );
- m_aCurrentProgress.SetRange( _nRange );
- m_aCurrentProgress.SetValue( sal_uInt32(0) );
-
- // since this is currently called from the main thread, which does not have the chance
- // to re-schedule, we need to explicitly update the display
- m_pCurrentObject->Update();
- m_pCurrentAction->Update();
- Update();
- }
-
- void ProgressPage::setObjectProgressText( const OUString& _rText )
- {
- m_pCurrentAction->SetText( _rText );
- m_pCurrentAction->Update();
- Update();
- }
-
- void ProgressPage::setObjectProgressValue( const sal_uInt32 _nValue )
- {
- m_aCurrentProgress.SetValue( _nValue );
- Update();
- }
-
- void ProgressPage::endObject()
- {
- m_pCurrentAction->SetText( OUString() );
- m_aCurrentProgress.SetValue( m_aCurrentProgress.GetRange() );
- m_pCurrentAction->Update();
- Update();
- }
-
- void ProgressPage::start( const sal_uInt32 _nOverallRange )
- {
- m_aAllProgress.SetRange( _nOverallRange );
- Update();
- }
-
- void ProgressPage::setOverallProgressText( const OUString& _rText )
- {
- m_pAllProgressText->SetText( _rText );
- Update();
- }
-
- void ProgressPage::setOverallProgressValue( const sal_uInt32 _nValue )
- {
- m_aAllProgress.SetValue( _nValue );
- Update();
- }
-
- // ResultPage
- ResultPage::ResultPage(vcl::Window* pParent)
- : MacroMigrationPage(pParent, "SummaryPage" ,"dbaccess/ui/summarypage.ui")
- {
- get(m_pChanges, "textview");
- m_pChanges->set_height_request(GetTextHeight() * 10);
- m_pChanges->set_width_request(approximate_char_width() * 40);
- get(m_pSuccessLabel, "success");
- get(m_pFailureLabel, "failure");
- }
-
- ResultPage::~ResultPage()
- {
- disposeOnce();
- }
-
- void ResultPage::dispose()
- {
- m_pSuccessLabel.clear();
- m_pFailureLabel.clear();
- m_pChanges.clear();
- MacroMigrationPage::dispose();
- }
-
- VclPtr<TabPage> ResultPage::Create(::vcl::RoadmapWizard& _rParentDialog)
- {
- return VclPtr<ResultPage>::Create(&_rParentDialog);
- }
-
- void ResultPage::displayMigrationLog(const bool _bSuccessful, const OUString& _rSummary)
- {
- if (_bSuccessful)
- m_pFailureLabel->Hide();
- else
- m_pSuccessLabel->Hide();
- m_pChanges->SetText(_rSummary);
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.hxx b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
deleted file mode 100644
index f04b41fa6a70..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationpages.hxx
+++ /dev/null
@@ -1,152 +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_MACROMIGRATIONPAGES_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONPAGES_HXX
-
-#include "migrationprogress.hxx"
-#include "rangeprogressbar.hxx"
-
-#include <svtools/urlcontrol.hxx>
-#include <vcl/wizardmachine.hxx>
-#include <svx/databaselocationinput.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/vclmedit.hxx>
-
-namespace vcl
-{
- class RoadmapWizard;
-}
-
-namespace dbmm
-{
-
- class MacroMigrationDialog;
-
- // MacroMigrationPage
- typedef ::vcl::OWizardPage MacroMigrationPage_Base;
- class MacroMigrationPage : public MacroMigrationPage_Base
- {
- public:
- MacroMigrationPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription);
-
- protected:
- MacroMigrationDialog& getDialog();
- };
-
- // PreparationPage
- class PreparationPage final : public MacroMigrationPage
- {
- public:
- explicit PreparationPage(vcl::Window *pParent);
- virtual ~PreparationPage() override;
- virtual void dispose() override;
-
- static VclPtr<TabPage> Create( ::vcl::RoadmapWizard& _rParentDialog );
-
- void showCloseDocsError(bool _bShow);
-
- private:
- VclPtr<FixedText> m_pCloseDocError;
- };
-
- // SaveDBDocPage
- class SaveDBDocPage final : public MacroMigrationPage
- {
- public:
- explicit SaveDBDocPage(MacroMigrationDialog& _rParentDialog);
- virtual ~SaveDBDocPage() override;
- virtual void dispose() override;
- static VclPtr<TabPage> Create( ::vcl::RoadmapWizard& _rParentDialog );
-
- OUString getBackupLocation() const { return m_pLocationController->getURL(); }
- void grabLocationFocus() { m_pSaveAsLocation->GrabFocus(); }
-
- private:
- VclPtr< ::svt::OFileURLControl> m_pSaveAsLocation;
- VclPtr<PushButton> m_pBrowseSaveAsLocation;
- VclPtr<FixedText> m_pStartMigration;
- std::unique_ptr<svx::SvxDatabaseLocationInputController> m_pLocationController;
-
- // IWizardPageController overridables
- virtual void initializePage() override;
- virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
- virtual bool canAdvance() const override;
-
- DECL_LINK( OnLocationModified, Edit&, void );
- void impl_updateLocationDependentItems();
- };
-
- // ProgressPage
- class ProgressPage : public MacroMigrationPage, public IMigrationProgress
- {
- public:
- explicit ProgressPage(vcl::Window *pParent);
- virtual ~ProgressPage() override;
- virtual void dispose() override;
-
- static VclPtr<TabPage> Create( ::vcl::RoadmapWizard& _rParentDialog );
-
- void setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports );
- void onFinishedSuccessfully();
-
- protected:
- // IMigrationProgress
- virtual void startObject( const OUString& _rObjectName, const OUString& _rCurrentAction, const sal_uInt32 _bRange ) override;
- virtual void setObjectProgressText( const OUString& _rText ) override;
- virtual void setObjectProgressValue( const sal_uInt32 _nValue ) override;
- virtual void endObject() override;
- virtual void start( const sal_uInt32 _nOverallRange ) override;
- virtual void setOverallProgressText( const OUString& _rText ) override;
- virtual void setOverallProgressValue( const sal_uInt32 _nValue ) override;
-
- private:
- VclPtr<FixedText> m_pObjectCount;
- VclPtr<FixedText> m_pCurrentObject;
- VclPtr<FixedText> m_pCurrentAction;
- RangeProgressBar m_aCurrentProgress;
- VclPtr<FixedText> m_pAllProgressText;
- RangeProgressBar m_aAllProgress;
- VclPtr<FixedText> m_pMigrationDone;
- };
-
- // ResultPage
- class ResultPage : public MacroMigrationPage
- {
- public:
- explicit ResultPage(vcl::Window *pParent);
- virtual ~ResultPage() override;
- virtual void dispose() override;
-
- static VclPtr<TabPage> Create( ::vcl::RoadmapWizard& _rParentDialog );
-
- void displayMigrationLog( const bool _bSuccessful, const OUString& _rLog );
-
- private:
- VclPtr<FixedText> m_pSuccessLabel;
- VclPtr<FixedText> m_pFailureLabel;
- VclPtr<VclMultiLineEdit> m_pChanges;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MACROMIGRATIONPAGES_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx b/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
deleted file mode 100644
index 1a3cc0c5a4f9..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationwizard.cxx
+++ /dev/null
@@ -1,132 +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 "macromigrationwizard.hxx"
-#include <toolkit/helper/vclunohelper.hxx>
-#include <core_resource.hxx>
-#include <strings.hrc>
-
-namespace dbmm
-{
- // MacroMigrationDialogService
- MacroMigrationDialogService::MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext )
- :MacroMigrationDialogService_Base( _rxContext )
- {
- m_bNeedInitialization = true;
- }
-
- MacroMigrationDialogService::~MacroMigrationDialogService()
- {
- // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within an dtor,
- // so this virtual-method-call the base class does not work, we're already dead then...
- if (m_aDialog)
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if (m_aDialog)
- destroyDialog();
- }
- }
-
- Reference< XInterface > MacroMigrationDialogService::Create( const Reference< XComponentContext >& _rxContext )
- {
- return *(new MacroMigrationDialogService( _rxContext ) );
- }
-
- svt::OGenericUnoDialog::Dialog MacroMigrationDialogService::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
- {
- return svt::OGenericUnoDialog::Dialog(VclPtr<MacroMigrationDialog>::Create(VCLUnoHelper::GetWindow(rParent), m_aContext, m_xDocument));
- }
-
- Sequence< sal_Int8 > SAL_CALL MacroMigrationDialogService::getImplementationId()
- {
- return css::uno::Sequence<sal_Int8>();
- }
-
- OUString MacroMigrationDialogService::getImplementationName_static()
- {
- return "com.sun.star.comp.dbaccess.macromigration.MacroMigrationDialogService";
- }
-
- Sequence< OUString > MacroMigrationDialogService::getSupportedServiceNames_static()
- {
- Sequence< OUString > aServices { "com.sun.star.sdb.application.MacroMigrationWizard" };
- return aServices;
- }
-
- OUString SAL_CALL MacroMigrationDialogService::getImplementationName()
- {
- return getImplementationName_static();
- }
-
- Sequence< OUString > SAL_CALL MacroMigrationDialogService::getSupportedServiceNames()
- {
- return getSupportedServiceNames_static();
- }
-
- void SAL_CALL MacroMigrationDialogService::initialize( const Sequence< Any >& _rArguments )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bInitialized )
- throw AlreadyInitializedException( OUString(), *this );
-
- if ( _rArguments.getLength() != 1 )
- throw IllegalArgumentException(
- DBA_RES(STR_INVALID_NUMBER_ARGS),
- *this,
- 1
- );
-
- m_xDocument.set( _rArguments[0], UNO_QUERY );
- if ( !m_xDocument.is() )
- throw IllegalArgumentException(
- DBA_RES(STR_NO_DATABASE),
- *this,
- 1
- );
-
- Reference< XStorable > xDocStor( m_xDocument, UNO_QUERY_THROW );
- if ( xDocStor->isReadonly() )
- throw IllegalArgumentException(
- DBA_RES(STR_NOT_READONLY),
- *this,
- 1
- );
-
- m_bInitialized = true;
- }
-
- Reference< XPropertySetInfo > SAL_CALL MacroMigrationDialogService::getPropertySetInfo()
- {
- return createPropertySetInfo( getInfoHelper() );
- }
-
- ::cppu::IPropertyArrayHelper& SAL_CALL MacroMigrationDialogService::getInfoHelper()
- {
- return *getArrayHelper();
- }
-
- ::cppu::IPropertyArrayHelper* MacroMigrationDialogService::createArrayHelper( ) const
- {
- Sequence< Property > aProps;
- describeProperties( aProps );
- return new ::cppu::OPropertyArrayHelper( aProps );
- }
-} // 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
deleted file mode 100644
index 389da3c01802..000000000000
--- a/dbaccess/source/ext/macromigration/macromigrationwizard.hxx
+++ /dev/null
@@ -1,96 +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 "macromigrationdialog.hxx"
-
-#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-
-#include <comphelper/proparrhlp.hxx>
-#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:
- 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 > Create( const Reference< XComponentContext >& _rxContext );
- /// @throws RuntimeException
- static OUString getImplementationName_static();
- /// @throws RuntimeException
- static Sequence< OUString > getSupportedServiceNames_static();
-
- protected:
- virtual ~MacroMigrationDialogService() override;
-
- protected:
- virtual svt::OGenericUnoDialog::Dialog createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) 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
deleted file mode 100644
index 59369641b413..000000000000
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ /dev/null
@@ -1,1824 +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_types.hxx"
-#include "docinteraction.hxx"
-#include "migrationengine.hxx"
-#include "migrationerror.hxx"
-#include "migrationprogress.hxx"
-#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>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/document/XStorageBasedDocument.hpp>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
-#include <com/sun/star/script/DocumentDialogLibraryContainer.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <com/sun/star/document/XEventsSupplier.hpp>
-#include <com/sun/star/uri/UriReferenceFactory.hpp>
-#include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp>
-#include <com/sun/star/form/XFormsSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/script/XEventAttacherManager.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/io/WrongFormatException.hpp>
-#include <com/sun/star/script/XScriptEventsSupplier.hpp>
-#include <com/sun/star/io/XInputStreamProvider.hpp>
-
-#include <comphelper/documentinfo.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/storagehelper.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/ref.hxx>
-#include <unotools/sharedunocomponent.hxx>
-#include <xmlscript/xmldlg_imexp.hxx>
-
-#include <vector>
-#include <set>
-#include <iterator>
-
-#define DEFAULT_DOC_PROGRESS_RANGE 100000
-
-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::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::XComponentContext;
- using ::com::sun::star::sdb::XOfficeDatabaseDocument;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::ucb::XCommandProcessor;
- using ::com::sun::star::ucb::XContent;
- using ::com::sun::star::ucb::Command;
- using ::com::sun::star::task::XStatusIndicator;
- using ::com::sun::star::embed::XStorage;
- using ::com::sun::star::document::XStorageBasedDocument;
- using ::com::sun::star::embed::XTransactedObject;
- using ::com::sun::star::frame::XStorable;
- using ::com::sun::star::script::DocumentDialogLibraryContainer;
- using ::com::sun::star::script::DocumentScriptLibraryContainer;
- using ::com::sun::star::script::XStorageBasedLibraryContainer;
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::document::XEventsSupplier;
- using ::com::sun::star::container::XNameReplace;
- using com::sun::star::uri::UriReferenceFactory;
- using com::sun::star::uri::XUriReferenceFactory;
- using com::sun::star::uri::XVndSunStarScriptUrlReference;
- using ::com::sun::star::form::XFormsSupplier;
- using ::com::sun::star::drawing::XDrawPageSupplier;
- using ::com::sun::star::drawing::XDrawPagesSupplier;
- using ::com::sun::star::drawing::XDrawPage;
- using ::com::sun::star::drawing::XDrawPages;
- using ::com::sun::star::container::XIndexAccess;
- using ::com::sun::star::script::XEventAttacherManager;
- using ::com::sun::star::script::ScriptEventDescriptor;
- using ::com::sun::star::script::XLibraryContainerPassword;
- using ::com::sun::star::io::WrongFormatException;
- using ::com::sun::star::script::XScriptEventsSupplier;
- using ::com::sun::star::io::XInputStreamProvider;
- using ::com::sun::star::io::XInputStream;
-
- namespace ElementModes = ::com::sun::star::embed::ElementModes;
-
-// migration phases whose progresses are to be mixed into one progress
-#define PHASE_JAVASCRIPT 1
-#define PHASE_BEANSHELL 2
-#define PHASE_PYTHON 3
-#define PHASE_JAVA 4
-#define PHASE_BASIC 5
-#define PHASE_DIALOGS 6
-
- // SubDocument
- struct SubDocument
- {
- Reference< XCommandProcessor > xCommandProcessor;
- Reference< XModel > xDocument; // valid only temporarily
- OUString sHierarchicalName;
- SubDocumentType eType;
- size_t nNumber;
-
- SubDocument( const Reference< XCommandProcessor >& _rxCommandProcessor, const OUString& _rName,
- const SubDocumentType _eType, const size_t _nNumber )
- :xCommandProcessor( _rxCommandProcessor )
- ,xDocument()
- ,sHierarchicalName( _rName )
- ,eType( _eType )
- ,nNumber( _nNumber )
- {
- }
- };
-
- typedef std::vector< SubDocument > SubDocuments;
-
- // helper
- typedef ::utl::SharedUNOComponent< XStorage > SharedStorage;
-
- namespace
- {
- static const char sScriptsStorageName[] = "Scripts";
-
- OUString lcl_getScriptsSubStorageName( const ScriptType _eType )
- {
- switch ( _eType )
- {
- case eBeanShell: return "beanshell";
- case eJavaScript: return "javascript";
- case ePython: return "python"; // TODO: is this correct?
- case eJava: return "java";
- default:
- break;
- }
-
- OSL_FAIL( "lcl_getScriptsSubStorageName: illegal type!" );
- return OUString();
- }
-
- bool lcl_getScriptTypeFromLanguage( const OUString& _rLanguage, ScriptType& _out_rScriptType )
- {
- struct LanguageMapping
- {
- const char* pAsciiLanguage;
- const ScriptType eScriptType;
-
- LanguageMapping( const char* _pAsciiLanguage, const ScriptType _eScriptType )
- :pAsciiLanguage( _pAsciiLanguage )
- ,eScriptType( _eScriptType )
- {
- }
- };
- static const LanguageMapping aLanguageMapping[] =
- {
- LanguageMapping( "JavaScript", eJavaScript ),
- LanguageMapping( "BeanShell", eBeanShell ),
- LanguageMapping( "Java", eJava ),
- LanguageMapping( "Python", ePython ), // TODO: is this correct?
- LanguageMapping( "Basic", eBasic )
- };
- for (const LanguageMapping& i : aLanguageMapping)
- {
- if ( _rLanguage.equalsAscii( i.pAsciiLanguage ) )
- {
- _out_rScriptType = i.eScriptType;
- return true;
- }
- }
- OSL_FAIL( "lcl_getScriptTypeFromLanguage: unknown language!" );
- return false;
- }
-
- OUString lcl_getSubDocumentDescription( const SubDocument& _rDocument )
- {
- OUString sObjectName(
- DBA_RES(
- _rDocument.eType == eForm ? STR_FORM : STR_REPORT).
- replaceFirst("$name$", _rDocument.sHierarchicalName));
- return sObjectName;
- }
-
- Any lcl_executeCommand_throw( const Reference< XCommandProcessor >& _rxCommandProc,
- const sal_Char* _pAsciiCommand )
- {
- OSL_PRECOND( _rxCommandProc.is(), "lcl_executeCommand_throw: illegal object!" );
- if ( !_rxCommandProc.is() )
- return Any();
-
- Command aCommand;
- aCommand.Name = OUString::createFromAscii( _pAsciiCommand );
- return _rxCommandProc->execute(
- aCommand, _rxCommandProc->createCommandIdentifier(), nullptr );
- }
-
- OUString lcl_getMimeType_nothrow( const Reference< XCommandProcessor >& _rxContent )
- {
- OUString sMimeType;
- try
- {
- Reference< XContent > xContent( _rxContent, UNO_QUERY_THROW );
- sMimeType = xContent->getContentType();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- return sMimeType;
- }
-
- enum OpenDocResult
- {
- eOpenedDoc,
- eIgnoreDoc,
- eFailure
- };
-
- OpenDocResult lcl_loadSubDocument_nothrow( SubDocument& _rDocument,
- const Reference< XStatusIndicator >& _rxProgress, MigrationLog& _rLogger )
- {
- OSL_PRECOND( !_rDocument.xDocument.is(), "lcl_loadSubDocument_nothrow: already loaded!" );
-
- try
- {
- ::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "Hidden", true );
- aLoadArgs.put( "StatusIndicator", _rxProgress );
-
- Reference< XCommandProcessor > xCommandProcessor( _rDocument.xCommandProcessor, UNO_SET_THROW );
- Command aCommand;
- aCommand.Name = "openDesign";
- aCommand.Argument <<= aLoadArgs.getPropertyValues();
- Reference< XComponent > xDocComponent(
- xCommandProcessor->execute(
- aCommand, xCommandProcessor->createCommandIdentifier(), nullptr
- ),
- UNO_QUERY
- );
- OSL_ENSURE( xDocComponent.is(), "lcl_loadSubDocument_nothrow: no component loaded!" );
-
- _rDocument.xDocument.set( xDocComponent, UNO_QUERY_THROW );
- }
- catch( const Exception& )
- {
- Any aError( ::cppu::getCaughtException() );
-
- bool bCausedByNewStyleReport =
- ( _rDocument.eType == eReport )
- && ( aError.isExtractableTo( ::cppu::UnoType< WrongFormatException >::get() ) )
- && ( lcl_getMimeType_nothrow( _rDocument.xCommandProcessor ) == "application/vnd.sun.xml.report" );
-
- if ( bCausedByNewStyleReport )
- {
- _rLogger.logRecoverable( MigrationError(
- ERR_NEW_STYLE_REPORT,
- lcl_getSubDocumentDescription( _rDocument )
- ) );
- return eIgnoreDoc;
- }
- else
- {
- _rLogger.logFailure( MigrationError(
- ERR_OPENING_SUB_DOCUMENT_FAILED,
- lcl_getSubDocumentDescription( _rDocument ),
- aError
- ) );
- }
- }
- return _rDocument.xDocument.is() ? eOpenedDoc : eFailure;
- }
-
- bool lcl_unloadSubDocument_nothrow( SubDocument& _rDocument, MigrationLog& _rLogger )
- {
- bool bSuccess = false;
- Any aException;
- try
- {
- OSL_VERIFY( lcl_executeCommand_throw( _rDocument.xCommandProcessor, "close" ) >>= bSuccess );
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- }
-
- // log the failure, if any
- if ( !bSuccess )
- {
- _rLogger.logFailure( MigrationError(
- ERR_CLOSING_SUB_DOCUMENT_FAILED,
- lcl_getSubDocumentDescription( _rDocument ),
- aException
- ) );
- }
-
- _rDocument.xDocument.clear();
- return bSuccess;
- }
-
- bool lcl_commitStorage_nothrow( const Reference< XStorage >& _rxStorage )
- {
- try
- {
- Reference< XTransactedObject > xTrans( _rxStorage, UNO_QUERY_THROW );
- xTrans->commit();
- }
- catch( const Exception& )
- {
- return false;
- }
- return true;
- }
-
- bool lcl_commitDocumentStorage_nothrow( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger )
- {
- bool bSuccess = false;
- Any aException;
- try
- {
- Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY_THROW );
- Reference< XStorage > xDocStorage( xStorageDoc->getDocumentStorage(), UNO_SET_THROW );
- bSuccess = lcl_commitStorage_nothrow( xDocStorage );
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- }
-
- // log the failure, if any
- if ( !bSuccess )
- {
- _rLogger.logFailure( MigrationError(
- ERR_STORAGE_COMMIT_FAILED,
- ::comphelper::DocumentInfo::getDocumentTitle( _rxDocument ),
- aException
- ) );
- }
- return bSuccess;
- }
-
- bool lcl_storeDocument_nothrow( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger )
- {
- bool bSuccess = false;
- Any aException;
- try
- {
- Reference< XStorable > xStorable( _rxDocument, UNO_QUERY_THROW );
- xStorable->store();
- bSuccess = true;
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- }
-
- // log the failure, if any
- if ( !bSuccess )
- {
- _rLogger.logFailure( MigrationError(
- ERR_STORING_DATABASEDOC_FAILED,
- aException
- ) );
- }
- return bSuccess;
- }
-
- bool lcl_storeEmbeddedDocument_nothrow( const SubDocument& _rDocument )
- {
- try
- {
- lcl_executeCommand_throw( _rDocument.xCommandProcessor, "store" );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- return false;
- }
- return true;
- }
- }
-
- // DrawPageIterator
- class DrawPageIterator
- {
- public:
- explicit DrawPageIterator( const Reference< XModel >& _rxDocument )
- :m_nPageCount( 0 )
- ,m_nCurrentPage( 0 )
- {
- Reference< XDrawPageSupplier > xSingle( _rxDocument, UNO_QUERY );
- Reference< XDrawPagesSupplier > xMulti( _rxDocument, UNO_QUERY );
- if ( xSingle.is() )
- {
- m_xSinglePage.set( xSingle->getDrawPage(), UNO_SET_THROW );
- m_nPageCount = 1;
- }
- else if ( xMulti.is() )
- {
- m_xMultiPages.set( xMulti->getDrawPages(), UNO_SET_THROW );
- m_nPageCount = m_xMultiPages->getCount();
- }
- }
-
- bool hasMore() const
- {
- return m_nCurrentPage < m_nPageCount;
- }
-
- Reference< XDrawPage > next()
- {
- Reference< XDrawPage > xNextPage;
-
- if ( m_xSinglePage.is() )
- {
- xNextPage = m_xSinglePage;
- }
- else if ( m_xMultiPages.is() )
- {
- xNextPage.set( m_xMultiPages->getByIndex( m_nCurrentPage ), UNO_QUERY_THROW );
- }
- ++m_nCurrentPage;
- return xNextPage;
- }
-
- private:
- Reference< XDrawPage > m_xSinglePage;
- Reference< XDrawPages > m_xMultiPages;
- sal_Int32 m_nPageCount;
- sal_Int32 m_nCurrentPage;
- };
-
- // FormComponentScripts
- class FormComponentScripts
- {
- public:
- FormComponentScripts(
- const Reference< XInterface >& _rxComponent,
- const Reference< XEventAttacherManager >& _rxManager,
- const sal_Int32 _nIndex
- )
- :m_xComponent( _rxComponent )
- ,m_xManager( _rxManager )
- ,m_nIndex( _nIndex )
- {
- }
-
- Sequence< ScriptEventDescriptor > getEvents() const
- {
- return m_xManager->getScriptEvents( m_nIndex );
- }
-
- void setEvents( const Sequence< ScriptEventDescriptor >& _rEvents ) const
- {
- m_xManager->registerScriptEvents( m_nIndex, _rEvents );
- }
-
- const Reference< XInterface >& getComponent() const
- {
- return m_xComponent;
- }
-
- private:
- const Reference< XInterface > m_xComponent;
- const Reference< XEventAttacherManager > m_xManager;
- const sal_Int32 m_nIndex;
- };
-
- // FormComponentIterator
- class FormComponentIterator
- {
- public:
- explicit FormComponentIterator( const Reference< XIndexAccess >& _rxContainer )
- :m_xContainer( _rxContainer )
- ,m_xEventManager( _rxContainer, UNO_QUERY_THROW )
- ,m_nElementCount( _rxContainer->getCount() )
- ,m_nCurrentElement( 0 )
- {
- }
-
- bool hasMore() const
- {
- return m_nCurrentElement < m_nElementCount;
- }
-
- FormComponentScripts next()
- {
- FormComponentScripts aComponent(
- Reference< XInterface >( m_xContainer->getByIndex( m_nCurrentElement ), UNO_QUERY_THROW ),
- m_xEventManager,
- m_nCurrentElement
- );
- ++m_nCurrentElement;
- return aComponent;
- }
-
- private:
- const Reference< XIndexAccess > m_xContainer;
- const Reference< XEventAttacherManager > m_xEventManager;
- const sal_Int32 m_nElementCount;
- sal_Int32 m_nCurrentElement;
-
- };
-
- // ScriptsStorage - declaration
- /** a helper class which encapsulates access to the storages for Java/Script, BeanShell, and Python scripts,
- i.e. all script types which can be manipulated on storage level.
- */
- class ScriptsStorage
- {
- public:
- explicit ScriptsStorage( MigrationLog& _rLogger );
- ScriptsStorage( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger );
-
- /** determines whether the instance is valid, i.e. refers to a valid root storage
- for reading/storing scripts
- */
- bool isValid() const { return m_xScriptsStorage.is(); }
-
- /** binds the instance to a new document. Only to be called when the instance is not yet
- bound (i.e. isValid returns <FALSE/>).
- */
- void bind( const Reference< XModel >& _rxDocument );
-
- /// determines whether scripts of the given type are present
- bool hasScripts( const ScriptType _eType ) const;
-
- /// returns the root storage for the scripts of the given type
- SharedStorage
- getScriptsRoot( const ScriptType _eType ) const;
-
- /** returns the names of the elements in the "Scripts" storage
- */
- std::set< OUString >
- getElementNames() const;
-
- /** removes the sub storage for a given script type
- @precond
- the respective storage is empty
- @precond
- the ScriptsStorage instance was opened for writing
- */
- void removeScriptTypeStorage( const ScriptType _eType ) const;
-
- /** commits the changes at our XStorage object
- */
- bool commit();
-
- /** removes the "Scripts" sub storage from the given document's root storage
- @precond
- the "Scripts" storage is empty
- */
- static bool
- removeFromDocument( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger );
-
- private:
- MigrationLog& m_rLogger;
- SharedStorage m_xScriptsStorage;
- };
-
- // ScriptsStorage - implementation
- ScriptsStorage::ScriptsStorage( MigrationLog& _rLogger )
- :m_rLogger( _rLogger )
- ,m_xScriptsStorage()
- {
- }
-
- ScriptsStorage::ScriptsStorage( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger )
- :m_rLogger( _rLogger )
- ,m_xScriptsStorage()
- {
- bind( _rxDocument );
- }
-
- bool ScriptsStorage::commit()
- {
- return lcl_commitStorage_nothrow( m_xScriptsStorage );
- }
-
- void ScriptsStorage::bind( const Reference< XModel >& _rxDocument )
- {
- OSL_PRECOND( !isValid(), "ScriptsStorage:bind: did not bother, yet, to check whether this is allowed!" );
- try
- {
- Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY_THROW );
- Reference< XStorage > xDocStorage( xStorageDoc->getDocumentStorage(), UNO_SET_THROW );
-
- // the "Scripts" storage exist, or if it does not (yet) exist and we are in write mode
- // => open the storage
- if ( ( xDocStorage->hasByName( sScriptsStorageName )
- && xDocStorage->isStorageElement( sScriptsStorageName )
- )
- || !xDocStorage->hasByName( sScriptsStorageName )
- )
- {
- m_xScriptsStorage.set(
- xDocStorage->openStorageElement(
- sScriptsStorageName, ElementModes::READWRITE
- ),
- UNO_QUERY_THROW
- );
- }
- }
- catch( const Exception& )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_BIND_SCRIPT_STORAGE_FAILED,
- ::comphelper::DocumentInfo::getDocumentTitle( _rxDocument ),
- ::cppu::getCaughtException()
- ) );
- }
- }
-
- bool ScriptsStorage::hasScripts( const ScriptType _eType ) const
- {
- OSL_PRECOND( isValid(), "ScriptsStorage::hasScripts: illegal call!" );
- if ( !isValid() )
- return false;
-
- const OUString& rSubStorageName( lcl_getScriptsSubStorageName( _eType ) );
- return m_xScriptsStorage->hasByName( rSubStorageName )
- && m_xScriptsStorage->isStorageElement( rSubStorageName );
- }
-
- SharedStorage ScriptsStorage::getScriptsRoot( const ScriptType _eType ) const
- {
- SharedStorage xStorage;
- if ( isValid() )
- {
- xStorage.reset( m_xScriptsStorage->openStorageElement(
- lcl_getScriptsSubStorageName( _eType ), ElementModes::READWRITE
- ) );
- }
- return xStorage;
- }
-
- std::set< OUString > ScriptsStorage::getElementNames() const
- {
- Sequence< OUString > aElementNames;
- if ( isValid() )
- aElementNames = m_xScriptsStorage->getElementNames();
-
- std::set< OUString > aNames;
- std::copy(
- aElementNames.begin(),
- aElementNames.end(),
- std::insert_iterator< std::set< OUString > >( aNames, aNames.end() )
- );
- return aNames;
- }
-
- void ScriptsStorage::removeScriptTypeStorage( const ScriptType _eType ) const
- {
- OUString sSubStorageName( lcl_getScriptsSubStorageName( _eType ) );
- if ( m_xScriptsStorage->hasByName( sSubStorageName ) )
- m_xScriptsStorage->removeElement( sSubStorageName );
- }
-
- bool ScriptsStorage::removeFromDocument( const Reference< XModel >& _rxDocument, MigrationLog& _rLogger )
- {
- try
- {
- Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY_THROW );
- Reference< XStorage > xDocStorage( xStorageDoc->getDocumentStorage(), UNO_SET_THROW );
- xDocStorage->removeElement( sScriptsStorageName );
- }
- catch( const Exception& )
- {
- _rLogger.logFailure( MigrationError(
- ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
- ::comphelper::DocumentInfo::getDocumentTitle( _rxDocument ),
- ::cppu::getCaughtException()
- ) ) ;
- return false;
- }
- return true;
- }
-
- // ProgressDelegator
- class ProgressDelegator : public IProgressConsumer
- {
- public:
- ProgressDelegator( IMigrationProgress& _rDelegator,
- const OUString& _rObjectName,
- const OUString& _rAction
- )
- :m_rDelegator( _rDelegator )
- ,m_sObjectName( _rObjectName )
- ,m_sAction( _rAction )
- {
- }
- virtual ~ProgressDelegator()
- {
- }
-
- // IProgressConsumer
- virtual void start( sal_uInt32 _nRange ) override
- {
- m_rDelegator.startObject( m_sObjectName, m_sAction, _nRange );
- }
- virtual void advance( sal_uInt32 _nValue ) override
- {
- m_rDelegator.setObjectProgressValue( _nValue );
- }
- virtual void end() override
- {
- m_rDelegator.endObject();
- }
-
- private:
- IMigrationProgress& m_rDelegator;
- OUString m_sObjectName;
- OUString m_sAction;
- };
-
- // PhaseGuard
- class PhaseGuard
- {
- public:
- explicit PhaseGuard( ProgressMixer& _rMixer )
- :m_rMixer( _rMixer )
- {
- }
-
- ~PhaseGuard()
- {
- m_rMixer.endPhase();
- }
-
- void start( const PhaseID _nID, const sal_uInt32 _nPhaseRange )
- {
- m_rMixer.startPhase( _nID, _nPhaseRange );
- }
-
- private:
- ProgressMixer& m_rMixer;
- };
-
- // MigrationEngine_Impl - declaration
- class MigrationEngine_Impl
- {
- public:
- MigrationEngine_Impl(
- const Reference<XComponentContext>& _rContext,
- const Reference< XOfficeDatabaseDocument >& _rxDocument,
- IMigrationProgress& _rProgress,
- MigrationLog& _rLogger
- );
-
- size_t getFormCount() const { return m_nFormCount; }
- size_t getReportCount()const { return m_nReportCount; }
- bool migrateAll();
-
- private:
- Reference<XComponentContext> m_aContext;
- const Reference< XOfficeDatabaseDocument > m_xDocument;
- const Reference< XModel > m_xDocumentModel;
- IMigrationProgress& m_rProgress;
- MigrationLog& m_rLogger;
- mutable DocumentID m_nCurrentDocumentID;
- SubDocuments m_aSubDocs;
- size_t m_nFormCount;
- size_t m_nReportCount;
-
- private:
- /** collects a description of all sub documents of our database document
-
- @return
- <TRUE/> if and only if collecting the documents was successful
- */
- bool impl_collectSubDocuments_nothrow();
-
- /** migrates the macros/scripts of the given sub document
- */
- bool impl_handleDocument_nothrow( const SubDocument& _rDocument ) const;
-
- /** checks the structure of the 'Scripts' folder of a sub document
- for unknown elements
-
- @return
- <TRUE/> if and only if the 'Scripts' folder contains known elements only.
- */
- bool impl_checkScriptStorageStructure_nothrow( const SubDocument& _rDocument ) const;
-
- /** migrates the scripts of the given "storage-based" script type
- */
- bool impl_migrateScriptStorage_nothrow(
- const SubDocument& _rDocument,
- const ScriptType _eScriptType,
- ProgressMixer& _rProgress,
- const PhaseID _nPhaseID
- ) const;
-
- /** migrates the content of the given "container based" libraries (Basic/Dialogs)
- */
- bool impl_migrateContainerLibraries_nothrow(
- const SubDocument& _rDocument,
- const ScriptType _eScriptType,
- ProgressMixer& _rProgress,
- const PhaseID _nPhaseID
- ) const;
-
- /** adjusts the events for the given dialog/element, taking into account the new names
- of the moved libraries
- */
- void impl_adjustDialogElementEvents_throw(
- const Reference< XInterface >& _rxElement
- ) const;
-
- /** adjusts the events in the given dialog, and its controls, taking into account the new names
- of the moved libraries
- */
- bool impl_adjustDialogEvents_nothrow(
- Any& _inout_rDialogLibraryElement,
- const OUString& _rDocName,
- const OUString& _rDialogLibName,
- const OUString& _rDialogName
- ) const;
-
- /** adjust the document-events which refer to macros/scripts in the document, taking into
- account the new names of the moved libraries
- */
- void impl_adjustDocumentEvents_nothrow(
- const SubDocument& _rDocument
- ) const;
-
- /** adjusts the script references bound to form component events
- */
- void impl_adjustFormComponentEvents_nothrow(
- const SubDocument& _rDocument
- ) const;
-
- /** adjusts the script references for the elements of the given form component container
- */
- void impl_adjustFormComponentEvents_throw(
- const Reference< XIndexAccess >& _rxComponentContainer
- ) const;
-
- /** adjusts the library name in the given script URL, so that it reflects
- the new name of the library
-
- @return <TRUE/>
- if and only if adjustments to the script code have been made
- */
- bool impl_adjustScriptLibrary_nothrow(
- const OUString& _rScriptType,
- OUString& _inout_rScriptCode
- ) const;
-
- bool impl_adjustScriptLibrary_nothrow( Any& _inout_rScriptDescriptor ) const;
- bool impl_adjustScriptLibrary_nothrow( ScriptEventDescriptor& _inout_rScriptEvent ) const;
-
- /** asks the user for a password for the given library, and unprotects the library
-
- @return <TRUE/>
- if and only if the library could be successfully unprotected
- */
- bool impl_unprotectPasswordLibrary_throw(
- const Reference< XLibraryContainerPassword >& _rxPasswordManager,
- const ScriptType _eScriptType,
- const OUString& _rLibraryName
- ) const;
- };
-
- // MigrationEngine_Impl - implementation
- MigrationEngine_Impl::MigrationEngine_Impl( const Reference<XComponentContext>& _rContext,
- const Reference< XOfficeDatabaseDocument >& _rxDocument, IMigrationProgress& _rProgress, MigrationLog& _rLogger )
- :m_aContext( _rContext )
- ,m_xDocument( _rxDocument )
- ,m_xDocumentModel( _rxDocument, UNO_QUERY_THROW )
- ,m_rProgress( _rProgress )
- ,m_rLogger( _rLogger )
- ,m_nCurrentDocumentID( - 1 )
- ,m_aSubDocs()
- ,m_nFormCount( 0 )
- ,m_nReportCount( 0 )
- {
- OSL_VERIFY( impl_collectSubDocuments_nothrow() );
- }
-
- bool MigrationEngine_Impl::migrateAll()
- {
- if ( m_aSubDocs.empty() )
- {
- OSL_FAIL( "MigrationEngine_Impl::migrateAll: no forms/reports found!" );
- // The whole migration wizard is not expected to be called when there are no forms/reports
- // with macros, not to mention when there are no forms/reports at all.
- return false;
- }
-
- // initialize global progress
- sal_Int32 nOverallRange( m_aSubDocs.size() );
- OUString sProgressSkeleton(
- DBA_RES( STR_OVERALL_PROGRESS).
- replaceFirst("$overall$", OUString::number(nOverallRange)));
-
- m_rProgress.start( nOverallRange );
-
- sal_Int32 nOverallProgressValue = 1;
- for (auto const& subDoc : m_aSubDocs)
- {
- // update overall progress text
- OUString sOverallProgress(
- sProgressSkeleton.replaceFirst("$current$",
- OUString::number(nOverallProgressValue)));
- m_rProgress.setOverallProgressText( sOverallProgress );
-
- // migrate document
- if ( !impl_handleDocument_nothrow(subDoc) )
- return false;
-
- // update overall progress value
- m_rProgress.setOverallProgressValue( nOverallProgressValue );
- ++nOverallProgressValue;
- }
-
- // commit the root storage of the database document, for all changes made so far to take effect
- if ( !lcl_commitDocumentStorage_nothrow( m_xDocumentModel, m_rLogger ) )
- return false;
-
- // save the document
- if ( !lcl_storeDocument_nothrow( m_xDocumentModel, m_rLogger ) )
- return false;
-
- return true;
- }
-
- namespace
- {
- void lcl_collectHierarchicalElementNames_throw(
- const Reference< XNameAccess >& _rxContainer, const OUString& _rContainerLoc,
- SubDocuments& _out_rDocs, const SubDocumentType _eType, size_t& _io_counter )
- {
- const OUString sHierarhicalBase(
- _rContainerLoc.isEmpty() ? OUString() :
- OUString( _rContainerLoc + "/" ) );
-
- const Sequence< OUString > aElementNames( _rxContainer->getElementNames() );
- for ( auto const & elementName : aElementNames )
- {
- Any aElement( _rxContainer->getByName( elementName ) );
- OUString sElementName( sHierarhicalBase + elementName );
-
- Reference< XNameAccess > xSubContainer( aElement, UNO_QUERY );
- if ( xSubContainer.is() )
- {
- lcl_collectHierarchicalElementNames_throw( xSubContainer, sElementName, _out_rDocs, _eType, _io_counter );
- }
- else
- {
- Reference< XCommandProcessor > xCommandProcessor( aElement, UNO_QUERY );
- OSL_ENSURE( xCommandProcessor.is(), "lcl_collectHierarchicalElementNames_throw: no container, and no command processor? What *is* it, then?!" );
- if ( xCommandProcessor.is() )
- {
- _out_rDocs.emplace_back( xCommandProcessor, sElementName, _eType, ++_io_counter );
- }
- }
- }
- }
- }
-
- bool MigrationEngine_Impl::impl_collectSubDocuments_nothrow()
- {
- OSL_PRECOND( m_xDocument.is(), "MigrationEngine_Impl::impl_collectSubDocuments_nothrow: invalid document!" );
- if ( !m_xDocument.is() )
- return false;
-
- try
- {
- Reference< XNameAccess > xDocContainer( m_xDocument->getFormDocuments(), UNO_SET_THROW );
- m_nFormCount = 0;
- lcl_collectHierarchicalElementNames_throw( xDocContainer, OUString(), m_aSubDocs, eForm, m_nFormCount );
-
- xDocContainer.set( m_xDocument->getReportDocuments(), UNO_SET_THROW );
- m_nReportCount = 0;
- lcl_collectHierarchicalElementNames_throw( xDocContainer, OUString(), m_aSubDocs, eReport, m_nReportCount );
- }
- catch( const Exception& )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_COLLECTING_DOCUMENTS_FAILED,
- ::cppu::getCaughtException()
- ) );
- return false;
- }
- return true;
- }
-
- bool MigrationEngine_Impl::impl_handleDocument_nothrow( const SubDocument& _rDocument ) const
- {
- OSL_ENSURE( m_nCurrentDocumentID == -1,
- "MigrationEngine_Impl::impl_handleDocument_nothrow: there already is a current document!");
- m_nCurrentDocumentID = m_rLogger.startedDocument( _rDocument.eType, _rDocument.sHierarchicalName );
-
- // start the progress
- OUString sObjectName( lcl_getSubDocumentDescription( _rDocument ) );
- m_rProgress.startObject( sObjectName, OUString(), DEFAULT_DOC_PROGRESS_RANGE );
-
- // load the document
- rtl::Reference pStatusIndicator( new ProgressCapture( sObjectName, m_rProgress ) );
- SubDocument aSubDocument( _rDocument );
- OpenDocResult eResult = lcl_loadSubDocument_nothrow( aSubDocument, pStatusIndicator.get(), m_rLogger );
- if ( eResult != eOpenedDoc )
- {
- pStatusIndicator->dispose();
- m_rProgress.endObject();
- m_rLogger.finishedDocument( m_nCurrentDocumentID );
- m_nCurrentDocumentID = -1;
- return ( eResult == eIgnoreDoc );
- }
-
- // migrate the libraries
- ProgressDelegator aDelegator(m_rProgress, sObjectName, DBA_RES(STR_MIGRATING_LIBS));
- ProgressMixer aProgressMixer( aDelegator );
- aProgressMixer.registerPhase( PHASE_JAVASCRIPT, 1 );
- aProgressMixer.registerPhase( PHASE_BEANSHELL, 1 );
- aProgressMixer.registerPhase( PHASE_PYTHON, 1 );
- aProgressMixer.registerPhase( PHASE_JAVA, 1 );
- aProgressMixer.registerPhase( PHASE_BASIC, 5 );
- // more weight than the others, assuming that usually, there are many more Basic macros than any other scripts
- aProgressMixer.registerPhase( PHASE_DIALOGS, 1 );
-
- bool bSuccess = impl_checkScriptStorageStructure_nothrow( aSubDocument );
-
- // migrate storage-based script libraries (which can be handled by mere storage operations)
- bSuccess = bSuccess
- && impl_migrateScriptStorage_nothrow( aSubDocument, eJavaScript, aProgressMixer, PHASE_JAVASCRIPT )
- && impl_migrateScriptStorage_nothrow( aSubDocument, eBeanShell, aProgressMixer, PHASE_BEANSHELL )
- && impl_migrateScriptStorage_nothrow( aSubDocument, ePython, aProgressMixer, PHASE_PYTHON )
- && impl_migrateScriptStorage_nothrow( aSubDocument, eJava, aProgressMixer, PHASE_JAVA );
-
- // migrate Basic and dialog libraries
- bSuccess = bSuccess
- && impl_migrateContainerLibraries_nothrow( aSubDocument, eBasic, aProgressMixer, PHASE_BASIC )
- && impl_migrateContainerLibraries_nothrow( aSubDocument, eDialog, aProgressMixer, PHASE_DIALOGS );
- // order matters: First Basic scripts, then dialogs. So we can adjust references from the latter
- // to the former
-
- // adjust the events in the document
- // (note that errors are ignored here - failure to convert a script reference
- // is not considered a critical error)
- if ( bSuccess )
- {
- impl_adjustDocumentEvents_nothrow( aSubDocument );
- impl_adjustFormComponentEvents_nothrow( aSubDocument );
- }
-
- // clean up
- // store the sub document, including removal of the (now obsolete) "Scripts" sub folder
- if ( m_rLogger.movedAnyLibrary( m_nCurrentDocumentID ) )
- {
- bSuccess = bSuccess
- && ScriptsStorage::removeFromDocument( aSubDocument.xDocument, m_rLogger )
- && lcl_commitDocumentStorage_nothrow( aSubDocument.xDocument, m_rLogger )
- && lcl_storeEmbeddedDocument_nothrow( aSubDocument );
- }
-
- // unload in any case, even if we were not successful
- bSuccess = lcl_unloadSubDocument_nothrow( aSubDocument, m_rLogger )
- && bSuccess;
-
- pStatusIndicator->dispose();
-
- // end the progress, just in case the ProgressCapture didn't receive the XStatusIndicator::end event
- m_rProgress.endObject();
-
- m_rLogger.finishedDocument( m_nCurrentDocumentID );
- m_nCurrentDocumentID = -1;
- return bSuccess;
- }
-
- namespace
- {
- OUString lcl_createTargetLibName( const SubDocument& _rDocument,
- const OUString& _rSourceLibName, const Reference< XNameAccess >& _rxTargetContainer )
- {
- // The new library name is composed from the prefix, the base name, and the old library name.
- const OUString sPrefix = (_rDocument.eType == eForm)?OUString("Form_"): OUString("Report_");
-
- OUString sBaseName( _rDocument.sHierarchicalName.copy(
- _rDocument.sHierarchicalName.lastIndexOf( '/' ) + 1 ) );
- // Normalize this name. In our current storage implementation (and script containers in a document
- // are finally mapped to sub storages of the document storage), not all characters are allowed.
- // The bug requesting to change this is #i95409#.
- // Unfortunately, the storage implementation does not complain if you use invalid characters/names, but instead
- // it silently accepts them, and produces garbage in the file (#i95408).
- // So, until especially the former is fixed, we need to strip all invalid characters from the name.
- // #i95865#
-
- // The general idea is to replace invalid characters with '_'. However, since "valid" essentially means
- // ASCII only, this implies that for a lot of languages, we would simply replace everything with '_',
- // which of course is not desired.
- // So, we use a heuristics: If the name contains at most 3 invalid characters, and as many valid as invalid
- // characters, then we use the replacement. Otherwise, we just use a unambiguous number for the sub document.
- sal_Int32 nValid=0, nInvalid=0;
- const sal_Unicode* pBaseName = sBaseName.getStr();
- const sal_Int32 nBaseNameLen = sBaseName.getLength();
- for ( sal_Int32 i=0; i<nBaseNameLen; ++i )
- {
- if ( ::comphelper::OStorageHelper::IsValidZipEntryFileName( pBaseName + i, 1, false ) )
- ++nValid;
- else
- ++nInvalid;
- }
- if ( ( nInvalid <= 3 ) && ( nInvalid * 2 <= nValid ) )
- { // not "too many" invalid => replace them
- OUStringBuffer aReplacement;
- aReplacement.ensureCapacity( nBaseNameLen );
- aReplacement.append( sBaseName );
- const sal_Unicode* pReplacement = aReplacement.getStr();
- for ( sal_Int32 i=0; i<nBaseNameLen; ++i )
- {
- if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( pReplacement + i, 1, false ) )
- aReplacement[i] = '_';
- }
- sBaseName = aReplacement.makeStringAndClear();
-
- OUString sTargetName( sPrefix + sBaseName + "_" + _rSourceLibName );
- if ( !_rxTargetContainer->hasByName( sTargetName ) )
- return sTargetName;
- }
-
- // "too many" invalid characters, or the name composed with the base name was already used.
- // (The latter is valid, since there can be multiple sub documents with the same base name,
- // in different levels in the hierarchy.)
- // In this case, just use the unambiguous sub document number.
- return sPrefix + OUString::number( _rDocument.nNumber ) + "_" + _rSourceLibName;
- }
- }
-
- bool MigrationEngine_Impl::impl_checkScriptStorageStructure_nothrow( const SubDocument& _rDocument ) const
- {
- OSL_PRECOND( _rDocument.xDocument.is(), "MigrationEngine_Impl::impl_checkScriptStorageStructure_nothrow: invalid document!" );
- if ( !_rDocument.xDocument.is() )
- return false;
-
- try
- {
- // the root storage of the document whose scripts are to be migrated
- ScriptsStorage aDocStorage( _rDocument.xDocument, m_rLogger );
- if ( !aDocStorage.isValid() )
- { // no scripts at all, or no scripts of the given type
- return !m_rLogger.hadFailure();
- }
- std::set< OUString > aElementNames( aDocStorage.getElementNames() );
-
- const ScriptType aKnownStorageBasedTypes[] = {
- eBeanShell, eJavaScript, ePython, eJava
- };
- for (ScriptType aKnownStorageBasedType : aKnownStorageBasedTypes)
- aElementNames.erase( lcl_getScriptsSubStorageName( aKnownStorageBasedType ) );
-
- if ( !aElementNames.empty() )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_UNKNOWN_SCRIPT_FOLDER,
- lcl_getSubDocumentDescription( _rDocument ),
- *aElementNames.begin()
- ) );
- return false;
- }
- }
- catch( const Exception& )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
- lcl_getSubDocumentDescription( _rDocument ),
- ::cppu::getCaughtException()
- ) );
- return false;
- }
- return true;
- }
-
- bool MigrationEngine_Impl::impl_migrateScriptStorage_nothrow( const SubDocument& _rDocument,
- const ScriptType _eScriptType, ProgressMixer& _rProgress, const PhaseID _nPhaseID ) const
- {
- OSL_PRECOND( _rDocument.xDocument.is(), "MigrationEngine_Impl::impl_migrateScriptStorage_nothrow: invalid document!" );
- if ( !_rDocument.xDocument.is() )
- return false;
-
- ScriptsStorage aDatabaseScripts( m_rLogger );
- // the scripts of our complete database document - created on demand only
- SharedStorage xTargetStorage;
- // the target for moving the scripts storages - created on demand only
-
- PhaseGuard aPhase( _rProgress );
- bool bSuccess = false;
- Any aException;
- try
- {
- // the root storage of the document whose scripts are to be migrated
- ScriptsStorage aDocStorage( _rDocument.xDocument, m_rLogger );
- if ( !aDocStorage.isValid()
- || !aDocStorage.hasScripts( _eScriptType )
- )
- {
- // no scripts at all, or no scripts of the given type
- _rProgress.startPhase( _nPhaseID, 1 );
- _rProgress.endPhase();
- return !m_rLogger.hadFailure();
- }
-
- SharedStorage xScriptsRoot( aDocStorage.getScriptsRoot( _eScriptType ) );
- if ( !xScriptsRoot.is() )
- throw RuntimeException("internal error");
-
- // loop through the script libraries
- Sequence< OUString > aStorageElements( xScriptsRoot->getElementNames() );
- aPhase.start( _nPhaseID, aStorageElements.getLength() );
-
- for ( const OUString* element = aStorageElements.getConstArray();
- element != aStorageElements.getConstArray() + aStorageElements.getLength();
- ++element
- )
- {
- bool bIsScriptLibrary = xScriptsRoot->isStorageElement( *element );
- OSL_ENSURE( bIsScriptLibrary,
- "MigrationEngine_Impl::impl_migrateScriptStorage_nothrow: warning: unknown scripts storage structure!" );
- // we cannot handle this. We would need to copy this stream to the respective scripts storage
- // of the database document, but we cannot guarantee that the name is not used, yet, and we cannot
- // simply rename the thing.
- if ( !bIsScriptLibrary )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
- lcl_getSubDocumentDescription( _rDocument ),
- getScriptTypeDisplayName( _eScriptType ),
- *element
- ) );
- return false;
- }
-
- // ensure we have access to the DBDoc's scripts storage
- if ( !aDatabaseScripts.isValid() )
- { // not needed 'til now
- aDatabaseScripts.bind( m_xDocumentModel );
- if ( aDatabaseScripts.isValid() )
- xTargetStorage = aDatabaseScripts.getScriptsRoot( _eScriptType );
-
- if ( !xTargetStorage.is() )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
- getScriptTypeDisplayName( _eScriptType )
- ) );
- return false;
- }
- }
-
- // move the library to the DBDoc's scripts library, under the new name
- OUString sNewLibName( lcl_createTargetLibName( _rDocument, *element, xTargetStorage.getTyped().get() ) );
- xScriptsRoot->moveElementTo( *element, xTargetStorage, sNewLibName );
-
- // log the fact that we moved the library
- m_rLogger.movedLibrary( m_nCurrentDocumentID, _eScriptType, *element, sNewLibName );
-
- // progress
- _rProgress.advancePhase( element - aStorageElements.getConstArray() );
- }
-
- // commit the storages, so the changes we made persist
- if ( !lcl_commitStorage_nothrow( xScriptsRoot )
- || ( xTargetStorage.is() && !lcl_commitStorage_nothrow( xTargetStorage ) )
- )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
- getScriptTypeDisplayName( _eScriptType ),
- lcl_getSubDocumentDescription( _rDocument )
- ) );
- return false;
- }
-
- // now that the concrete scripts storage does not have any elements anymore,
- // remove it
- xScriptsRoot.reset(nullptr); // need to reset the storage to be allowed to remove it
- aDocStorage.removeScriptTypeStorage( _eScriptType );
-
- // done so far
- bSuccess = aDocStorage.commit()
- && aDatabaseScripts.commit();
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- bSuccess = false;
- }
-
- // log the error, if any
- if ( !bSuccess )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
- getScriptTypeDisplayName( _eScriptType ),
- lcl_getSubDocumentDescription( _rDocument ),
- aException
- ) );
- }
-
- return bSuccess;
- }
-
- bool MigrationEngine_Impl::impl_migrateContainerLibraries_nothrow( const SubDocument& _rDocument,
- const ScriptType _eScriptType, ProgressMixer& _rProgress, const PhaseID _nPhaseID ) const
- {
- OSL_PRECOND( ( _eScriptType == eBasic ) || ( _eScriptType == eDialog ),
- "MigrationEngine_Impl::impl_migrateContainerLibraries_nothrow: illegal script type!" );
-
- bool bSuccess = false;
- PhaseGuard aPhase( _rProgress );
- Any aException;
- do // artificial loop for flow control only
- {
- try
- {
- // access library container of the sub document
- Reference< XEmbeddedScripts > xSubDocScripts( _rDocument.xDocument, UNO_QUERY );
- if ( !xSubDocScripts.is() )
- { // no script support in the sub document -> nothing to migrate
- // (though ... this is suspicious, at least ...)
- bSuccess = true;
- break;
- }
-
- Reference< XStorageBasedLibraryContainer > xSourceLibraries(
- _eScriptType == eBasic ? xSubDocScripts->getBasicLibraries() : xSubDocScripts->getDialogLibraries(),
- UNO_SET_THROW
- );
- Reference< XLibraryContainerPassword > xSourcePasswords( xSourceLibraries, UNO_QUERY );
- OSL_ENSURE( xSourcePasswords.is(),
- "MigrationEngine_Impl::impl_migrateContainerLibraries_nothrow: suspicious: no password management for the source libraries!" );
-
- Sequence< OUString > aSourceLibNames( xSourceLibraries->getElementNames() );
- aPhase.start( _nPhaseID, aSourceLibNames.getLength() );
-
- if ( !xSourceLibraries->hasElements() )
- {
- bSuccess = true;
- break;
- }
-
- // create library containers for the document - those will be the target for the migration
- Reference< XStorageBasedDocument > xStorageDoc( m_xDocument, UNO_QUERY_THROW );
- Reference< XStorageBasedLibraryContainer > xTargetLibraries;
- if ( _eScriptType == eBasic )
- {
- xTargetLibraries.set( DocumentScriptLibraryContainer::create(
- m_aContext, xStorageDoc ), UNO_SET_THROW );
- }
- else
- {
- xTargetLibraries.set( DocumentDialogLibraryContainer::create(
- m_aContext, xStorageDoc ), UNO_SET_THROW );
- }
-
- // copy all libs to the target, with potentially renaming them
- const OUString* pSourceLibBegin = aSourceLibNames.getConstArray();
- const OUString* pSourceLibEnd = pSourceLibBegin + aSourceLibNames.getLength();
- for ( const OUString* pSourceLibName = pSourceLibBegin;
- pSourceLibName != pSourceLibEnd;
- ++pSourceLibName
- )
- {
- // if the library is password-protected, ask the user to unprotect it
- if ( xSourcePasswords.is()
- && xSourcePasswords->isLibraryPasswordProtected( *pSourceLibName )
- && !xSourcePasswords->isLibraryPasswordVerified( *pSourceLibName )
- )
- {
- if ( !impl_unprotectPasswordLibrary_throw( xSourcePasswords, _eScriptType, *pSourceLibName ) )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_PASSWORD_VERIFICATION_FAILED,
- _rDocument.sHierarchicalName,
- getScriptTypeDisplayName( _eScriptType ),
- *pSourceLibName
- ) );
- return false;
- }
- }
-
- OUString sNewLibName( lcl_createTargetLibName( _rDocument, *pSourceLibName, xTargetLibraries.get() ) );
-
- if ( xSourceLibraries->isLibraryLink( *pSourceLibName ) )
- {
- // just re-create the link in the target library
- xTargetLibraries->createLibraryLink(
- sNewLibName,
- xSourceLibraries->getLibraryLinkURL( *pSourceLibName ),
- xSourceLibraries->isLibraryReadOnly( *pSourceLibName )
- );
- }
- else
- {
- if ( !xSourceLibraries->isLibraryLoaded( *pSourceLibName ) )
- xSourceLibraries->loadLibrary( *pSourceLibName );
-
- // copy the content of this particular library
- Reference< XNameAccess > xSourceLib( xSourceLibraries->getByName( *pSourceLibName ), UNO_QUERY_THROW );
- Reference< XNameContainer > xTargetLib( xTargetLibraries->createLibrary( sNewLibName ), UNO_SET_THROW );
-
- const Sequence< OUString > aLibElementNames( xSourceLib->getElementNames() );
- for ( auto const & sourceElementName : aLibElementNames )
- {
- Any aElement = xSourceLib->getByName( sourceElementName );
- OSL_ENSURE( aElement.hasValue(),
- "MigrationEngine_Impl::impl_migrateContainerLibraries_nothrow: invalid (empty) lib element!" );
-
- // if this is a dialog, adjust the references to scripts
- if ( _eScriptType == eDialog )
- {
- impl_adjustDialogEvents_nothrow( aElement, lcl_getSubDocumentDescription( _rDocument ),
- *pSourceLibName, sourceElementName );
- }
-
- xTargetLib->insertByName( sourceElementName, aElement );
- }
-
- // transfer the read-only flag
- xTargetLibraries->setLibraryReadOnly(
- sNewLibName, xSourceLibraries->isLibraryReadOnly( *pSourceLibName ) );
- }
-
- // remove the source lib
- xSourceLibraries->removeLibrary( *pSourceLibName );
-
- // tell the logger
- m_rLogger.movedLibrary( m_nCurrentDocumentID, _eScriptType, *pSourceLibName, sNewLibName );
-
- // tell the progress
- _rProgress.advancePhase( pSourceLibName - pSourceLibBegin );
- }
-
- // clean up
- xSourceLibraries->storeLibraries();
-
- xTargetLibraries->storeLibraries();
- Reference< XStorage > xTargetRoot( xTargetLibraries->getRootLocation(), UNO_QUERY_THROW );
- bSuccess = lcl_commitStorage_nothrow( xTargetRoot );
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- bSuccess = false;
- }
- } while ( false );
-
- // log the error, if any
- if ( !bSuccess )
- {
- m_rLogger.logFailure( MigrationError(
- ERR_GENERAL_MACRO_MIGRATION_FAILURE,
- lcl_getSubDocumentDescription( _rDocument ),
- aException
- ) );
- }
-
- return bSuccess;
- }
-
- bool MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow( const OUString& _rScriptType,
- OUString& _inout_rScriptCode ) const
- {
- OSL_PRECOND( !_inout_rScriptCode.isEmpty(), "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: invalid script!" );
- if ( _inout_rScriptCode.isEmpty() )
- return false;
-
- bool bSuccess = false;
- Any aException;
- try
- {
- if ( _rScriptType != "Script" || _rScriptType.isEmpty() )
- {
- OSL_FAIL(
- "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: no or unknown script type!" );
- m_rLogger.logRecoverable( MigrationError(
- ERR_UNKNOWN_SCRIPT_TYPE,
- _rScriptType
- ) );
- return false;
- }
-
- // analyze the script URI
- Reference< XUriReferenceFactory > xUriRefFac = UriReferenceFactory::create( m_aContext );
- Reference< XVndSunStarScriptUrlReference > xUri( xUriRefFac->parse( _inout_rScriptCode ), UNO_QUERY_THROW );
-
- OUString sScriptLanguage = xUri->getParameter( "language" );
- ScriptType eScriptType = eBasic;
- if ( !lcl_getScriptTypeFromLanguage( sScriptLanguage, eScriptType ) )
- {
- OSL_FAIL(
- "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: unknown script language!" );
- m_rLogger.logRecoverable( MigrationError(
- ERR_UNKNOWN_SCRIPT_LANGUAGE,
- sScriptLanguage
- ) );
- return false;
- }
-
- OUString sLocation = xUri->getParameter( "location" );
- if ( sLocation != "document" )
- {
- // only document libraries must be migrated, of course
- return false;
- }
-
- OUString sScriptName = xUri->getName();
- sal_Int32 nLibModuleSeparator = sScriptName.indexOf( '.' );
- if ( nLibModuleSeparator < 0 )
- {
- OSL_FAIL(
- "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: invalid/unknown location format!" );
- m_rLogger.logRecoverable( MigrationError(
- ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
- sScriptName
- ) );
- return false;
- }
-
- // replace the library name
- OUString sLibrary = sScriptName.copy( 0, nLibModuleSeparator );
- OUString sNewLibName = m_rLogger.getNewLibraryName(
- m_nCurrentDocumentID, eScriptType, sLibrary );
- OSL_ENSURE( sLibrary != sNewLibName,
- "MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow: a library which has not been migrated?" );
-
- xUri->setName( sNewLibName + sScriptName.copy( nLibModuleSeparator ) );
-
- // update the new script URL
- _inout_rScriptCode = xUri->getUriReference();
- bSuccess = true;
- }
- catch( const Exception& )
- {
- aException = ::cppu::getCaughtException();
- bSuccess = false;
- }
-
- // log the failure, if any
- if ( !bSuccess )
- {
- m_rLogger.logRecoverable( MigrationError(
- ERR_SCRIPT_TRANSLATION_FAILURE,
- _rScriptType,
- _inout_rScriptCode,
- aException
- ) );
- }
-
- return bSuccess;
- }
-
- bool MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow( ScriptEventDescriptor& _inout_rScriptEvent ) const
- {
- if ( !(_inout_rScriptEvent.ScriptType.isEmpty() || _inout_rScriptEvent.ScriptCode.isEmpty()) )
- return impl_adjustScriptLibrary_nothrow( _inout_rScriptEvent.ScriptType, _inout_rScriptEvent.ScriptCode );
- return false;
- }
-
- bool MigrationEngine_Impl::impl_adjustScriptLibrary_nothrow( Any& _inout_rScriptDescriptor ) const
- {
- ::comphelper::NamedValueCollection aScriptDesc( _inout_rScriptDescriptor );
-
- OUString sScriptType;
- OUString sScript;
- try
- {
- OSL_VERIFY( aScriptDesc.get_ensureType( "EventType", sScriptType ) );
- OSL_VERIFY( aScriptDesc.get_ensureType( "Script", sScript ) );
- }
- catch( const Exception& )
- {
- m_rLogger.logRecoverable( MigrationError(
- ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
- ::cppu::getCaughtException()
- ) );
- }
-
- if ( !(sScriptType.isEmpty() || sScript.isEmpty()) )
- if ( !impl_adjustScriptLibrary_nothrow( sScriptType, sScript ) )
- return false;
-
- aScriptDesc.put( "Script", sScript );
- _inout_rScriptDescriptor <<= aScriptDesc.getPropertyValues();
- return true;
- }
-
- void MigrationEngine_Impl::impl_adjustDocumentEvents_nothrow( const SubDocument& _rDocument ) const
- {
- try
- {
- Reference< XEventsSupplier > xSuppEvents( _rDocument.xDocument, UNO_QUERY );
- if ( !xSuppEvents.is() )
- // this is allowed. E.g. new-style reports currently do not support this
- return;
-
- Reference< XNameReplace > xEvents( xSuppEvents->getEvents(), UNO_SET_THROW );
- const Sequence< OUString > aEventNames = xEvents->getElementNames();
-
- Any aEvent;
- for ( auto const & eventName : aEventNames )
- {
- aEvent = xEvents->getByName( eventName );
- if ( !aEvent.hasValue() )
- continue;
-
- // translate
- if ( !impl_adjustScriptLibrary_nothrow( aEvent ) )
- continue;
-
- // put back
- xEvents->replaceByName( eventName, aEvent );
- }
- }
- catch( const Exception& )
- {
- m_rLogger.logRecoverable( MigrationError(
- ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
- lcl_getSubDocumentDescription( _rDocument ),
- ::cppu::getCaughtException()
- ) );
- }
- }
-
- void MigrationEngine_Impl::impl_adjustDialogElementEvents_throw( const Reference< XInterface >& _rxElement ) const
- {
- Reference< XScriptEventsSupplier > xEventsSupplier( _rxElement, UNO_QUERY_THROW );
- Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
- const Sequence< OUString > aEventNames( xEvents->getElementNames() );
-
- ScriptEventDescriptor aScriptEvent;
- for ( OUString const & eventName : aEventNames )
- {
- OSL_VERIFY( xEvents->getByName( eventName ) >>= aScriptEvent );
-
- if ( !impl_adjustScriptLibrary_nothrow( aScriptEvent ) )
- continue;
-
- xEvents->replaceByName( eventName, makeAny( aScriptEvent ) );
- }
- }
-
- bool MigrationEngine_Impl::impl_adjustDialogEvents_nothrow( Any& _inout_rDialogLibraryElement,
- const OUString& _rDocName, const OUString& _rDialogLibName, const OUString& _rDialogName ) const
- {
- try
- {
- // load a dialog model from the stream describing it
- Reference< XInputStreamProvider > xISP( _inout_rDialogLibraryElement, UNO_QUERY_THROW );
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_SET_THROW );
-
- Reference< XNameContainer > xDialogModel( m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_aContext), UNO_QUERY_THROW );
- ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext, m_xDocumentModel );
-
- // adjust the events of the dialog
- impl_adjustDialogElementEvents_throw( xDialogModel );
-
- // adjust the events of the controls
- Sequence< OUString > aControlNames( xDialogModel->getElementNames() );
- const OUString* controlName = aControlNames.getConstArray();
- const OUString* controlNamesEnd = controlName + aControlNames.getLength();
- for ( ; controlName != controlNamesEnd; ++controlName )
- {
- impl_adjustDialogElementEvents_throw( Reference< XInterface >( xDialogModel->getByName( *controlName ), UNO_QUERY ) );
- }
-
- // export dialog model
- xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext, m_xDocumentModel );
- _inout_rDialogLibraryElement <<= xISP;
- }
- catch( const Exception& )
- {
- m_rLogger.logRecoverable( MigrationError(
- ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
- _rDocName,
- _rDialogLibName,
- _rDialogName,
- ::cppu::getCaughtException()
- ) );
- return false;
- }
- return true;
- }
-
- void MigrationEngine_Impl::impl_adjustFormComponentEvents_throw( const Reference< XIndexAccess >& _rxComponentContainer ) const
- {
- FormComponentIterator aCompIter( _rxComponentContainer );
- while ( aCompIter.hasMore() )
- {
- // 1. adjust the component's scripts of the current component
- FormComponentScripts aComponent( aCompIter.next() );
- Sequence< ScriptEventDescriptor > aEvents( aComponent.getEvents() );
-
- bool bChangedComponentEvents = false;
- for ( ScriptEventDescriptor & scriptEvent : aEvents )
- {
- if ( !impl_adjustScriptLibrary_nothrow( scriptEvent ) )
- continue;
-
- bChangedComponentEvents = true;
- }
-
- if ( bChangedComponentEvents )
- aComponent.setEvents( aEvents );
-
- // 2. step down if the component is a container itself
- Reference< XIndexAccess > xContainer( aComponent.getComponent(), UNO_QUERY );
- if ( xContainer.is() )
- impl_adjustFormComponentEvents_throw( xContainer );
- }
- }
-
- void MigrationEngine_Impl::impl_adjustFormComponentEvents_nothrow( const SubDocument& _rDocument ) const
- {
- try
- {
- DrawPageIterator aPageIter( _rDocument.xDocument );
- while ( aPageIter.hasMore() )
- {
- Reference< XFormsSupplier > xSuppForms( aPageIter.next(), UNO_QUERY_THROW );
- Reference< XIndexAccess > xForms( xSuppForms->getForms(), UNO_QUERY_THROW );
- impl_adjustFormComponentEvents_throw( xForms );
- }
- }
- catch( const Exception& )
- {
- m_rLogger.logRecoverable( MigrationError(
- ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
- lcl_getSubDocumentDescription( _rDocument ),
- ::cppu::getCaughtException()
- ) );
- }
- }
-
- bool MigrationEngine_Impl::impl_unprotectPasswordLibrary_throw( const Reference< XLibraryContainerPassword >& _rxPasswordManager,
- const ScriptType _eScriptType, const OUString& _rLibraryName ) const
- {
- // a human-readable description of the affected library
- OUString sLibraryDescription(
- DBA_RES(STR_LIBRARY_TYPE_AND_NAME).
- replaceFirst("$type$",
- getScriptTypeDisplayName(_eScriptType)).
- replaceFirst("$library$", _rLibraryName));
- //TODO: probably broken if first replaceFirst can produce
- // fresh instance of "$library$" in subject string of second
- // replaceFirst
-
- InteractionHandler aHandler( m_aContext, m_xDocumentModel );
- OUString sPassword;
- while ( true )
- {
- if ( !aHandler.requestDocumentPassword( sLibraryDescription, sPassword ) )
- // aborted by the user
- return false;
-
- bool bSuccessVerification = _rxPasswordManager->verifyLibraryPassword( _rLibraryName, sPassword );
- if ( bSuccessVerification )
- return true;
- }
-
- }
-
- // MigrationEngine
- MigrationEngine::MigrationEngine( const Reference<XComponentContext>& _rContext,
- const Reference< XOfficeDatabaseDocument >& _rxDocument, IMigrationProgress& _rProgress,
- MigrationLog& _rLogger )
- :m_pImpl( new MigrationEngine_Impl( _rContext, _rxDocument, _rProgress, _rLogger ) )
- {
- }
-
- MigrationEngine::~MigrationEngine()
- {
- }
-
- sal_Int32 MigrationEngine::getFormCount() const
- {
- return m_pImpl->getFormCount();
- }
-
- sal_Int32 MigrationEngine::getReportCount() const
- {
- return m_pImpl->getReportCount();
- }
-
- bool MigrationEngine::migrateAll()
- {
- return m_pImpl->migrateAll();
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/migrationengine.hxx b/dbaccess/source/ext/macromigration/migrationengine.hxx
deleted file mode 100644
index b5a2c023a369..000000000000
--- a/dbaccess/source/ext/macromigration/migrationengine.hxx
+++ /dev/null
@@ -1,80 +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_MIGRATIONENGINE_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONENGINE_HXX
-
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-
-#include <memory>
-
-namespace dbmm
-{
-
- class IMigrationProgress;
- class MigrationLog;
-
- // MigrationEngine
- class MigrationEngine_Impl;
- class MigrationEngine
- {
- public:
- /** creates the migration engine
- @param _rxDocument
- the document whose macros/scripts should be migrated
- @param _rProgress
- a callback for notifying progress. Beware of lifetimes here: The progress callback,
- passed herein as reference, must live as long as the engine instance lives.
- */
- MigrationEngine(
- const css::uno::Reference< css::uno::XComponentContext >& _rContext,
- const css::uno::Reference< css::sdb::XOfficeDatabaseDocument >& _rxDocument,
- IMigrationProgress& _rProgress,
- MigrationLog& _rLogger
- );
-
- ~MigrationEngine();
-
- sal_Int32 getFormCount() const;
- sal_Int32 getReportCount() const;
-
- /** starts migrating the scripts and macros in the forms/reports to the database
- document.
-
- This process cannot be cancelled, as it would leave the document in an inconsistent
- state.
-
- When the function returns, then the migration is finished.
-
- @return
- whether or not the migration was successful. If it wasn't, then an error has been reported
- to the user, using the document's interaction handler. If no such interaction handler
- was present, then the error has been silenced.
- */
- bool migrateAll();
-
- private:
- std::unique_ptr< MigrationEngine_Impl > m_pImpl;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONENGINE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/migrationerror.hxx b/dbaccess/source/ext/macromigration/migrationerror.hxx
deleted file mode 100644
index 0de6162d0cde..000000000000
--- a/dbaccess/source/ext/macromigration/migrationerror.hxx
+++ /dev/null
@@ -1,153 +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_MIGRATIONERROR_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONERROR_HXX
-
-#include <com/sun/star/uno/Any.hxx>
-
-#include <vector>
-
-namespace dbmm
-{
-
- enum MigrationErrorType
- {
- ERR_OPENING_SUB_DOCUMENT_FAILED = 1,
- ERR_CLOSING_SUB_DOCUMENT_FAILED,
- ERR_STORAGE_COMMIT_FAILED,
- ERR_STORING_DATABASEDOC_FAILED,
- ERR_COLLECTING_DOCUMENTS_FAILED,
- ERR_UNEXPECTED_LIBSTORAGE_ELEMENT,
- ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED,
- ERR_COMMITTING_SCRIPT_STORAGES_FAILED,
- ERR_GENERAL_SCRIPT_MIGRATION_FAILURE,
- ERR_GENERAL_MACRO_MIGRATION_FAILURE,
- ERR_UNKNOWN_SCRIPT_TYPE,
- ERR_UNKNOWN_SCRIPT_LANGUAGE,
- ERR_UNKNOWN_SCRIPT_NAME_FORMAT,
- ERR_SCRIPT_TRANSLATION_FAILURE,
- ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT,
- ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED,
- ERR_ADJUSTING_DIALOG_EVENTS_FAILED,
- ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED,
- ERR_BIND_SCRIPT_STORAGE_FAILED,
- ERR_REMOVE_SCRIPTS_STORAGE_FAILED,
- ERR_DOCUMENT_BACKUP_FAILED,
- ERR_UNKNOWN_SCRIPT_FOLDER,
- ERR_EXAMINING_SCRIPTS_FOLDER_FAILED,
- ERR_PASSWORD_VERIFICATION_FAILED,
- ERR_NEW_STYLE_REPORT
- };
-
- // MigrationError
- /** encapsulates information about an error which happened during the migration
- */
- struct MigrationError
- {
- const MigrationErrorType eType;
- std::vector< OUString > aErrorDetails;
- const css::uno::Any aCaughtException;
-
- MigrationError(
- const MigrationErrorType _eType,
- const css::uno::Any& _rCaughtException )
- :eType( _eType )
- ,aCaughtException( _rCaughtException )
- {
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail )
- :eType( _eType )
- {
- impl_constructDetails( _rDetail );
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail,
- const css::uno::Any& _rCaughtException )
- :eType( _eType )
- ,aCaughtException( _rCaughtException )
- {
- impl_constructDetails( _rDetail );
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail1,
- const OUString& _rDetail2 )
- :eType( _eType )
- {
- impl_constructDetails( _rDetail1, _rDetail2 );
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail1,
- const OUString& _rDetail2,
- const css::uno::Any& _rCaughtException )
- :eType( _eType )
- ,aCaughtException( _rCaughtException )
- {
- impl_constructDetails( _rDetail1, _rDetail2 );
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail1,
- const OUString& _rDetail2,
- const OUString& _rDetail3,
- const css::uno::Any& _rCaughtException )
- :eType( _eType )
- ,aCaughtException( _rCaughtException )
- {
- impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
- }
-
- MigrationError(
- const MigrationErrorType _eType,
- const OUString& _rDetail1,
- const OUString& _rDetail2,
- const OUString& _rDetail3 )
- :eType( _eType )
- {
- impl_constructDetails( _rDetail1, _rDetail2, _rDetail3 );
- }
-
- private:
- void impl_constructDetails(
- const OUString& _rDetail1,
- const OUString& _rDetail2 = OUString(),
- const OUString& _rDetail3 = OUString()
- )
- {
- if ( !_rDetail1.isEmpty() ) aErrorDetails.push_back( _rDetail1 );
- if ( !_rDetail2.isEmpty() ) aErrorDetails.push_back( _rDetail2 );
- if ( !_rDetail3.isEmpty() ) aErrorDetails.push_back( _rDetail3 );
- }
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONERROR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
deleted file mode 100644
index a6e1a254ff6d..000000000000
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ /dev/null
@@ -1,433 +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 <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>
-#include <map>
-#include <algorithm>
-
-namespace dbmm
-{
- // LibraryEntry
- struct LibraryEntry
- {
- ScriptType eType;
- OUString sOldName;
- OUString sNewName;
-
- LibraryEntry( const ScriptType& _eType, const OUString& _rOldName, const OUString& _rNewName )
- :eType( _eType )
- ,sOldName( _rOldName )
- ,sNewName( _rNewName )
- {
- }
- };
-
- // DocumentEntry
- struct DocumentEntry
- {
- SubDocumentType eType;
- OUString sName;
- std::vector< LibraryEntry > aMovedLibraries;
-
- DocumentEntry()
- :eType( eForm )
- ,sName()
- ,aMovedLibraries()
- {
- }
-
- DocumentEntry( const SubDocumentType _eType, const OUString& _rName )
- :eType( _eType )
- ,sName( _rName )
- {
- }
- };
-
- // DocumentLogs
- typedef std::map< DocumentID, DocumentEntry > DocumentLogs;
-
- // ErrorLog
- typedef std::vector< MigrationError > ErrorLog;
-
- // MigrationLog_Data
- struct MigrationLog_Data
- {
- OUString sBackupLocation;
- DocumentLogs aDocumentLogs;
- ErrorLog aFailures;
- ErrorLog aWarnings;
- };
-
- // MigrationLog
- MigrationLog::MigrationLog()
- :m_pData( new MigrationLog_Data )
- {
- }
-
- MigrationLog::~MigrationLog()
- {
- }
-
- void MigrationLog::logFailure( const MigrationError& _rError )
- {
- m_pData->aFailures.push_back( _rError );
- }
-
- void MigrationLog::logRecoverable( const MigrationError& _rError )
- {
- m_pData->aWarnings.push_back( _rError );
- }
-
- bool MigrationLog::hadFailure() const
- {
- return !m_pData->aFailures.empty();
- }
-
- void MigrationLog::backedUpDocument( const OUString& _rNewDocumentLocation )
- {
- m_pData->sBackupLocation = _rNewDocumentLocation;
- }
-
- DocumentID MigrationLog::startedDocument( const SubDocumentType _eType, const OUString& _rName )
- {
-#if OSL_DEBUG_LEVEL > 0
- bool bAlreadyKnown = false;
- for (auto const& documentLog : m_pData->aDocumentLogs)
- {
- bAlreadyKnown = ( documentLog.second.eType == _eType ) && ( documentLog.second.sName == _rName );
- if (bAlreadyKnown)
- break;
- }
- OSL_ENSURE( !bAlreadyKnown, "MigrationLog::startedDocument: document is already known!" );
-#endif
-
- DocumentID nID = static_cast<DocumentID>( m_pData->aDocumentLogs.size() + 1 );
- while ( m_pData->aDocumentLogs.find( nID ) != m_pData->aDocumentLogs.end() )
- ++nID;
-
- m_pData->aDocumentLogs[ nID ] = DocumentEntry( _eType, _rName );
-
- return nID;
- }
-
- void MigrationLog::movedLibrary( const DocumentID _nDocID, const ScriptType _eScriptType,
- const OUString& _rOriginalLibName, const OUString& _rNewLibName )
- {
- OSL_ENSURE( m_pData->aDocumentLogs.find( _nDocID ) != m_pData->aDocumentLogs.end(),
- "MigrationLog::movedLibrary: document is not known!" );
-
- DocumentEntry& rDocEntry = m_pData->aDocumentLogs[ _nDocID ];
- rDocEntry.aMovedLibraries.emplace_back( _eScriptType, _rOriginalLibName, _rNewLibName );
- }
-
- void MigrationLog::finishedDocument( const DocumentID _nDocID )
- {
- OSL_ENSURE( m_pData->aDocumentLogs.find( _nDocID ) != m_pData->aDocumentLogs.end(),
- "MigrationLog::finishedDocument: document is not known!" );
-
- // nothing to do here
- }
-
- OUString MigrationLog::getNewLibraryName( DocumentID _nDocID, ScriptType _eScriptType,
- const OUString& _rOriginalLibName ) const
- {
- DocumentLogs::const_iterator docPos = m_pData->aDocumentLogs.find( _nDocID );
- if ( docPos == m_pData->aDocumentLogs.end() )
- {
- OSL_FAIL( "MigrationLog::getNewLibraryName: document is not known!" );
- return OUString();
- }
-
- const DocumentEntry& rDocEntry( docPos->second );
- for (auto const& elem : rDocEntry.aMovedLibraries)
- {
- if ( ( _eScriptType == elem.eType )
- && ( _rOriginalLibName == elem.sOldName )
- )
- return elem.sNewName;
- }
-
- OSL_FAIL( "MigrationLog::getNewLibraryName: doc is known, but library isn't!" );
- return OUString();
- }
-
- namespace
- {
- void lcl_appendErrorDescription( OUStringBuffer& _inout_rBuffer, const MigrationError& _rError )
- {
- const sal_Char* pAsciiErrorDescription( nullptr );
- std::vector< OUString > aParameterNames;
- switch ( _rError.eType )
- {
- case ERR_OPENING_SUB_DOCUMENT_FAILED:
- pAsciiErrorDescription = "opening '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_CLOSING_SUB_DOCUMENT_FAILED:
- pAsciiErrorDescription = "closing '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_STORAGE_COMMIT_FAILED:
- pAsciiErrorDescription = "committing the changes for document '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_STORING_DATABASEDOC_FAILED:
- pAsciiErrorDescription = "storing the database document failed";
- break;
-
- case ERR_COLLECTING_DOCUMENTS_FAILED:
- pAsciiErrorDescription = "collecting the forms/reports of the database document failed";
- break;
-
- case ERR_UNEXPECTED_LIBSTORAGE_ELEMENT:
- pAsciiErrorDescription = "unexpected #lib# storage element in document '#doc#', named '#element#'";
- aParameterNames.emplace_back("#doc#");
- aParameterNames.emplace_back("#libstore#");
- aParameterNames.emplace_back("#element#");
- break;
-
- case ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED:
- pAsciiErrorDescription = "creating the database document's storage for #scripttype# scripts failed";
- aParameterNames.emplace_back("#scripttype#");
- break;
-
- case ERR_COMMITTING_SCRIPT_STORAGES_FAILED:
- pAsciiErrorDescription = "saving the #scripttype# scripts for document '#doc#' failed";
- aParameterNames.emplace_back("#scripttype#");
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_GENERAL_SCRIPT_MIGRATION_FAILURE:
- pAsciiErrorDescription = "general error while migrating #scripttype# scripts of document '#doc#'";
- aParameterNames.emplace_back("#scripttype#");
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_GENERAL_MACRO_MIGRATION_FAILURE:
- pAsciiErrorDescription = "general error during macro migration of document '#doc#'";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_UNKNOWN_SCRIPT_TYPE:
- pAsciiErrorDescription = "unknown script type: #type#";
- aParameterNames.emplace_back("#type#");
- break;
-
- case ERR_UNKNOWN_SCRIPT_LANGUAGE:
- pAsciiErrorDescription = "unknown script language: #lang#";
- aParameterNames.emplace_back("#lang#");
- break;
-
- case ERR_UNKNOWN_SCRIPT_NAME_FORMAT:
- pAsciiErrorDescription = "unknown script name format: #script#";
- aParameterNames.emplace_back("#script#");
- break;
-
- case ERR_SCRIPT_TRANSLATION_FAILURE:
- pAsciiErrorDescription = "analyzing/translating the script URL failed; script type: #type#; script: #code#";
- aParameterNames.emplace_back("#type#");
- aParameterNames.emplace_back("#code#");
- break;
-
- case ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT:
- pAsciiErrorDescription = "invalid script descriptor format";
- break;
-
- case ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED:
- pAsciiErrorDescription = "adjusting events for document '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_ADJUSTING_DIALOG_EVENTS_FAILED:
- pAsciiErrorDescription = "adjusting events for dialog #lib#.#dlg# in document '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- aParameterNames.emplace_back("#lib#");
- aParameterNames.emplace_back("#dlg#");
- break;
-
- case ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED:
- pAsciiErrorDescription = "adjusting form component events for '#doc#' failed";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_BIND_SCRIPT_STORAGE_FAILED:
- pAsciiErrorDescription = "binding to the script storage failed for document '#doc#'";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_REMOVE_SCRIPTS_STORAGE_FAILED:
- pAsciiErrorDescription = "removing a scripts storage failed for document '#doc#'";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_DOCUMENT_BACKUP_FAILED:
- pAsciiErrorDescription = "backing up the document to #location# failed";
- aParameterNames.emplace_back("#location#");
- break;
-
- case ERR_UNKNOWN_SCRIPT_FOLDER:
- pAsciiErrorDescription = "unknown script folder '#name#' in document '#doc#'";
- aParameterNames.emplace_back("#doc#");
- aParameterNames.emplace_back("#name#");
- break;
-
- case ERR_EXAMINING_SCRIPTS_FOLDER_FAILED:
- pAsciiErrorDescription = "examining the 'Scripts' folder failed for document '#doc#'";
- aParameterNames.emplace_back("#doc#");
- break;
-
- case ERR_PASSWORD_VERIFICATION_FAILED:
- pAsciiErrorDescription = "password verification failed for document '#doc#', #libtype# library '#name#'";
- aParameterNames.emplace_back("#doc#");
- aParameterNames.emplace_back("#libtype#");
- aParameterNames.emplace_back("#name#");
- break;
-
- case ERR_NEW_STYLE_REPORT:
- pAsciiErrorDescription = "#doc# could not be processed, since you don't have the Report Builder feature installed.";
- aParameterNames.emplace_back("#doc#");
- break;
-
- // do *not* add a default case here: Without a default, some compilers will warn you when
- // you miss a newly-introduced enum value here
- }
- OSL_ENSURE( pAsciiErrorDescription, "lcl_appendErrorDescription: no error message!" );
- if ( pAsciiErrorDescription )
- {
- OUString sSubstituted( OUString::createFromAscii( pAsciiErrorDescription ) );
- OSL_ENSURE( aParameterNames.size() == _rError.aErrorDetails.size(),
- "lcl_appendErrorDescription: unexpected number of error message parameters!" );
-
- for ( size_t i=0; i < std::min( aParameterNames.size(), _rError.aErrorDetails.size() ); ++i )
- {
- sSubstituted = sSubstituted.replaceFirst(
- aParameterNames[i], _rError.aErrorDetails[i]);
- }
-
- _inout_rBuffer.append( sSubstituted );
- }
- }
-
- void lcl_describeErrors( OUStringBuffer& _rBuffer, const ErrorLog& _rErrors, const char* pHeadingResId )
- {
- _rBuffer.append( "=== " );
- _rBuffer.append( DBA_RES(pHeadingResId) );
- _rBuffer.append( " ===\n" );
-
- OUString sException( DBA_RES( STR_EXCEPTION ) );
-
- for (auto const& error : _rErrors)
- {
- _rBuffer.append( '-' );
- _rBuffer.append( ' ' );
- lcl_appendErrorDescription(_rBuffer, error);
- _rBuffer.append( '\n' );
-
- if ( !error.aCaughtException.hasValue() )
- continue;
-
- _rBuffer.append( sException );
- _rBuffer.append( ::comphelper::anyToString( error.aCaughtException ) );
- _rBuffer.append( '\n' );
- _rBuffer.append( '\n' );
- }
- }
- }
-
- bool MigrationLog::movedAnyLibrary( const DocumentID _nDocID )
- {
- DocumentLogs::const_iterator docPos = m_pData->aDocumentLogs.find( _nDocID );
- if ( docPos == m_pData->aDocumentLogs.end() )
- {
- OSL_FAIL( "MigrationLog::movedAnyLibrary: document is not known!" );
- return false;
- }
- return !docPos->second.aMovedLibraries.empty();
- }
-
- OUString MigrationLog::getCompleteLog() const
- {
- OUStringBuffer aBuffer;
-
- if ( !m_pData->sBackupLocation.isEmpty() )
- {
- OUString sBackedUp( DBA_RES( STR_SAVED_COPY_TO ) );
- sBackedUp = sBackedUp.replaceAll( "$location$", m_pData->sBackupLocation );
-
- aBuffer.append( "=== " ).append( DBA_RES( STR_DATABASE_DOCUMENT ) )
- .append( " ===\n" ).append( sBackedUp ).append("\n\n");
- }
-
- if ( !m_pData->aFailures.empty() )
- {
- lcl_describeErrors( aBuffer, m_pData->aFailures
- , STR_ERRORS );
- }
- else
- {
- OUString sMovedLibTemplate( DBA_RES( STR_MOVED_LIBRARY ) );
-
- for (auto const& documentLog : m_pData->aDocumentLogs)
- {
- const DocumentEntry& rDoc( documentLog.second );
-
- if ( rDoc.aMovedLibraries.empty() )
- continue;
-
- OUString sDocTitle( DBA_RES( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) );
- sDocTitle = sDocTitle.replaceAll( "$name$", rDoc.sName );
-
- aBuffer.append( "=== " ).append( sDocTitle ).append( " ===\n" );
-
- for (auto const& elem : rDoc.aMovedLibraries)
- {
- OUString sMovedLib = sMovedLibTemplate.replaceAll( "$type$", getScriptTypeDisplayName( elem.eType ) );
- sMovedLib = sMovedLib.replaceAll( "$old$", elem.sOldName );
- sMovedLib = sMovedLib.replaceAll( "$new$", elem.sNewName );
-
- aBuffer.append( sMovedLib ).append( "\n" );
- }
-
- aBuffer.append( '\n' );
- }
- }
-
- if ( !m_pData->aWarnings.empty() )
- {
- lcl_describeErrors( aBuffer, m_pData->aWarnings, STR_WARNINGS );
- }
-
- return aBuffer.makeStringAndClear();
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/migrationlog.hxx b/dbaccess/source/ext/macromigration/migrationlog.hxx
deleted file mode 100644
index d4e757c4c281..000000000000
--- a/dbaccess/source/ext/macromigration/migrationlog.hxx
+++ /dev/null
@@ -1,110 +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_MIGRATIONLOG_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONLOG_HXX
-
-#include "dbmm_types.hxx"
-
-#include <rtl/ustring.hxx>
-
-#include <memory>
-
-namespace dbmm
-{
-
- typedef sal_Int16 DocumentID;
- struct MigrationError;
-
- // MigrationLog
- struct MigrationLog_Data;
- class MigrationLog
- {
- public:
- MigrationLog();
- ~MigrationLog();
-
- //- event logging
-
- /** logs an unrecoverable error during the migration process
- */
- void logFailure( const MigrationError& _rError );
-
- /** logs a recoverable (or at least ignorable) error during the migration process
- */
- void logRecoverable( const MigrationError& _rError );
-
- /// checks whether logFailure has been called
- bool hadFailure() const;
-
- /// logs the fact that the database document has been backed up
- void backedUpDocument( const OUString& _rNewDocumentLocation );
-
- /** logs that the migration for a certain sub document has been started, returns
- a unique ID for this sub document which is to be used in later calls
- */
- DocumentID startedDocument( const SubDocumentType _eType, const OUString& _rName );
-
- /** logs the event that a macro or script library has been moved from within a
- sub document to the database document
- */
- void movedLibrary(
- const DocumentID _nDocID,
- const ScriptType _eScriptType,
- const OUString& _rOriginalLibName,
- const OUString& _rNewLibName
- );
-
- /** logs that the migration for a certain document has been finished
- */
- void finishedDocument( const DocumentID _nDocID );
-
- //- information retrieval
-
- /** retrieves the new name of a library
-
- The new library name must previously have been logger by calling
- <member>movedLibrary</member>. If not, an assertion will be raised in
- the non-product builds, and an empty string will be returned.
- */
- OUString getNewLibraryName(
- DocumentID _nDocID,
- ScriptType _eScriptType,
- const OUString& _rOriginalLibName
- ) const;
-
- /** determines whether for the given document, any library needed to be (and was) moved
- */
- bool movedAnyLibrary( const DocumentID );
-
- /** provides a human-readable version of the log, explaining a user what happened during
- the migration.
- */
- OUString
- getCompleteLog() const;
-
- private:
- std::unique_ptr< MigrationLog_Data > m_pData;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONLOG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/migrationprogress.hxx b/dbaccess/source/ext/macromigration/migrationprogress.hxx
deleted file mode 100644
index 49feb9af9181..000000000000
--- a/dbaccess/source/ext/macromigration/migrationprogress.hxx
+++ /dev/null
@@ -1,49 +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_MIGRATIONPROGRESS_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONPROGRESS_HXX
-
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-
-namespace dbmm
-{
-
- // IMigrationProgress
- class SAL_NO_VTABLE IMigrationProgress
- {
- public:
- virtual void startObject( const OUString& _rObjectName, const OUString& _rCurrentAction, const sal_uInt32 _nRange ) = 0;
- virtual void setObjectProgressText( const OUString& _rText ) = 0;
- virtual void setObjectProgressValue( const sal_uInt32 _nValue ) = 0;
- virtual void endObject() = 0;
- virtual void start( const sal_uInt32 _nOverallRange ) = 0;
- virtual void setOverallProgressText( const OUString& _rText ) = 0;
- virtual void setOverallProgressValue( const sal_uInt32 _nValue ) = 0;
-
- protected:
- ~IMigrationProgress() {}
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_MIGRATIONPROGRESS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/progresscapture.cxx b/dbaccess/source/ext/macromigration/progresscapture.cxx
deleted file mode 100644
index 6a7244436e6c..000000000000
--- a/dbaccess/source/ext/macromigration/progresscapture.cxx
+++ /dev/null
@@ -1,95 +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 "progresscapture.hxx"
-#include "migrationprogress.hxx"
-
-#include <osl/diagnose.h>
-#include <vcl/svapp.hxx>
-
-namespace dbmm
-{
-
- // ProgressCapture_Data
- struct ProgressCapture_Data
- {
- ProgressCapture_Data( const OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
- :sObjectName( _rObjectName )
- ,rMasterProgress( _rMasterProgress )
- ,bDisposed( false )
- {
- }
-
- OUString sObjectName;
- IMigrationProgress& rMasterProgress;
- bool bDisposed;
- };
-
- // ProgressCapture
- ProgressCapture::ProgressCapture( const OUString& _rObjectName, IMigrationProgress& _rMasterProgress )
- :m_pData( new ProgressCapture_Data( _rObjectName, _rMasterProgress ) )
- {
- }
-
- ProgressCapture::~ProgressCapture()
- {
- }
-
- void ProgressCapture::dispose()
- {
- SolarMutexGuard aGuard;
- m_pData->bDisposed = true;
- }
-
- void SAL_CALL ProgressCapture::start( const OUString& _rText, ::sal_Int32 _nRange )
- {
- SolarMutexGuard aGuard;
- if ( !m_pData->bDisposed )
- m_pData->rMasterProgress.startObject( m_pData->sObjectName, _rText, _nRange );
- }
-
- void SAL_CALL ProgressCapture::end( )
- {
- SolarMutexGuard aGuard;
- if ( !m_pData->bDisposed )
- m_pData->rMasterProgress.endObject();
- }
-
- void SAL_CALL ProgressCapture::setText( const OUString& _rText )
- {
- SolarMutexGuard aGuard;
- if ( !m_pData->bDisposed )
- m_pData->rMasterProgress.setObjectProgressText( _rText );
- }
-
- void SAL_CALL ProgressCapture::setValue( ::sal_Int32 _nValue )
- {
- SolarMutexGuard aGuard;
- if ( !m_pData->bDisposed )
- m_pData->rMasterProgress.setObjectProgressValue( _nValue );
- }
-
- void SAL_CALL ProgressCapture::reset( )
- {
- OSL_FAIL( "ProgressCapture::reset: not implemented!" );
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/progresscapture.hxx b/dbaccess/source/ext/macromigration/progresscapture.hxx
deleted file mode 100644
index 8cbb2144802c..000000000000
--- a/dbaccess/source/ext/macromigration/progresscapture.hxx
+++ /dev/null
@@ -1,65 +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_PROGRESSCAPTURE_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSCAPTURE_HXX
-
-#include <com/sun/star/task/XStatusIndicator.hpp>
-
-#include <cppuhelper/implbase.hxx>
-
-#include <memory>
-
-namespace dbmm
-{
-
- class IMigrationProgress;
-
- // ProgressCapture
- typedef ::cppu::WeakImplHelper< css::task::XStatusIndicator
- > ProgressCapture_Base;
-
- struct ProgressCapture_Data;
-
- class ProgressCapture : public ProgressCapture_Base
- {
- public:
- ProgressCapture( const OUString& _rObjectName, IMigrationProgress& _rMasterProgress );
-
- void dispose();
-
- // XStatusIndicator
- virtual void SAL_CALL start( const OUString& Text, ::sal_Int32 Range ) override;
- virtual void SAL_CALL end( ) override;
- virtual void SAL_CALL setText( const OUString& Text ) override;
- virtual void SAL_CALL setValue( ::sal_Int32 Value ) override;
- virtual void SAL_CALL reset( ) override;
-
- protected:
- virtual ~ProgressCapture() override;
-
- private:
- std::unique_ptr< ProgressCapture_Data > m_pData;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSCAPTURE_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx
deleted file mode 100644
index 9a75db868b15..000000000000
--- a/dbaccess/source/ext/macromigration/progressmixer.cxx
+++ /dev/null
@@ -1,177 +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 "progressmixer.hxx"
-
-#include <osl/diagnose.h>
-
-#include <map>
-
-namespace dbmm
-{
-#define OVERALL_RANGE 100000
-
- // misc types
- struct PhaseData
- {
- // the weight of the phase, relative to all other phases
- PhaseWeight nWeight;
- // the "local" range of the phase
- sal_uInt32 nRange;
- // this is the point in the "overall range" at which this phase starts
- sal_uInt32 nGlobalStart;
- /** the "global" range of the phase, i.e. its range after weighting with all other
- phases
- */
- sal_uInt32 nGlobalRange;
-
- PhaseData()
- :nWeight(1)
- ,nRange(100)
- ,nGlobalStart(0)
- ,nGlobalRange(100)
- {
- }
-
- explicit PhaseData( const PhaseWeight _nWeight )
- :nWeight( _nWeight )
- ,nRange(100)
- ,nGlobalStart(0)
- ,nGlobalRange(100)
- {
- }
- };
-
- typedef std::map< PhaseID, PhaseData > Phases;
-
- // ProgressMixer_Data
- struct ProgressMixer_Data
- {
- Phases aPhases;
- Phases::iterator pCurrentPhase;
- sal_uInt32 nWeightSum; /// the cached sum of the weights
- double nOverallStretch;
- IProgressConsumer& rConsumer;
-
- explicit ProgressMixer_Data( IProgressConsumer& _rConsumer )
- :aPhases()
- ,pCurrentPhase( aPhases.end() )
- ,nWeightSum( 0 )
- ,nOverallStretch( 0 )
- ,rConsumer( _rConsumer )
- {
- }
- };
-
- namespace
- {
- bool lcl_isRunning( const ProgressMixer_Data& _rData )
- {
- return _rData.pCurrentPhase != _rData.aPhases.end();
- }
-
- void lcl_ensureInitialized( ProgressMixer_Data& _rData )
- {
- OSL_PRECOND( _rData.nWeightSum, "lcl_ensureInitialized: we have no phases, this will crash!" );
-
- if ( _rData.nOverallStretch )
- return;
-
- _rData.nOverallStretch = 1.0 * OVERALL_RANGE / _rData.nWeightSum;
-
- // tell the single phases their "overall starting point"
- PhaseWeight nRunningWeight( 0 );
- for (auto & phase : _rData.aPhases)
- {
- phase.second.nGlobalStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch );
- nRunningWeight += phase.second.nWeight;
-
- sal_uInt32 nNextPhaseStart = static_cast<sal_uInt32>( nRunningWeight * _rData.nOverallStretch );
- phase.second.nGlobalRange = nNextPhaseStart - phase.second.nGlobalStart;
- }
-
- _rData.rConsumer.start( OVERALL_RANGE );
- }
- }
-
- // ProgressMixer
- ProgressMixer::ProgressMixer( IProgressConsumer& _rConsumer )
- :m_pData( new ProgressMixer_Data( _rConsumer ) )
- {
- }
-
- ProgressMixer::~ProgressMixer()
- {
- }
-
- void ProgressMixer::registerPhase( const PhaseID _nID, const PhaseWeight _nWeight )
- {
- OSL_PRECOND( !lcl_isRunning( *m_pData ), "ProgressMixer::registerPhase: already running!" );
- OSL_ENSURE( m_pData->aPhases.find( _nID ) == m_pData->aPhases.end(),
- "ProgressMixer::registerPhase: ID already used!" );
- m_pData->aPhases[ _nID ] = PhaseData( _nWeight );
- m_pData->nWeightSum += _nWeight;
- }
-
- void ProgressMixer::startPhase( const PhaseID _nID, const sal_uInt32 _nPhaseRange )
- {
- OSL_ENSURE( m_pData->aPhases.find( _nID ) != m_pData->aPhases.end(),
- "ProgresMixer::startPhase: unknown phase!" );
-
- m_pData->aPhases[ _nID ].nRange = _nPhaseRange;
- m_pData->pCurrentPhase = m_pData->aPhases.find( _nID );
- }
-
- void ProgressMixer::advancePhase( const sal_uInt32 _nPhaseProgress )
- {
- OSL_PRECOND( lcl_isRunning( *m_pData ), "ProgresMixer::advancePhase: not running!" );
-
- // in case this is the first call, ensure all the ranges/weights are calculated
- // correctly
- lcl_ensureInitialized( *m_pData );
-
- const PhaseData& rPhase( m_pData->pCurrentPhase->second );
-
- double nLocalProgress = 1.0 * _nPhaseProgress / rPhase.nRange;
- sal_uInt32 nOverallProgress = static_cast<sal_uInt32>( rPhase.nGlobalStart + nLocalProgress * rPhase.nGlobalRange );
-
- m_pData->rConsumer.advance( nOverallProgress );
- }
-
- void ProgressMixer::endPhase()
- {
- OSL_PRECOND( lcl_isRunning( *m_pData ), "ProgresMixer::endPhase: not running!" );
-
- // in case this is the first call, ensure all the ranges/weights are calculated
- // correctly
- lcl_ensureInitialized( *m_pData );
-
- // simply assume the phase's complete range is over
- advancePhase( m_pData->pCurrentPhase->second.nRange );
-
- // if that's the last phase, this is the "global end", too
- Phases::const_iterator pNextPhase( m_pData->pCurrentPhase );
- ++pNextPhase;
- if ( pNextPhase == m_pData->aPhases.end() )
- m_pData->rConsumer.end();
- }
-
-} // namespace dbmm
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/progressmixer.hxx b/dbaccess/source/ext/macromigration/progressmixer.hxx
deleted file mode 100644
index 171089380af1..000000000000
--- a/dbaccess/source/ext/macromigration/progressmixer.hxx
+++ /dev/null
@@ -1,87 +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_PROGRESSMIXER_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
-
-#include <sal/types.h>
-
-#include <memory>
-
-namespace dbmm
-{
-
- typedef sal_uInt32 PhaseID;
- typedef sal_uInt32 PhaseWeight;
-
- // IProgressConsumer
- class SAL_NO_VTABLE IProgressConsumer
- {
- public:
- virtual void start( sal_uInt32 _nRange ) = 0;
- virtual void advance( sal_uInt32 _nValue ) = 0;
- virtual void end() = 0;
-
- protected:
- ~IProgressConsumer() {}
- };
-
- // ProgressMixer
- struct ProgressMixer_Data;
- /** a class which mixes (i.e. concatenates) progress values from different
- sources/phases, with different weight
- */
- class ProgressMixer
- {
- public:
- explicit ProgressMixer( IProgressConsumer& _rConsumer );
- ~ProgressMixer();
-
- /** registers a phase of the process, which has the given weight
- in the overall process
- @precond
- the progress is not running, yet
- */
- void registerPhase( const PhaseID _nID, const PhaseWeight _nWeight );
-
- /** enters the phase with the given ID, with the phase having
- the given overall range
- */
- void startPhase( const PhaseID _nID, const sal_uInt32 _nPhaseRange );
-
- /** announces a new progress in the current phase.
-
- The given phase progress must be between 0 and the overall phase range
- as specified in ->startPhase.
- */
- void advancePhase( const sal_uInt32 _nPhaseProgress );
-
- /** leaves the current phase, which has been started with ->startPhase previously
- */
- void endPhase();
-
- private:
- std::unique_ptr< ProgressMixer_Data > m_pData;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
deleted file mode 100644
index c8800635c196..000000000000
--- a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx
+++ /dev/null
@@ -1,71 +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_RANGEPROGRESSBAR_HXX
-#define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_RANGEPROGRESSBAR_HXX
-
-#include <vcl/prgsbar.hxx>
-
-namespace dbmm
-{
-
- // RangeProgressBar
- /** a slight extension of the usual progress bar, which is able to remember a range
- */
- class RangeProgressBar
- {
- public:
- explicit RangeProgressBar()
- : m_pBar(nullptr)
- , m_nRange(0)
- {
- }
-
- void Set(ProgressBar *pBar)
- {
- m_pBar = pBar;
- }
-
- void SetRange(sal_uInt32 _nRange)
- {
- m_nRange = _nRange;
- if ( !m_nRange )
- m_nRange = 100;
- }
-
- sal_uInt32 GetRange() const
- {
- return m_nRange;
- }
-
- void SetValue(sal_uInt32 _nValue)
- {
- m_pBar->SetValue( static_cast<sal_uInt16>( 100.0 * _nValue / m_nRange ) );
- }
-
- private:
- VclPtr<ProgressBar> m_pBar;
- sal_uInt32 m_nRange;
- };
-
-} // namespace dbmm
-
-#endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_RANGEPROGRESSBAR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 3f528f8bc509..4d36c4fac96a 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -45,7 +45,6 @@
#include <com/sun/star/sdbcx/XRename.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/sdb/application/MacroMigrationWizard.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
#include <com/sun/star/util/XFlushable.hpp>
@@ -669,19 +668,6 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
case ID_DIRECT_SQL:
aReturn.bEnabled = true;
break;
- case ID_MIGRATE_SCRIPTS:
- {
- // Our document supports embedding scripts into it, if and only if there are no
- // forms/reports with macros/scripts into them. So, we need to enable migration
- // if and only if the database document does *not* support embedding scripts.
- bool bAvailable =
- !Reference< XEmbeddedScripts >( m_xModel, UNO_QUERY ).is()
- && !Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly();
- aReturn.bEnabled = bAvailable;
- if ( !bAvailable )
- aReturn.bInvisible = true;
- }
- break;
case SID_APP_NEW_FOLDER:
aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() <= 1;
if ( aReturn.bEnabled )
@@ -1329,9 +1315,6 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
openDialog( SERVICE_SDB_DIRECTSQLDIALOG );
}
break;
- case ID_MIGRATE_SCRIPTS:
- impl_migrateScripts_nothrow();
- break;
case SID_DB_APP_VIEW_TABLES:
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_TABLE ) );
break;
@@ -1454,7 +1437,6 @@ void OApplicationController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:DBConvertToView", SID_DB_APP_CONVERTTOVIEW, CommandGroup::EDIT );
implDescribeSupportedFeature( ".uno:DBRefreshTables", SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
implDescribeSupportedFeature( ".uno:DBDirectSQL", ID_DIRECT_SQL, CommandGroup::APPLICATION );
- implDescribeSupportedFeature( ".uno:DBMigrateScripts", ID_MIGRATE_SCRIPTS, CommandGroup::APPLICATION );
implDescribeSupportedFeature( ".uno:DBViewTables", SID_DB_APP_VIEW_TABLES, CommandGroup::VIEW );
implDescribeSupportedFeature( ".uno:DBViewQueries", SID_DB_APP_VIEW_QUERIES, CommandGroup::VIEW );
implDescribeSupportedFeature( ".uno:DBViewForms", SID_DB_APP_VIEW_FORMS, CommandGroup::VIEW );
@@ -2823,19 +2805,6 @@ Any SAL_CALL OApplicationController::getSelection( )
return makeAny( aCurrentSelection );
}
-void OApplicationController::impl_migrateScripts_nothrow()
-{
- try
- {
- Reference< XExecutableDialog > xDialog = css::sdb::application::MacroMigrationWizard::createWithDocument( getORB(), Reference< XOfficeDatabaseDocument >( m_xModel, UNO_QUERY_THROW ) );
- xDialog->execute();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
-}
-
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx
index 51793bd8102d..44e96431fe82 100644
--- a/dbaccess/source/ui/inc/browserids.hxx
+++ b/dbaccess/source/ui/inc/browserids.hxx
@@ -62,7 +62,6 @@
#define ID_TREE_CLOSE_CONN 2
// FREE
#define ID_TREE_ADMINISTRATE 4
-#define ID_MIGRATE_SCRIPTS 5
#define ID_REPORT_NEW_TEXT 14
#define ID_FORM_NEW_TEXT 15
diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
index 9b254110b9af..2949b57e7740 100644
--- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
@@ -117,7 +117,6 @@
<menu:menuitem menu:id=".uno:DBUserAdmin"/>
<menu:menuitem menu:id=".uno:DBTableFilter"/>
<menu:menuitem menu:id=".uno:DBDirectSQL"/>
- <menu:menuitem menu:id=".uno:DBMigrateScripts"/>
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
diff --git a/dbaccess/uiconfig/ui/backuppage.ui b/dbaccess/uiconfig/ui/backuppage.ui
deleted file mode 100644
index 0ea91eed52f6..000000000000
--- a/dbaccess/uiconfig/ui/backuppage.ui
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface domain="dba">
- <requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
- <object class="GtkGrid" id="BackupPage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="border_width">6</property>
- <property name="row_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="backuppage|label1">Backup Your Document</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="backuppage|label2">To allow you to go back to the state before the migration, the database document will be backed up to a location of your choice. Every change done by the wizard will be made to the original document, the backup will stay untouched.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="startmigrate">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="backuppage|startmigrate">Press 'Next' to save a copy of your document, and to begin the migration.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="backuppage|label3">Save to:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">location</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="svtlo-OFileURLControl" id="location">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="has_entry">True</property>
- <child internal-child="entry">
- <object class="GtkEntry" id="URLBox-entry1">
- <property name="can_focus">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="browse">
- <property name="label" translatable="yes" context="backuppage|browse">Browse...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="halign">end</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
-</interface>
diff --git a/dbaccess/uiconfig/ui/migratepage.ui b/dbaccess/uiconfig/ui/migratepage.ui
deleted file mode 100644
index fa313ae46415..000000000000
--- a/dbaccess/uiconfig/ui/migratepage.ui
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface domain="dba">
- <requires lib="gtk+" version="3.18"/>
- <object class="GtkGrid" id="MigratePage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="border_width">6</property>
- <property name="row_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="migratepage|label1">Migration Progress</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="count">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="migratepage|count">The database document contains $forms$ form(s) and $reports$ report(s), which are currently being processed:</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="done">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="migratepage|done">All forms and reports have been successfully processed. Press 'Next' to show a detailed summary.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="migratepage|label4">Overall progress:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="overall">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="migratepage|overall">document $current$ of $overall$</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkProgressBar" id="allprogress">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="migratepage|label6">Current progress:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="current">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkProgressBar" id="currentprogress">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="migratepage|label5">Current object:</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="object">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
- <object class="GtkSizeGroup" id="sizegroup1">
- <widgets>
- <widget name="overall"/>
- <widget name="current"/>
- <widget name="object"/>
- </widgets>
- </object>
- <object class="GtkSizeGroup" id="sizegroup2">
- <widgets>
- <widget name="label4"/>
- <widget name="label6"/>
- <widget name="label5"/>
- </widgets>
- </object>
-</interface>
diff --git a/dbaccess/uiconfig/ui/preparepage.ui b/dbaccess/uiconfig/ui/preparepage.ui
deleted file mode 100644
index b7deeecff61f..000000000000
--- a/dbaccess/uiconfig/ui/preparepage.ui
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface domain="dba">
- <requires lib="gtk+" version="3.18"/>
- <object class="GtkGrid" id="PreparePage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="border_width">6</property>
- <property name="row_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="preparepage|label1">Welcome to the Database Macro Migration Wizard</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="preparepage|label2">This wizard will guide you through the task of migrating your macros.
-
-After you finished it, all macros which were formerly embedded into the forms and reports of the current database document will have been moved to the document itself. In this course, libraries will be renamed as needed.
-
-If your forms and reports contain references to those macros, they will be adjusted, where possible.
-
-Before the migration can start, all forms, reports, queries and tables belonging to the document must be closed. Press 'Next' to do so.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="closedocerror">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="preparepage|closedocerror">Not all objects could be closed. Please close them manually, and re-start the wizard.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- </object>
-</interface>
diff --git a/dbaccess/uiconfig/ui/summarypage.ui b/dbaccess/uiconfig/ui/summarypage.ui
deleted file mode 100644
index 91eec238701d..000000000000
--- a/dbaccess/uiconfig/ui/summarypage.ui
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface domain="dba">
- <requires lib="gtk+" version="3.18"/>
- <object class="GtkGrid" id="SummaryPage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="border_width">6</property>
- <property name="row_spacing">12</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" context="summarypage|label1">Summary</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="success">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="summarypage|success">The migration was successful. Below is a log of the actions which have been taken to your document.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="failure">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes" context="summarypage|failure">The migration was not successful. Examine the migration log below for details.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">64</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTextView" id="textview:border">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="editable">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- </object>
-</interface>
diff --git a/include/svx/databaselocationinput.hxx b/include/svx/databaselocationinput.hxx
index 3608bc03e766..22bb6e5d7bd1 100644
--- a/include/svx/databaselocationinput.hxx
+++ b/include/svx/databaselocationinput.hxx
@@ -78,53 +78,8 @@ namespace svx
::std::unique_ptr< DatabaseLocationInputController_Impl >
m_pImpl;
};
-
- //= SvxDatabaseLocationInputController
- class SvxDatabaseLocationInputController_Impl;
- /** helper class to control controls needed to input a database location
-
- If you allow, in your dialog, to save a database document, then you usually
- have a OFileURLControl for inputting the actual location, and a push button
- to browse for a location.
-
- This helper class controls such two UI elements.
- */
- class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxDatabaseLocationInputController
- {
- public:
- SvxDatabaseLocationInputController(
- const css::uno::Reference<css::uno::XComponentContext>& _rContext,
- ::svt::OFileURLControl& _rLocationInput,
- PushButton& _rBrowseButton
- );
- ~SvxDatabaseLocationInputController();
-
- /** sets the given URL at the input control, after translating it into a system path
- */
- void setURL( const OUString& _rURL );
-
- /** returns the current database location, in form of a URL (not a system path)
- */
- OUString getURL() const;
-
- /** prepares committing the database location entered in the input field
-
- Effectively, this method checks whether the file in the location already
- exists, and if so, it asks the user whether to overwrite it.
-
- If the method is called multiple times, this check only happens when the location
- changed since the last call.
- */
- bool prepareCommit();
-
- private:
- ::std::unique_ptr< SvxDatabaseLocationInputController_Impl >
- m_pImpl;
- };
-
}
-
#endif // INCLUDED_SVX_DATABASELOCATIONINPUT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 474fc58160fa..4e36995a7d53 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -352,7 +352,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/sdb,\
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/sdb/application,\
CopyTableWizard \
- MacroMigrationWizard \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/sdb/tools,\
ConnectionTools \
diff --git a/offapi/com/sun/star/sdb/application/MacroMigrationWizard.idl b/offapi/com/sun/star/sdb/application/MacroMigrationWizard.idl
deleted file mode 100644
index 015afe4867e2..000000000000
--- a/offapi/com/sun/star/sdb/application/MacroMigrationWizard.idl
+++ /dev/null
@@ -1,43 +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 __com_sun_star_sdb_application_MacroMigrationWizard_idl__
-#define __com_sun_star_sdb_application_MacroMigrationWizard_idl__
-
-#include <com/sun/star/ui/dialogs/XExecutableDialog.idl>
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.idl>
-
-module com { module sun { module star { module sdb { module application {
-
-
-/**
- @since LibreOffice 4.1
- */
-service MacroMigrationWizard : com::sun::star::ui::dialogs::XExecutableDialog
-{
- createWithDocument([in] com::sun::star::sdb::XOfficeDatabaseDocument Document);
-};
-
-
-}; }; }; }; };
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
index c540127e1a17..26b7cd2441e3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu
@@ -480,11 +480,6 @@
<value>1</value>
</prop>
</node>
- <node oor:name=".uno:DBMigrateScripts" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Migrate Macros ...</value>
- </prop>
- </node>
<node oor:name=".uno:DSBEditDoc" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Edit Data</value>
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index ab2ded7ae3a0..f8c5047de79f 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -262,7 +262,6 @@ $(eval $(call gb_Rdb_add_components,services,\
connectivity/source/drivers/mysql_jdbc/mysql_jdbc \
connectivity/source/manager/sdbc2 \
connectivity/source/drivers/writer/writer \
- dbaccess/source/ext/macromigration/dbmm \
dbaccess/source/filter/xml/dbaxml \
dbaccess/util/dba \
dbaccess/util/dbu \
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index b894de96c7a9..258c5c15d851 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -2933,8 +2933,6 @@ dbaccess/inc/pch/precompiled_dba.cxx
dbaccess/inc/pch/precompiled_dba.hxx
dbaccess/inc/pch/precompiled_dbaxml.cxx
dbaccess/inc/pch/precompiled_dbaxml.hxx
-dbaccess/inc/pch/precompiled_dbmm.cxx
-dbaccess/inc/pch/precompiled_dbmm.hxx
dbaccess/inc/pch/precompiled_dbu.cxx
dbaccess/inc/pch/precompiled_dbu.hxx
dbaccess/inc/pch/precompiled_sdbt.cxx
@@ -3103,28 +3101,6 @@ dbaccess/source/core/recovery/subcomponentrecovery.cxx
dbaccess/source/core/recovery/subcomponentrecovery.hxx
dbaccess/source/core/recovery/subcomponents.hxx
dbaccess/source/core/resource/core_resource.cxx
-dbaccess/source/ext/macromigration/dbmm_services.cxx
-dbaccess/source/ext/macromigration/dbmm_types.cxx
-dbaccess/source/ext/macromigration/dbmm_types.hxx
-dbaccess/source/ext/macromigration/docinteraction.cxx
-dbaccess/source/ext/macromigration/docinteraction.hxx
-dbaccess/source/ext/macromigration/macromigrationdialog.cxx
-dbaccess/source/ext/macromigration/macromigrationdialog.hxx
-dbaccess/source/ext/macromigration/macromigrationpages.cxx
-dbaccess/source/ext/macromigration/macromigrationpages.hxx
-dbaccess/source/ext/macromigration/macromigrationwizard.cxx
-dbaccess/source/ext/macromigration/macromigrationwizard.hxx
-dbaccess/source/ext/macromigration/migrationengine.cxx
-dbaccess/source/ext/macromigration/migrationengine.hxx
-dbaccess/source/ext/macromigration/migrationerror.hxx
-dbaccess/source/ext/macromigration/migrationlog.cxx
-dbaccess/source/ext/macromigration/migrationlog.hxx
-dbaccess/source/ext/macromigration/migrationprogress.hxx
-dbaccess/source/ext/macromigration/progresscapture.cxx
-dbaccess/source/ext/macromigration/progresscapture.hxx
-dbaccess/source/ext/macromigration/progressmixer.cxx
-dbaccess/source/ext/macromigration/progressmixer.hxx
-dbaccess/source/ext/macromigration/rangeprogressbar.hxx
dbaccess/source/filter/xml/dbloader2.cxx
dbaccess/source/filter/xml/xmlAutoStyle.cxx
dbaccess/source/filter/xml/xmlAutoStyle.hxx
diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx
index 8b90fb2cd7d9..a7af41882767 100644
--- a/svx/source/form/databaselocationinput.cxx
+++ b/svx/source/form/databaselocationinput.cxx
@@ -247,222 +247,6 @@ namespace svx
{
return m_pImpl->getURL();
}
-
- class SvxDatabaseLocationInputController_Impl
- {
- public:
- SvxDatabaseLocationInputController_Impl(
- const Reference<XComponentContext>& _rContext,
- ::svt::OFileURLControl& _rLocationInput,
- PushButton& _rBrowseButton
- );
- ~SvxDatabaseLocationInputController_Impl();
-
- bool prepareCommit();
- void setURL( const OUString& _rURL );
- OUString getURL() const;
-
- private:
- void impl_initFilterProperties_nothrow();
- void impl_onBrowseButtonClicked();
- OUString impl_getCurrentURL() const;
-
- DECL_LINK( OnControlAction, VclWindowEvent&, void );
-
- private:
- const Reference<XComponentContext> m_xContext;
- ::svt::OFileURLControl& m_rLocationInput;
- PushButton& m_rBrowseButton;
- Sequence< OUString > m_aFilterExtensions;
- OUString m_sFilterUIName;
- bool m_bNeedExistenceCheck;
- };
-
- SvxDatabaseLocationInputController_Impl::SvxDatabaseLocationInputController_Impl(const Reference<XComponentContext>& _rContext,
- ::svt::OFileURLControl& _rLocationInput,
- PushButton& _rBrowseButton)
- :m_xContext( _rContext )
- ,m_rLocationInput( _rLocationInput )
- ,m_rBrowseButton( _rBrowseButton )
- ,m_aFilterExtensions()
- ,m_sFilterUIName()
- ,m_bNeedExistenceCheck( true )
- {
- impl_initFilterProperties_nothrow();
-
- // forward the allowed extensions to the input control
- OUStringBuffer aExtensionList;
- for ( auto const & extension : std::as_const(m_aFilterExtensions) )
- {
- aExtensionList.append( extension );
- aExtensionList.append( ';' );
- }
- m_rLocationInput.SetFilter( aExtensionList.makeStringAndClear() );
- m_rBrowseButton.AddEventListener( LINK( this, SvxDatabaseLocationInputController_Impl, OnControlAction ) );
- m_rLocationInput.AddEventListener( LINK( this, SvxDatabaseLocationInputController_Impl, OnControlAction ) );
- }
-
- SvxDatabaseLocationInputController_Impl::~SvxDatabaseLocationInputController_Impl()
- {
- m_rBrowseButton.RemoveEventListener( LINK( this, SvxDatabaseLocationInputController_Impl, OnControlAction ) );
- m_rLocationInput.RemoveEventListener( LINK( this, SvxDatabaseLocationInputController_Impl, OnControlAction ) );
- }
-
- bool SvxDatabaseLocationInputController_Impl::prepareCommit()
- {
- OUString sURL( impl_getCurrentURL() );
- if ( sURL.isEmpty() )
- return false;
-
- // check if the name exists
- if ( m_bNeedExistenceCheck )
- {
- if ( ::utl::UCBContentHelper::Exists( sURL ) )
- {
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_rLocationInput.GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- SvxResId(RID_STR_ALREADYEXISTOVERWRITE)));
- if (xQueryBox->run() != RET_YES)
- return false;
- }
- }
-
- return true;
- }
-
- void SvxDatabaseLocationInputController_Impl::setURL( const OUString& _rURL )
- {
- ::svt::OFileNotation aTransformer( _rURL );
- m_rLocationInput.SetText( aTransformer.get( ::svt::OFileNotation::N_SYSTEM ) );
- }
-
- OUString SvxDatabaseLocationInputController_Impl::getURL() const
- {
- return impl_getCurrentURL();
- }
-
- void SvxDatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow()
- {
- try
- {
- // get the name of the default filter for database documents
- ::utl::OConfigurationTreeRoot aConfig(
- ::utl::OConfigurationTreeRoot::createWithComponentContext(
- m_xContext,
- "/org.openoffice.Setup/Office/Factories/com.sun.star.sdb.OfficeDatabaseDocument"
- ) );
- OUString sDatabaseFilter;
- OSL_VERIFY( aConfig.getNodeValue( "ooSetupFactoryActualFilter" ) >>= sDatabaseFilter );
-
- // get the type this filter is responsible for
- Reference< XNameAccess > xFilterFactory(
- m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", m_xContext),
- UNO_QUERY_THROW );
- ::comphelper::NamedValueCollection aFilterProperties( xFilterFactory->getByName( sDatabaseFilter ) );
- OUString sDocumentType = aFilterProperties.getOrDefault( "Type", OUString() );
-
- // get the extension(s) for this type
- Reference< XNameAccess > xTypeDetection(
- m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext),
- UNO_QUERY_THROW );
-
- ::comphelper::NamedValueCollection aTypeProperties( xTypeDetection->getByName( sDocumentType ) );
- m_aFilterExtensions = aTypeProperties.getOrDefault( "Extensions", m_aFilterExtensions );
- m_sFilterUIName = aTypeProperties.getOrDefault( "UIName", m_sFilterUIName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("svx");
- }
-
- // ensure we have at least one extension
- OSL_ENSURE( m_aFilterExtensions.hasElements(),
- "DatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow: unable to determine the file extension(s)!" );
- if ( !m_aFilterExtensions.hasElements() )
- {
- m_aFilterExtensions.realloc(1);
- m_aFilterExtensions[0] = "*.odb";
- }
- }
-
- IMPL_LINK( SvxDatabaseLocationInputController_Impl, OnControlAction, VclWindowEvent&, _rEvent, void )
- {
- if ( ( _rEvent.GetWindow() == &m_rBrowseButton )
- && ( _rEvent.GetId() == VclEventId::ButtonClick )
- )
- {
- impl_onBrowseButtonClicked();
- }
-
- if ( ( _rEvent.GetWindow() == &m_rLocationInput )
- && ( _rEvent.GetId() == VclEventId::EditModify )
- )
- {
- m_bNeedExistenceCheck = true;
- }
- }
-
- OUString SvxDatabaseLocationInputController_Impl::impl_getCurrentURL() const
- {
- OUString sCurrentFile( m_rLocationInput.GetText() );
- if ( !sCurrentFile.isEmpty() )
- {
- ::svt::OFileNotation aCurrentFile( sCurrentFile );
- sCurrentFile = aCurrentFile.get( ::svt::OFileNotation::N_URL );
- }
- return sCurrentFile;
- }
-
- void SvxDatabaseLocationInputController_Impl::impl_onBrowseButtonClicked()
- {
- ::sfx2::FileDialogHelper aFileDlg(
- TemplateDescription::FILESAVE_AUTOEXTENSION,
- FileDialogFlags::NONE,
- m_rLocationInput.GetFrameWeld()
- );
- aFileDlg.SetDisplayDirectory( impl_getCurrentURL() );
-
- aFileDlg.AddFilter( m_sFilterUIName, "*." + m_aFilterExtensions[0] );
- aFileDlg.SetCurrentFilter( m_sFilterUIName );
-
- if ( aFileDlg.Execute() == ERRCODE_NONE )
- {
- INetURLObject aURL( aFileDlg.GetPath() );
- if( aURL.GetProtocol() != INetProtocol::NotValid )
- {
- ::svt::OFileNotation aFileNotation( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- m_rLocationInput.SetText( aFileNotation.get( ::svt::OFileNotation::N_SYSTEM ) );
- m_rLocationInput.GetModifyHdl().Call( m_rLocationInput );
- // the dialog already checked for the file's existence, so we don't need to, again
- m_bNeedExistenceCheck = false;
- }
- }
- }
- SvxDatabaseLocationInputController::SvxDatabaseLocationInputController( const Reference<XComponentContext>& _rContext,
- ::svt::OFileURLControl& _rLocationInput, PushButton& _rBrowseButton )
- :m_pImpl( new SvxDatabaseLocationInputController_Impl( _rContext, _rLocationInput, _rBrowseButton ) )
- {
- }
-
- SvxDatabaseLocationInputController::~SvxDatabaseLocationInputController()
- {
- }
-
- bool SvxDatabaseLocationInputController::prepareCommit()
- {
- return m_pImpl->prepareCommit();
- }
-
- void SvxDatabaseLocationInputController::setURL( const OUString& _rURL )
- {
- m_pImpl->setURL( _rURL );
- }
-
- OUString SvxDatabaseLocationInputController::getURL() const
- {
- return m_pImpl->getURL();
- }
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */