2010-10-12 15:59:03 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-06-14 17:39:53 +01:00
/*
* 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 .
*/
2001-05-29 08:59:46 +00:00
2017-10-23 22:42:52 +02:00
# include <core_resource.hxx>
2008-10-01 12:28:29 +00:00
# include "dsnItem.hxx"
2001-05-29 08:59:46 +00:00
# include "generalpage.hxx"
2003-06-04 11:26:07 +00:00
# include <connectivity/dbexception.hxx>
2017-10-23 22:42:52 +02:00
# include <dbu_dlg.hxx>
# include <strings.hrc>
# include <dsitems.hxx>
# include <stringconstants.hxx>
# include <dbadmin.hxx>
2001-05-29 08:59:46 +00:00
# include <sfx2/filedlghelper.hxx>
2008-08-19 08:55:36 +00:00
# include <sfx2/docfilt.hxx>
2001-05-29 08:59:46 +00:00
# include <vcl/stdtext.hxx>
2019-04-07 18:43:32 +02:00
# include <vcl/svapp.hxx>
2018-02-21 21:20:15 +00:00
# include <vcl/weld.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/stritem.hxx>
2001-05-29 08:59:46 +00:00
# include <com/sun/star/sdbc/XDriverAccess.hpp>
2005-06-30 15:33:15 +00:00
# include <com/sun/star/beans/PropertyValue.hpp>
2011-11-30 16:08:23 +01:00
# include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
2005-06-30 15:33:15 +00:00
# include <com/sun/star/container/XNameAccess.hpp>
2004-08-02 14:49:03 +00:00
# include "DriverSettings.hxx"
2017-10-23 22:42:52 +02:00
# include <UITools.hxx>
CWS-TOOLING: integrate CWS dba32g
2009-09-09 07:53:55 +0200 oj r275964 : replace strlen with rtl_str_getLength
2009-09-07 20:59:10 +0200 fs r275913 : disable the CopyTableWizard test until issue 104869 is fixed
2009-09-07 12:17:31 +0200 oj r275885 : #i104810# remove de as lang
2009-09-05 22:26:21 +0200 fs r275857 : protect StateChanged against re-entrance
2009-09-05 22:25:52 +0200 fs r275856 : don't attempt to classify the parent of a form as control
2009-09-05 22:25:29 +0200 fs r275855 : protect against re-entrance
2009-09-05 00:11:40 +0200 fs r275835 : #i10000#
2009-09-04 23:25:50 +0200 fs r275834 : #i10000#
2009-09-04 23:23:47 +0200 fs r275833 : #i10000#
2009-09-04 21:49:37 +0200 fs r275830 : #i10000# correct wrong conflict resolution
2009-09-04 20:59:51 +0200 fs r275829 : CWS-TOOLING: rebase CWS dba32g to trunk@275801 (milestone: DEV300:m57)
2009-09-04 11:08:32 +0200 oj r275791 : #i104780# new version 1.2.0
2009-09-03 22:29:21 +0200 fs r275775 : OSL_TRACE doesn't need \n anymore
2009-09-03 08:33:21 +0200 fs r275743 : CWS-TOOLING: rebase CWS dba32g to trunk@275331 (milestone: DEV300:m56)
2009-09-02 13:48:12 +0200 fs r275708 : removed useless include
2009-09-02 13:45:43 +0200 fs r275707 : more since tags, which are used across offapi/udkapi
2009-09-02 13:23:04 +0200 fs r275705 : should *not* have the dtor, copy ctor, and assignment operator compiler-generated, else we run into trouble as soon as the compiler creates different versions of our singleton member's static data in different libraries
2009-09-02 12:32:45 +0200 fs r275704 : AutoIncrementIsPrimaryKey is a driver setting, not a data source setting
2009-09-02 11:42:49 +0200 fs r275701 : URL meta data are meta data which are valid for all connections of this type, not per-data-source properties. Settings them as data source properties is a hack.
2009-09-02 08:43:34 +0200 fs r275696 : 3.x.x is not a valid 'since' tag
2009-09-01 16:05:24 +0200 fs r275665 : #i104686# don't treat controls bound to read-only columns as required
2009-09-01 13:10:22 +0200 fs r275657 : #i104574# use PageUp/Down to scroll through the complete page
2009-09-01 07:04:48 +0200 oj r275641 : #i104104# correct line ends
2009-08-31 15:52:34 +0200 fs r275612 : #i104410#
2009-08-31 12:29:05 +0200 fs r275596 : #i104364#
2009-08-31 12:28:56 +0200 fs r275595 : #i104364#
2009-08-31 11:43:09 +0200 fs r275593 : #i104649# JavaDriverClassPath is also a known JDBC-bridge setting
2009-08-31 11:41:37 +0200 fs r275592 : #i104649#
2009-08-28 21:48:27 +0200 fs r275552 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:48:17 +0200 fs r275551 : #i96862# do not show the 'Create a new database' option when a) no embedded/dBase driver is installed or b) the configuration requests to hide the option
2009-08-28 21:47:19 +0200 fs r275550 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:46:41 +0200 fs r275549 : #i96862# renamed and extended the configuration data which controls availability of certain DBA-related UI
2009-08-28 15:10:19 +0200 fs r275535 : #i96862# if no embedded driver is installed, use dBase for creating new DBs. If no dBase driver is installed, too, do not offer the 'Create new database' option
2009-08-28 14:03:04 +0200 fs r275532 : #i104454# allow multiple fields to display the same column
2009-08-28 13:14:00 +0200 fs r275528 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:09:57 +0200 fs r275527 : properly chech the MySQL type buttons (else next/back in the wizard leads to state with two buttons checked)
2009-08-28 13:09:17 +0200 fs r275526 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:07:18 +0200 fs r275525 : BooleanComparisonMode is a property, or a feature - but not a driver meta data
2009-08-28 11:00:31 +0200 fs r275521 : #i104580#
2009-08-28 10:40:05 +0200 fs r275519 : #i104577# correct assertion: If the template node type is ANY, then any value type is allowed
2009-08-28 10:09:30 +0200 fs r275518 : #i104575# implement Named Pipe UI
2009-08-28 10:09:07 +0200 fs r275517 : pass the trigger-event to IWindowOperator::operateOn / work with VclWindowEvents, not VclSimpleEvents
2009-08-27 14:27:36 +0200 fs r275484 : ImplPosTabPage: respect mbEmptyViewMargin for WINDOWALIGN_LEFT
2009-08-27 13:43:56 +0200 fs r275480 : merging latest changes from CWS dba32f herein
2009-08-27 13:23:07 +0200 fs r275475 : #i103882#
2009-08-27 11:56:55 +0200 fs r275466 : #i104544# SetState: Do not call Update at the window which we just set text for. It should (sic\!) not be needed, but causes trouble
2009-08-27 11:55:34 +0200 fs r275465 : #i104544#
do not allow re-entrance for impl_ensureControl_nothrow
Actually, this is part of the fix only. I also removed the code which triggered this re-entrance (from
the grid control implementation), but to ensure it won't happen, again, I added some safety herein.
2009-08-27 10:14:11 +0200 fs r275459 : preparations for supporting a 'NamedPipe' parameter for the MySQL Connector/OOo
2009-08-27 10:13:21 +0200 fs r275458 : preparations for supporting a 'NamedPipe' setting for the MySQL Connector/OOo
2009-08-27 10:11:14 +0200 fs r275456 : outsourced the MySQLNative settings into a dedicated class, to not duplicate all the code in two tab page implementations
2009-08-26 14:18:13 +0200 fs r275422 : #i10000#
2009-08-26 13:26:36 +0200 fs r275419 : ignore output paths
2009-08-26 13:23:38 +0200 fs r275417 : support the LocalSocket property for the MySQL native driver
2009-08-26 13:17:05 +0200 fs r275416 : some re-factoring, to outsource the tab page for setting up the MySQLNative connection, into a dedicated class (needed later)
2009-08-26 13:15:15 +0200 fs r275415 : support a NoThousandSep property for NumericFormatters - I'm tired of correcting this at runtime, instead of controlling it in the resource
2009-08-26 11:45:08 +0200 fs r275410 : oops, 'flat' shouldn't have got lost
2009-08-26 09:38:57 +0200 fs r275398 : #i102631# when saving the document fails, ensure that the interaction handler really can handle/display the error
2009-08-26 09:37:05 +0200 fs r275397 : #i102631# don't let non-IO/RuntimeExceptions escape from DatabaseDocument::store*, wrap them into an IOException
2009-08-26 09:35:39 +0200 fs r275395 : let the default interaction handler implement XInteractionHandler2
2009-08-25 13:51:34 +0200 fs r275352 : #i102631# createTempFile: pass URL through FileHelper.getOOoCompatibleFileURL
2009-08-25 13:49:23 +0200 fs r275351 : #i102631# createTempFileURL: immediately delete the file implicitly created by createTempFile, we really only need the URL
2009-08-24 14:49:07 +0200 fs r275318 : #i10000#
2009-08-24 14:36:03 +0200 fs r275315 : properly terminate message with 0 character
2009-08-24 14:35:45 +0200 fs r275314 : trace method concepts in non-pro, if special flag is enabled
2009-08-24 14:24:17 +0200 fs r275312 : #i98973# filter some more events for grid control columns
2009-08-24 14:15:23 +0200 fs r275311 : #i98973# implement XComboBox for combo box cells
2009-08-24 13:39:24 +0200 fs r275308 : #i98973# do not display the 'actionPerformed' event for grid combo box columns
2009-08-24 12:52:03 +0200 fs r275303 : #i98973# implement XCheckBox and XButton for check box cells
2009-08-24 11:56:05 +0200 oj r275300 : #i104447# wrong default for orientation
2009-08-24 10:51:21 +0200 fs r275296 : in the script selector dialog, interpret a double click onto a function as OK
2009-08-24 10:50:56 +0200 fs r275295 : localize some to-be-displayed names, consolidate some code regarding form/control naming
2009-08-21 14:28:05 +0200 fs r275255 : #i98973# implement KeyListeners
2009-08-21 14:27:20 +0200 fs r275254 : #i98973# move the conversion VCL[Mouse|Key]Event->Awt[Mouse|Key]Event from vclxwindow.cxx to VCLUnoHelper
2009-08-21 14:08:50 +0200 fs r275248 : #i98973# implement Mouse- and MouseMotion-broadcasting
2009-08-21 13:31:08 +0200 fs r275244 : #i98973# implement text and change listeners at text cells
2009-08-21 12:47:38 +0200 fs r275234 : #i104399# some refactoring:
If the MySQL Connector/OOo is installed, it registers for the sdbc:mysqlc: protocol (now known as DST_MYSQL_NATIVE_DIRECT).
However, we do not want to display this in the UI, instead we display "MySQL" only, which collects DST_MYSQL_ODBC, DST_MYSQL_JDBC, and DST_MYSQL_NATIVE.
2009-08-21 12:45:18 +0200 fs r275232 : #i104399# also register for the sdbc:mysql:mysqlc protocol, decide at runtime (depending on the availability of sdbc:mysqlc:), whether it is really accepted. This prevents that the C/OOo extension needs to register *our* implementation name for the sdbc:mysql:mysqlc: protocol, which would be somewhat weird
2009-08-20 16:18:48 +0200 fs r275190 : merging the latest changes from CWS dba32f (which this CWS was created from)
2009-08-19 20:19:59 +0200 fs r275160 : add some spacing between the radios
2009-08-19 14:50:15 +0200 fs r275150 : #i98973# slightly refactoring the grid cell implementations, to prepare for proper events being fired. Implement focus events for the moment, more to come.
2009-08-19 10:53:38 +0200 fs r275142 : #i99936# initialize newly created models
2009-08-18 23:03:48 +0200 fs r275132 : merging latest changes from CWS dba32f
2009-08-18 15:14:08 +0200 fs r275110 : #i102819# SetColumnPos: SCROLL_CLIP is deadly here
2009-09-14 11:18:01 +00:00
# include <comphelper/processfactory.hxx>
# include <unotools/confignode.hxx>
2011-02-03 00:33:36 +01:00
# include <osl/diagnose.h>
2018-07-27 09:42:16 +02:00
# include <sal/log.hxx>
2019-10-20 18:22:43 +01:00
# include <dbwizsetup.hxx>
CWS-TOOLING: integrate CWS dba32g
2009-09-09 07:53:55 +0200 oj r275964 : replace strlen with rtl_str_getLength
2009-09-07 20:59:10 +0200 fs r275913 : disable the CopyTableWizard test until issue 104869 is fixed
2009-09-07 12:17:31 +0200 oj r275885 : #i104810# remove de as lang
2009-09-05 22:26:21 +0200 fs r275857 : protect StateChanged against re-entrance
2009-09-05 22:25:52 +0200 fs r275856 : don't attempt to classify the parent of a form as control
2009-09-05 22:25:29 +0200 fs r275855 : protect against re-entrance
2009-09-05 00:11:40 +0200 fs r275835 : #i10000#
2009-09-04 23:25:50 +0200 fs r275834 : #i10000#
2009-09-04 23:23:47 +0200 fs r275833 : #i10000#
2009-09-04 21:49:37 +0200 fs r275830 : #i10000# correct wrong conflict resolution
2009-09-04 20:59:51 +0200 fs r275829 : CWS-TOOLING: rebase CWS dba32g to trunk@275801 (milestone: DEV300:m57)
2009-09-04 11:08:32 +0200 oj r275791 : #i104780# new version 1.2.0
2009-09-03 22:29:21 +0200 fs r275775 : OSL_TRACE doesn't need \n anymore
2009-09-03 08:33:21 +0200 fs r275743 : CWS-TOOLING: rebase CWS dba32g to trunk@275331 (milestone: DEV300:m56)
2009-09-02 13:48:12 +0200 fs r275708 : removed useless include
2009-09-02 13:45:43 +0200 fs r275707 : more since tags, which are used across offapi/udkapi
2009-09-02 13:23:04 +0200 fs r275705 : should *not* have the dtor, copy ctor, and assignment operator compiler-generated, else we run into trouble as soon as the compiler creates different versions of our singleton member's static data in different libraries
2009-09-02 12:32:45 +0200 fs r275704 : AutoIncrementIsPrimaryKey is a driver setting, not a data source setting
2009-09-02 11:42:49 +0200 fs r275701 : URL meta data are meta data which are valid for all connections of this type, not per-data-source properties. Settings them as data source properties is a hack.
2009-09-02 08:43:34 +0200 fs r275696 : 3.x.x is not a valid 'since' tag
2009-09-01 16:05:24 +0200 fs r275665 : #i104686# don't treat controls bound to read-only columns as required
2009-09-01 13:10:22 +0200 fs r275657 : #i104574# use PageUp/Down to scroll through the complete page
2009-09-01 07:04:48 +0200 oj r275641 : #i104104# correct line ends
2009-08-31 15:52:34 +0200 fs r275612 : #i104410#
2009-08-31 12:29:05 +0200 fs r275596 : #i104364#
2009-08-31 12:28:56 +0200 fs r275595 : #i104364#
2009-08-31 11:43:09 +0200 fs r275593 : #i104649# JavaDriverClassPath is also a known JDBC-bridge setting
2009-08-31 11:41:37 +0200 fs r275592 : #i104649#
2009-08-28 21:48:27 +0200 fs r275552 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:48:17 +0200 fs r275551 : #i96862# do not show the 'Create a new database' option when a) no embedded/dBase driver is installed or b) the configuration requests to hide the option
2009-08-28 21:47:19 +0200 fs r275550 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI
2009-08-28 21:46:41 +0200 fs r275549 : #i96862# renamed and extended the configuration data which controls availability of certain DBA-related UI
2009-08-28 15:10:19 +0200 fs r275535 : #i96862# if no embedded driver is installed, use dBase for creating new DBs. If no dBase driver is installed, too, do not offer the 'Create new database' option
2009-08-28 14:03:04 +0200 fs r275532 : #i104454# allow multiple fields to display the same column
2009-08-28 13:14:00 +0200 fs r275528 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:09:57 +0200 fs r275527 : properly chech the MySQL type buttons (else next/back in the wizard leads to state with two buttons checked)
2009-08-28 13:09:17 +0200 fs r275526 : #i104584# driver meta data do not belong into a data source's settings
2009-08-28 13:07:18 +0200 fs r275525 : BooleanComparisonMode is a property, or a feature - but not a driver meta data
2009-08-28 11:00:31 +0200 fs r275521 : #i104580#
2009-08-28 10:40:05 +0200 fs r275519 : #i104577# correct assertion: If the template node type is ANY, then any value type is allowed
2009-08-28 10:09:30 +0200 fs r275518 : #i104575# implement Named Pipe UI
2009-08-28 10:09:07 +0200 fs r275517 : pass the trigger-event to IWindowOperator::operateOn / work with VclWindowEvents, not VclSimpleEvents
2009-08-27 14:27:36 +0200 fs r275484 : ImplPosTabPage: respect mbEmptyViewMargin for WINDOWALIGN_LEFT
2009-08-27 13:43:56 +0200 fs r275480 : merging latest changes from CWS dba32f herein
2009-08-27 13:23:07 +0200 fs r275475 : #i103882#
2009-08-27 11:56:55 +0200 fs r275466 : #i104544# SetState: Do not call Update at the window which we just set text for. It should (sic\!) not be needed, but causes trouble
2009-08-27 11:55:34 +0200 fs r275465 : #i104544#
do not allow re-entrance for impl_ensureControl_nothrow
Actually, this is part of the fix only. I also removed the code which triggered this re-entrance (from
the grid control implementation), but to ensure it won't happen, again, I added some safety herein.
2009-08-27 10:14:11 +0200 fs r275459 : preparations for supporting a 'NamedPipe' parameter for the MySQL Connector/OOo
2009-08-27 10:13:21 +0200 fs r275458 : preparations for supporting a 'NamedPipe' setting for the MySQL Connector/OOo
2009-08-27 10:11:14 +0200 fs r275456 : outsourced the MySQLNative settings into a dedicated class, to not duplicate all the code in two tab page implementations
2009-08-26 14:18:13 +0200 fs r275422 : #i10000#
2009-08-26 13:26:36 +0200 fs r275419 : ignore output paths
2009-08-26 13:23:38 +0200 fs r275417 : support the LocalSocket property for the MySQL native driver
2009-08-26 13:17:05 +0200 fs r275416 : some re-factoring, to outsource the tab page for setting up the MySQLNative connection, into a dedicated class (needed later)
2009-08-26 13:15:15 +0200 fs r275415 : support a NoThousandSep property for NumericFormatters - I'm tired of correcting this at runtime, instead of controlling it in the resource
2009-08-26 11:45:08 +0200 fs r275410 : oops, 'flat' shouldn't have got lost
2009-08-26 09:38:57 +0200 fs r275398 : #i102631# when saving the document fails, ensure that the interaction handler really can handle/display the error
2009-08-26 09:37:05 +0200 fs r275397 : #i102631# don't let non-IO/RuntimeExceptions escape from DatabaseDocument::store*, wrap them into an IOException
2009-08-26 09:35:39 +0200 fs r275395 : let the default interaction handler implement XInteractionHandler2
2009-08-25 13:51:34 +0200 fs r275352 : #i102631# createTempFile: pass URL through FileHelper.getOOoCompatibleFileURL
2009-08-25 13:49:23 +0200 fs r275351 : #i102631# createTempFileURL: immediately delete the file implicitly created by createTempFile, we really only need the URL
2009-08-24 14:49:07 +0200 fs r275318 : #i10000#
2009-08-24 14:36:03 +0200 fs r275315 : properly terminate message with 0 character
2009-08-24 14:35:45 +0200 fs r275314 : trace method concepts in non-pro, if special flag is enabled
2009-08-24 14:24:17 +0200 fs r275312 : #i98973# filter some more events for grid control columns
2009-08-24 14:15:23 +0200 fs r275311 : #i98973# implement XComboBox for combo box cells
2009-08-24 13:39:24 +0200 fs r275308 : #i98973# do not display the 'actionPerformed' event for grid combo box columns
2009-08-24 12:52:03 +0200 fs r275303 : #i98973# implement XCheckBox and XButton for check box cells
2009-08-24 11:56:05 +0200 oj r275300 : #i104447# wrong default for orientation
2009-08-24 10:51:21 +0200 fs r275296 : in the script selector dialog, interpret a double click onto a function as OK
2009-08-24 10:50:56 +0200 fs r275295 : localize some to-be-displayed names, consolidate some code regarding form/control naming
2009-08-21 14:28:05 +0200 fs r275255 : #i98973# implement KeyListeners
2009-08-21 14:27:20 +0200 fs r275254 : #i98973# move the conversion VCL[Mouse|Key]Event->Awt[Mouse|Key]Event from vclxwindow.cxx to VCLUnoHelper
2009-08-21 14:08:50 +0200 fs r275248 : #i98973# implement Mouse- and MouseMotion-broadcasting
2009-08-21 13:31:08 +0200 fs r275244 : #i98973# implement text and change listeners at text cells
2009-08-21 12:47:38 +0200 fs r275234 : #i104399# some refactoring:
If the MySQL Connector/OOo is installed, it registers for the sdbc:mysqlc: protocol (now known as DST_MYSQL_NATIVE_DIRECT).
However, we do not want to display this in the UI, instead we display "MySQL" only, which collects DST_MYSQL_ODBC, DST_MYSQL_JDBC, and DST_MYSQL_NATIVE.
2009-08-21 12:45:18 +0200 fs r275232 : #i104399# also register for the sdbc:mysql:mysqlc protocol, decide at runtime (depending on the availability of sdbc:mysqlc:), whether it is really accepted. This prevents that the C/OOo extension needs to register *our* implementation name for the sdbc:mysql:mysqlc: protocol, which would be somewhat weird
2009-08-20 16:18:48 +0200 fs r275190 : merging the latest changes from CWS dba32f (which this CWS was created from)
2009-08-19 20:19:59 +0200 fs r275160 : add some spacing between the radios
2009-08-19 14:50:15 +0200 fs r275150 : #i98973# slightly refactoring the grid cell implementations, to prepare for proper events being fired. Implement focus events for the moment, more to come.
2009-08-19 10:53:38 +0200 fs r275142 : #i99936# initialize newly created models
2009-08-18 23:03:48 +0200 fs r275132 : merging latest changes from CWS dba32f
2009-08-18 15:14:08 +0200 fs r275110 : #i102819# SetColumnPos: SCROLL_CLIP is deadly here
2009-09-14 11:18:01 +00:00
2001-05-29 08:59:46 +00:00
namespace dbaui
{
2011-11-30 16:08:23 +01:00
using namespace : : com : : sun : : star ;
2001-05-29 08:59:46 +00:00
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : sdbc ;
2005-06-30 15:33:15 +00:00
using namespace : : com : : sun : : star : : beans ;
using namespace : : com : : sun : : star : : container ;
2013-08-17 23:43:14 +02:00
// OGeneralPage
2019-09-24 14:10:48 +01:00
OGeneralPage : : OGeneralPage ( weld : : Container * pPage , weld : : DialogController * pController , const OUString & _rUIXMLDescription , const SfxItemSet & _rItems )
: OGenericAdministrationPage ( pPage , pController , _rUIXMLDescription , " PageGeneral " , _rItems )
2019-08-01 17:05:28 +01:00
, m_xSpecialMessage ( m_xBuilder - > weld_label ( " specialMessage " ) )
, m_eLastMessage ( smNone )
, m_bInitTypeList ( true )
, m_xDatasourceType ( m_xBuilder - > weld_combo_box ( " datasourceType " ) )
, m_pCollection ( nullptr )
2013-03-21 09:04:55 +01:00
{
2001-05-29 08:59:46 +00:00
// extract the datasource type collection from the item set
2015-09-28 11:42:43 +02:00
const DbuTypeCollectionItem * pCollectionItem = dynamic_cast < const DbuTypeCollectionItem * > ( _rItems . GetItem ( DSID_TYPECOLLECTION ) ) ;
2001-05-29 08:59:46 +00:00
if ( pCollectionItem )
m_pCollection = pCollectionItem - > getCollection ( ) ;
2016-12-14 09:49:39 +02:00
SAL_WARN_IF ( ! m_pCollection , " dbaccess.ui.generalpage " , " OGeneralPage::OGeneralPage : really need a DSN type collection ! " ) ;
2001-05-29 08:59:46 +00:00
// do some knittings
2019-08-01 17:05:28 +01:00
m_xDatasourceType - > connect_changed ( LINK ( this , OGeneralPage , OnDatasourceTypeSelected ) ) ;
2001-05-29 08:59:46 +00:00
}
2004-10-27 12:04:10 +00:00
2015-03-09 14:29:30 +02:00
OGeneralPage : : ~ OGeneralPage ( )
{
}
2005-10-24 07:31:44 +00:00
namespace
{
struct DisplayedType
{
2013-02-20 04:33:49 +01:00
OUString eType ;
2013-09-26 12:17:53 +02:00
OUString sDisplayName ;
2005-10-24 07:31:44 +00:00
2013-09-26 12:17:53 +02:00
DisplayedType ( const OUString & _eType , const OUString & _rDisplayName ) : eType ( _eType ) , sDisplayName ( _rDisplayName ) { }
2005-10-24 07:31:44 +00:00
} ;
2017-02-17 19:06:24 +02:00
typedef std : : vector < DisplayedType > DisplayedTypes ;
2005-10-24 07:31:44 +00:00
2017-07-02 17:10:53 +02:00
struct DisplayedTypeLess
2005-10-24 07:31:44 +00:00
{
bool operator ( ) ( const DisplayedType & _rLHS , const DisplayedType & _rRHS )
{
return _rLHS . eType < _rRHS . eType ;
}
} ;
}
2001-05-29 08:59:46 +00:00
void OGeneralPage : : initializeTypeList ( )
{
2009-07-03 12:24:35 +00:00
if ( m_bInitTypeList )
2001-05-29 08:59:46 +00:00
{
2009-07-03 12:24:35 +00:00
m_bInitTypeList = false ;
2019-08-01 17:05:28 +01:00
m_xDatasourceType - > clear ( ) ;
2005-10-24 07:31:44 +00:00
2009-07-03 12:24:35 +00:00
if ( m_pCollection )
2001-05-29 08:59:46 +00:00
{
2009-07-03 12:24:35 +00:00
DisplayedTypes aDisplayedTypes ;
: : dbaccess : : ODsnTypeCollection : : TypeIterator aEnd = m_pCollection - > end ( ) ;
for ( : : dbaccess : : ODsnTypeCollection : : TypeIterator aTypeLoop = m_pCollection - > begin ( ) ;
aTypeLoop ! = aEnd ;
+ + aTypeLoop
)
2002-11-21 14:27:11 +00:00
{
2018-10-23 07:47:33 +02:00
const OUString & sURLPrefix = aTypeLoop . getURLPrefix ( ) ;
2011-12-19 18:10:37 -02:00
if ( ! sURLPrefix . isEmpty ( ) )
2009-07-03 12:24:35 +00:00
{
2018-10-08 11:04:48 +02:00
// skip mysql connection variations. It is handled in another window.
if ( sURLPrefix . startsWith ( " sdbc:mysql: " ) & & ! sURLPrefix . startsWith ( " sdbc:mysql:jdbc: " ) )
continue ;
2013-02-20 04:33:49 +01:00
OUString sDisplayName = aTypeLoop . getDisplayName ( ) ;
2019-08-01 17:05:28 +01:00
if ( m_xDatasourceType - > find_text ( sDisplayName ) = = - 1 & &
approveDatasourceType ( sURLPrefix , sDisplayName ) )
2009-07-03 12:24:35 +00:00
{
2017-09-11 08:54:30 +02:00
aDisplayedTypes . emplace_back ( sURLPrefix , sDisplayName ) ;
2009-07-03 12:24:35 +00:00
}
}
2002-11-21 14:27:11 +00:00
}
2017-02-17 19:06:24 +02:00
std : : sort ( aDisplayedTypes . begin ( ) , aDisplayedTypes . end ( ) , DisplayedTypeLess ( ) ) ;
2019-02-24 17:09:03 +03:00
for ( const auto & rDisplayedType : aDisplayedTypes )
insertDatasourceTypeEntryData ( rDisplayedType . eType , rDisplayedType . sDisplayName ) ;
2010-11-24 01:50:15 +00:00
}
2001-05-29 08:59:46 +00:00
}
}
2013-08-28 09:22:37 +01:00
void OGeneralPageWizard : : initializeEmbeddedDBList ( )
2013-07-30 12:27:10 +02:00
{
if ( m_bInitEmbeddedDBList )
{
m_bInitEmbeddedDBList = false ;
2019-08-01 17:05:28 +01:00
m_xEmbeddedDBType - > clear ( ) ;
2013-07-30 12:27:10 +02:00
if ( m_pCollection )
{
DisplayedTypes aDisplayedTypes ;
: : dbaccess : : ODsnTypeCollection : : TypeIterator aEnd = m_pCollection - > end ( ) ;
for ( : : dbaccess : : ODsnTypeCollection : : TypeIterator aTypeLoop = m_pCollection - > begin ( ) ;
aTypeLoop ! = aEnd ;
+ + aTypeLoop
)
{
2018-10-23 07:47:33 +02:00
const OUString & sURLPrefix = aTypeLoop . getURLPrefix ( ) ;
2013-07-30 12:27:10 +02:00
if ( ! sURLPrefix . isEmpty ( ) )
{
OUString sDisplayName = aTypeLoop . getDisplayName ( ) ;
2019-08-01 17:05:28 +01:00
if ( m_xEmbeddedDBType - > find_text ( sDisplayName ) = = - 1 & &
dbaccess : : ODsnTypeCollection : : isEmbeddedDatabase ( sURLPrefix ) )
2013-07-30 12:27:10 +02:00
{
2017-09-11 08:54:30 +02:00
aDisplayedTypes . emplace_back ( sURLPrefix , sDisplayName ) ;
2013-07-30 12:27:10 +02:00
}
}
}
2017-02-17 19:06:24 +02:00
std : : sort ( aDisplayedTypes . begin ( ) , aDisplayedTypes . end ( ) , DisplayedTypeLess ( ) ) ;
2018-03-09 23:27:25 +01:00
for ( auto const & displayedType : aDisplayedTypes )
insertEmbeddedDBTypeEntryData ( displayedType . eType , displayedType . sDisplayName ) ;
2013-07-30 12:27:10 +02:00
}
}
}
2013-03-21 09:04:55 +01:00
void OGeneralPage : : setParentTitle ( const OUString & )
2005-06-30 15:33:15 +00:00
{
2001-05-29 08:59:46 +00:00
}
2013-02-20 04:33:49 +01:00
void OGeneralPage : : switchMessage ( const OUString & _sURLPrefix )
2001-05-29 08:59:46 +00:00
{
2002-11-21 14:27:11 +00:00
SPECIAL_MESSAGE eMessage = smNone ;
2011-12-19 18:10:37 -02:00
if ( _sURLPrefix . isEmpty ( ) /*_eType == m_eNotSupportedKnownType*/ )
2001-05-29 08:59:46 +00:00
{
2002-12-09 06:50:18 +00:00
eMessage = smUnsupportedType ;
2001-05-29 08:59:46 +00:00
}
2002-11-21 14:27:11 +00:00
if ( eMessage ! = m_eLastMessage )
{
2017-06-11 20:56:30 +01:00
const char * pResId = nullptr ;
2006-06-20 02:07:54 +00:00
if ( smUnsupportedType = = eMessage )
2017-06-11 20:56:30 +01:00
pResId = STR_UNSUPPORTED_DATASOURCE_TYPE ;
2013-09-26 12:17:53 +02:00
OUString sMessage ;
2017-06-11 20:56:30 +01:00
if ( pResId )
sMessage = DBA_RES ( pResId ) ;
2002-11-21 14:27:11 +00:00
2019-08-01 17:05:28 +01:00
m_xSpecialMessage - > set_label ( sMessage ) ;
2002-11-21 14:27:11 +00:00
m_eLastMessage = eMessage ;
}
2001-05-29 08:59:46 +00:00
}
2013-02-20 04:33:49 +01:00
void OGeneralPage : : onTypeSelected ( const OUString & _sURLPrefix )
2001-05-29 08:59:46 +00:00
{
2013-02-22 09:48:17 +02:00
// the new URL text as indicated by the selection history
2009-07-03 12:24:35 +00:00
implSetCurrentType ( _sURLPrefix ) ;
2001-05-29 08:59:46 +00:00
2009-07-03 12:24:35 +00:00
switchMessage ( _sURLPrefix ) ;
2001-05-29 08:59:46 +00:00
2015-10-15 12:28:31 +02:00
m_aTypeSelectHandler . Call ( * this ) ;
2001-05-29 08:59:46 +00:00
}
2004-10-27 12:04:10 +00:00
2014-04-17 11:16:55 +02:00
void OGeneralPage : : implInitControls ( const SfxItemSet & _rSet , bool _bSaveValue )
2001-05-29 08:59:46 +00:00
{
initializeTypeList ( ) ;
2019-08-01 17:05:28 +01:00
m_xDatasourceType - > set_active_text ( getDatasourceName ( _rSet ) ) ;
2005-06-30 15:33:15 +00:00
2013-03-21 09:04:55 +01:00
// notify our listener that our type selection has changed (if so)
2013-05-21 10:46:45 +02:00
// FIXME: how to detect that it did not changed? (fdo#62937)
setParentTitle ( m_eCurrentSelection ) ;
onTypeSelected ( m_eCurrentSelection ) ;
2005-06-30 15:33:15 +00:00
2013-03-21 09:04:55 +01:00
// a special message for the current page state
switchMessage ( m_eCurrentSelection ) ;
2005-06-30 15:33:15 +00:00
2013-03-21 09:04:55 +01:00
OGenericAdministrationPage : : implInitControls ( _rSet , _bSaveValue ) ;
}
2005-06-30 15:33:15 +00:00
2013-08-28 09:22:37 +01:00
OUString OGeneralPageWizard : : getEmbeddedDBName ( const SfxItemSet & _rSet )
2013-07-30 12:27:10 +02:00
{
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
2014-04-17 11:16:55 +02:00
bool bValid , bReadonly ;
2013-07-30 12:27:10 +02:00
getFlags ( _rSet , bValid , bReadonly ) ;
// if the selection is invalid, disable everything
implSetCurrentType ( OUString ( ) ) ;
// compare the DSN prefix with the registered ones
OUString sDisplayName ;
if ( m_pCollection & & bValid )
{
Remove dead and broken EmbeddedDatabases configuration
As found out in 98c0b20864af965c3bb99a32f8ea57be7402e534 "Make Firebird the
(unconditional) default for new databases": "(Curiously,
ODsnTypeCollection::getEmbeddedDatabase would read a DefaultEmbeddedDatabase
value from the configuration before resorting to the hardcoded default, but
`git log -SDefaultEmbeddedDatabase` makes it look like there has never been any
code to actually write that setting.)"
Digging deeper, the story appears to be as follows: First, "INTEGRATION: CWS
hsqldb" commits in 2004 had addded the EmbeddedDatabases group (and accompanying
templates) to officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
(ee11cb6373f6bbb28b1cdf57daa73465d030fda5), corresponding values (for HSQLDB)
to officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
(60c5f0af740265ab81b620208205fe9e74be452f), and code to read those values
(lcl_getEmbeddedDatabase in dbaccess/source/ui/misc/dsntypes.cxx;
ODsnTypeCollection::getEmbeddedDatabaseURL et al in
dbaccess/source/ui/misc/dsntypes.cxx; all
a68938bc908c8f852912f3310d2f4bec779a3cea). This looks like it actually worked.
Then, "INTEGRATION: CWS dba24b" commits in 2007 removed the EmbeddedDatabases
configuration data from
officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
(473a3ccf63cc36ac3fa992dcb72d581496cb1bbf, "during #i80930#: The approach to
read the concrete type of the embedded DB from the configuration does not work,
there are enough places where we silently assume 'embedded == embedded HSQLDB'")
and removed the code reading it (79bbd382beb13a8f4031cc9b61332d0794878699), but
left the EmbeddedDatabases schema data in
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs untouched.
Then, b88a62cc97613e5dc00c806f59982cb57f9d1dc8 "CWS-TOOLING: integrate CWS
dbaperf2" in 2009 reintroduced code that attempts to read the configuration data
as ODsnTypeCollection::getEmbeddedDatabase
(dbaccess/source/core/misc/dsntypes.cxx). The reason for that may be
"2009-05-06 14:22:21 +0200 oj r271589 : #i101587# use config for the drivers"
as listed in the commit message. The code added as
ODsnTypeCollection::getEmbeddedDatabase back then remained effectively unchanged
until today, but looks fundamentally broken: It starts out with trying to read
an /org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase/
Value property that can never be present per the schema (an
/org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase
property could be); so no data is ever actually read from the configuration by
ODsnTypeCollection::getEmbeddedDatabase. (And the commit also didn't add back
any configuration data to
officecfg/registry/data/org/openoffice/Office/DataAccess.xcu that could have
been read in the first place, nor any code to generate such data
programmatically.)
So remove the broken code to read configuration data from
ODsnTypeCollection::getEmbeddedDatabase (which means it can be a static member
function now) and also remove the obviously unused EmbeddedDatabases group (and
accompanying templates) from
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs.
Change-Id: Icc9b34075b9b7e960df6c236d3595b7fabe71f9d
Reviewed-on: https://gerrit.libreoffice.org/67494
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-07 11:26:14 +01:00
implSetCurrentType ( dbaccess : : ODsnTypeCollection : : getEmbeddedDatabase ( ) ) ;
2013-07-30 12:27:10 +02:00
sDisplayName = m_pCollection - > getTypeDisplayName ( m_eCurrentSelection ) ;
2019-08-05 17:26:53 +01:00
onTypeSelected ( m_eCurrentSelection ) ;
2013-07-30 12:27:10 +02:00
}
// select the correct datasource type
2015-04-24 15:29:31 +02:00
if ( dbaccess : : ODsnTypeCollection : : isEmbeddedDatabase ( m_eCurrentSelection )
2019-08-01 17:05:28 +01:00
& & m_xEmbeddedDBType - > find_text ( sDisplayName ) = = - 1 )
2013-07-30 12:27:10 +02:00
{ // this indicates it's really a type which is known in general, but not supported on the current platform
// show a message saying so
// eSpecialMessage = smUnsupportedType;
2013-08-28 09:22:37 +01:00
insertEmbeddedDBTypeEntryData ( m_eCurrentSelection , sDisplayName ) ;
2013-07-30 12:27:10 +02:00
}
return sDisplayName ;
}
2013-03-21 09:04:55 +01:00
OUString OGeneralPage : : getDatasourceName ( const SfxItemSet & _rSet )
{
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
2014-04-17 11:16:55 +02:00
bool bValid , bReadonly ;
2013-03-21 09:04:55 +01:00
getFlags ( _rSet , bValid , bReadonly ) ;
// if the selection is invalid, disable everything
2018-04-04 14:34:07 +02:00
OUString sConnectURL ;
2004-08-02 14:49:03 +00:00
if ( bValid )
2001-05-29 08:59:46 +00:00
{
// collect some items and some values
2015-10-19 07:18:39 +02:00
const SfxStringItem * pUrlItem = _rSet . GetItem < SfxStringItem > ( DSID_CONNECTURL ) ;
2013-07-30 12:27:10 +02:00
assert ( pUrlItem ) ;
2004-08-02 14:49:03 +00:00
sConnectURL = pUrlItem - > GetValue ( ) ;
2001-05-29 08:59:46 +00:00
}
2013-02-20 04:33:49 +01:00
implSetCurrentType ( OUString ( ) ) ;
2001-08-01 07:30:41 +00:00
2001-05-29 08:59:46 +00:00
// compare the DSN prefix with the registered ones
2013-02-20 04:33:49 +01:00
OUString sDisplayName ;
2001-08-01 07:30:41 +00:00
2001-05-29 08:59:46 +00:00
if ( m_pCollection & & bValid )
{
2013-03-21 09:04:55 +01:00
implSetCurrentType ( m_pCollection - > getPrefix ( sConnectURL ) ) ;
sDisplayName = m_pCollection - > getTypeDisplayName ( m_eCurrentSelection ) ;
2001-05-29 08:59:46 +00:00
}
2008-01-30 07:45:43 +00:00
2001-05-29 08:59:46 +00:00
// select the correct datasource type
2019-08-01 17:05:28 +01:00
if ( approveDatasourceType ( m_eCurrentSelection , sDisplayName )
& & m_xDatasourceType - > find_text ( sDisplayName ) = = - 1 )
2008-01-30 07:45:43 +00:00
{ // this indicates it's really a type which is known in general, but not supported on the current platform
// show a message saying so
// eSpecialMessage = smUnsupportedType;
2013-03-21 09:04:55 +01:00
insertDatasourceTypeEntryData ( m_eCurrentSelection , sDisplayName ) ;
2001-05-29 08:59:46 +00:00
}
2008-01-30 07:45:43 +00:00
2013-03-21 09:04:55 +01:00
return sDisplayName ;
2004-08-02 14:49:03 +00:00
}
2004-10-27 12:04:10 +00:00
// For the databaseWizard we only have one entry for the MySQL Database,
2013-05-15 10:42:04 +03:00
// because we have a separate tabpage to retrieve the respective datasource type
2008-10-01 12:28:29 +00:00
// ( ::dbaccess::DST_MYSQL_ODBC || ::dbaccess::DST_MYSQL_JDBC). Therefore we use ::dbaccess::DST_MYSQL_JDBC as a temporary
2004-10-27 12:04:10 +00:00
// representative for all MySQl databases)
2008-01-30 07:45:43 +00:00
// Also, embedded databases (embedded HSQL, at the moment), are not to appear in the list of
// databases to connect to.
2013-03-21 09:04:55 +01:00
bool OGeneralPage : : approveDatasourceType ( const OUString & _sURLPrefix , OUString & _inout_rDisplayName )
2004-10-27 12:04:10 +00:00
{
2013-03-21 09:04:55 +01:00
return approveDatasourceType ( m_pCollection - > determineType ( _sURLPrefix ) , _inout_rDisplayName ) ;
}
2008-03-05 16:00:34 +00:00
2013-03-21 09:04:55 +01:00
bool OGeneralPage : : approveDatasourceType ( : : dbaccess : : DATASOURCE_TYPE eType , OUString & _inout_rDisplayName )
{
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
if ( eType = = : : dbaccess : : DST_MYSQL_NATIVE_DIRECT )
{
// do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if
// this driver is installed
if ( m_pCollection - > hasDriver ( " sdbc:mysql:mysqlc: " ) )
2014-12-18 13:22:10 +01:00
_inout_rDisplayName . clear ( ) ;
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
}
2013-07-08 09:39:55 +01:00
if ( eType = = : : dbaccess : : DST_EMBEDDED_HSQLDB
| | eType = = : : dbaccess : : DST_EMBEDDED_FIREBIRD )
2014-12-18 13:22:10 +01:00
_inout_rDisplayName . clear ( ) ;
2008-01-30 07:45:43 +00:00
2013-02-20 04:33:49 +01:00
return _inout_rDisplayName . getLength ( ) > 0 ;
2004-10-27 12:04:10 +00:00
}
2014-03-17 09:18:05 +02:00
void OGeneralPage : : insertDatasourceTypeEntryData ( const OUString & _sType , const OUString & sDisplayName )
2004-10-27 12:04:10 +00:00
{
2005-06-30 15:33:15 +00:00
// insert a (temporary) entry
2019-08-01 17:05:28 +01:00
m_xDatasourceType - > append_text ( sDisplayName ) ;
m_aURLPrefixes . push_back ( _sType ) ;
2004-10-27 12:04:10 +00:00
}
2014-03-17 09:18:05 +02:00
void OGeneralPageWizard : : insertEmbeddedDBTypeEntryData ( const OUString & _sType , const OUString & sDisplayName )
2013-07-30 12:27:10 +02:00
{
// insert a (temporary) entry
2019-08-01 17:05:28 +01:00
m_xEmbeddedDBType - > append_text ( sDisplayName ) ;
m_aEmbeddedURLPrefixes . push_back ( _sType ) ;
2013-07-30 12:27:10 +02:00
}
2018-09-07 14:33:33 +02:00
void OGeneralPage : : fillWindows ( std : : vector < std : : unique_ptr < ISaveValueWrapper > > & _rControlList )
2004-08-02 14:49:03 +00:00
{
2019-08-01 17:05:28 +01:00
_rControlList . emplace_back ( new ODisableWidgetWrapper < weld : : Label > ( m_xSpecialMessage . get ( ) ) ) ;
2004-08-02 14:49:03 +00:00
}
2013-03-21 09:04:55 +01:00
2018-09-07 14:33:33 +02:00
void OGeneralPage : : fillControls ( std : : vector < std : : unique_ptr < ISaveValueWrapper > > & _rControlList )
2004-08-02 14:49:03 +00:00
{
2019-08-01 17:05:28 +01:00
_rControlList . emplace_back ( new OSaveValueWidgetWrapper < weld : : ComboBox > ( m_xDatasourceType . get ( ) ) ) ;
2001-05-29 08:59:46 +00:00
}
2013-02-20 04:33:49 +01:00
void OGeneralPage : : implSetCurrentType ( const OUString & _eType )
2001-08-01 07:30:41 +00:00
{
if ( _eType = = m_eCurrentSelection )
return ;
m_eCurrentSelection = _eType ;
}
2014-06-11 10:35:24 +02:00
void OGeneralPage : : Reset ( const SfxItemSet * _rCoreAttrs )
2001-05-29 08:59:46 +00:00
{
2001-08-02 12:46:58 +00:00
// reset all locale data
2013-02-20 04:33:49 +01:00
implSetCurrentType ( OUString ( ) ) ;
2014-11-10 15:05:25 +01:00
// this ensures that our type selection link will be called, even if the new one is the same as the
2001-05-29 08:59:46 +00:00
// current one
OGenericAdministrationPage : : Reset ( _rCoreAttrs ) ;
2001-07-31 15:02:21 +00:00
}
2019-08-01 17:05:28 +01:00
IMPL_LINK ( OGeneralPageWizard , OnEmbeddedDBTypeSelected , weld : : ComboBox & , _rBox , void )
2013-07-30 12:27:10 +02:00
{
// get the type from the entry data
2019-08-01 17:05:28 +01:00
const sal_Int32 nSelected = _rBox . get_active ( ) ;
2015-08-30 23:08:29 +02:00
if ( static_cast < size_t > ( nSelected ) > = m_aEmbeddedURLPrefixes . size ( ) )
2013-07-30 12:27:10 +02:00
{
2017-09-14 16:57:06 +02:00
SAL_WARN ( " dbaccess.ui.generalpage " , " Got out-of-range value ' " < < nSelected < < " ' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix " ) ;
2015-10-04 15:05:38 +02:00
return ;
2013-07-30 12:27:10 +02:00
}
const OUString sURLPrefix = m_aEmbeddedURLPrefixes [ nSelected ] ;
setParentTitle ( sURLPrefix ) ;
// let the impl method do all the stuff
onTypeSelected ( sURLPrefix ) ;
// tell the listener we were modified
callModifiedHdl ( ) ;
}
2019-08-01 17:05:28 +01:00
IMPL_LINK ( OGeneralPage , OnDatasourceTypeSelected , weld : : ComboBox & , _rBox , void )
2013-03-21 09:04:55 +01:00
{
// get the type from the entry data
2019-08-01 17:05:28 +01:00
const sal_Int32 nSelected = _rBox . get_active ( ) ;
if ( nSelected = = - 1 )
2018-09-13 21:13:16 +02:00
return ;
2015-08-30 23:08:29 +02:00
if ( static_cast < size_t > ( nSelected ) > = m_aURLPrefixes . size ( ) )
2013-06-06 09:14:49 +00:00
{
2017-09-14 16:57:06 +02:00
SAL_WARN ( " dbaccess.ui.generalpage " , " Got out-of-range value ' " < < nSelected < < " ' from the DatasourceType selection ListBox's GetSelectedEntryPos(): no corresponding URL prefix " ) ;
2015-10-04 15:05:38 +02:00
return ;
2013-06-06 09:14:49 +00:00
}
2013-03-21 09:04:55 +01:00
const OUString sURLPrefix = m_aURLPrefixes [ nSelected ] ;
setParentTitle ( sURLPrefix ) ;
// let the impl method do all the stuff
onTypeSelected ( sURLPrefix ) ;
// tell the listener we were modified
callModifiedHdl ( ) ;
}
2013-08-17 23:43:14 +02:00
// OGeneralPageDialog
2019-09-24 14:10:48 +01:00
OGeneralPageDialog : : OGeneralPageDialog ( weld : : Container * pPage , weld : : DialogController * pController , const SfxItemSet & _rItems )
: OGeneralPage ( pPage , pController , " dbaccess/ui/generalpagedialog.ui " , _rItems )
2013-03-21 09:04:55 +01:00
{
}
void OGeneralPageDialog : : setParentTitle ( const OUString & _sURLPrefix )
{
const OUString sName = m_pCollection - > getTypeDisplayName ( _sURLPrefix ) ;
if ( m_pAdminDialog )
{
2017-06-11 20:56:30 +01:00
OUString sMessage = DBA_RES ( STR_PARENTTITLE_GENERAL ) ;
2013-03-21 09:04:55 +01:00
m_pAdminDialog - > setTitle ( sMessage . replaceAll ( " # " , sName ) ) ;
}
}
2014-04-17 11:16:55 +02:00
void OGeneralPageDialog : : implInitControls ( const SfxItemSet & _rSet , bool _bSaveValue )
2013-03-21 09:04:55 +01:00
{
OGeneralPage : : implInitControls ( _rSet , _bSaveValue ) ;
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
2014-04-17 11:16:55 +02:00
bool bValid , bReadonly ;
2013-03-21 09:04:55 +01:00
getFlags ( _rSet , bValid , bReadonly ) ;
2019-08-01 17:05:28 +01:00
m_xDatasourceType - > set_sensitive ( bValid ) ;
2013-03-21 09:04:55 +01:00
}
2014-06-10 17:23:12 +02:00
bool OGeneralPageDialog : : FillItemSet ( SfxItemSet * _rCoreAttrs )
2013-03-21 09:04:55 +01:00
{
2014-04-17 11:16:55 +02:00
bool bChangedSomething = false ;
2013-03-21 09:04:55 +01:00
2019-08-01 17:05:28 +01:00
const sal_Int32 nEntry = m_xDatasourceType - > get_active ( ) ;
2013-03-21 09:04:55 +01:00
OUString sURLPrefix = m_aURLPrefixes [ nEntry ] ;
2019-08-01 17:05:28 +01:00
if ( m_xDatasourceType - > get_value_changed_from_saved ( ) )
2013-03-21 09:04:55 +01:00
{
2014-06-10 17:23:12 +02:00
_rCoreAttrs - > Put ( SfxStringItem ( DSID_CONNECTURL , sURLPrefix ) ) ;
2014-04-17 11:16:55 +02:00
bChangedSomething = true ;
2013-03-21 09:04:55 +01:00
}
return bChangedSomething ;
}
2013-08-17 23:43:14 +02:00
// OGeneralPageWizard
2019-10-20 18:22:43 +01:00
OGeneralPageWizard : : OGeneralPageWizard ( weld : : Container * pPage , ODbTypeWizDialogSetup * pController , const SfxItemSet & _rItems )
2019-09-24 14:10:48 +01:00
: OGeneralPage ( pPage , pController , " dbaccess/ui/generalpagewizard.ui " , _rItems )
2019-08-01 17:05:28 +01:00
, m_xRB_CreateDatabase ( m_xBuilder - > weld_radio_button ( " createDatabase " ) )
, m_xRB_OpenExistingDatabase ( m_xBuilder - > weld_radio_button ( " openExistingDatabase " ) )
, m_xRB_ConnectDatabase ( m_xBuilder - > weld_radio_button ( " connectDatabase " ) )
, m_xFT_EmbeddedDBLabel ( m_xBuilder - > weld_label ( " embeddeddbLabel " ) )
, m_xEmbeddedDBType ( m_xBuilder - > weld_combo_box ( " embeddeddbList " ) )
, m_xFT_DocListLabel ( m_xBuilder - > weld_label ( " docListLabel " ) )
2019-08-05 17:26:53 +01:00
, m_xFT_HelpText ( m_xBuilder - > weld_label ( " helpText " ) )
2019-08-01 17:05:28 +01:00
, m_xLB_DocumentList ( new OpenDocumentListBox ( m_xBuilder - > weld_combo_box ( " documentList " ) , " com.sun.star.sdb.OfficeDatabaseDocument " ) )
, m_xPB_OpenDatabase ( new OpenDocumentButton ( m_xBuilder - > weld_button ( " openDatabase " ) , " com.sun.star.sdb.OfficeDatabaseDocument " ) )
, m_eOriginalCreationMode ( eCreateNew )
, m_bInitEmbeddedDBList ( true )
{
2013-03-21 09:04:55 +01:00
// If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
Remove dead and broken EmbeddedDatabases configuration
As found out in 98c0b20864af965c3bb99a32f8ea57be7402e534 "Make Firebird the
(unconditional) default for new databases": "(Curiously,
ODsnTypeCollection::getEmbeddedDatabase would read a DefaultEmbeddedDatabase
value from the configuration before resorting to the hardcoded default, but
`git log -SDefaultEmbeddedDatabase` makes it look like there has never been any
code to actually write that setting.)"
Digging deeper, the story appears to be as follows: First, "INTEGRATION: CWS
hsqldb" commits in 2004 had addded the EmbeddedDatabases group (and accompanying
templates) to officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
(ee11cb6373f6bbb28b1cdf57daa73465d030fda5), corresponding values (for HSQLDB)
to officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
(60c5f0af740265ab81b620208205fe9e74be452f), and code to read those values
(lcl_getEmbeddedDatabase in dbaccess/source/ui/misc/dsntypes.cxx;
ODsnTypeCollection::getEmbeddedDatabaseURL et al in
dbaccess/source/ui/misc/dsntypes.cxx; all
a68938bc908c8f852912f3310d2f4bec779a3cea). This looks like it actually worked.
Then, "INTEGRATION: CWS dba24b" commits in 2007 removed the EmbeddedDatabases
configuration data from
officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
(473a3ccf63cc36ac3fa992dcb72d581496cb1bbf, "during #i80930#: The approach to
read the concrete type of the embedded DB from the configuration does not work,
there are enough places where we silently assume 'embedded == embedded HSQLDB'")
and removed the code reading it (79bbd382beb13a8f4031cc9b61332d0794878699), but
left the EmbeddedDatabases schema data in
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs untouched.
Then, b88a62cc97613e5dc00c806f59982cb57f9d1dc8 "CWS-TOOLING: integrate CWS
dbaperf2" in 2009 reintroduced code that attempts to read the configuration data
as ODsnTypeCollection::getEmbeddedDatabase
(dbaccess/source/core/misc/dsntypes.cxx). The reason for that may be
"2009-05-06 14:22:21 +0200 oj r271589 : #i101587# use config for the drivers"
as listed in the commit message. The code added as
ODsnTypeCollection::getEmbeddedDatabase back then remained effectively unchanged
until today, but looks fundamentally broken: It starts out with trying to read
an /org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase/
Value property that can never be present per the schema (an
/org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase
property could be); so no data is ever actually read from the configuration by
ODsnTypeCollection::getEmbeddedDatabase. (And the commit also didn't add back
any configuration data to
officecfg/registry/data/org/openoffice/Office/DataAccess.xcu that could have
been read in the first place, nor any code to generate such data
programmatically.)
So remove the broken code to read configuration data from
ODsnTypeCollection::getEmbeddedDatabase (which means it can be a static member
function now) and also remove the obviously unused EmbeddedDatabases group (and
accompanying templates) from
officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs.
Change-Id: Icc9b34075b9b7e960df6c236d3595b7fabe71f9d
Reviewed-on: https://gerrit.libreoffice.org/67494
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-07 11:26:14 +01:00
sal_Int32 nCreateNewDBIndex = m_pCollection - > getIndexOf ( dbaccess : : ODsnTypeCollection : : getEmbeddedDatabase ( ) ) ;
2013-03-21 09:04:55 +01:00
if ( nCreateNewDBIndex = = - 1 )
2015-11-06 09:35:25 +01:00
nCreateNewDBIndex = m_pCollection - > getIndexOf ( " sdbc:dbase: " ) ;
2013-03-21 09:04:55 +01:00
bool bHideCreateNew = ( nCreateNewDBIndex = = - 1 ) ;
// also, if our application policies tell us to hide the option, do it
: : utl : : OConfigurationTreeRoot aConfig ( : : utl : : OConfigurationTreeRoot : : createWithComponentContext (
: : comphelper : : getProcessComponentContext ( ) ,
2015-11-06 09:35:25 +01:00
" /org.openoffice.Office.DataAccess/Policies/Features/Base "
2013-03-21 09:04:55 +01:00
) ) ;
2014-04-17 11:16:55 +02:00
bool bAllowCreateLocalDatabase ( true ) ;
2013-03-21 09:04:55 +01:00
OSL_VERIFY ( aConfig . getNodeValue ( " CreateLocalDatabase " ) > > = bAllowCreateLocalDatabase ) ;
if ( ! bAllowCreateLocalDatabase )
bHideCreateNew = true ;
if ( bHideCreateNew )
{
2019-08-01 17:05:28 +01:00
m_xRB_CreateDatabase - > hide ( ) ;
m_xRB_ConnectDatabase - > set_active ( true ) ;
2013-03-21 09:04:55 +01:00
}
else
2019-08-01 17:05:28 +01:00
m_xRB_CreateDatabase - > set_active ( true ) ;
2013-03-21 09:04:55 +01:00
// do some knittings
2019-08-01 17:05:28 +01:00
m_xEmbeddedDBType - > connect_changed ( LINK ( this , OGeneralPageWizard , OnEmbeddedDBTypeSelected ) ) ;
2019-08-05 17:26:53 +01:00
m_xRB_CreateDatabase - > connect_clicked ( LINK ( this , OGeneralPageWizard , OnSetupModeSelected ) ) ;
2019-08-01 17:05:28 +01:00
m_xRB_ConnectDatabase - > connect_clicked ( LINK ( this , OGeneralPageWizard , OnSetupModeSelected ) ) ;
m_xRB_OpenExistingDatabase - > connect_clicked ( LINK ( this , OGeneralPageWizard , OnSetupModeSelected ) ) ;
m_xLB_DocumentList - > connect_changed ( LINK ( this , OGeneralPageWizard , OnDocumentSelected ) ) ;
m_xPB_OpenDatabase - > connect_clicked ( LINK ( this , OGeneralPageWizard , OnOpenDocument ) ) ;
2019-10-20 18:22:43 +01:00
pController - > SetGeneralPage ( this ) ;
2013-03-21 09:04:55 +01:00
}
2015-03-09 14:29:30 +02:00
OGeneralPageWizard : : ~ OGeneralPageWizard ( )
{
}
2013-03-21 09:04:55 +01:00
OGeneralPageWizard : : CreationMode OGeneralPageWizard : : GetDatabaseCreationMode ( ) const
{
2019-08-01 17:05:28 +01:00
if ( m_xRB_CreateDatabase - > get_active ( ) )
2013-03-21 09:04:55 +01:00
return eCreateNew ;
2019-08-01 17:05:28 +01:00
if ( m_xRB_ConnectDatabase - > get_active ( ) )
2013-03-21 09:04:55 +01:00
return eConnectExternal ;
return eOpenExisting ;
}
2014-04-17 11:16:55 +02:00
void OGeneralPageWizard : : implInitControls ( const SfxItemSet & _rSet , bool _bSaveValue )
2013-03-21 09:04:55 +01:00
{
OGeneralPage : : implInitControls ( _rSet , _bSaveValue ) ;
2013-08-28 09:22:37 +01:00
initializeEmbeddedDBList ( ) ;
2019-08-01 17:05:28 +01:00
m_xEmbeddedDBType - > set_active_text ( getEmbeddedDBName ( _rSet ) ) ;
2013-08-28 09:22:37 +01:00
2013-03-21 09:04:55 +01:00
// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
2014-04-17 11:16:55 +02:00
bool bValid , bReadonly ;
2013-03-21 09:04:55 +01:00
getFlags ( _rSet , bValid , bReadonly ) ;
2019-09-20 20:29:36 +01:00
SetPageTitle ( OUString ( ) ) ;
2013-03-21 09:04:55 +01:00
if ( ! bValid | | bReadonly )
{
2019-08-01 17:05:28 +01:00
m_xFT_EmbeddedDBLabel - > set_sensitive ( false ) ;
m_xDatasourceType - > set_sensitive ( false ) ;
m_xPB_OpenDatabase - > set_sensitive ( false ) ;
m_xFT_DocListLabel - > set_sensitive ( false ) ;
m_xLB_DocumentList - > set_sensitive ( false ) ;
2013-03-21 09:04:55 +01:00
}
2019-08-01 17:05:28 +01:00
if ( m_xLB_DocumentList - > get_count ( ) )
m_xLB_DocumentList - > set_active ( 0 ) ;
2013-03-21 09:04:55 +01:00
m_eOriginalCreationMode = GetDatabaseCreationMode ( ) ;
2019-08-05 17:26:53 +01:00
SetupModeSelected ( ) ;
2013-03-21 09:04:55 +01:00
}
OUString OGeneralPageWizard : : getDatasourceName ( const SfxItemSet & _rSet )
{
2018-04-23 22:34:00 +02:00
// Sets the default selected database on startup.
2019-08-01 17:05:28 +01:00
if ( m_xRB_CreateDatabase - > get_active ( ) )
2018-04-23 22:34:00 +02:00
{
2019-02-06 12:59:07 +01:00
return m_pCollection - > getTypeDisplayName ( " sdbc:firebird: " ) ;
2018-04-23 22:34:00 +02:00
}
2013-03-21 09:04:55 +01:00
return OGeneralPage : : getDatasourceName ( _rSet ) ;
}
bool OGeneralPageWizard : : approveDatasourceType ( : : dbaccess : : DATASOURCE_TYPE eType , OUString & _inout_rDisplayName )
{
switch ( eType )
{
case : : dbaccess : : DST_MYSQL_JDBC :
case : : dbaccess : : DST_MYSQL_ODBC :
case : : dbaccess : : DST_MYSQL_NATIVE :
2018-09-22 14:31:23 +02:00
_inout_rDisplayName = " MySQL " ;
2013-03-21 09:04:55 +01:00
break ;
default :
break ;
}
return OGeneralPage : : approveDatasourceType ( eType , _inout_rDisplayName ) ;
}
2014-06-10 17:23:12 +02:00
bool OGeneralPageWizard : : FillItemSet ( SfxItemSet * _rCoreAttrs )
2001-05-29 08:59:46 +00:00
{
2014-04-17 11:16:55 +02:00
bool bChangedSomething = false ;
2005-06-30 15:33:15 +00:00
bool bCommitTypeSelection = true ;
2013-03-21 09:04:55 +01:00
2019-08-01 17:05:28 +01:00
if ( m_xRB_CreateDatabase - > get_active ( ) )
2001-05-29 08:59:46 +00:00
{
2019-04-18 19:25:06 +02:00
_rCoreAttrs - > Put ( SfxStringItem ( DSID_CONNECTURL , " sdbc:dbase: " ) ) ;
2014-04-17 11:16:55 +02:00
bChangedSomething = true ;
2013-03-21 09:04:55 +01:00
bCommitTypeSelection = false ;
}
2019-08-01 17:05:28 +01:00
else if ( m_xRB_OpenExistingDatabase - > get_active ( ) )
2013-03-21 09:04:55 +01:00
{
2019-08-01 17:05:28 +01:00
if ( m_xRB_OpenExistingDatabase - > get_state_changed_from_saved ( ) )
2014-04-17 11:16:55 +02:00
bChangedSomething = true ;
2005-06-30 15:33:15 +00:00
2013-03-21 09:04:55 +01:00
// TODO
bCommitTypeSelection = false ;
2001-05-29 08:59:46 +00:00
}
2005-06-30 15:33:15 +00:00
if ( bCommitTypeSelection )
2004-10-27 12:04:10 +00:00
{
2019-08-01 17:05:28 +01:00
const sal_Int32 nEntry = m_xDatasourceType - > get_active ( ) ;
2013-02-20 04:33:49 +01:00
OUString sURLPrefix = m_aURLPrefixes [ nEntry ] ;
2013-03-21 09:04:55 +01:00
2019-08-01 17:05:28 +01:00
if ( m_xDatasourceType - > get_value_changed_from_saved ( )
2013-03-21 09:04:55 +01:00
| | ( GetDatabaseCreationMode ( ) ! = m_eOriginalCreationMode )
)
2004-10-27 12:04:10 +00:00
{
2014-06-10 17:23:12 +02:00
_rCoreAttrs - > Put ( SfxStringItem ( DSID_CONNECTURL , sURLPrefix ) ) ;
2014-04-17 11:16:55 +02:00
bChangedSomething = true ;
2004-10-27 12:04:10 +00:00
}
else
2013-03-21 09:04:55 +01:00
implSetCurrentType ( sURLPrefix ) ;
2004-10-27 12:04:10 +00:00
}
2001-05-29 08:59:46 +00:00
return bChangedSomething ;
}
2019-02-24 09:07:58 +02:00
OUString OGeneralPageWizard : : GetSelectedDocumentURL ( ) const
2004-10-27 12:04:10 +00:00
{
2019-02-24 09:07:58 +02:00
if ( ! m_aBrowsedDocumentURL . isEmpty ( ) )
return m_aBrowsedDocumentURL ;
2004-10-27 12:04:10 +00:00
else
2019-08-01 17:05:28 +01:00
return m_xLB_DocumentList - > GetSelectedDocumentURL ( ) ;
2005-06-30 15:33:15 +00:00
}
2013-07-30 12:27:10 +02:00
2019-08-05 17:26:53 +01:00
void OGeneralPageWizard : : EnableControls ( )
2013-07-30 12:27:10 +02:00
{
2019-02-08 11:55:18 +02:00
bool bValid , bReadonly ;
getFlags ( GetItemSet ( ) , bValid , bReadonly ) ;
if ( bValid & & ! bReadonly )
{
2019-08-01 17:05:28 +01:00
m_xEmbeddedDBType - > set_sensitive ( m_xRB_CreateDatabase - > get_active ( ) ) ;
m_xFT_EmbeddedDBLabel - > set_sensitive ( m_xRB_CreateDatabase - > get_active ( ) ) ;
m_xDatasourceType - > set_sensitive ( m_xRB_ConnectDatabase - > get_active ( ) ) ;
m_xPB_OpenDatabase - > set_sensitive ( m_xRB_OpenExistingDatabase - > get_active ( ) ) ;
m_xFT_DocListLabel - > set_sensitive ( m_xRB_OpenExistingDatabase - > get_active ( ) ) ;
m_xLB_DocumentList - > set_sensitive ( m_xRB_OpenExistingDatabase - > get_active ( ) ) ;
2019-02-08 11:55:18 +02:00
}
2013-07-30 12:27:10 +02:00
}
2005-06-30 15:33:15 +00:00
2019-08-05 17:26:53 +01:00
void OGeneralPageWizard : : SetupModeSelected ( )
2005-06-30 15:33:15 +00:00
{
2015-10-15 12:28:31 +02:00
m_aCreationModeHandler . Call ( * this ) ;
2019-02-08 11:55:18 +02:00
2019-08-05 17:26:53 +01:00
if ( m_xRB_CreateDatabase - > get_active ( ) )
OnEmbeddedDBTypeSelected ( * m_xEmbeddedDBType ) ;
else
OnDatasourceTypeSelected ( * m_xDatasourceType ) ;
EnableControls ( ) ;
}
IMPL_LINK_NOARG ( OGeneralPageWizard , OnSetupModeSelected , weld : : Button & , void )
{
SetupModeSelected ( ) ;
2004-10-27 12:04:10 +00:00
}
2005-06-30 15:33:15 +00:00
2019-08-01 17:05:28 +01:00
IMPL_LINK_NOARG ( OGeneralPageWizard , OnDocumentSelected , weld : : ComboBox & , void )
2005-06-30 15:33:15 +00:00
{
2015-09-16 17:01:36 +02:00
m_aDocumentSelectionHandler . Call ( * this ) ;
2005-06-30 15:33:15 +00:00
}
2019-08-01 17:05:28 +01:00
IMPL_LINK_NOARG ( OGeneralPageWizard , OnOpenDocument , weld : : Button & , void )
2005-06-30 15:33:15 +00:00
{
2011-11-30 16:08:23 +01:00
: : sfx2 : : FileDialogHelper aFileDlg (
ui : : dialogs : : TemplateDescription : : FILEOPEN_READONLY_VERSION ,
2019-09-25 15:14:55 +01:00
FileDialogFlags : : NONE , " sdatabase " , SfxFilterFlags : : NONE , SfxFilterFlags : : NONE , GetFrameWeld ( ) ) ;
2016-03-11 06:43:06 +01:00
std : : shared_ptr < const SfxFilter > pFilter = getStandardDatabaseFilter ( ) ;
2008-08-19 08:55:36 +00:00
if ( pFilter )
{
aFileDlg . SetCurrentFilter ( pFilter - > GetUIName ( ) ) ;
}
2005-06-30 15:33:15 +00:00
if ( aFileDlg . Execute ( ) = = ERRCODE_NONE )
{
2013-09-26 12:17:53 +02:00
OUString sPath = aFileDlg . GetPath ( ) ;
2019-05-15 20:12:23 +02:00
// check for aFileDlg.GetCurrentFilter used to be here but current fpicker filter
// can be set to anything, see tdf#125267 how this breaks if other value
// than 'ODF Database' is selected. Let's therefore check only if wildcard matches
if ( ! pFilter - > GetWildcard ( ) . Matches ( sPath ) )
2008-08-19 08:55:36 +00:00
{
2017-06-11 20:56:30 +01:00
OUString sMessage ( DBA_RES ( STR_ERR_USE_CONNECT_TO ) ) ;
2019-09-25 15:14:55 +01:00
std : : unique_ptr < weld : : MessageDialog > xInfoBox ( Application : : CreateMessageDialog ( GetFrameWeld ( ) ,
2018-02-21 21:20:15 +00:00
VclMessageType : : Info , VclButtonsType : : Ok ,
sMessage ) ) ;
xInfoBox - > run ( ) ;
2019-08-01 17:05:28 +01:00
m_xRB_ConnectDatabase - > set_active ( true ) ;
OnSetupModeSelected ( * m_xRB_ConnectDatabase ) ;
2015-08-19 09:11:34 +02:00
return ;
2008-08-19 08:55:36 +00:00
}
2019-02-24 09:07:58 +02:00
m_aBrowsedDocumentURL = sPath ;
2015-09-16 17:01:36 +02:00
m_aChooseDocumentHandler . Call ( * this ) ;
2005-06-30 15:33:15 +00:00
}
}
2001-05-29 08:59:46 +00:00
} // namespace dbaui
2010-10-12 15:59:03 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */