Repository.mk | 1 bin/update_pch | 1 dbaccess/Library_dbmm.mk | 56 dbaccess/Module_dbaccess.mk | 1 dbaccess/UIConfig_dbaccess.mk | 4 dbaccess/inc/pch/precompiled_dbmm.cxx | 12 dbaccess/inc/pch/precompiled_dbmm.hxx | 105 dbaccess/source/ext/macromigration/dbmm.component | 25 dbaccess/source/ext/macromigration/dbmm_services.cxx | 41 dbaccess/source/ext/macromigration/dbmm_types.cxx | 48 dbaccess/source/ext/macromigration/dbmm_types.hxx | 53 dbaccess/source/ext/macromigration/docinteraction.cxx | 108 dbaccess/source/ext/macromigration/docinteraction.hxx | 80 dbaccess/source/ext/macromigration/macromigrationdialog.cxx | 556 --- dbaccess/source/ext/macromigration/macromigrationdialog.hxx | 76 dbaccess/source/ext/macromigration/macromigrationpages.cxx | 308 - dbaccess/source/ext/macromigration/macromigrationpages.hxx | 152 dbaccess/source/ext/macromigration/macromigrationwizard.cxx | 132 dbaccess/source/ext/macromigration/macromigrationwizard.hxx | 96 dbaccess/source/ext/macromigration/migrationengine.cxx | 1824 ---------- dbaccess/source/ext/macromigration/migrationengine.hxx | 80 dbaccess/source/ext/macromigration/migrationerror.hxx | 153 dbaccess/source/ext/macromigration/migrationlog.cxx | 433 -- dbaccess/source/ext/macromigration/migrationlog.hxx | 110 dbaccess/source/ext/macromigration/migrationprogress.hxx | 49 dbaccess/source/ext/macromigration/progresscapture.cxx | 95 dbaccess/source/ext/macromigration/progresscapture.hxx | 65 dbaccess/source/ext/macromigration/progressmixer.cxx | 177 dbaccess/source/ext/macromigration/progressmixer.hxx | 87 dbaccess/source/ext/macromigration/rangeprogressbar.hxx | 71 dbaccess/source/ui/app/AppController.cxx | 31 dbaccess/source/ui/inc/browserids.hxx | 1 dbaccess/uiconfig/dbapp/menubar/menubar.xml | 1 dbaccess/uiconfig/ui/backuppage.ui | 128 dbaccess/uiconfig/ui/migratepage.ui | 214 - dbaccess/uiconfig/ui/preparepage.ui | 66 dbaccess/uiconfig/ui/summarypage.ui | 82 extensions/source/abpilot/abpfinalpage.cxx | 2 extensions/source/abpilot/abpfinalpage.hxx | 2 extras/source/glade/libreoffice-catalog.xml.in | 4 include/svtools/urlcontrol.hxx | 50 include/svx/databaselocationinput.hxx | 48 offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/sdb/application/MacroMigrationWizard.idl | 43 officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu | 5 postprocess/Rdb_services.mk | 1 solenv/bin/native-code.py | 1 solenv/clang-format/blacklist | 26 svtools/Library_svt.mk | 1 svtools/source/control/urlcontrol.cxx | 78 svx/source/form/databaselocationinput.cxx | 218 - 51 files changed, 3 insertions(+), 5999 deletions(-)
New commits: commit 8d3f4245555f5fbaba8be7b318f80dd79532099d Author: Caolán McNamara <[email protected]> AuthorDate: Sat Aug 31 12:20:41 2019 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sat Aug 31 15:07:57 2019 +0200 drop newly unused OFileURLControl Change-Id: I8a043df9a90f363f0b6a1c470ac74c02c52db9a9 Reviewed-on: https://gerrit.libreoffice.org/78342 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 730b669e4062..b94331e6da11 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -22,13 +22,13 @@ #include "abspilot.hxx" #include <osl/diagnose.h> #include <tools/urlobj.hxx> +#include <svtools/inettbc.hxx> #include <unotools/ucbhelper.hxx> #include <unotools/pathoptions.hxx> #include <svl/filenotation.hxx> #include <sfx2/docfilt.hxx> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> - namespace abp { diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index c44f6659e3ca..915ec6abc932 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -23,12 +23,10 @@ #include "abspage.hxx" #include "abptypes.hxx" -#include <svtools/urlcontrol.hxx> #include <svx/databaselocationinput.hxx> #include <vcl/edit.hxx> #include <vcl/vclptr.hxx> - namespace abp { diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index a86845bd17d1..ab106329f9a2 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -203,10 +203,6 @@ generic-name="URLBox" parent="VclComboBoxText" icon-name="widget-gtk-comboboxtext"/> - <glade-widget-class title="OFileURLControl" name="svtlo-OFileURLControl" - generic-name="URLBox" parent="svtlo-SvtURLBox" - icon-name="widget-gtk-comboboxtext"/> - <glade-widget-class title="PropertyControl" name="sdlo-PropertyControl" generic-name="PropertyControl" parent="VclComboBoxText" icon-name="widget-gtk-comboboxtext"/> diff --git a/include/svtools/urlcontrol.hxx b/include/svtools/urlcontrol.hxx deleted file mode 100644 index 6f001d3cbb71..000000000000 --- a/include/svtools/urlcontrol.hxx +++ /dev/null @@ -1,50 +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_SVTOOLS_URLCONTROL_HXX -#define INCLUDED_SVTOOLS_URLCONTROL_HXX - -#include <svtools/svtdllapi.h> -#include <svtools/inettbc.hxx> - - -namespace svt -{ - - //= OFileURLControl - - class SVT_DLLPUBLIC OFileURLControl : public SvtURLBox - { - private: - OUString m_sPreservedText; - - public: - OFileURLControl(vcl::Window* _pParent, WinBits nStyle); - - protected: - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - }; - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_URLCONTROL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/databaselocationinput.hxx b/include/svx/databaselocationinput.hxx index 22bb6e5d7bd1..ae0cd05e0484 100644 --- a/include/svx/databaselocationinput.hxx +++ b/include/svx/databaselocationinput.hxx @@ -26,7 +26,6 @@ #include <memory> class PushButton; -namespace svt { class OFileURLControl; } class URLBox; namespace weld { class Button; class Window; } @@ -40,7 +39,7 @@ namespace svx /** 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 + have an URLBox for inputting the actual location, and a push button to browse for a location. This helper class controls such two UI elements. diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index cff16c954cd6..aeb73892d64d 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -476,7 +476,6 @@ custom_widgets = [ 'IndexBox', 'ManagedMenuButton', 'MultiLineEditSyntaxHighlight', - 'OFileURLControl', 'OptionalBox', 'PageNumberListBox', 'PaperSizeListBox', diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 258c5c15d851..a4c01d637fce 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -6993,7 +6993,6 @@ include/svtools/toolboxcontroller.hxx include/svtools/unitconv.hxx include/svtools/unoevent.hxx include/svtools/unoimap.hxx -include/svtools/urlcontrol.hxx include/svtools/valueset.hxx include/svx/AccessibleControlShape.hxx include/svx/AccessibleGraphicShape.hxx @@ -13717,7 +13716,6 @@ svtools/source/control/tabbar.cxx svtools/source/control/toolbarmenu.cxx svtools/source/control/toolbarmenuacc.cxx svtools/source/control/toolbarmenuimp.hxx -svtools/source/control/urlcontrol.cxx svtools/source/control/valueacc.cxx svtools/source/control/valueimp.hxx svtools/source/control/valueset.cxx diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 83815d191487..ecffada72bb7 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/tabbar \ svtools/source/control/toolbarmenu \ svtools/source/control/toolbarmenuacc \ - svtools/source/control/urlcontrol \ svtools/source/control/valueacc \ svtools/source/control/valueset \ svtools/source/dialogs/addresstemplate \ diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx deleted file mode 100644 index dcf22fbdab78..000000000000 --- a/svtools/source/control/urlcontrol.cxx +++ /dev/null @@ -1,78 +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 <svl/filenotation.hxx> -#include <svtools/urlcontrol.hxx> -#include <vcl/layout.hxx> -#include <vcl/builderfactory.hxx> - -namespace svt -{ - //= OFileURLControl - OFileURLControl::OFileURLControl(vcl::Window* _pParent, WinBits nStyle) - : SvtURLBox(_pParent, nStyle, INetProtocol::File) - { - DisableHistory(); - } - - extern "C" SAL_DLLPUBLIC_EXPORT void makeOFileURLControl(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) - { - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP| - WB_DROPDOWN|WB_AUTOHSCROLL; - VclPtrInstance<OFileURLControl> pListBox(pParent, nWinBits); - pListBox->EnableAutoSize(true); - rRet = pListBox; - } - - bool OFileURLControl::PreNotify( NotifyEvent& _rNEvt ) - { - if (GetSubEdit() == _rNEvt.GetWindow()) - if (MouseNotifyEvent::KEYINPUT == _rNEvt.GetType()) - if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode()) - if (IsInDropDown()) - m_sPreservedText = GetURL(); - - return SvtURLBox::PreNotify(_rNEvt); - } - - bool OFileURLControl::EventNotify( NotifyEvent& _rNEvt ) - { - if (GetSubEdit() == _rNEvt.GetWindow()) - if (MouseNotifyEvent::KEYINPUT == _rNEvt.GetType()) - if (KEY_RETURN == _rNEvt.GetKeyEvent()->GetKeyCode().GetCode()) - if (IsInDropDown()) - { - bool bReturn = SvtURLBox::EventNotify(_rNEvt); - - // build a system dependent (thus more user readable) file name - OFileNotation aTransformer(m_sPreservedText, OFileNotation::N_URL); - SetText(aTransformer.get(OFileNotation::N_SYSTEM)); - Modify(); - - // Update the pick list - UpdatePickList(); - - return bReturn; - } - - return SvtURLBox::EventNotify(_rNEvt); - } -} // namespace svt - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx index a7af41882767..ab13de1444a2 100644 --- a/svx/source/form/databaselocationinput.cxx +++ b/svx/source/form/databaselocationinput.cxx @@ -30,8 +30,8 @@ #include <comphelper/namedvaluecollection.hxx> #include <rtl/ustrbuf.hxx> #include <sfx2/filedlghelper.hxx> -#include <svtools/urlcontrol.hxx> #include <svl/filenotation.hxx> +#include <svtools/inettbc.hxx> #include <tools/diagnose_ex.h> #include <unotools/confignode.hxx> #include <unotools/ucbhelper.hxx> commit 0e944350e92810adfcf080ae1d98ad7bc4bd578d Author: Caolán McNamara <[email protected]> AuthorDate: Fri Aug 30 20:44:01 2019 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sat Aug 31 15:07:47 2019 +0200 [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 <[email protected]> Tested-by: Caolán McNamara <[email protected]> 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 - ), ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
